Helius
2021-01-22 6add6b3044b74d654ccb065e63d24bbc96eb0d6f
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml
@@ -9,7 +9,6 @@
            create_time,
            create_by,
            id,
            vip_id,
            label,
            shop_id,
            company_id,
@@ -20,13 +19,25 @@
            #{createTime},
            #{createBy},
            #{id},
            #{vipId},
            #{label},
            #{shopId},
            #{companyId},
            #{isAll},
            #{userId},
            #{color}
        )
    </insert>
    <insert id="insertRelate" parameterType="com.matrix.system.hive.bean.SysVipLabel" useGeneratedKeys="true"
            keyProperty="id">
        insert sys_vip_label_relate (
            id,
            label_id,
            vip_id
        ) values (
            #{id},
            #{labelId},
            #{vipId}
        )
    </insert>
@@ -50,26 +61,43 @@
    <select id="selectByVipId" resultType="com.matrix.system.hive.bean.SysVipLabel">
        select *
        from sys_vip_label
        where vip_id=#{vipId}
        select b.*
        from sys_vip_label_relate a
        inner join sys_vip_label b on a.label_id=b.id
        where a.vip_id=#{vipId}
    </select>
    <select id="selectByModel" resultType="com.matrix.system.hive.bean.SysVipLabel">
        select * from sys_vip_label
        select
            create_time createTime,
            create_by createBy,
            id,
            label,
            shop_id shopId,
            company_id companyId,
            is_all isAll,
            user_id userId,
            color
        from sys_vip_label
        where 1=1
        <if test="record!=null">
            <if test="record.label!=null  and record.label!=''">
                and label=#{record.label}
                and label like CONCAT('%', CONCAT(#{record.label},'%'))
            </if>
            <if test="record.vipId!=null">
                and vip_id=#{record.vipId}
            <if test="record.isAll!=null  and record.isAll!=0">
                and is_all=#{record.isAll}
            </if>
            <if test="record.userId!=null  and record.userId!=''">
                and user_id=#{record.userId}
            </if>
            <if test="record.companyId!=null  and record.companyId!=''">
                and company_id=#{record.companyId}
            </if>
        </if>
    </select>
    <delete id="deleteByVipId">
        delete from sys_vip_label
    <delete id="deleteRelateByVipId">
        delete from sys_vip_label_relate
        where vip_id=#{vipId}
    </delete>
</mapper>