zhwl/zhwl-business/zhwl-vip/target/classes/mapper/vip/ZdyVipPointsMapper.xml

157 lines
5.8 KiB
XML
Raw Permalink Normal View History

2025-07-01 17:54:58 +08:00
<?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.zhwl.vip.mapper.ZdyVipPointsMapper">
<resultMap type="ZdyVipPoints" id="ZdyVipPointsResult">
<result property="id" column="id"/>
<result property="vipUserId" column="vip_user_id"/>
<result property="beforeValue" column="before_value"/>
<result property="changeValue" column="change_value"/>
<result property="afterValue" column="after_value"/>
<result property="reason" column="reason"/>
<result property="relationOrderType" column="relation_order_type"/>
<result property="relationOrderCode" column="relation_order_code"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectZdyVipPointsVo">
select vp.id,
vp.vip_user_id,
vp.before_value,
vp.change_value,
vp.after_value,
vp.reason,
vp.relation_order_type,
vp.relation_order_code,
vp.create_time
from zdy_vip_points vp
left join zdy_vip_user vu on vp.vip_user_id = vu.id
</sql>
<select id="selectZdyVipPointsList" parameterType="ZdyVipPointsQueryDTO" resultMap="ZdyVipPointsResult">
<include refid="selectZdyVipPointsVo"/>
<where>
<choose>
<when test="code != null and code == 1">
and vp.change_value > 0
</when>
<when test="code != null and code == -1">
and vp.change_value &lt; 0
</when>
</choose>
<if test="miniProgramUserId != null">
and vu.mini_program_user_id = #{miniProgramUserId}
</if>
<if test="vipUserId != null ">
and vp.vip_user_id = #{vipUserId}
</if>
<if test="reason != null and reason != ''">
and vp.reason = #{reason}
</if>
<if test="relationOrderType != null and relationOrderType != ''">
and vp.relation_order_type = #{relationOrderType}
</if>
<if test="relationOrderCode != null and relationOrderCode != ''">
and vp.relation_order_code = #{relationOrderCode}
</if>
</where>
order by create_time desc
</select>
<select id="selectZdyVipPointsById" parameterType="Long"
resultMap="ZdyVipPointsResult">
<include refid="selectZdyVipPointsVo"/>
where id = #{id}
</select>
<select id="selectZdyVipPointsByVipUserId" parameterType="Long"
resultMap="ZdyVipPointsResult">
<include refid="selectZdyVipPointsVo"/>
where vip_user_id = #{vipUserId}
order by create_time desc
</select>
<insert id="insertZdyVipPoints" parameterType="ZdyVipPoints" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_vip_points
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="vipUserId != null">vip_user_id,
</if>
<if test="beforeValue != null">before_value,
</if>
<if test="changeValue != null">change_value,
</if>
<if test="afterValue != null">after_value,
</if>
<if test="reason != null and reason != ''">reason,
</if>
<if test="relationOrderType != null">relation_order_type,
</if>
<if test="relationOrderCode != null">relation_order_code,
</if>
<if test="createTime != null">create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="vipUserId != null">#{vipUserId},
</if>
<if test="beforeValue != null">#{beforeValue},
</if>
<if test="changeValue != null">#{changeValue},
</if>
<if test="afterValue != null">#{afterValue},
</if>
<if test="reason != null and reason != ''">#{reason},
</if>
<if test="relationOrderType != null">#{relationOrderType},
</if>
<if test="relationOrderCode != null">#{relationOrderCode},
</if>
<if test="createTime != null">#{createTime},
</if>
</trim>
</insert>
<update id="updateZdyVipPoints" parameterType="ZdyVipPoints">
update zdy_vip_points
<trim prefix="SET" suffixOverrides=",">
<if test="beforeValue != null">before_value =
#{beforeValue},
</if>
<if test="changeValue != null">change_value =
#{changeValue},
</if>
<if test="afterValue != null">after_value =
#{afterValue},
</if>
<if test="reason != null and reason != ''">reason =
#{reason},
</if>
<if test="relationOrderType != null">relation_order_type =
#{relationOrderType},
</if>
<if test="relationOrderCode != null">relation_order_code =
#{relationOrderCode},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyVipPointsById" parameterType="Long">
delete
from zdy_vip_points
where id = #{id}
</delete>
<delete id="deleteZdyVipPointsByIds" parameterType="String">
delete from zdy_vip_points where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>