潘志宝
5 天以前 042be316746210a681a21c3ecca6b7a44e793db0
提交 | 用户 | 时间
3e61b6 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.matlab.dao.MlModelDao">
4     <resultMap type="com.iailab.module.model.matlab.dto.MlModelDTO" id="mlModelMap">
5         <result property="id" column="id"/>
6         <result property="modelName" column="model_name"/>
7         <result property="modelFileName" column="model_file_name"/>
8         <result property="modelFilePath" column="model_file_path"/>
9         <result property="modelType" column="model_type"/>
10         <result property="matlabPlatform" column="matlab_platform"/>
11         <result property="matlabVersion" column="matlab_version"/>
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.matlab.dto.MlModelMethodDTO">
18             <id property="id" column="method_id"/>
19             <result property="className" column="class_name"/>
20             <result property="methodName" column="method_name"/>
21             <result property="dataLength" column="data_length"/>
22             <result property="outLength" column="out_length"/>
23             <collection property="methodSettings" ofType="com.iailab.module.model.matlab.dto.MlModelMethodSettingDTO">
24                 <id property="id" column="setting_id"/>
25                 <result property="name" column="setting_name"/>
26                 <result property="settingKey" column="setting_key"/>
27                 <result property="settingValue" column="setting_value"/>
28                 <result property="valueType" column="value_type"/>
29             </collection>
30         </collection>
31     </resultMap>
32
33     <select id="list" resultMap="mlModelMap" parameterType="java.util.Map">
34         SELECT
35         a.*,
36         b.id method_id,
37         b.class_name,
38         b.method_name,
39         b.data_length,
40         b.out_length,
41         c.id setting_id,
42         c.NAME setting_name,
43         c.setting_key,
44         c.setting_value,
45         c.value_type
46         FROM
47         t_ml_model a
48         LEFT JOIN t_ml_model_method b ON a.id = b.ml_model_id
49         LEFT JOIN t_ml_model_method_setting c ON b.id = c.ml_model_method_id
50         <where>
51             <if test="params.modelType != null and params.modelType != ''">
52                 AND a.model_type = #{params.modelType}
53             </if>
54         </where>
55         ORDER BY
56         a.create_date,
57         b.sort,
58         c.sort
59     </select>
60     <select id="get" resultMap="mlModelMap" parameterType="java.lang.String">
61         SELECT
62             a.*,
63             b.id method_id,
64             b.class_name,
65             b.method_name,
66             b.data_length,
67             b.out_length,
68             c.id setting_id,
69             c.NAME setting_name,
70             c.setting_key,
71             c.setting_value,
72             c.value_type
73         FROM
74             t_ml_model a
75         LEFT JOIN t_ml_model_method b ON a.id = b.ml_model_id
76         LEFT JOIN t_ml_model_method_setting c ON b.id = c.ml_model_method_id
77         WHERE a.id = #{id}
78         ORDER BY b.sort,c.sort
79     </select>
80     <select id="getProjectModelCount" resultType="java.lang.Integer" parameterType="java.lang.String">
81         SELECT
82             count(*)
83         FROM
84             t_ml_project_model
85         WHERE
86             project_id = #{projectId}
87     </select>
88     <select id="getProjectModel" resultMap="mlModelMap" parameterType="java.util.Map">
89         SELECT
90         t3.*,
91         t4.id method_id,
92         t4.class_name,
93         t4.method_name,
94         t4.data_length,
95         t4.out_length,
96         t5.id setting_id,
97         t5.setting_key,
98         t5.name setting_name,
99         t5.setting_value,
100         t5.value_type
101         FROM
102         (
103         SELECT
104         t2.*
105         FROM
106         t_ml_project_model t1
107         LEFT JOIN t_ml_model t2 ON t1.model_id = t2.id
108         WHERE
109         t1.project_id = #{params.projectId}
110         <if test="params.modelFileName != null and params.modelFileName != ''">
111             AND t2.model_file_name LIKE CONCAT('%',#{params.modelFileName},'%')
112         </if>
113         ORDER BY
114         t2.create_date DESC
115         LIMIT #{params.offset},#{params.pageSize}
116         ) t3
117         LEFT JOIN t_ml_model_method t4 ON t3.id = t4.ml_model_id
118         LEFT JOIN t_ml_model_method_setting t5 ON t4.id = t5.ml_model_method_id
119     </select>
120 </mapper>