SQL语句修改为xml
parent
dc315eeca7
commit
58e0701d07
|
@ -1,5 +1,8 @@
|
||||||
package cn.edu.hfut.rmdjzz.projectmanagement.entity.query;
|
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.TableLogic;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -12,6 +15,7 @@ import java.time.LocalDate;
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ResultProject {
|
public class ResultProject {
|
||||||
|
@TableId
|
||||||
Integer projectId;
|
Integer projectId;
|
||||||
String projectName;
|
String projectName;
|
||||||
Integer projectCreator;
|
Integer projectCreator;
|
||||||
|
|
|
@ -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_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}
|
|
||||||
""")
|
|
||||||
@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_closed_date", property = "projectClosedDate"),
|
|
||||||
@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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?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">
|
||||||
|
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 as completed,
|
||||||
|
is_deleted as 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>
|
Loading…
Reference in New Issue