This commit is contained in:
2025-07-01 17:54:58 +08:00
commit 57dcd609e2
5136 changed files with 346184 additions and 0 deletions

View File

@@ -0,0 +1,157 @@
<?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.ZdyVipBenefitsMapper">
<resultMap type="ZdyVipBenefits" id="ZdyVipBenefitsResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="image" column="image"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectZdyVipBenefitsVo">
select id,
name,
image,
status,
del_flag,
create_time,
create_by,
update_time,
update_by,
remark
from zdy_vip_benefits
</sql>
<select id="selectZdyVipBenefitsList" parameterType="ZdyVipBenefits" resultMap="ZdyVipBenefitsResult">
<include refid="selectZdyVipBenefitsVo"/>
<where>
del_flag = 0
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
</select>
<select id="selectZdyVipBenefitsById" parameterType="Long"
resultMap="ZdyVipBenefitsResult">
<include refid="selectZdyVipBenefitsVo"/>
where id = #{id} and del_flag = 0
</select>
<insert id="insertZdyVipBenefits" parameterType="ZdyVipBenefits" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_vip_benefits
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,
</if>
<if test="image != null and image != ''">image,
</if>
<if test="status != null and status != ''">status,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},
</if>
<if test="image != null and image != ''">#{image},
</if>
<if test="status != null and status != ''">#{status},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateZdyVipBenefits" parameterType="ZdyVipBenefits">
update zdy_vip_benefits
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="image != null and image != ''">image =
#{image},
</if>
<if test="status != null and status != ''">status =
#{status},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyVipBenefitsById" parameterType="Long">
delete
from zdy_vip_benefits
where id = #{id}
</delete>
<delete id="deleteZdyVipBenefitsByIds" parameterType="String">
update zdy_vip_benefits set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="checkNameUnique" parameterType="string" resultMap="ZdyVipBenefitsResult">
<include refid="selectZdyVipBenefitsVo"/>
where del_flag = 0
and name =#{name}
limit 1
</select>
<update id="updateStatus">
update zdy_vip_benefits
set status = #{status}
where id = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,146 @@
<?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.ZdyVipGrowthValueMapper">
<resultMap type="ZdyVipGrowthValue" id="ZdyVipGrowthValueResult">
<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="selectZdyVipGrowthValueVo">
select id,
vip_user_id,
before_value,
change_value,
after_value,
reason,
relation_order_type,
relation_order_code,
create_time
from zdy_vip_growth_value
</sql>
<select id="selectZdyVipGrowthValueList" parameterType="ZdyVipGrowthValue" resultMap="ZdyVipGrowthValueResult">
<include refid="selectZdyVipGrowthValueVo"/>
<where>
<if test="vipUserId != null ">
and vip_user_id = #{vipUserId}
</if>
<if test="reason != null and reason != ''">
and reason = #{reason}
</if>
<if test="relationOrderType != null and relationOrderType != ''">
and relation_order_type = #{relationOrderType}
</if>
<if test="relationOrderCode != null and relationOrderCode != ''">
and relation_order_code = #{relationOrderCode}
</if>
</where>
order by create_time desc
</select>
<select id="selectZdyVipGrowthValueById" parameterType="Long"
resultMap="ZdyVipGrowthValueResult">
<include refid="selectZdyVipGrowthValueVo"/>
where id = #{id}
</select>
<select id="selectZdyVipGrowthValueByVipUserId" parameterType="Long"
resultMap="ZdyVipGrowthValueResult">
<include refid="selectZdyVipGrowthValueVo"/>
where vip_user_id = #{vipUserId}
order by create_time desc
</select>
<insert id="insertZdyVipGrowthValue" parameterType="ZdyVipGrowthValue" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_vip_growth_value
<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="updateZdyVipGrowthValue" parameterType="ZdyVipGrowthValue">
update zdy_vip_growth_value
<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="deleteZdyVipGrowthValueById" parameterType="Long">
delete
from zdy_vip_growth_value
where id = #{id}
</delete>
<delete id="deleteZdyVipGrowthValueByIds" parameterType="String">
delete from zdy_vip_growth_value where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,151 @@
<?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.ZdyVipLabelMapper">
<resultMap type="ZdyVipLabel" id="ZdyVipLabelResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="enable" column="enable"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectZdyVipLabelVo">
select id,
name,
enable,
del_flag,
create_time,
create_by,
update_time,
update_by,
remark
from zdy_vip_label
</sql>
<select id="selectZdyVipLabelList" parameterType="ZdyVipLabel" resultMap="ZdyVipLabelResult">
<include refid="selectZdyVipLabelVo"/>
<where>
and del_flag = 0
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="enable != null and enable != ''">
and enable = #{enable}
</if>
</where>
order by create_time desc
</select>
<select id="selectZdyVipLabelById" parameterType="Long"
resultMap="ZdyVipLabelResult">
<include refid="selectZdyVipLabelVo"/>
where id = #{id} and del_flag = 0
</select>
<select id="selectZdyVipLabelByIds" parameterType="Long"
resultMap="ZdyVipLabelResult">
<include refid="selectZdyVipLabelVo"/>
<where>
and del_flag = 0
<if test="ids != null and ids.length > 0">
and id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
<insert id="insertZdyVipLabel" parameterType="ZdyVipLabel" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_vip_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,
</if>
<if test="enable != null and enable != ''">enable,
</if>
<if test="delFlag != null and delFlag != ''">del_flag,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},
</if>
<if test="enable != null and enable != ''">#{enable},
</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateZdyVipLabel" parameterType="ZdyVipLabel">
update zdy_vip_label
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="enable != null ">enable =
#{enable},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyVipLabelById" parameterType="Long">
delete
from zdy_vip_label
where id = #{id}
</delete>
<delete id="deleteZdyVipLabelByIds" parameterType="String">
update zdy_vip_label set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="checkNameUnique" parameterType="string" resultMap="ZdyVipLabelResult">
<include refid="selectZdyVipLabelVo"/>
<where>
and del_flag = 0
and name = #{name}
</where>
limit 1
</select>
</mapper>

