<?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.sinata.modular.member.dao.MemUserBankDetailMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.sinata.modular.member.model.MemUserBankDetail">
|
<id column="id" property="id"/>
|
<result column="type" property="type"/>
|
<result column="user_id" property="userId"/>
|
<result column="other_user_id" property="otherUserId"/>
|
<result column="amount" property="amount"/>
|
<result column="done_type" property="doneType"/>
|
<result column="mark" property="mark"/>
|
<result column="create_time" property="createTime"/>
|
<result column="old_amount" property="oldAmount"/>
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, type, user_id, other_user_id, amount, done_type, mark, create_time, old_amount
|
</sql>
|
|
<select id="selectMapList" resultType="java.util.Map">
|
SELECT * FROM (
|
(
|
SELECT
|
id,type,user_id userId,other_user_id otherUserId,amount,other_amount otherAmout,done_type doneType,
|
mark,create_time createTime,inviteType,exc_order_id excOrderId,exc_admin_id excAdminId,done_ip
|
doneIp,mall_oder_no mallOrderNo,
|
rice_order_no riceOrderNo,admin_id adminId,old_amount oldAmount,merchant_id merchantId,association_no
|
associationNo
|
FROM mem_user_bank_detail
|
<where>
|
<if test="userId != null">
|
and user_id = #{userId}
|
</if>
|
<if test="type != null">
|
AND type = #{type}
|
</if>
|
<if test="beginTime != null and beginTime != ''">
|
AND create_time >= #{beginTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND create_time <= #{endTime}
|
</if>
|
<if test="doneType != null">
|
and done_type = #{doneType}
|
</if>
|
</where>
|
|
)
|
UNION
|
(
|
SELECT
|
id,type,user_id userId,other_user_id otherUserId,amount,other_amount otherAmout,done_type doneType,
|
mark,create_time createTime,inviteType,exc_order_id excOrderId,exc_admin_id excAdminId,done_ip
|
doneIp,mall_oder_no mallOrderNo,
|
rice_order_no riceOrderNo,admin_id adminId,old_amount oldAmount,merchant_id merchantId,association_no
|
associationNo
|
FROM mall_user_bank_detail
|
<where>
|
<if test="userId != null">
|
and user_id = #{userId}
|
</if>
|
<if test="type != null">
|
AND type = #{type}
|
</if>
|
<if test="beginTime != null and beginTime != ''">
|
AND create_time >= #{beginTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND create_time <= #{endTime}
|
</if>
|
<if test="doneType != null">
|
and done_type = #{doneType}
|
</if>
|
</where>
|
)
|
) test
|
ORDER BY test.createTime DESC
|
</select>
|
|
<select id="selectForList" resultType="com.sinata.modular.member.model.MemUserBankDetail">
|
SELECT * FROM (
|
(
|
SELECT * FROM mem_user_bank_detail
|
<where>
|
<if test="userId != null">
|
and user_id = #{userId}
|
</if>
|
<if test="type != null">
|
AND type = #{type}
|
</if>
|
<if test="beginTime != null and beginTime != ''">
|
AND create_time >= #{beginTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND create_time <= #{endTime}
|
</if>
|
<if test="doneType != null">
|
and done_type = #{doneType}
|
</if>
|
</where>
|
|
)
|
UNION all
|
(
|
SELECT * FROM mall_user_bank_detail
|
<where>
|
<if test="userId != null">
|
and user_id = #{userId}
|
</if>
|
<if test="type != null">
|
AND type = #{type}
|
</if>
|
<if test="beginTime != null and beginTime != ''">
|
AND create_time >= #{beginTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND create_time <= #{endTime}
|
</if>
|
<if test="doneType != null">
|
and done_type = #{doneType}
|
</if>
|
</where>
|
)
|
) test
|
ORDER BY test.create_time DESC
|
</select>
|
|
|
<select id="selectMapListForPage" resultType="java.util.Map">
|
|
SELECT * FROM (
|
(
|
SELECT
|
id,type,user_id userId,other_user_id otherUserId,amount,other_amount otherAmout,done_type doneType,
|
mark,create_time createTime,inviteType,exc_order_id excOrderId,exc_admin_id excAdminId,done_ip
|
doneIp,mall_oder_no mallOrderNo,
|
rice_order_no riceOrderNo,admin_id adminId,old_amount oldAmount,merchant_id merchantId,association_no
|
associationNo
|
FROM mem_user_bank_detail
|
<where>
|
<if test="userId != null">
|
and user_id = #{userId}
|
</if>
|
<if test="type != null">
|
AND type = #{type}
|
</if>
|
<if test="beginTime != null and beginTime != ''">
|
AND create_time >= #{beginTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND create_time <= #{endTime}
|
</if>
|
<if test="doneType != null">
|
and done_type = #{doneType}
|
</if>
|
</where>
|
|
)
|
UNION all
|
(
|
SELECT
|
id,type,user_id userId,other_user_id otherUserId,amount,other_amount otherAmout,done_type doneType,
|
mark,create_time createTime,inviteType,exc_order_id excOrderId,exc_admin_id excAdminId,done_ip
|
doneIp,mall_oder_no mallOrderNo,
|
rice_order_no riceOrderNo,admin_id adminId,old_amount oldAmount,merchant_id merchantId,association_no
|
associationNo
|
FROM mall_user_bank_detail
|
<where>
|
<if test="userId != null">
|
and user_id = #{userId}
|
</if>
|
<if test="type != null">
|
AND type = #{type}
|
</if>
|
<if test="beginTime != null and beginTime != ''">
|
AND create_time >= #{beginTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND create_time <= #{endTime}
|
</if>
|
<if test="doneType != null">
|
and done_type = #{doneType}
|
</if>
|
</where>
|
)
|
) test
|
ORDER BY test.createTime DESC
|
</select>
|
|
<select id="selectForListForPage" resultType="com.sinata.modular.member.model.MemUserBankDetail">
|
SELECT * FROM (
|
(
|
SELECT * FROM mem_user_bank_detail
|
<where>
|
<if test="userId != null">
|
and user_id = #{userId}
|
</if>
|
<if test="type != null">
|
AND type = #{type}
|
</if>
|
<if test="beginTime != null and beginTime != ''">
|
AND create_time >= #{beginTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND create_time <= #{endTime}
|
</if>
|
<if test="doneType != null">
|
and done_type = #{doneType}
|
</if>
|
</where>
|
|
)
|
UNION
|
(
|
SELECT * FROM mall_user_bank_detail
|
<where>
|
<if test="userId != null">
|
and user_id = #{userId}
|
</if>
|
<if test="type != null">
|
AND type = #{type}
|
</if>
|
<if test="beginTime != null and beginTime != ''">
|
AND create_time >= #{beginTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND create_time <= #{endTime}
|
</if>
|
<if test="doneType != null">
|
and done_type = #{doneType}
|
</if>
|
</where>
|
)
|
) test
|
ORDER BY test.create_time DESC
|
</select>
|
|
|
<select id="findDetailTotal" resultType="java.util.Map">
|
SELECT ${groupName} as time
|
,
|
IFNULL(sum(amount), 0) as num
|
FROM mem_user_bank_detail FORCE INDEX (index_type_create_time )
|
WHERE (
|
create_time >= #{beginTime}
|
AND create_time <= #{endTime}
|
AND type = #{type}
|
)
|
GROUP BY ${groupName}
|
|
</select>
|
</mapper>
|