TradeBillsMapper.xml
2.97 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
<?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.yoho.order.dal.TradeBillsMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.TradeBills">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="order_code" jdbcType="BIGINT" property="orderCode" />
<result column="user_type" jdbcType="TINYINT" property="userType" />
<result column="pay_type" jdbcType="TINYINT" property="payType" />
<result column="trade_type" jdbcType="INTEGER" property="tradeType" />
<result column="income_outcome" jdbcType="TINYINT" property="incomeOutcome" />
<result column="amount" jdbcType="DECIMAL" property="amount" />
<result column="system_amount" jdbcType="DECIMAL" property="systemAmount" />
<result column="trade_status" jdbcType="TINYINT" property="tradeStatus" />
<result column="create_time" jdbcType="INTEGER" property="createTime" />
<result column="deal_uid" jdbcType="INTEGER" property="dealUid" />
<result column="deal_status" jdbcType="TINYINT" property="dealStatus" />
<result column="deal_time" jdbcType="INTEGER" property="dealTime" />
<result column="deal_relate_id" jdbcType="INTEGER" property="dealRelateId" />
<result column="deal_user_name" jdbcType="VARCHAR" property="dealUserName" />
</resultMap>
<sql id="Base_Column_List">
id,uid, order_code, user_type,pay_type,trade_type,
income_outcome,amount,system_amount,trade_status,create_time,
deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name
</sql>
<sql id="Query_Condition_Sql" >
<if test="billsTradeReq.orderCode != null">
and order_code = #{billsTradeReq.orderCode}
</if>
<if test="billsTradeReq.uid != null">
and uid = #{billsTradeReq.uid}
</if>
and income_outcome=1
and deal_status != 1
<if test="billsTradeReq.userType != null">
and user_type = #{billsTradeReq.userType}
</if>
<if test="billsTradeReq.tradeType != null">
and trade_type = #{billsTradeReq.tradeType}
</if>
<if test="billsTradeReq.status != null ">
<choose>
<when test="billsTradeReq.status == 100 ">
and trade_status = 100
</when>
<otherwise>
and trade_status != 100
</otherwise>
</choose>
</if>
</sql>
<select id="selectCountByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.TradeBillsReq">
select count(id)
from trade_bills where 1=1
<include refid="Query_Condition_Sql" />
</select>
<select id="selectByConditionWithPage" resultMap="BaseResultMap" parameterType="com.yoho.order.model.TradeBillsReq">
select <include refid="Base_Column_List" />
from trade_bills where 1=1
<include refid="Query_Condition_Sql" />
order by id desc
limit #{billsTradeReq.start},#{billsTradeReq.size}
</select>
</mapper>