gongchunyi
昨天 5b334f63a33646b57a428c647bad9894cd3f3068
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
<?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.ruoyi.production.mapper.ProcessRouteItemParamMapper">
 
    <resultMap id="ProcessRouteItemParamResultMap" type="com.ruoyi.production.pojo.ProcessRouteItemParam">
        <id property="id" column="id"/>
        <result property="routeItemId" column="route_item_id"/>
        <result property="paramId" column="param_id"/>
        <result property="processParamId" column="process_param_id"/>
        <result property="standardValue" column="standard_value"/>
        <result property="minValue" column="min_value"/>
        <result property="maxValue" column="max_value"/>
        <result property="isRequired" column="is_required"/>
        <result property="sort" column="sort"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>
 
    <insert id="insertFromProcessTemplate">
        INSERT INTO process_route_item_param (route_item_id, param_id, process_param_id,
                                              standard_value, min_value, max_value,
                                              is_required, sort, tenant_id, create_time)
        SELECT #{routeItemId},
               param_id,
               id,
               standard_value,
               min_value,
               max_value,
               is_required,
               sort,
               #{tenantId},
               NOW()
        FROM product_process_param
        WHERE process_id = #{processId}
    </insert>
 
    <select id="selectParamPage" resultType="com.ruoyi.production.dto.ProcessRouteItemParamDto">
        select
        prip.*,
        bp.param_name,
        bp.param_key,
        bp.unit,
        bp.param_type,
        bp.param_format,
        bp.value_mode
        from process_route_item_param prip
        left join base_param bp on prip.param_id = bp.id
        <where>
            <if test="p.routeItemId != null">
                and prip.route_item_id = #{p.routeItemId}
            </if>
            <if test="p.tenantId != null">
                and prip.tenant_id = #{p.tenantId}
            </if>
        </where>
        order by prip.sort asc, prip.id asc
    </select>
 
    <select id="selectMaxSortByRouteItemId" resultType="java.lang.Integer">
        SELECT MAX(sort)
        FROM process_route_item_param
        WHERE route_item_id = #{routeItemId}
    </select>
 
</mapper>