Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/cn/edu/hfut/rmdjzz/projectmanagement/controller/ProjectGroupController.java
master
ShiPengHui 2022-07-06 17:28:16 +08:00
commit f0ca1ce6d9
15 changed files with 172 additions and 68 deletions

View File

@ -1,7 +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.ResultProject; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.controller; package cn.edu.hfut.rmdjzz.projectmanagement.controller;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultTask;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
import cn.edu.hfut.rmdjzz.projectmanagement.service.ITaskService; import cn.edu.hfut.rmdjzz.projectmanagement.service.ITaskService;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
@ -26,13 +26,13 @@ public class TaskController {
private IProjectGroupService projectGroupService; private IProjectGroupService projectGroupService;
@SneakyThrows @SneakyThrows
@GetMapping("/subtask/{fatherId}") @GetMapping("/{fatherId}/subtask")
public ResponseList<Task> getSubTaskList( public ResponseList<ResultTask> getSubTaskList(
@RequestHeader("Token") String token, @RequestHeader("Token") String token,
@PathVariable("projectId") Integer projectId, @PathVariable("projectId") Integer projectId,
@PathVariable("fatherId") Long fatherId @PathVariable("fatherId") Long fatherId
) { ) {
List<Task> result = taskService.getTaskList(token, projectId, fatherId); List<ResultTask> result = taskService.getSubTaskList(token, projectId, fatherId);
return ResponseList.ofSuccess("查询成功", result); return ResponseList.ofSuccess("查询成功", result);
} }
@ -55,7 +55,7 @@ public class TaskController {
} }
@SneakyThrows @SneakyThrows
@PostMapping("/") @PostMapping
public ResponseMap createTask( public ResponseMap createTask(
@RequestHeader("Token") String token, @RequestHeader("Token") String token,
@PathVariable("projectId") Integer projectId, @PathVariable("projectId") Integer projectId,
@ -67,7 +67,7 @@ public class TaskController {
} }
@SneakyThrows @SneakyThrows
@PutMapping("/") @PutMapping
public ResponseMap modifyTask( public ResponseMap modifyTask(
@RequestHeader("Token") String token, @RequestHeader("Token") String token,
@PathVariable("projectId") Integer projectId, @PathVariable("projectId") Integer projectId,
@ -77,4 +77,15 @@ public class TaskController {
taskService.modifyTask(token,task); taskService.modifyTask(token,task);
return ResponseMap.ofSuccess("操作成功"); return ResponseMap.ofSuccess("操作成功");
} }
@SneakyThrows
@DeleteMapping
public ResponseMap deleteTaskAndSubTask(
@RequestHeader("Token") String token,
@PathVariable("projectId") Integer projectId,
@RequestParam("taskId") Long taskId
) {
taskService.deleteTaskAndSubTask(token, projectId, taskId);
return ResponseMap.ofSuccess("删除成功");
}
} }

View File

@ -20,12 +20,11 @@ public class Project {
private Integer projectId; private Integer projectId;
private String projectName; private String projectName;
//TODO: 时间线顺序判断 //TODO: 时间线顺序判断
private LocalDate projectStartTime; private LocalDate projectStartDate;
private LocalDate projectOnlineTime; private LocalDate projectOnlineDate;
private LocalDate projectFirstTestTime; private LocalDate projectFirstTestDate;
private LocalDate projectFinalTestTime; private LocalDate projectFinalTestDate;
private LocalDate projectEndTime; private LocalDate projectEndDate;
private LocalDate projectCloseTime;
private String projectAbbreviation; private String projectAbbreviation;
private Integer projectClassId; private Integer projectClassId;
private Integer projectSubclassId; private Integer projectSubclassId;
@ -44,5 +43,6 @@ public class Project {
@TableLogic @TableLogic
private Boolean deleted; private Boolean deleted;
private Integer projectCreator; private Integer projectCreator;
private LocalDateTime projectCreateTime; private LocalDateTime projectCreatedTime;
private LocalDate projectClosedDate;
} }

View File

