houzhongjian
2024-12-05 a709abfd8ffec1524cefff30c3581f4425695433
提交 | 用户 | 时间
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}
587b43 71         ORDER BY b.sort,c.sort,d.sort
449017 72     </select>
D 73     <select id="selectByIds" resultMap="mpkFile">
74         SELECT
75             a.*,
76             b.id method_id,
77             b.method_name,
78             b.data_length,
0255ea 79             b.model,
D 80             b.result_key,
81             c.id setting_id,
82             c.setting_key,
83             c.name setting_name,
84             c.value,
85             c.type,
86             c.value_type,
87             c.max,
88             c.min,
89             d.id select_id,
90             d.select_key,
91             d.name select_name
449017 92         FROM
D 93             t_mpk_file a
94                 LEFT JOIN t_mpk_model_method b ON a.id = b.mpk_file_id
0255ea 95                 LEFT JOIN t_mpk_method_setting c ON b.id = c.method_id
D 96                 LEFT JOIN t_mpk_setting_select d ON c.id = d.setting_id
2cc235 97                 LEFT JOIN t_mpk_file_menu e ON e.name = a.menu_name
D 98                 LEFT JOIN t_mpk_file_group f ON f.menu_id = e.id and f.name = a.group_name
449017 99         WHERE a.id in
D 100         <foreach collection="ids" item="item" open="(" close=")" separator=",">
101             #{item}
102         </foreach>
587b43 103         ORDER BY b.sort,c.sort,d.sort,e.sort,f.sort,a.create_date
449017 104     </select>
4f4b05 105     <select id="list" resultMap="mpkFile" parameterType="java.util.Map">
D 106         SELECT
107         a.*,
108         b.id method_id,
109         b.method_name,
110         b.data_length,
111         b.model,
112         b.result_key,
113         c.id setting_id,
114         c.setting_key,
115         c.name setting_name,
116         c.value,
117         c.type,
118         c.value_type,
119         c.max,
120         c.min,
121         d.id select_id,
122         d.select_key,
123         d.name select_name
124         FROM
125         t_mpk_file a
126         LEFT JOIN t_mpk_model_method b ON a.id = b.mpk_file_id
127         LEFT JOIN t_mpk_method_setting c ON b.id = c.method_id
128         LEFT JOIN t_mpk_setting_select d ON c.id = d.setting_id
129         LEFT JOIN t_mpk_file_menu e ON e.name = a.menu_name
130         LEFT JOIN t_mpk_file_group f ON f.menu_id = e.id and f.name = a.group_name
131         <where>
132             <if test="params.pyType != null and params.pyType != ''">
133                 AND a.py_type = #{params.pyType}
134             </if>
135         </where>
136         ORDER BY b.sort,c.sort,d.sort,e.sort,f.sort,a.create_date
137     </select>
449017 138     <select id="getProjectModelCount" resultType="java.lang.Integer" parameterType="java.lang.String">
D 139         SELECT
140             count(*)
141         FROM
142             t_mpk_project_model
143         WHERE
144             project_id = #{projectId}
145     </select>
146     <select id="getProjectModel" resultMap="mpkFile">
147         SELECT
0255ea 148             t3.*,
067d7a 149             t4.id method_id,
0255ea 150             t4.method_name,
D 151             t4.data_length,
152             t4.model,
153             t4.result_key,
154             t5.id setting_id,
155             t5.setting_key,
156             t5.name setting_name,
157             t5.value,
158             t5.type,
159             t5.value_type,
160             t5.max,
161             t5.min,
162             t6.id select_id,
163             t6.select_key,
164             t6.name select_name
449017 165         FROM
D 166             (
167                 SELECT
067d7a 168                     t2.*
449017 169                 FROM
D 170                     t_mpk_project_model t1
171                         LEFT JOIN t_mpk_file t2 ON t1.model_id = t2.id
172                 WHERE
173                     t1.project_id = #{params.projectId}
174                     <if test="params.pyName != null and params.pyName != ''">
175                         AND t2.py_name LIKE CONCAT('%',#{params.pyName},'%')
176                     </if>
177                 ORDER BY
178                     t2.create_date DESC
179                     LIMIT #{params.offset},#{params.pageSize}
180             ) t3
181                 LEFT JOIN t_mpk_model_method t4 ON t3.id = t4.mpk_file_id
0255ea 182                 LEFT JOIN t_mpk_method_setting t5 ON t4.id = t5.method_id
D 183                 LEFT JOIN t_mpk_setting_select t6 ON t5.id = t6.setting_id
449017 184     </select>
D 185 </mapper>