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

56 lines
2.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="cn.pluss.platform.mapper.UserIntegralMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.pluss.platform.entity.UserIntegral">
<id column="id" property="id" />
<result column="userId" property="userId" />
<result column="orderNumber" property="orderNumber" />
<result column="integral" property="integral" />
<result column="orderAmt" property="orderAmt" />
<result column="type" property="type" />
<result column="source" property="source" />
<result column="remark" property="remark" />
<result column="createTime" property="createTime" />
</resultMap>
<select id="list" resultType="cn.pluss.platform.other.JfShopIntegral">
select orderNumber,integral,createTime as grantDate,`type`
from tb_pluss_user_integral where userId = #{userId} and `status` = 1
<if test="type != null and type != ''">
and type = #{type}
</if>
order by id desc
</select>
<select id="getCountIntegral" resultType="java.math.BigDecimal">
select IFNULL(SUM(integral),0) from tb_pluss_user_integral where userId = #{userId} and `status` = 1
<if test="date != null and date != ''">
and date_format(createTime, '%Y-%m') = #{date}
</if>
<if test="auditDate != null and auditDate != ''">
and createTime >= #{auditDate}
</if>
</select>
<select id="pageInfo" parameterType="cn.pluss.platform.entity.UserIntegral"
resultType="cn.pluss.platform.entity.UserIntegral">
select * from tb_pluss_user_integral
where status = '1'
<if test="entity.userId != null">
and userId = #{entity.userId}
</if>
<if test="entity.orderNumber != null and entity.orderNumber != ''">
and orderNumber = #{entity.orderNumber}
</if>
<if test="entity.type != null and entity.type != ''">
and type = #{entity.type}
</if>
<if test="entity.queryDate != null and entity.queryDate != ''">
and DATE_FORMAT(createTime,'%Y-%m') = #{entity.queryDate}
</if>
ORDER BY createTime desc
</select>
</mapper>