潘志宝
2024-09-12 27e7299964b861c079dbb2826edab00dfd6dc27d
提交 | 用户 | 时间
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.MpkFileDao">
4
5     <resultMap id="mpkFile" type="com.iailab.module.model.mpk.dto.MpkFileDTO">
6         <id property="id" column="id"/>
7         <result property="pyName" column="py_name"/>
8         <result property="filePath" column="file_path"/>
9         <result property="pkgName" column="pkg_name"/>
10         <result property="className" column="class_name"/>
11         <result property="pyModule" column="py_module"/>
12         <result property="remark" column="remark"/>
13         <result property="creator" column="creator"/>
14         <result property="createDate" column="create_date"/>
15         <result property="updater" column="updater"/>
16         <result property="updateDate" column="update_date"/>
17         <collection property="modelMethods" ofType="com.iailab.module.model.mpk.entity.ModelMethodEntity">
18             <id property="id" column="method_id"/>
19             <result property="methodName" column="method_name"/>
20             <result property="dataLength" column="data_length"/>
21             <result property="model" column="model"/>
22         </collection>
23     </resultMap>
24
25     <select id="get" resultMap="mpkFile">
26         SELECT
27             a.*,
28             b.id method_id,
29             b.method_name,
30             b.data_length,
31             b.model
32         FROM
33             t_mpk_file a
34             LEFT JOIN t_mpk_model_method b ON a.id = b.mpk_file_id
35         WHERE a.id = #{id}
36     </select>
37     <select id="selectByIds" resultMap="mpkFile">
38         SELECT
39             a.*,
40             b.id method_id,
41             b.method_name,
42             b.data_length,
43             b.model
44         FROM
45             t_mpk_file a
46                 LEFT JOIN t_mpk_model_method b ON a.id = b.mpk_file_id
47         WHERE a.id in
48         <foreach collection="ids" item="item" open="(" close=")" separator=",">
49             #{item}
50         </foreach>
51     </select>
52     <select id="getProjectModelCount" resultType="java.lang.Integer" parameterType="java.lang.String">
53         SELECT
54             count(*)
55         FROM
56             t_mpk_project_model
57         WHERE
58             project_id = #{projectId}
59     </select>
60     <select id="getProjectModel" resultMap="mpkFile">
61         SELECT
62             t3.*,t4.method_name,t4.data_length,t4.model
63         FROM
64             (
65                 SELECT
66                     t2.id,
67                     t2.py_name,
68                     t2.pkg_name,
69                     t2.py_module,
70                     t2.remark,
71                     t2.create_date
72                 FROM
73                     t_mpk_project_model t1
74                         LEFT JOIN t_mpk_file t2 ON t1.model_id = t2.id
75                 WHERE
76                     t1.project_id = #{params.projectId}
77                     <if test="params.pyName != null and params.pyName != ''">
78                         AND t2.py_name LIKE CONCAT('%',#{params.pyName},'%')
79                     </if>
80                 ORDER BY
81                     t2.create_date DESC
82                     LIMIT #{params.offset},#{params.pageSize}
83             ) t3
84                 LEFT JOIN t_mpk_model_method t4 ON t3.id = t4.mpk_file_id
85     </select>
86 </mapper>