179 lines
6.3 KiB
XML
179 lines
6.3 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.hzs.member.detail.mapper.CuMemberAssessMapper">
|
||
|
|
|
||
|
|
<!-- 通用查询映射结果 -->
|
||
|
|
<resultMap id="CuMemberAssess" type="com.hzs.common.domain.member.ext.CuMemberAssessExt">
|
||
|
|
<id column="PK_ID" property="pkId"/>
|
||
|
|
<result column="DEL_FLAG" property="delFlag"/>
|
||
|
|
<result column="PK_CREATOR" property="pkCreator"/>
|
||
|
|
<result column="CREATION_TIME" property="creationTime"/>
|
||
|
|
<result column="PK_MODIFIED" property="pkModified"/>
|
||
|
|
<result column="MODIFIED_TIME" property="modifiedTime"/>
|
||
|
|
<result column="PK_COUNTRY" property="pkCountry"/>
|
||
|
|
<result column="PK_MEMBER" property="pkMember"/>
|
||
|
|
<result column="PERIOD" property="period"/>
|
||
|
|
<result column="SETTLE_MONTH" property="settleMonth"/>
|
||
|
|
<result column="ASSESS_TYPE" property="assessType"/>
|
||
|
|
<result column="PK_ORIGINAL_AWARDS" property="pkOriginalAwards"/>
|
||
|
|
<result column="PK_AWARDS" property="pkAwards"/>
|
||
|
|
<result column="ASSESS_TARGET" property="assessTarget"/>
|
||
|
|
<result column="IS_EXAMINE" property="isExamine"/>
|
||
|
|
<result column="ASSESS_STATUS" property="assessStatus"/>
|
||
|
|
<result column="MONTH_BALANCE" property="monthBalance"/>
|
||
|
|
<result column="MONTH_ADD" property="monthAdd"/>
|
||
|
|
<result column="CUR_MONTH_ADD" property="curMonthAdd"/>
|
||
|
|
<result column="MONTH_USED" property="monthUsed"/>
|
||
|
|
<result column="MONTH_SURPLUS" property="monthSurplus"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!-- 会员-考核明细列表-->
|
||
|
|
<select id="selectAssessList"
|
||
|
|
resultType="com.hzs.member.detail.vo.CuMemberAssessVO">
|
||
|
|
select * from (
|
||
|
|
SELECT
|
||
|
|
a.PK_ASSESS pkAssess,
|
||
|
|
a.PK_MEMBER pkMember,
|
||
|
|
a.TRADE_TIME tradeTime,
|
||
|
|
a.PK_ORDER pkOrder,
|
||
|
|
a.CHANGE_TYPE changeType,
|
||
|
|
a.TRADE_ACHIEVE tradeAchieve,
|
||
|
|
0 orderAssAchieve,
|
||
|
|
0 orderAchieve,
|
||
|
|
'' orderCode
|
||
|
|
FROM
|
||
|
|
CU_MEMBER_ASSESS_DETAIL a
|
||
|
|
LEFT JOIN ${tableName} b on b.PK_ID=a.PK_ASSESS
|
||
|
|
WHERE
|
||
|
|
a.DEL_FLAG = 0
|
||
|
|
<if test="pkMember != null ">
|
||
|
|
AND a.PK_MEMBER = #{pkMember}
|
||
|
|
</if>
|
||
|
|
<if test="pkCountry != null ">
|
||
|
|
AND a.PK_COUNTRY = #{pkCountry}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="changeType != null ">
|
||
|
|
AND a.CHANGE_TYPE = #{changeType}
|
||
|
|
</if>
|
||
|
|
<if test="assessType != null ">
|
||
|
|
AND b.ASSESS_TYPE = #{assessType}
|
||
|
|
</if>
|
||
|
|
<if test="assessStatus != null and assessStatus!=0 ">
|
||
|
|
AND b.ASSESS_STATUS = #{assessStatus}
|
||
|
|
</if>
|
||
|
|
<if test="assessStatus == 0 ">
|
||
|
|
AND (b.ASSESS_STATUS = #{assessStatus} or b.ASSESS_STATUS = 1 )
|
||
|
|
</if>
|
||
|
|
<if test="startDate != null">
|
||
|
|
and a.TRADE_TIME >= #{startDate, jdbcType=DATE}
|
||
|
|
</if>
|
||
|
|
<if test="endDate != null">
|
||
|
|
and a.TRADE_TIME < #{endDate, jdbcType=DATE}
|
||
|
|
</if>
|
||
|
|
<if test="startTradeTime != null and endDateTradeTime != null ">
|
||
|
|
UNION ALL
|
||
|
|
select
|
||
|
|
null pkAssess,
|
||
|
|
PK_MEMBER pkMember,
|
||
|
|
PAY_TIME tradeTime,
|
||
|
|
null pkOrder,
|
||
|
|
null changeType,
|
||
|
|
null tradeAchieve,
|
||
|
|
ORDER_ASS_ACHIEVE orderAssAchieve,
|
||
|
|
ORDER_ACHIEVE orderAchieve,
|
||
|
|
ORDER_CODE orderCode
|
||
|
|
from SA_ORDER
|
||
|
|
WHERE
|
||
|
|
DEL_FLAG = 0
|
||
|
|
<if test="pkMember != null ">
|
||
|
|
AND PK_MEMBER = #{pkMember}
|
||
|
|
</if>
|
||
|
|
<if test="orderTypeList != null ">
|
||
|
|
and ORDER_TYPE in
|
||
|
|
<foreach collection="orderTypeList" item="item" open="(" close=")" separator=",">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
<if test="assessType == 0 ">
|
||
|
|
AND order_achieve > 0
|
||
|
|
</if>
|
||
|
|
<if test="assessType == 1 ">
|
||
|
|
AND ORDER_ASS_ACHIEVE > 0
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="pkCountry != null ">
|
||
|
|
AND PK_COUNTRY = #{pkCountry}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="startTradeTime != null">
|
||
|
|
and PAY_TIME >= #{startTradeTime, jdbcType=DATE}
|
||
|
|
</if>
|
||
|
|
<if test="endDateTradeTime != null">
|
||
|
|
and PAY_TIME < #{endDateTradeTime, jdbcType=DATE}
|
||
|
|
</if>
|
||
|
|
</if>
|
||
|
|
)
|
||
|
|
order by tradeTime desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--查询会员月度考核-->
|
||
|
|
<select id="getMemberAssessMonthList"
|
||
|
|
resultType="com.hzs.member.detail.vo.CuMemberAssessVO">
|
||
|
|
SELECT
|
||
|
|
a.pk_id pkId,
|
||
|
|
a.SETTLE_MONTH settleMonth,
|
||
|
|
a.ASSESS_STATUS assessStatus,
|
||
|
|
a.MONTH_SURPLUS monthSurplus,
|
||
|
|
a.CREATION_TIME creationTime
|
||
|
|
FROM
|
||
|
|
${tableName} a
|
||
|
|
WHERE
|
||
|
|
a.DEL_FLAG = 0
|
||
|
|
<if test="period != null ">
|
||
|
|
AND a.period=#{period}
|
||
|
|
</if>
|
||
|
|
<if test="pkMember != null ">
|
||
|
|
AND a.PK_MEMBER = #{pkMember}
|
||
|
|
</if>
|
||
|
|
<if test="pkCountry != null ">
|
||
|
|
AND a.PK_COUNTRY = #{pkCountry}
|
||
|
|
</if>
|
||
|
|
<if test="assessType != null ">
|
||
|
|
AND a.ASSESS_TYPE = #{assessType}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--查询会员订单考核积分-->
|
||
|
|
<select id="getOrderAssessList" parameterType="com.hzs.member.detail.vo.CuMemberAssessVO"
|
||
|
|
resultType="com.hzs.member.detail.vo.CuMemberAssessVO">
|
||
|
|
SELECT
|
||
|
|
sum (ORDER_ASS_ACHIEVE) orderAssAchieve,
|
||
|
|
sum (ORDER_ACHIEVE) orderAchieve
|
||
|
|
FROM
|
||
|
|
SA_ORDER a
|
||
|
|
WHERE
|
||
|
|
a.DEL_FLAG = 0
|
||
|
|
<if test="orderTypeList != null ">
|
||
|
|
AND a.order_type in
|
||
|
|
<foreach collection="orderTypeList" item="item" open="(" close=")" separator=",">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="pkMember != null ">
|
||
|
|
AND a.PK_MEMBER = #{pkMember}
|
||
|
|
</if>
|
||
|
|
<if test="pkCountry != null ">
|
||
|
|
AND a.PK_COUNTRY = #{pkCountry}
|
||
|
|
</if>
|
||
|
|
<if test="startDate != null">
|
||
|
|
and a.PAY_TIME >= #{startDate, jdbcType=DATE}
|
||
|
|
</if>
|
||
|
|
<if test="endDate != null">
|
||
|
|
and a.PAY_TIME < #{endDate, jdbcType=DATE}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|