user-kiting-mapper.xml
2.71 KB
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
<?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">
<!-- @author 仝玉甫 -->
<mapper namespace="com.cjs.cms.dao.user.fund.UserKitingDao">
<sql id="user_kiting_field">
id, user_id, user_name, mobile, bank_name, bank_no, sub_branch, province, city,
kit_amount, kit_fare, payable_amount, kit_status, kit_at, pay_at, pay_by, review_at, review_by, refuse_at, refuse_by, remark
</sql>
<!-- 状态(0:申请失败;1:已申请;2:汇款待复核;3:已复核;4:申请否决) -->
<update id="updateStatus" parameterType="UserKitingInfo">
update user_kiting set kit_status = #{kitStatus},
<if test="kitStatus == 2">
pay_at = now(), pay_by = #{payBy}
</if>
<if test="kitStatus == 3">
review_at = now(), review_by = #{reviewBy}
</if>
<if test="kitStatus == 4">
refuse_at = now(), refuse_by = #{refuseBy}, remark = #{remark}
</if>
where id = #{id}
<if test="kitStatus == 2">
and kit_status = '1'
</if>
<if test="kitStatus == 3">
and kit_status = '2'
</if>
<if test="kitStatus == 4">
and kit_status in ('1','2')
</if>
</update>
<select id="queryById" parameterType="int" resultType="UserKitingInfo">
select <include refid="user_kiting_field" />
from user_kiting
where id = #{id}
</select>
<sql id="searchCondition">
where 1 = 1
<if test="userId != null and userId != ''"> and user_id like CONCAT('%', #{userId}, '%') </if>
<if test="userName != null and userName != ''"> and user_name like CONCAT('%', #{userName}, '%') </if>
<if test="bankNo != null and bankNo != ''"> and bank_no like CONCAT('%', #{bankNo}, '%') </if>
<if test="bankName != null and bankName != ''"> and bank_name like CONCAT('%', #{bankName}, '%') </if>
<if test="kitStatus != null and kitStatus != ''"> and kit_status = #{kitStatus} </if>
<if test="kitStart != null and kitStart != ''">
<![CDATA[ and kit_at >= CONCAT(#{kitStart}, ' 00:00:00') ]]>
</if>
<if test="kitEnd != null and kitEnd != ''">
<![CDATA[ and kit_at <= CONCAT(#{kitEnd}, ' 23:59:59') ]]>
</if>
</sql>
<select id="search" parameterType="map" resultType="UserKitingInfo">
select <include refid="user_kiting_field" />
from user_kiting
<include refid="searchCondition" />
order by kit_at desc
<include refid="common.pageLimit" />
</select>
<select id="searchTotal" parameterType="map" resultType="int">
select count(*)
from user_kiting
<include refid="searchCondition" />
</select>
<select id="querySumByCondition" parameterType="map" resultType="map">
select sum(kit_amount) kitAmount, sum(kit_fare) kitFare, sum(payable_amount) payableAmount
from user_kiting
<include refid="searchCondition" />
</select>
</mapper>