Bonus-Cloud-Houqin/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccTradeRepealErrorMapper.xml

91 lines
3.9 KiB
XML

<?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.bonus.canteen.core.account.v3.mapper.AccTradeRepealErrorMapper">
<!-- 查询充值撤销异常记录-->
<select id="queryAccTradeRepealError" resultType="com.bonus.canteen.core.account.v3.web.vo.AccTradeRepealPageVO">
<include refid="query_repeal_error_sql">
</include>
</select>
<!-- 查询充值撤销异常记录-导出-->
<select id="listAccTradeRepealError" resultType="com.bonus.canteen.core.account.v3.web.vo.AccTradeRepealPageVO">
<include refid="query_repeal_error_sql">
</include>
</select>
<!-- 查询充值撤销异常记录合计-->
<select id="getTotalqueryAccTradeRepealError" resultType="com.bonus.canteen.core.account.v3.web.vo.AccTradeRepealPageVO">
SELECT SUM(atre.amount) amount
FROM
acc_trade_repeal_error atre
LEFT JOIN sys_user ci ON ci.cust_id = atre.cust_id
LEFT JOIN sys_dept co ON co.dept_id = ci.dept_id
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = ci.psn_type
<include refid="query_repeal_error_where_sql">
</include>
</select>
<sql id="query_repeal_error_sql">
SELECT
atre.*,
ci.cust_num,
ci.nick_name as cust_name,
ci.phonenumber as mobile,
<!-- co.org_full_name, -->
ci.psn_type,
cpt.psn_type_name
FROM
acc_trade_repeal_error atre
LEFT JOIN sys_user ci ON ci.cust_id = atre.cust_id
LEFT JOIN sys_dept co ON co.dept_id = ci.dept_id
LEFT JOIN cust_psn_type cpt ON cpt.psn_type = ci.psn_type
<include refid="query_repeal_error_where_sql">
</include>
ORDER BY atre.crtime desc
</sql>
<sql id="query_repeal_error_where_sql">
<where>
<if test="param.walletId != null">
and atre.wallet_id = #{param.walletId}
</if>
<if test="param.startDateTime != null">
and atre.crtime <![CDATA[ >= ]]> #{param.startDateTime}
</if>
<if test="param.endDateTime != null">
and atre.crtime <![CDATA[ <= ]]> #{param.endDateTime}
</if>
<if test="param.crBy != null and param.crBy != ''">
and atre.crby like #{param.crBy}
</if>
<if test="param.orgIdList != null and param.orgIdList.size() > 0">
and ci.dept_id in
<foreach collection="param.orgIdList" item="orgId" separator="," open="(" close=")">
#{orgId}
</foreach>
</if>
<if test="param.psnTypeList != null and param.psnTypeList.size() > 0">
and ci.psn_type in
<foreach collection="param.psnTypeList" item="psnType" separator="," open="(" close=")">
#{psnType}
</foreach>
</if>
<if test="param.keyword != null and param.keyword != ''">
and (ci.cust_num LIKE CONCAT('%', #{param.keyword},'%')
or ci.nick_name = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
or ci.phonenumber = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
<!-- or ci.mobile_suffix = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler} -->
or ci.nick_name_like LIKE CONCAT('%',#{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.CipherQueryLikeHandler},'%')
)
</if>
<if test="param.originTradeId != null and param.originTradeId != ''">
and atre.origin_trade_id = #{param.originTradeId}
</if>
</where>
</sql>
</mapper>