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