@ -1,5 +1,8 @@
package cn.edu.hfut.rmdjzz.projectmanagement.entity; package cn.edu.hfut.rmdjzz.projectmanagement.entity.query;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -11,7 +14,9 @@ import java.time.LocalDate;
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@TableName(autoResultMap = true)
public class ResultProject { public class ResultProject {
@TableId
Integer projectId; Integer projectId;
String projectName; String projectName;
Integer projectCreator; Integer projectCreator;
@ -21,7 +26,7 @@ public class ResultProject {
String projectSubclassName; String projectSubclassName;
Boolean deleted; Boolean deleted;
Boolean completed; Boolean completed;
LocalDate projectCloseTime; LocalDate projectClosedDate;
Integer completeNum; Integer completeNum;
Integer totalNum; Integer totalNum;

View File

@ -0,0 +1,33 @@
package cn.edu.hfut.rmdjzz.projectmanagement.entity.query;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Map;
/**
* @author
* @since 2022/7/6 10:25
*/
@Data
public class ResultTask {
private Long taskId;
private String taskName;
private Integer taskProjectId;
private Integer taskHolderId;
private String taskHolderName;
private String taskStatus;
private String taskType;
private Long taskFatherId;
private LocalDateTime taskCreatedTime;
private LocalDateTime taskStartTime;
private LocalDateTime taskEndTime;
private LocalDateTime taskClosedTime;
private Integer taskPriority;
private String taskDescription;
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, Object> attachedInfo;
private Boolean hasChildren;
}

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.mapper; package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -23,35 +23,5 @@ public interface ProjectMapper extends BaseMapper<Project> {
""") """)
Long findProjectCount(@Param("id") Integer staffId); Long findProjectCount(@Param("id") Integer staffId);
@Select("""
SELECT * FROM
(SELECT project_id,
project_name,
contract_amount,
project_importance,
project_creator,
pt1.project_class_name as project_class_name,
pt2.project_class_name as project_subclass_name,
is_completed,
is_deleted,
project_close_time
FROM project join project_type pt1 on project.project_class_id = pt1.project_class_id
join project_type pt2 on project.project_subclass_id = pt2.project_class_id
WHERE project_id IN (SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})) AS T
${ew.customSqlSegment}
""")
@Results({
@Result(column = "project_id", property = "projectId", id = true),
@Result(column = "project_name", property = "projectName"),
@Result(column = "contract_amount", property = "contractAmount"),
@Result(column = "project_importance", property = "projectImportance"),
@Result(column = "project_class_name", property = "projectClassName"),
@Result(column = "project_subclass_name", property = "projectSubclassName"),
@Result(column = "project_class_name", property = "projectClassName"),
@Result(column = "is_completed", property = "completed"),
@Result(column = "is_deleted", property = "deleted"),
@Result(column = "project_close_time", property = "projectCloseTime"),
@Result(column = "project_creator", property = "projectCreator")
})
IPage<ResultProject> findMyProject(IPage<ResultProject> pg, @Param("id") Integer staff_id, @Param(Constants.WRAPPER) Wrapper<Project> wrapper); IPage<ResultProject> findMyProject(IPage<ResultProject> pg, @Param("id") Integer staff_id, @Param(Constants.WRAPPER) Wrapper<Project> wrapper);
} }

View File

@ -1,11 +1,16 @@
package cn.edu.hfut.rmdjzz.projectmanagement.mapper; package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @author * @author
* created at 2022/7/4 14:52 * created at 2022/7/4 14:52
*/ */
public interface TaskMapper extends BaseMapper<Task> { public interface TaskMapper extends BaseMapper<Task> {
List<ResultTask> selectSubTaskList(@Param("projectId") Integer projectId, @Param("fatherId") Long fatherId);
} }

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service; package cn.edu.hfut.rmdjzz.projectmanagement.service;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.RequestPage; import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.RequestPage;

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service; package cn.edu.hfut.rmdjzz.projectmanagement.service;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Staff;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultTask;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -12,14 +12,23 @@ import java.util.List;
* created at 2022/7/4 14:49 * created at 2022/7/4 14:49
*/ */
public interface ITaskService extends IService<Task> { public interface ITaskService extends IService<Task> {
List<Task> getTaskList(String token,Integer projectId,Long fatherId) throws BadRequestException; List<ResultTask> getSubTaskList(String token, Integer projectId, Long fatherId) throws BadRequestException;
Boolean existSubTask(String token, Integer projectId, Long taskId) throws BadRequestException; Boolean existSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
Boolean deleteTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException; Boolean deleteTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
Boolean closeTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException; Boolean closeTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
Integer checkHolder(Integer staffId,Long taskId);
Integer checkHolder(String token,Long taskId); Integer checkHolder(Integer staffId, Long taskId);
List<Task> getMyTaskList(String token,Integer projectId) throws BadRequestException;
Integer checkHolder(String token, Long taskId);
List<Task> getMyTaskList(String token, Integer projectId) throws BadRequestException;
Boolean canBeDone(Long taskId); Boolean canBeDone(Long taskId);
Task insertTask(String token,Task task) throws BadRequestException;
Task modifyTask(String token,Task task) throws BadRequestException; Task insertTask(String token, Task task) throws BadRequestException;
Task modifyTask(String token, Task task) throws BadRequestException;
} }

View File

@ -1,7 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl; package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject; import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException;
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectMapper; import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectMapper;
@ -60,7 +60,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
if (targetProject.getCompleted()) if (targetProject.getCompleted())
throw new BadRequestException("该项目已结项"); throw new BadRequestException("该项目已结项");
targetProject.setCompleted(true); targetProject.setCompleted(true);
targetProject.setProjectCloseTime(LocalDate.now()); targetProject.setProjectClosedDate(LocalDate.now());
if (baseMapper.updateById(targetProject) == 1) if (baseMapper.updateById(targetProject) == 1)
return true; return true;
throw new BadRequestException("操作失败"); throw new BadRequestException("操作失败");
@ -70,14 +70,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
public Boolean createProject(String token, Project project) throws TokenException, BadRequestException { public Boolean createProject(String token, Project project) throws TokenException, BadRequestException {
project.setProjectId(null); project.setProjectId(null);
project.setCompleted(false); project.setCompleted(false);
project.setProjectCreateTime(null); project.setProjectCreatedTime(null);
project.setProjectCreator(TokenUtils.getStaffId(token)); project.setProjectCreator(TokenUtils.getStaffId(token));
project.setProjectCloseTime(null); project.setProjectClosedDate(null);
if (project.getExpectedCompletion() == null) { if (project.getExpectedCompletion() == null) {
project.setExpectedCompletion((short) 100); project.setExpectedCompletion((short) 100);
} else if (project.getExpectedCompletion() < 0 || project.getExpectedCompletion() > 100 || } else if (project.getExpectedCompletion() < 0 || project.getExpectedCompletion() > 100 ||
project.getProjectStartTime() == null || project.getProjectEndTime() == null || project.getProjectStartDate() == null || project.getProjectEndDate() == null ||
project.getProjectStartTime().isAfter(project.getProjectEndTime()) project.getProjectStartDate().isAfter(project.getProjectEndDate())
) { ) {
throw new BadRequestException("参数错误"); throw new BadRequestException("参数错误");
} }

View File

@ -1,6 +1,7 @@
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl; package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultTask;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException; import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException;
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.TaskMapper; import cn.edu.hfut.rmdjzz.projectmanagement.mapper.TaskMapper;
@ -30,11 +31,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
//FIXME: 抛出未授权异常 //FIXME: 抛出未授权异常
@Override @Override
public List<Task> getTaskList(String token, Integer projectId, Long fatherId) throws BadRequestException { public List<ResultTask> getSubTaskList(String token, Integer projectId, Long fatherId) throws BadRequestException {
if (projectGroupService.getUserLevelInGroup(token, projectId) == 0 || fatherId == null) { if (projectGroupService.getUserLevelInGroup(token, projectId) == 0 || fatherId == null) {
throw new BadRequestException("错误的访问参数"); throw new BadRequestException("错误的访问参数");
} }
return baseMapper.selectList(Wrappers.<Task>lambdaQuery().eq(Task::getTaskProjectId, projectId).eq(Task::getTaskFatherId, fatherId)); return baseMapper.selectSubTaskList(projectId, fatherId);
} }
@Override @Override
@ -97,7 +98,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
Wrappers.<Task>lambdaUpdate() Wrappers.<Task>lambdaUpdate()
.in(Task::getTaskId, res) .in(Task::getTaskId, res)
.set(Task::getTaskStatus, "关闭") .set(Task::getTaskStatus, "关闭")
.set(Task::getTaskClosedTime,LocalDateTime.now()) .set(Task::getTaskClosedTime, LocalDateTime.now())
); );
if (list == null || list.isEmpty()) break; if (list == null || list.isEmpty()) break;
res = list.stream().map(Task::getTaskId).collect(Collectors.toList()); res = list.stream().map(Task::getTaskId).collect(Collectors.toList());

View File

@ -20,6 +20,7 @@ spring:
pathmatch: pathmatch:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mapper/*.xml
configuration: configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
server: server:

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectMapper">
<resultMap id="resultProject" type="cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject">
<id property="projectId" column="project_id"/>
<result property="completed" column="is_completed"/>
<result property="deleted" column="is_deleted"/>
</resultMap>
<select id="findMyProject" resultMap="resultProject">
SELECT *
FROM (SELECT project_id,
project_name,
contract_amount,
project_importance,
project_creator,
pt1.project_class_name AS project_class_name,
pt2.project_class_name AS project_subclass_name,
is_completed,
is_deleted,
project_closed_date
FROM project
JOIN project_type pt1 ON project.project_class_id = pt1.project_class_id
JOIN project_type pt2 ON project.project_subclass_id = pt2.project_class_id
WHERE project_id IN (SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})) AS T
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.edu.hfut.rmdjzz.projectmanagement.mapper.TaskMapper">
<select id="selectSubTaskList" resultType="cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultTask">
SELECT task_id,
task_name,
task_project_id,
task_holder_id,
s.staff_fullname AS task_holder_name,
task_status,
task_type,
t.task_father_id,
task_created_time,
task_start_time,
task_end_time,
task_closed_time,
task_priority,
task_description,
attached_info,
judge.task_father_id IS NOT NULL AS has_children
FROM task AS t
JOIN (SELECT staff_id, staff_fullname FROM staff) AS s ON t.task_holder_id = s.staff_id
LEFT JOIN (SELECT DISTINCT task_father_id FROM task WHERE is_deleted = 0) AS judge ON t.task_id = judge.task_father_id
WHERE is_deleted = 0
AND task_project_id = #{projectId}
AND t.task_father_id = #{fatherId}
</select>
</mapper>

View File

@ -1,11 +1,11 @@
package cn.edu.hfut.rmdjzz.projectmanagement; package cn.edu.hfut.rmdjzz.projectmanagement;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project; import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Staff;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IStaffService; import cn.edu.hfut.rmdjzz.projectmanagement.service.IStaffService;
import cn.edu.hfut.rmdjzz.projectmanagement.service.impl.ProjectServiceImpl; import cn.edu.hfut.rmdjzz.projectmanagement.service.impl.ProjectServiceImpl;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.WrapperUtils; import cn.edu.hfut.rmdjzz.projectmanagement.utils.WrapperUtils;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.RequestPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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;
@ -73,4 +73,18 @@ public class MybatisPlusTests {
System.out.println(objectMapper.writeValueAsString(((ProjectServiceImpl) projectService).getBaseMapper() System.out.println(objectMapper.writeValueAsString(((ProjectServiceImpl) projectService).getBaseMapper()
.findMyProject(new Page<>(1, 5), 1, Wrappers.query()))); .findMyProject(new Page<>(1, 5), 1, Wrappers.query())));
} }
@SneakyThrows
@Test
public void findProjectTest() {
RequestPage page = new RequestPage();
page.setPageCurrent(1);
page.setPageSize(5);
Map<String, Object> map = new HashMap<>();
map.put("completed", true);
System.out.println(objectMapper.writeValueAsString(projectService
.getOnePageProject("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkdXJhdGlvbiI6MTgwMDAsInN0YWZmVXNlcm5hbWUiOiJtaWtlIiwiZXhwIjoxNjU3MDkzNTU1LCJpYXQiOjE2NTcwNzU1NTUsInN0YWZmSWQiOjF9.g8l01dnHglt223469Z03i9gqZL8P13Fo7KoaA1pf310",
page, map)));
}
} }