dengzedong
2024-09-25 f7932f5848903427a2c08f8eb40bc0022410de42
提交 | 用户 | 时间
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"/>
0255ea 8         <result property="pyChineseName" column="py_chinese_name"/>
449017 9         <result property="filePath" column="file_path"/>
0255ea 10         <result property="pyType" column="py_type"/>
449017 11         <result property="pkgName" column="pkg_name"/>
D 12         <result property="className" column="class_name"/>
13         <result property="pyModule" column="py_module"/>
0255ea 14         <result property="icon" column="icon"/>
D 15         <result property="menuName" column="menu_name"/>
16         <result property="groupName" column="group_name"/>
449017 17         <result property="remark" column="remark"/>
D 18         <result property="creator" column="creator"/>
19         <result property="createDate" column="create_date"/>
20         <result property="updater" column="updater"/>
21         <result property="updateDate" column="update_date"/>
0255ea 22         <collection property="modelMethods" ofType="com.iailab.module.model.mpk.dto.ModelMethodDTO">
449017 23             <id property="id" column="method_id"/>
D 24             <result property="methodName" column="method_name"/>
25             <result property="dataLength" column="data_length"/>
26             <result property="model" column="model"/>
0255ea 27             <result property="resultKey" column="result_key"/>
D 28             <collection property="methodSettings" ofType="com.iailab.module.model.mpk.dto.MethodSettingDTO">
29                 <id property="id" column="setting_id"/>
30                 <result property="settingKey" column="setting_key"/>
31                 <result property="name" column="setting_name"/>
32                 <result property="value" column="value"/>
33                 <result property="type" column="type"/>
34                 <result property="valueType" column="value_type"/>
35                 <result property="max" column="max"/>
36                 <result property="min" column="min"/>
37                 <collection property="settingSelects" ofType="com.iailab.module.model.mpk.dto.SettingSelectDTO">
38                     <id property="id" column="select_id"/>
39                     <result property="selectKey" column="select_key"/>
40                     <result property="name" column="select_name"/>
41                 </collection>
42             </collection>
449017 43         </collection>
D 44     </resultMap>
45
46     <select id="get" resultMap="mpkFile">
47         SELECT
48             a.*,
49             b.id method_id,
50             b.method_name,
51             b.data_length,
0255ea 52             b.model,
D 53             b.result_key,
54             c.id setting_id,
55             c.setting_key,
56             c.name setting_name,
57             c.value,
58             c.type,
59             c.value_type,
60             c.max,
61             c.min,
62             d.id select_id,
63             d.select_key,
64             d.name select_name
449017 65         FROM
D 66             t_mpk_file a
67             LEFT JOIN t_mpk_model_method b ON a.id = b.mpk_file_id
0255ea 68             LEFT JOIN t_mpk_method_setting c ON b.id = c.method_id
D 69             LEFT JOIN t_mpk_setting_select d ON c.id = d.setting_id
449017 70         WHERE a.id = #{id}
D 71     </select>
72     <select id="selectByIds" resultMap="mpkFile">
73         SELECT
74             a.*,
75             b.id method_id,
76             b.method_name,
77             b.data_length,
0255ea 78             b.model,
D 79             b.result_key,
80             c.id setting_id,
81             c.setting_key,
82             c.name setting_name,
83             c.value,
84             c.type,
85             c.value_type,
86             c.max,
87             c.min,
88             d.id select_id,
89             d.select_key,
90             d.name select_name
449017 91         FROM
D 92             t_mpk_file a
93                 LEFT JOIN t_mpk_model_method b ON a.id = b.mpk_file_id
0255ea 94                 LEFT JOIN t_mpk_method_setting c ON b.id = c.method_id
D 95                 LEFT JOIN t_mpk_setting_select d ON c.id = d.setting_id
2cc235 96                 LEFT JOIN t_mpk_file_menu e ON e.name = a.menu_name
D 97                 LEFT JOIN t_mpk_file_group f ON f.menu_id = e.id and f.name = a.group_name
449017 98         WHERE a.id in
D 99         <foreach collection="ids" item="item" open="(" close=")" separator=",">
100             #{item}
101         </foreach>
2cc235 102         ORDER BY e.sort,f.sort,a.create_date
449017 103     </select>
D 104     <select id="getProjectModelCount" resultType="java.lang.Integer" parameterType="java.lang.String">
105         SELECT
106             count(*)
107         FROM
108             t_mpk_project_model
109         WHERE
110             project_id = #{projectId}
111     </select>
112     <select id="getProjectModel" resultMap="mpkFile">
113         SELECT
0255ea 114             t3.*,
067d7a 115             t4.id method_id,
0255ea 116             t4.method_name,
D 117             t4.data_length,
118             t4.model,
119             t4.result_key,
120             t5.id setting_id,
121             t5.setting_key,
122             t5.name setting_name,
123             t5.value,
124             t5.type,
125             t5.value_type,
126             t5.max,
127             t5.min,
128             t6.id select_id,
129             t6.select_key,
130             t6.name select_name
449017 131         FROM
D 132             (
133                 SELECT
067d7a 134                     t2.*
449017 135                 FROM
D 136                     t_mpk_project_model t1
137                         LEFT JOIN t_mpk_file t2 ON t1.model_id = t2.id
138                 WHERE
139                     t1.project_id = #{params.projectId}
140                     <if test="params.pyName != null and params.pyName != ''">
141                         AND t2.py_name LIKE CONCAT('%',#{params.pyName},'%')
142                     </if>
143                 ORDER BY
144                     t2.create_date DESC
145                     LIMIT #{params.offset},#{params.pageSize}
146             ) t3
147                 LEFT JOIN t_mpk_model_method t4 ON t3.id = t4.mpk_file_id
0255ea 148                 LEFT JOIN t_mpk_method_setting t5 ON t4.id = t5.method_id
D 149                 LEFT JOIN t_mpk_setting_select t6 ON t5.id = t6.setting_id
449017 150     </select>
D 151 </mapper>