郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
<?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.gkhy.safePlatform.specialWork.repository.ApprovalRuleItemMeasureRepository" >
    <resultMap id="measureResultMap" type="com.gkhy.safePlatform.specialWork.entity.ApprovalRuleItemMeasure" >
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="work_type" property="workType" jdbcType="TINYINT"/>
        <result column="type" property="type" jdbcType="TINYINT"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
        <result column="correct_val" property="correctVal" jdbcType="TINYINT"/>
        <result column="context" property="context" jdbcType="VARCHAR"/>
        <result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
        <result column="create_uname" property="createUname" jdbcType="VARCHAR"/>
        <result column="create_uid" property="createUid" jdbcType="BIGINT"/>
        <result column="gmt_modified" property="gmtModified" jdbcType="TIMESTAMP"/>
        <result column="modified_uname" property="modifiedUname" jdbcType="VARCHAR"/>
        <result column="modified_uid" property="modifiedUid" jdbcType="BIGINT"/>
    </resultMap>
 
    <resultMap id="ApprovalRuleItemMeasureDO" type="com.gkhy.safePlatform.specialWork.entity.ApprovalRuleItemMeasureDO" >
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="work_type" property="workType" jdbcType="TINYINT"/>
        <result column="type" property="type" jdbcType="TINYINT"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
        <result column="correct_val" property="correctVal" jdbcType="TINYINT"/>
        <result column="context" property="context" jdbcType="VARCHAR"/>
    </resultMap>
 
 
    <select id="listByConditions"
            parameterType="com.gkhy.safePlatform.specialWork.model.query.db.ApprovalRuleItemMeasureQuery"
            resultMap="measureResultMap">
        select
        id,
        work_type,
        type,
        correct_val,
        context,
        status,
        gmt_create,
        create_uname,
        create_uid,
        gmt_modified,
        modified_uname,
        modified_uid
        from approval_rule_item_measure
        <where>
            <if test="query.status != null">
                and status = #{query.status}
            </if>
            <if test="query.workType != null">
                and work_type = #{query.workType}
            </if>
            <if test="query.type != null">
                and type = #{query.type}
            </if>
            <if test="query.context != null and query.context != ''">
                and context like concat("%",#{query.context},"%")
            </if>
        </where>
        ORDER BY gmt_create DESC
    </select>
    <!--删除-单条-->
    <update id="updateStatusById" >
        update approval_rule_item_measure
        set status = #{status}
        where
        id = #{id}
    </update>
    <!--删除-批量-->
    <update id="updateStatusByIds" >
        update approval_rule_item_measure
        set status = #{status}
        where
            id in
            <foreach collection="ids" item="id" open="(" close=")" separator=",">
                #{id}
            </foreach>
    </update>
 
    <select id="listMeasureId" resultType="java.lang.Long">
        select id from approval_rule_item_measure where status = #{status}
    </select>
    <select id="listItemMeasureByIds"
            parameterType="long"
            resultMap="ApprovalRuleItemMeasureDO">
    select
    measure.id,
    measure.work_type,
    measure.type,
    measure.correct_val,
    measure.context,
    measure.status
    from approval_rule_item_measure as measure
    where measure.id in
    <foreach collection="measureIds" item="id" open="(" close=")" separator=",">
        #{id}
    </foreach>
    </select>
 
</mapper>