修复了xml的mapper中不能使用mybatis-plus映射的问题
parent
17f516545b
commit
c81065d93e
|
@ -1,6 +1,8 @@
|
|||
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.Data;
|
||||
|
||||
|
@ -12,6 +14,7 @@ import java.time.LocalDate;
|
|||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@TableName(autoResultMap = true)
|
||||
public class ResultProject {
|
||||
@TableId
|
||||
Integer projectId;
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
<?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">
|
||||
<select id="findMyProject" resultType="cn.edu.hfut.rmdjzz.projectmanagement.entity.query.ResultProject">
|
||||
<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,
|
||||
|
@ -10,8 +16,8 @@
|
|||
project_creator,
|
||||
pt1.project_class_name AS project_class_name,
|
||||
pt2.project_class_name AS project_subclass_name,
|
||||
is_completed AS completed,
|
||||
is_deleted AS deleted,
|
||||
is_completed,
|
||||
is_deleted,
|
||||
project_closed_date
|
||||
FROM project
|
||||
JOIN project_type pt1 ON project.project_class_id = pt1.project_class_id
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package cn.edu.hfut.rmdjzz.projectmanagement;
|
||||
|
||||
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.IStaffService;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.impl.ProjectServiceImpl;
|
||||
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.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -73,4 +73,18 @@ public class MybatisPlusTests {
|
|||
System.out.println(objectMapper.writeValueAsString(((ProjectServiceImpl) projectService).getBaseMapper()
|
||||
.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)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue