Files
chaozhanggui/pluss-dao-bundle/target/classes/mapper/OpenAccountRecordMapper.xml
2023-01-28 15:57:27 +08:00

72 lines
3.1 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="cn.pluss.platform.mapper.OpenAccountRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.pluss.platform.entity.OpenAccountRecord">
<id column="id" property="id" />
<result column="userId" property="userId" />
<result column="merchantName" property="merchantName" />
<result column="orderNumber" property="orderNumber" />
<result column="orderAmt" property="orderAmt" />
<result column="goodCode" property="goodCode" />
<result column="goodName" property="goodName" />
<result column="type" property="type" />
<result column="rewardAmt" property="rewardAmt" />
<result column="status" property="status" />
<result column="rewardUserId" property="rewardUserId" />
<result column="areaCode" property="areaCode" />
<result column="areaName" property="areaName" />
<result column="createTime" property="createTime" />
<result column="createDate" property="createDate" />
<result column="roleCode" property="roleCode" />
</resultMap>
<select id="countData" parameterType="cn.pluss.platform.entity.OpenAccountRecord" resultType="java.util.Map">
SELECT
IFNULL( SUM(IF(type = '01',orderAmt,0)), 0 ) AS orderAmtCount,
IFNULL(SUM(IF(type = '02',orderAmt,0)),0) as refundAmtCount,
IFNULL(SUM(rewardAmt),0) as actualExpendAmtCount
FROM
tb_pluss_open_account_record
<where>
<if test="userId != null">
and userId = #{userId}
</if>
<if test="merchantName != null and merchantName != ''">
and merchantName = #{merchantName}
</if>
<if test="orderNumber != null and orderNumber != ''">
and orderNumber = #{orderNumber}
</if>
<if test="goodCode != null and goodCode != ''">
and goodCode = #{goodCode}
</if>
<if test="goodName != null and goodName != ''">
and goodName = #{goodName}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="status != null and status != ''">
and userId = #{userId}
</if>
<if test="rewardUserId != null and rewardUserId != ''">
and rewardUserId = #{rewardUserId}
</if>
<if test="areaCode != null and areaCode != ''">
and areaCode = #{areaCode}
</if>
<if test="areaName != null and areaName != ''">
and areaName = #{areaName}
</if>
<if test="startTime != null and startTime != ''">
and createDate <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and createDate <![CDATA[ <= ]]> #{endTime}
</if>
</where>
</select>
</mapper>