mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?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.panzhihua.service_community.dao.VolunteerMerchantWithdrawDao">
 
    <resultMap type="com.panzhihua.service_community.entity.VolunteerMerchantWithdraw" id="MerchantWithdrawMap">
        <result property="id" column="id" />
        <result property="merchantId" column="merchant_id" />
        <result property="creationTime" column="creation_time" />
        <result property="updateTime" column="update_time" />
        <result property="communityId" column="community_id" />
        <result property="withdrawIntegral" column="withdraw_integral" />
        <result property="disposeTime" column="dispose_time" />
        <result property="disposeType" column="dispose_type" />
        <result property="isDelete" column="is_delete" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="base_sql">
        id,
        merchant_id,
        community_id,
        (select vm.name from volunteer_merchant as vm where volunteer_merchant_withdraw.merchant_id=vm.id) as merchantName,
        withdraw_integral,
        creation_time,
        update_time,
        dispose_time,
        dispose_type,
        is_delete
    </sql>
 
    <!-- 分页查询 -->
    <select id="getList" resultMap="MerchantWithdrawMap">
        select <include refid="base_sql"/>
        from volunteer_merchant_withdraw
        <where>
            is_delete='0'
            <if test="disposeType !=null and disposeType != '' ">
                and dispose_type=#{disposeType}
            </if>
            <if test="merchantName !=null and merchantName != '' ">
                and
                ((select vm.name from volunteer_merchant as vm where volunteer_merchant_withdraw.merchant_id=vm.id) like concat('%',#{merchantName},'%'))
            </if>
            <if test="merchantId !=null and merchantId != '' ">
                and merchant_id=#{merchantId}
            </if>
            <if test="communityId !=null and communityId != '' ">
                and community_id=#{communityId}
            </if>
        </where>
        order by creation_time desc
    </select>
 
    <insert id="insert">
        insert into volunteer_merchant_withdraw
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="item.id != null">
                id,
            </if>
            <if test="item.merchantId != null">
                merchant_id,
            </if>
            <if test="item.communityId != null">
                community_id,
            </if>
            <if test="item.withdrawIntegral != null">
                withdraw_integral,
            </if>
            <if test="item.disposeTime != null">
                dispose_time,
            </if>
            <if test="item.disposeType != null">
                dispose_type,
            </if>
            <if test="item.isDelete != null">
                is_delete,
            </if>
            creation_time
        </trim>
        values
        <trim prefix="("  suffix=")" suffixOverrides=",">
            <if test="item.id != null">
                #{item.id},
            </if>
            <if test="item.merchantId != null">
                #{item.merchantId},
            </if>
            <if test="item.communityId != null">
                #{item.communityId},
            </if>
            <if test="item.withdrawIntegral != null">
                #{item.withdrawIntegral},
            </if>
            <if test="item.disposeTime != null">
                #{item.disposeTime},
            </if>
            <if test="item.disposeType != null">
                #{item.disposeType},
            </if>
            <if test="item.isDelete != null">
                #{item.isDelete},
            </if>
            sysdate()
        </trim>
    </insert>
 
    <update id="update">
        update volunteer_merchant_withdraw
        <set>
            <if test="item.id != null">
                id=#{item.id},
            </if>
            <if test="item.merchantId != null">
                merchant_id=#{item.merchantId},
            </if>
            <if test="item.communityId != null">
                community_id=#{item.communityId},
            </if>
            <if test="item.withdrawIntegral != null">
                withdraw_integral=#{item.withdrawIntegral},
            </if>
            <if test="item.disposeTime != null">
                dispose_time=#{item.disposeTime},
            </if>
            <if test="item.disposeType != null">
                dispose_type=#{item.disposeType},
            </if>
            <if test="item.isDelete != null">
                is_delete=#{item.isDelete},
            </if>
            update_time=sysdate()
        </set>
        where id = #{item.id}
    </update>
 
    <update id="delete" parameterType="String">
        update volunteer_merchant_withdraw set is_delete=1 where id=#{id}
    </update>
 
 
    <update id="dispose" parameterType="String">
        update volunteer_merchant_withdraw set dispose_time=sysdate(),dispose_type='1' where id=#{id}
    </update>
 
</mapper>