daily-balance-compare-mapper.xml
1.31 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
<?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.user.fund.DailyBalanceCompareDao">
<sql id="daily_balance_compare">
client_id, hundsun, pnr, data_date, type, create_at
</sql>
<insert id="insert" parameterType="map">
insert into daily_balance_compare(<include refid="daily_balance_compare" />)
select #{client_id}, #{hundsun}, #{pnr}, #{data_date}, #{type}, CURRENT_TIMESTAMP
from dual
where not exists
(select * from daily_balance_compare
where client_id = #{client_id} and data_date=#{data_date} and type = #{type})
</insert>
<select id="search" parameterType="map" resultType="map">
select <include refid="daily_balance_compare" />
from daily_balance_compare
<include refid="searchCondition" />
<include refid="common.pageLimit" />
</select>
<sql id="searchCondition">
where data_date = #{data_date}
<if test="type != null and type != ''">
and type = #{type}
</if>
</sql>
<select id="searchTotal" parameterType="map" resultType="int">
select count(1) from
(select <include refid="daily_balance_compare" />
from daily_balance_compare
<include refid="searchCondition" />) t
</select>
</mapper>