|
|
<?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.yohoufo.dal.order.TradeBillsMapper">
|
|
|
<resultMap id="BaseResultMap" type="com.yohoufo.dal.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" />
|
|
|
</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
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from trade_bills
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectCountGoodsIncomeOrCompensateIncomeByUid" resultType="java.lang.Integer" parameterType="java.lang.Integer" >
|
|
|
select
|
|
|
count(id)
|
|
|
from trade_bills
|
|
|
where uid = #{uid,jdbcType=INTEGER} and ( trade_type = 2 or trade_type = 3 )
|
|
|
</select>
|
|
|
|
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.TradeBills" useGeneratedKeys="true">
|
|
|
insert into trade_bills (uid, order_code, user_type,pay_type,trade_type,
|
|
|
income_outcome,amount,system_amount,trade_status,create_time)
|
|
|
values (#{uid},#{orderCode},#{userType},#{payType},#{tradeType},
|
|
|
#{incomeOutcome},#{amount},#{systemAmount},
|
|
|
#{tradeStatus},#{createTime})
|
|
|
</insert>
|
|
|
|
|
|
<select id="selectGoodsIncomeOrCompensateIncomeTradeBillsWithPageByUid" resultMap="BaseResultMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from trade_bills
|
|
|
where uid = #{uid,jdbcType=INTEGER} and ( trade_type = 2 or trade_type = 3 )
|
|
|
limit #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="selectIncomeAmountByUid" resultType="java.util.HashMap">
|
|
|
select trade_type as tradeType,sum(amount) as allAmount from trade_bills
|
|
|
where uid = #{uid} and income_outcome = 1 group by trade_type
|
|
|
</select>
|
|
|
|
|
|
<select id="selectSpendAmountByUid" resultType="java.util.HashMap">
|
|
|
select trade_type as tradeType,sum(amount) as allAmount from trade_bills
|
|
|
where uid = #{uid} and income_outcome = 2 group by trade_type
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<?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.yohoufo.dal.order.TradeBillsMapper">
|
|
|
<resultMap id="BaseResultMap" type="com.yohoufo.dal.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" />
|
|
|
</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
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from trade_bills
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectCountGoodsIncomeOrCompensateIncomeByUid" resultType="java.lang.Integer" parameterType="java.lang.Integer" >
|
|
|
select
|
|
|
count(id)
|
|
|
from trade_bills
|
|
|
where uid = #{uid,jdbcType=INTEGER} and ( trade_type = 2 or trade_type = 3 )
|
|
|
</select>
|
|
|
|
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.TradeBills" useGeneratedKeys="true">
|
|
|
insert into trade_bills (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)
|
|
|
values (#{uid},#{orderCode},#{userType},#{payType},#{tradeType},
|
|
|
#{incomeOutcome},#{amount},#{systemAmount},
|
|
|
#{tradeStatus},#{createTime},#{dealUid},#{dealStatus}#{dealTime},#{dealRelateId})
|
|
|
</insert>
|
|
|
|
|
|
<select id="selectGoodsIncomeOrCompensateIncomeTradeBillsWithPageByUid" resultMap="BaseResultMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from trade_bills
|
|
|
where uid = #{uid,jdbcType=INTEGER} and ( trade_type = 2 or trade_type = 3 )
|
|
|
limit #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="selectIncomeAmountByUid" resultType="java.util.HashMap">
|
|
|
select trade_type as tradeType,sum(amount) as allAmount from trade_bills
|
|
|
where uid = #{uid} and income_outcome = 1 group by trade_type
|
|
|
</select>
|
|
|
|
|
|
<select id="selectSpendAmountByUid" resultType="java.util.HashMap">
|
|
|
select trade_type as tradeType,sum(amount) as allAmount from trade_bills
|
|
|
where uid = #{uid} and income_outcome = 2 group by trade_type
|
|
|
</select>
|
|
|
|
|
|
<!--
|
|
|
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
delete from trade_bills
|
|
|
where id = #{id,jdbcType=INTEGER}
|
...
|
...
|
@@ -189,4 +196,6 @@ |
|
|
create_time = #{createTime,jdbcType=INTEGER}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
-->
|
|
|
</mapper> |
|
|
\ No newline at end of file |
...
|
...
|
|