fengjin
2022-09-29 13db271c8d35d8730c8daf6d359c1fa352f52cd8
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
<?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.dg.core.db.gen.mapper.GuideEvolveMapper">
 
    <resultMap type="com.dg.core.db.gen.entity.GuideEvolveEntity" id="GuideEvolveResult">
        <id     property="id"      column="id"      />
        <id     property="departmentalId"      column="departmental_id"      />
        <id     property="toUserId"      column="to_user_id"      />
        <id     property="fromUserId"      column="from_user_id"      />
        <id     property="state"      column="state"      />
        <id     property="remark"      column="remark"      />
        <id     property="guideId"      column="guide_id"      />
        <id     property="transactionId"      column="transaction_id"      />
        <id     property="accessoryId"      column="accessory_id"      />
        <id     property="accessoryName"      column="accessory_name"      />
        <id     property="accessoryUrl"      column="accessory_url"      />
        <id     property="createTime"      column="create_time"      />
        <id     property="updateTime"      column="update_time"      />
        <id     property="fromDepartmentalId"      column="from_departmental_id"      />
 
    </resultMap>
 
    <sql id="selectGuideEvolveVo">
        SELECT
            id,
            departmental_id,
            to_user_id,
            from_user_id,
            state,
            remark,
            guide_id,
            transaction_id,
            accessory_id,
            accessory_name,
            accessory_url,
            from_departmental_id,
            create_time,
            update_time
        FROM
            automessage_guide_evolve
    </sql>
 
    <select id="selectConfigList"  resultMap="GuideEvolveResult">
        <include refid="selectGuideEvolveVo"/>
        <where>
            <if test="guideId != null and guideId != ''">
                AND guide_id=#{guideId}
            </if>
        </where>
        order by create_time desc
    </select>
 
 
    <insert id="insertConfig" parameterType="com.dg.core.db.gen.entity.GuideEvolveEntity">
        insert into automessage_guide_evolve (
        <if test="id != null">id,</if>
        <if test="departmentalId != null and departmentalId != '' ">departmental_id,</if>
        <if test="toUserId != null and toUserId != '' ">to_user_id,</if>
        <if test="fromUserId != null and fromUserId != '' ">from_user_id,</if>
        <if test="state != null and state != '' ">state,</if>
        <if test="remark != null and remark != '' ">remark,</if>
        <if test="guideId != null and guideId != '' ">guide_id,</if>
        <if test="transactionId != null and transactionId != '' ">transaction_id,</if>
        <if test="accessoryId != null and accessoryId != '' ">accessory_id,</if>
        <if test="accessoryName != null and accessoryName != '' ">accessory_name,</if>
        <if test="accessoryUrl != null and accessoryUrl != '' ">accessory_url,</if>
        <if test="fromDepartmentalId != null and fromDepartmentalId != '' ">from_departmental_id,</if>
        update_time,
        create_time
        )values(
        <if test="departmentalId != null and departmentalId != '' ">#{departmentalId},</if>
        <if test="toUserId != null and toUserId != '' ">#{toUserId},</if>
        <if test="fromUserId != null and fromUserId != '' ">#{fromUserId},</if>
        <if test="state != null and state != '' ">#{state},</if>
        <if test="remark != null and remark != '' ">#{remark},</if>
        <if test="guideId != null and guideId != '' ">#{guideId},</if>
        <if test="transactionId != null and transactionId != '' ">#{transactionId},</if>
        <if test="accessoryId != null and accessoryId != '' ">#{accessoryId},</if>
        <if test="accessoryName != null and accessoryName != '' ">#{accessoryName},</if>
        <if test="accessoryUrl != null and accessoryUrl != '' ">#{accessoryUrl},</if>
        <if test="fromDepartmentalId != null and fromDepartmentalId != '' ">#{fromDepartmentalId},</if>
        sysdate(),
        sysdate()
        )
    </insert>
 
    <update id="updateConfig" parameterType="com.dg.core.db.gen.entity.GuideEvolveEntity">
        update automessage_guide_evolve
        <set>
            <if test="departmentalId != null and departmentalId != '' ">departmental_id=#{departmentalId},</if>
            <if test="toUserId != null and toUserId != '' ">to_user_id=#{toUserId},</if>
            <if test="fromUserId != null and fromUserId != '' ">from_user_id=#{fromUserId},</if>
            <if test="state != null and state != '' ">state=#{state},</if>
            <if test="remark != null and remark != '' ">remark=#{remark},</if>
            <if test="guideId != null and guideId != '' ">guide_id=#{guideId},</if>
            <if test="transactionId != null and transactionId != '' ">transaction_id=#{transactionId},</if>
            <if test="accessoryId != null and accessoryId != '' ">accessory_id=#{accessoryId},</if>
            <if test="accessoryName != null and accessoryName != '' ">accessory_name=#{accessoryName},</if>
            <if test="accessoryUrl != null and accessoryUrl != '' ">accessory_url=#{accessoryUrl},</if>
            <if test="fromDepartmentalId != null and fromDepartmentalId != '' ">from_departmental_id=#{fromDepartmentalId},</if>
            update_time=sysdate()
        </set>
        where  id= #{Id}
    </update>
 
    <delete id="deleteConfigById" parameterType="string">
        delete from automessage_guide_evolve where id= #{Id}
    </delete>
 
    <select id="countNum" resultType="integer">
        select count(id) from automessage_guide_evolve
    </select>
 
</mapper>