潘志宝
2024-12-10 a440ec3bfaa1363f5841100b8948d852971a2eb1
提交 | 用户 | 时间
449017 1 <?xml version="1.0" encoding="UTF-8" ?>
D 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 <mapper namespace="com.iailab.module.model.mpk.dao.ProjectDao">
4
5     <resultMap id="projectModel" type="com.iailab.module.model.mpk.dto.ProjectDTO">
6         <id property="id" column="id"/>
7         <result property="projectName" column="project_name"/>
8         <result property="projectCode" column="project_code"/>
9         <result property="createTime" column="create_time"/>
10         <collection property="models" ofType="com.iailab.module.model.mpk.dto.MpkFileDTO">
11             <id property="id" column="model_id"/>
12             <result property="pyName" column="py_name"/>
13         </collection>
14     </resultMap>
15
16     <select id="getPageList" resultMap="projectModel" resultType="com.iailab.module.model.mpk.dto.ProjectDTO">
17         SELECT
18             t1.id,
19             t1.project_name,
20             t1.project_code,
21             t1.create_time,
22             t2.model_id,
23             t3.py_name
24         FROM
25             t_mpk_project t1
26                 LEFT JOIN t_mpk_project_model t2 on t1.id = t2.project_id
27                 LEFT JOIN t_mpk_file t3 ON t2.model_id = t3.id
28         <where>
29             <if test="params.projectName != null and params.projectName != ''">
30                 and t1.project_name like CONCAT('%',#{params.projectName},'%')
31             </if>
32             <if test="params.projectCode != null and params.projectCode != ''">
33                 and t1.project_code like CONCAT('%',#{params.projectCode},'%')
34             </if>
35         </where>
36         order by t1.create_time desc
37     </select>
38 </mapper>