quota-convert-mapper.xml
2.8 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
76
77
78
79
80
<?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 tongxiaochuan -->
<mapper namespace="com.cjs.cms.dao.quota.QuotaConvertDao">
<sql id="quota_convert_field">
id,otc_code,otc_name,user_id,otc_account,quota,post_quota,type,export_status,create_at,create_by,update_at,update_by
</sql>
<select id="search" parameterType="java.util.Map" resultType="QuotaConvertInfo">
select <include refid="quota_convert_field" />
from quota_convert where export_status = #{exportStatus}
<include refid="searchCondition"/>
order by id desc
<include refid="common.pageLimit" />
</select>
<select id="searchTotal" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(1) from quota_convert where export_status = #{exportStatus}
<include refid="searchCondition"/>
</select>
<sql id="searchCondition">
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="otcCode != null and otcCode != ''">
and otc_code = #{otcCode}
</if>
<if test="otcName != null and otcName != ''">
<![CDATA[and instr(otc_name, #{otcName}) > 0 ]]>
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="startDate != null and startDate != ''">
<![CDATA[and create_at >= #{startDate} ]]>
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[and create_at <= #{endDate} ]]>
</if>
</sql>
<update id="updateExportStatusExport" parameterType="map">
update quota_convert set post_quota = #{postQuota}, export_status = 1, update_by = #{updateBy}, update_at = CURRENT_TIMESTAMP
where export_status = 0
<include refid="searchCondition"/>
</update>
<update id="updateEnsure" parameterType="map">
update quota_convert set export_status = 2, update_by = #{updateBy}, update_at = CURRENT_TIMESTAMP
where export_status = 1
<include refid="searchCondition"/>
</update>
<select id="searchQuota" parameterType="map" resultType="map">
select id,otc_code,otc_name,user_id,quota,type,post_quota,type
from quota_convert where export_status = #{exportStatus}
<include refid="searchCondition"/>
order by user_id asc,create_at asc
</select>
<select id="searchExport" parameterType="map" resultType="map">
select otc_code,otc_account,post_quota
from quota_convert where export_status = #{exportStatus}
<include refid="searchCondition"/>
order by id desc
</select>
<select id="querySum" resultType="String" parameterType="map">
select sum(quota) from quota_convert
where otc_code = #{otcCode} and user_id = #{userId} and type = 1 and export_status != 1
and create_at between #{startDate} and #{endDate}
</select>
</mapper>