liulingling.177216
2024-08-26 349f1cfc5fa77fbc636d542df0d8050fddec48c2
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
<?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.dingzhuo.energy.basic.data.policy.mapper.PolicyRegulationsTranslateMapper">
    
    <resultMap type="PolicyRegulationsTranslate" id="PolicyRegulationsTranslateResult">
        <result property="id"    column="id"    />
        <result property="titleName"    column="title_name"    />
        <result property="content"    column="content"    />
        <result property="sort"    column="sort"    />
        <result property="creationTime"    column="creation_time"    />
        <result property="operator"    column="operator"    />
    </resultMap>
 
    <sql id="selectPolicyRegulationsTranslateVo">
         select "id",title_name,"content",fun_getDiceData('policy_sort',sort)as sort,to_char(creation_time,'YYYY-MM-DD') creation_time,"operator" from policy_regulations
    </sql>
 
    <select id="selectPolicyRegulationsTranslateList" parameterType="PolicyRegulationsTranslate" resultMap="PolicyRegulationsTranslateResult">
        <include refid="selectPolicyRegulationsTranslateVo"/>
        <where>  
            <if test="titleName != null  and titleName != ''"> and title_name like concat('%', #{titleName}, '%')</if>
            <if test="content != null  and content != ''"> and content like concat('%', #{content}, '%')</if>
            <if test="sort != null  and sort != ''"> and sort like concat('%', #{sort}, '%')</if>
            <if test="creationTime != null "> and creation_time like concat('%', #{creationTime}, '%')</if>
            <if test="operator != null  and operator != ''"> and operator like concat('%', #{operator}, '%')</if>
        </where>
    </select>
    
    <select id="selectPolicyRegulationsTranslateById" parameterType="String" resultMap="PolicyRegulationsTranslateResult">
        <include refid="selectPolicyRegulationsTranslateVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertPolicyRegulationsTranslate" parameterType="PolicyRegulationsTranslate">
        insert into policy_regulations
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="titleName != null  and titleName != ''">title_name,</if>
            <if test="content != null  and content != ''">content,</if>
            <if test="sort != null  and sort != ''">sort,</if>
            <if test="creationTime != null ">creation_time,</if>
            <if test="operator != null  and operator != ''">operator,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="titleName != null  and titleName != ''">#{titleName},</if>
            <if test="content != null  and content != ''">#{content},</if>
            <if test="sort != null  and sort != ''">#{sort},</if>
            <if test="creationTime != null ">#{creationTime},</if>
            <if test="operator != null  and operator != ''">#{operator},</if>
         </trim>
    </insert>
 
    <update id="updatePolicyRegulationsTranslate" parameterType="PolicyRegulationsTranslate">
        update policy_regulations
        <trim prefix="SET" suffixOverrides=",">
            <if test="titleName != null  and titleName != ''">title_name = #{titleName},</if>
            <if test="content != null  and content != ''">content = #{content},</if>
            <if test="sort != null  and sort != ''">sort = #{sort},</if>
            <if test="creationTime != null ">creation_time = #{creationTime},</if>
            <if test="operator != null  and operator != ''">operator = #{operator},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deletePolicyRegulationsTranslateById" parameterType="String">
        delete from policy_regulations where id = #{id}
    </delete>
 
    <delete id="deletePolicyRegulationsTranslateByIds" parameterType="String">
        delete from policy_regulations where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>