View File

@@ -0,0 +1,74 @@
<?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.ZdyVipLevelBenefitsRelationMapper">
<resultMap type="ZdyVipLevelBenefitsRelation" id="ZdyVipLevelBenefitsRelationResult">
<result property="levelId" column="level_id"/>
<result property="benefitsId" column="benefits_id"/>
</resultMap>
<sql id="selectZdyVipLevelBenefitsRelationVo">
select level_id, benefits_id
from zdy_vip_level_benefits_relation
</sql>
<select id="selectZdyVipLevelBenefitsRelationList" parameterType="ZdyVipLevelBenefitsRelation"
resultMap="ZdyVipLevelBenefitsRelationResult">
<include refid="selectZdyVipLevelBenefitsRelationVo"/>
<where>
<if test="levelId != null ">
and level_id = #{levelId}
</if>
<if test="benefitsId != null ">
and benefits_id = #{benefitsId}
</if>
</where>
</select>
<select id="selectZdyVipLevelBenefitsRelationByLevelId" parameterType="Long"
resultMap="ZdyVipLevelBenefitsRelationResult">
<include refid="selectZdyVipLevelBenefitsRelationVo"/>
where level_id = #{levelId}
</select>
<insert id="insertZdyVipLevelBenefitsRelation" parameterType="ZdyVipLevelBenefitsRelation">
insert into zdy_vip_level_benefits_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="levelId != null">level_id,
</if>
<if test="benefitsId != null">benefits_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="levelId != null">#{levelId},
</if>
<if test="benefitsId != null">#{benefitsId},
</if>
</trim>
</insert>
<update id="updateZdyVipLevelBenefitsRelation" parameterType="ZdyVipLevelBenefitsRelation">
update zdy_vip_level_benefits_relation
<trim prefix="SET" suffixOverrides=",">
<if test="benefitsId != null">benefits_id =
#{benefitsId},
</if>
</trim>
where level_id = #{levelId}
</update>
<delete id="deleteZdyVipLevelBenefitsRelationByLevelId" parameterType="Long">
delete
from zdy_vip_level_benefits_relation
where level_id = #{levelId}
</delete>
<delete id="deleteZdyVipLevelBenefitsRelationByLevelIds" parameterType="String">
delete from zdy_vip_level_benefits_relation where level_id in
<foreach item="levelId" collection="array" open="(" separator="," close=")">
#{levelId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,244 @@
<?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.ZdyVipLevelMapper">
<resultMap type="ZdyVipLevel" id="ZdyVipLevelResult">
<result property="id" column="id"/>
<result property="level" column="level"/>
<result property="name" column="name"/>
<result property="growthValue" column="growth_value"/>
<result property="coverImage" column="cover_Image"/>
<result property="image1" column="image1"/>
<result property="image2" column="image2"/>
<result property="color" column="color"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
</resultMap>
<resultMap type="AppZdyVipLevelVO" id="AppZdyVipLevelVOResult">
<result property="id" column="id"/>
<result property="level" column="level"/>
<result property="name" column="name"/>
<result property="growthValue" column="growth_value"/>
<result property="coverImage" column="cover_Image"/>
<result property="image1" column="image1"/>
<result property="image2" column="image2"/>
<result property="color" column="color"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
<result property="remark" column="remark"/>
<collection property="benefitsList" ofType="com.zhwl.vip.domain.ZdyVipBenefits"
resultMap="ZdyVipBenefitsResult">
</collection>
</resultMap>
<resultMap type="ZdyVipBenefits" id="ZdyVipBenefitsResult">
<result property="id" column="zvb_id"/>
<result property="name" column="zvb_name"/>
<result property="image" column="zvb_image"/>
</resultMap>
<sql id="selectZdyVipLevelVo">
select id,
level,
name,
growth_value,
cover_Image,
image1,
image2,
color,
del_flag,
create_time,
create_by,
update_time,
update_by,
remark
from zdy_vip_level
</sql>
<select id="selectZdyVipLevelList" parameterType="ZdyVipLevel" resultMap="ZdyVipLevelResult">
<include refid="selectZdyVipLevelVo"/>
<where>
<if test="level != null and level != ''">
and level = #{level}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="growthValue != null ">
and growth_value = #{growthValue}
</if>
<if test="coverImage != null and coverImage != ''">
and cover_Image = #{coverImage}
</if>
</where>
</select>
<select id="selectZdyVipLevelById" parameterType="Long"
resultMap="ZdyVipLevelResult">
<include refid="selectZdyVipLevelVo"/>
where id = #{id}
</select>
<insert id="insertZdyVipLevel" parameterType="ZdyVipLevel" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_vip_level
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="level != null and level != ''">level,
</if>
<if test="name != null and name != ''">name,
</if>
<if test="growthValue != null">growth_value,
</if>
<if test="coverImage != null and coverImage != ''">cover_Image,
</if>
<if test="image1 != null and image1 != ''">image1,
</if>
<if test="image2 != null and image2 != ''">image2,
</if>
<if test="color != null and color != ''">color,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="level != null and level != ''">#{level},
</if>
<if test="name != null and name != ''">#{name},
</if>
<if test="growthValue != null">#{growthValue},
</if>
<if test="coverImage != null and coverImage != ''">#{coverImage},
</if>
<if test="image1 != null and image1 != ''">image1,
</if>
<if test="image2 != null and image2 != ''">image2,
</if>
<if test="color != null and color != ''">color,
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateZdyVipLevel" parameterType="ZdyVipLevel">
update zdy_vip_level
<trim prefix="SET" suffixOverrides=",">
<if test="level != null and level != ''">level =
#{level},
</if>
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="growthValue != null">growth_value =
#{growthValue},
</if>
<if test="coverImage != null and coverImage != ''">cover_Image =
#{coverImage},
</if>
<if test="image1 != null and image1 != ''">image1 = #{image1},
</if>
<if test="image2 != null and image2 != ''">image2 = #{image2},
</if>
<if test="color != null and color != ''">color = #{color},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyVipLevelById" parameterType="Long">
delete
from zdy_vip_level
where id = #{id}
</delete>
<delete id="deleteZdyVipLevelByIds" parameterType="String">
update zdy_vip_level set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="checkLevelUnique" parameterType="string" resultMap="ZdyVipLevelResult">
<include refid="selectZdyVipLevelVo"/>
<where>
and del_flag = 0
and level = #{level}
</where>
</select>
<select id="checkNameUnique" parameterType="string" resultMap="ZdyVipLevelResult">
<include refid="selectZdyVipLevelVo"/>
<where>
and del_flag = 0
and name = #{name}
</where>
</select>
<select id="selectMinId" resultType="long">
select MIN(id)
from zdy_vip_level
where del_flag = 0
</select>
<select id="selectMaxGrowthValue" resultType="long">
select ifnull(MAX(growth_value), 0)
from zdy_vip_level
where del_flag = 0
</select>
<select id="appGetAllVipLevel" resultMap="AppZdyVipLevelVOResult">
select zvl.*, zvb.id zvb_id, zvb.name zvb_name, zvb.image zvb_image
from zdy_vip_level zvl
left join zdy_vip_level_benefits_relation zvlbr on zvl.id = zvlbr.level_id
left join zdy_vip_benefits zvb on zvlbr.benefits_id = zvb.id
</select>
</mapper>

