parent
5fcfe0a5bd
commit
afe0bc3c2e
|
@ -1,6 +1,7 @@
|
||||||
package cn.edu.hfut.rmdjzz.projectmanagement.controller;
|
package cn.edu.hfut.rmdjzz.projectmanagement.controller;
|
||||||
|
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectType;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject;
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
|
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.impl.ProjectServiceImpl;
|
import cn.edu.hfut.rmdjzz.projectmanagement.service.impl.ProjectServiceImpl;
|
||||||
|
@ -10,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -28,14 +30,22 @@ public class ProjectController {
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public ResponseMap getProjectListOfStaff(
|
public ResponseList<ResultProject> getProjectListOfStaff(
|
||||||
@RequestHeader("Token") String token,
|
@RequestHeader("Token") String token,
|
||||||
@RequestParam("pageCurrent") Integer pageCurrent,
|
@RequestParam("pageCurrent") Integer pageCurrent,
|
||||||
@RequestParam("pageSize") Integer pageSize,
|
@RequestParam("pageSize") Integer pageSize,
|
||||||
Map<String, Object> paramMap
|
Map<String, Object> paramMap
|
||||||
) {
|
) {
|
||||||
Page<ResultProject> page = projectServiceImpl.getOnePageProject(token, pageCurrent, pageSize, paramMap);
|
Page<ResultProject> page = projectServiceImpl.getOnePageProject(token, pageCurrent, pageSize, paramMap);
|
||||||
return ResponseMap.ofSuccess("返回列表", page);
|
return ResponseList.ofSuccess("成功返回列表", page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@GetMapping("/total")
|
||||||
|
public ResponseMap getProjectNumOfStaff(@RequestHeader("Token") String token) {
|
||||||
|
Map<String, Long> res = new HashMap<>();
|
||||||
|
res.put("totalNum", projectServiceImpl.getAllProjectOfStaff(token));
|
||||||
|
return ResponseMap.ofSuccess("获得参与项目总数", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,7 @@ public class ResultProject {
|
||||||
Boolean IsDeleted;
|
Boolean IsDeleted;
|
||||||
Boolean IsCompleted;
|
Boolean IsCompleted;
|
||||||
LocalDate projectCloseTime;
|
LocalDate projectCloseTime;
|
||||||
|
Integer CompleteNum;
|
||||||
|
Integer TotalNum;
|
||||||
// 带加的进度 Double projectProcess;
|
// 带加的进度 Double projectProcess;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,12 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ProjectMapper extends BaseMapper<Project> {
|
public interface ProjectMapper extends BaseMapper<Project> {
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
SELECT COUNT(*) FROM project WHERE project_id IN
|
||||||
|
(SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})
|
||||||
|
""")
|
||||||
|
Long findProjectCount(@Param("id") Integer staffId);
|
||||||
|
|
||||||
@Select("""
|
@Select("""
|
||||||
SELECT * FROM
|
SELECT * FROM
|
||||||
(SELECT project_id,
|
(SELECT project_id,
|
||||||
|
|
|
@ -14,6 +14,9 @@ import java.util.Map;
|
||||||
* @since 2022/6/29 17:08
|
* @since 2022/6/29 17:08
|
||||||
*/
|
*/
|
||||||
public interface IProjectService extends IService<Project> {
|
public interface IProjectService extends IService<Project> {
|
||||||
|
|
||||||
|
Long getAllProjectOfStaff(String token) throws TokenException;
|
||||||
|
|
||||||
Page<ResultProject> getOnePageProject(String token, Integer pageCurrent, Integer pageSize, Map<String,Object> params) throws TokenException;
|
Page<ResultProject> getOnePageProject(String token, Integer pageCurrent, Integer pageSize, Map<String,Object> params) throws TokenException;
|
||||||
|
|
||||||
Boolean setProjectCompleted(String token, Project project) throws TokenException;
|
Boolean setProjectCompleted(String token, Project project) throws TokenException;
|
||||||
|
|
|
@ -11,7 +11,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -22,6 +24,12 @@ import java.util.Map;
|
||||||
@Service
|
@Service
|
||||||
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService {
|
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getAllProjectOfStaff(String token) throws TokenException {
|
||||||
|
Integer staffId = TokenUtils.getStaffId(token);
|
||||||
|
return baseMapper.findProjectCount(staffId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ResultProject> getOnePageProject(
|
public Page<ResultProject> getOnePageProject(
|
||||||
String token,
|
String token,
|
||||||
|
@ -29,10 +37,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||||
Integer pageSize,
|
Integer pageSize,
|
||||||
Map<String, Object> params
|
Map<String, Object> params
|
||||||
) throws TokenException {
|
) throws TokenException {
|
||||||
Integer staffId = 2;
|
Integer staffId = TokenUtils.getStaffId(token);
|
||||||
IPage<ResultProject> page = new Page<>(pageCurrent, pageSize);
|
IPage<ResultProject> page = new Page<>(pageCurrent, pageSize);
|
||||||
baseMapper.findMyProject(page, staffId, WrapperUtils.allEqAndTimeIntervalQueryWrapper(params, false));
|
IPage<ResultProject> userPage = baseMapper.findMyProject(page, staffId, WrapperUtils.allEqAndTimeIntervalQueryWrapper(params, false));
|
||||||
return (Page<ResultProject>) page;
|
return (Page<ResultProject>) userPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue