郑永安
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
<?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.ApprovalRuleRepository" >
    <resultMap id="BaseResultMap" type="com.gkhy.safePlatform.specialWork.entity.ApprovalRule" >
        <id column="rule_id" property="ruleId" jdbcType="BIGINT" />
        <result column="eid" property="eid" jdbcType="BIGINT"/>
        <result column="dep_id" property="depId" jdbcType="BIGINT"/>
        <result column="rule_name" property="ruleName" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
        <result column="work_type" property="workType" jdbcType="TINYINT"/>
        <result column="work_level" property="workLevel" jdbcType="TINYINT"/>
        <result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
        <result column="gmt_modified" property="gmtModified" jdbcType="TIMESTAMP"/>
        <result column="create_uid" property="createUid" jdbcType="BIGINT"/>
        <result column="create_uname" property="createUname" jdbcType="VARCHAR"/>
        <result column="modified_uname" property="modifiedUname" jdbcType="VARCHAR"/>
        <result column="modified_uid" property="modifiedUid" jdbcType="BIGINT"/>
 
    </resultMap>
    <sql id="all_Column_List" >
        rule_id,rule_name,eid,dep_id,status,work_type,work_level,gmt_create,gmt_modified,create_uid,create_uname,modified_uid,modified_uname
    </sql>
    <sql id="base_table_name">approval_rule</sql>
    <select id="listByConditions" resultMap="BaseResultMap"
            parameterType="com.gkhy.safePlatform.specialWork.model.query.db.ApprovalRuleListDbQuery">
        select <include refid="all_Column_List"></include> from <include refid="base_table_name"></include>
        <where>
            <if test="query.eid != null and query.eid > 0">
                and eid = #{query.eid}
            </if>
            <if test="query.depId != null and query.depId > 0">
                and dep_id = #{query.depId}
            </if>
            <if test="query.workType != null and query.workType > 0">
                and work_type = #{query.workType}
            </if>
            <if test="query.workLevel != null and query.workLevel > 0">
                and work_Level = #{query.workLevel}
            </if>
            <if test="query.status != null">
                and status = #{query.status}
            </if>
            <if test="query.createUid != null and query.createUid > 0">
                and create_uid = #{query.createUid}
            </if>
            <if test="query.createUname != null and query.createUname != ''">
                and create_uname like concat("%",#{query.createUname},"%")
            </if>
            <if test="query.ruleName != null and query.ruleName != ''">
                and rule_name like concat("%",#{query.ruleName},"%")
            </if>
        </where>
        ORDER BY gmt_create DESC
    </select>
    <!--批量删除规则-->
    <update id="updateStutsByRuleIds">
        update <include refid="base_table_name"></include>
        set status = #{status}
        where
        rule_id in
        <foreach collection="ruleIds" item="ruleId" open="(" close=")" separator=",">
            #{ruleId}
        </foreach>
    </update>
 
    <update id="updateStutsByRuleId">
        update <include refid="base_table_name"></include>
        set status = #{status}
        where
        rule_id = #{ruleId}
    </update>
</mapper>