DracChannelCodeBillMapper.xml 4.22 KB
<?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="cn.com.glsx.entmicro.mapper.DracChannelCodeBillMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.DracChannelCodeBill">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="code_id" jdbcType="INTEGER" property="codeId"/>
        <result column="back_url" jdbcType="VARCHAR" property="backUrl"/>
        <result column="auto_url" jdbcType="VARCHAR" property="autoUrl"/>
        <result column="image_position" jdbcType="VARCHAR" property="imagePosition"/>
        <result column="created_by" jdbcType="INTEGER" property="createdBy"/>
        <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
        <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
        <!--    <result column="merchant_id" jdbcType="INTEGER" property="merchantId" />-->
        <result column="thumbnail_url" jdbcType="VARCHAR" property="thumbnailUrl"/>
    </resultMap>

    <resultMap id="resultMap" type="cn.com.glsx.entmicro.model.response.DracChannelCodeBillListResponse">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="auto_url" jdbcType="VARCHAR" property="autoUrl"/>
        <result column="back_url" jdbcType="VARCHAR" property="backUrl"/>
        <result column="code_id" jdbcType="VARCHAR" property="codeId"/>
        <result column="qr_code" jdbcType="VARCHAR" property="codeUrl"/>
        <result column="image_position" jdbcType="VARCHAR" property="imagePosition"/>
        <result column="code_state" jdbcType="VARCHAR" property="codeState"/>
        <result column="thumbnail_url" jdbcType="VARCHAR" property="thumbnailUrl"/>
    </resultMap>

    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        id, code_id, channel_remark, auto_add, tagging, created_by, created_time, updated_by,
        updated_time, del_flag, merchant_id, thumbnail_url
    </sql>

    <update id="deleteChannelCodeBill">
        update drac_channel_code_bill
        set del_flag = -1,
        updated_time = NOW()
        where
        <trim prefixOverrides="and">
            <if test="dracChannelCodeBillRequest.id != null">
                id = #{dracChannelCodeBillRequest.id}
            </if>
            <if test="dracChannelCodeBillRequest.codeId != null">
                and code_id = #{dracChannelCodeBillRequest.codeId}
            </if>
        </trim>
    </update>

    <!--当前活码海报活码列表-->
    <select id="getSubCodeChannelCodeBill" resultMap="resultMap">
        select t1.id,
               t1.code_id,
               t1.auto_url,
               t1.back_url,
               t2.qr_code,
               t1.image_position,
               t1.created_time,
               t1.thumbnail_url
        from drac_channel_code_bill t1
                 left join drac_channel_code t2 on t1.code_id = t2.id
        where t1.del_flag = 0
          and t1.code_id = #{codeId}
    </select>

    <!--获取所有海报活码-->
    <select id="listChannelCodeBill" resultMap="resultMap">
        select t1.id,
               t1.back_url,
               t1.auto_url,
               t1.code_id,
               t2.code_state,
               t1.thumbnail_url
        from drac_channel_code_bill t1
                 left join drac_channel_code t2 on t1.code_id = t2.id
        where t1.del_flag = 0
          and t1.merchant_id = #{merchantId}
        order by t1.created_time desc
    </select>

    <!--海报活码编辑详情-->
    <select id="getChannelCodeBill" resultMap="resultMap">
        select t1.id,
               t1.code_id,
               t1.auto_url,
               t1.back_url,
               t2.qr_code,
               t1.image_position,
               t1.thumbnail_url
        from drac_channel_code_bill t1
                 left join drac_channel_code t2 on t1.code_id = t2.id
        where t1.del_flag = 0
          and t1.id = #{id}
    </select>
</mapper>