View File

@@ -0,0 +1,157 @@
<?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>

View File

@@ -0,0 +1,250 @@
<?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.ZdyVipUserMapper">
<resultMap type="ZdyVipUser" id="ZdyVipUserResult">
<result property="id" column="id"/>
<result property="miniProgramUserId" column="mini_program_user_id"/>
<result property="levelId" column="level_id"/>
<result property="consumeAmount" column="consume_amount"/>
<result property="points" column="points"/>
<result property="growthValue" column="growth_value"/>
<result property="labelIds" column="label_ids"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="achieveThisLevelTime" column="achieve_this_level_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
</resultMap>
<resultMap type="ZdyVipUserVO" id="ZdyVipUserVOResult">
<result property="id" column="id"/>
<result property="miniProgramUserId" column="mini_program_user_id"/>
<result property="levelId" column="level_id"/>
<result property="consumeAmount" column="consume_amount"/>
<result property="points" column="points"/>
<result property="growthValue" column="growth_value"/>
<result property="labelIds" column="label_ids"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="achieveThisLevelTime" column="achieve_this_level_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
<result property="vipName" column="vip_name"/>
<result property="mobile" column="mobile"/>
<result property="registerTime" column="register_time"/>
<result property="levelName" column="level_name"/>
<result property="nickname" column="nickname"/>
<result property="sex" column="sex"/>
<result property="birthday" column="birthday"/>
<result property="province" column="province"/>
<result property="city" column="city"/>
<result property="area" column="area"/>
<result property="idCard" column="id_card"/>
<result property="avatar" column="avatar"/>
</resultMap>
<sql id="selectZdyVipUserVo">
select vu.id,
vu.mini_program_user_id,
vu.level_id,
vu.consume_amount,
vu.points,
vu.growth_value,
vu.label_ids,
vu.del_flag,
vu.create_time,
vu.create_by,
vu.update_time,
vu.achieve_this_level_time,
vu.update_by,
vu.remark,
u.name vip_name,
u.nickname,
u.mobile,
u.create_time as register_time,
u.id_card,
u.sex,
u.province,
u.city,
u.area,
u.birthday,
u.avatar,
vl.name as level_name
from zdy_vip_user vu
inner join zdy_user u on vu.mini_program_user_id = u.id
left join zdy_vip_level vl on vu.level_id = vl.id
</sql>
<select id="selectZdyVipUserList" parameterType="ZdyVipUserQueryDTO" resultMap="ZdyVipUserVOResult">
<include refid="selectZdyVipUserVo"/>
<where>
vu.del_flag = 0
<if test="levelId != null ">
and vu.level_id = #{levelId}
</if>
<if test="vipName != null and vipName !=''">
and u.name = #{vipName}
</if>
<if test="mobile != null and mobile != '' ">
and u.mobile = #{mobile}
</if>
<if test="vipLevelId != null ">
and vu.level_id = #{vipLevelId}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
order by create_time desc
</select>
<select id="selectZdyVipUserByMiniProgramUserId" parameterType="Long"
resultMap="ZdyVipUserVOResult">
<include refid="selectZdyVipUserVo"/>
where vu.mini_program_user_id = #{miniProgramUserId}
and vu.del_flag = 0 limit 1
</select>
<select id="selectZdyVipUserById" parameterType="Long"
resultMap="ZdyVipUserVOResult">
<include refid="selectZdyVipUserVo"/>
where vu.id = #{id} and vu.del_flag = 0
</select>
<insert id="insertZdyVipUser" parameterType="ZdyVipUser" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_vip_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="miniProgramUserId != null">mini_program_user_id,
</if>
<if test="levelId != null">level_id,
</if>
<if test="consumeAmount != null">consume_amount,
</if>
<if test="points != null">points,
</if>
<if test="growthValue != null">growth_value,
</if>
<if test="labelIds != null and labelIds != '' ">
label_ids,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="achieveThisLevelTime != null">achieve_this_level_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="miniProgramUserId != null">#{miniProgramUserId},
</if>
<if test="levelId != null">#{levelId},
</if>
<if test="consumeAmount != null">#{consumeAmount},
</if>
<if test="points != null">#{points},
</if>
<if test="growthValue != null">#{growthValue},
</if>
<if test="labelIds != null and labelIds != '' ">
#{labelIds},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="achieveThisLevelTime != null">#{achieveThisLevelTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateZdyVipUser" parameterType="ZdyVipUser">
update zdy_vip_user
<trim prefix="SET" suffixOverrides=",">
<if test="miniProgramUserId != null">mini_program_user_id =
#{miniProgramUserId},
</if>
<if test="levelId != null">level_id =
#{levelId},
</if>
<if test="consumeAmount != null">consume_amount =
#{consumeAmount},
</if>
<if test="points != null">points =
#{points},
</if>
<if test="growthValue != null">growth_value =
#{growthValue},
</if>
label_ids = #{labelIds},
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="achieveThisLevelTime != null">achieve_this_level_time = #{achieveThisLevelTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyVipUserById" parameterType="Long">
delete
from zdy_vip_user
where id = #{id}
</delete>
<delete id="deleteZdyVipUserByIds" parameterType="String">
update zdy_vip_user set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getAllLabelIds" resultType="string">
select label_ids
from zdy_vip_user
<where>
and del_flag = 0
</where>
</select>
<select id="countZdyVipUserList" resultType="long">
select count(1)
from zdy_vip_user
where del_flag = 0
</select>
</mapper>