244 lines
8.8 KiB
XML
244 lines
8.8 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.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> |