82 lines
3.2 KiB
XML
82 lines
3.2 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.gxwebsoft.love.mapper.ProfitMapper">
|
|
|
|
<!-- 关联查询sql -->
|
|
<sql id="selectSql">
|
|
SELECT a.*,
|
|
b.type,b.money,b.user_id as playerId,b.comments,b.money as orderPrice,b.is_settled,b.type,b.grade_id,
|
|
c.nickname as playerNickname,c.avatar as playerAvatar,
|
|
d.name as gradeName
|
|
FROM love_profit a
|
|
LEFT JOIN love_user_plan_log b ON a.log_id = b.log_id AND b.pay_status = 20
|
|
LEFT JOIN sys_user c ON b.user_id = c.user_id
|
|
LEFT JOIN shop_user_grade d ON b.grade_id = d.grade_id
|
|
<where>
|
|
<if test="param.profitId != null">
|
|
AND a.profit_id = #{param.profitId}
|
|
</if>
|
|
<if test="param.userId != null">
|
|
AND a.user_id = #{param.userId}
|
|
</if>
|
|
<if test="param.scene != null and param.scene != 0">
|
|
AND a.scene = #{param.scene}
|
|
</if>
|
|
<if test="param.sceneMultiple != null">
|
|
AND a.scene IN
|
|
<foreach collection="param.sceneMultiple.split(',')" item="item" separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.money != null">
|
|
AND a.money = #{param.money}
|
|
</if>
|
|
<if test="param.balance != null">
|
|
AND a.balance = #{param.balance}
|
|
</if>
|
|
<if test="param.remark != null">
|
|
AND a.remark LIKE CONCAT('%', #{param.remark}, '%')
|
|
</if>
|
|
<if test="param.sortNumber != null">
|
|
AND a.sort_number = #{param.sortNumber}
|
|
</if>
|
|
<if test="param.comments != null">
|
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
|
</if>
|
|
<if test="param.status != null">
|
|
AND a.status = #{param.status}
|
|
</if>
|
|
<choose>
|
|
<when test="param.deleted != null">AND a.deleted = #{param.deleted}</when>
|
|
<otherwise>AND a.deleted = 0</otherwise>
|
|
</choose>
|
|
<if test="param.merchantCode != null">
|
|
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
|
</if>
|
|
<if test="param.createTimeStart != null">
|
|
AND a.create_time >= #{param.createTimeStart}
|
|
</if>
|
|
<if test="param.createTimeEnd != null">
|
|
AND a.create_time <= #{param.createTimeEnd}
|
|
</if>
|
|
<if test="param.gradeStart != null">
|
|
AND d.grade_id >= #{param.gradeStart}
|
|
</if>
|
|
<if test="param.gradeEnd != null">
|
|
AND d.grade_id <= #{param.gradeEnd}
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<!-- 分页查询 -->
|
|
<select id="selectPageRel" resultType="com.gxwebsoft.love.entity.Profit">
|
|
<include refid="selectSql"></include>
|
|
</select>
|
|
|
|
<!-- 查询全部 -->
|
|
<select id="selectListRel" resultType="com.gxwebsoft.love.entity.Profit">
|
|
<include refid="selectSql"></include>
|
|
</select>
|
|
|
|
</mapper>
|