<?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.matrix.system.shopXcx.dao.ShopAdvertisTypeDao"> 
 | 
  
 | 
    <!-- 定义ShopAdvertisType 的复杂关联map --> 
 | 
    <resultMap type="com.matrix.system.shopXcx.bean.ShopAdvertisType" id="ShopAdvertisTypeMap"> 
 | 
        <id property="adtId" column="adt_id"/> 
 | 
        <result property="createBy" column="create_by"/> 
 | 
        <result property="createTime" column="create_time"/> 
 | 
        <result property="updateBy" column="update_by"/> 
 | 
        <result property="updateTime" column="update_time"/> 
 | 
        <result property="adtCode" column="adt_code"/> 
 | 
        <result property="adtName" column="adt_name"/> 
 | 
        <result property="adtMark" column="adt_mark"/> 
 | 
        <result property="adtCapacity" column="adt_capacity"/> 
 | 
        <result property="adtSort" column="adt_sort"/> 
 | 
  
 | 
        <result property="adtSort" column="adt_sort"/> 
 | 
  
 | 
        <result property="nodeType" column="node_type"/> 
 | 
  
 | 
        <result property="nodeValue" column="node_value"/> 
 | 
        <result property="nodeStyle" column="node_style"/> 
 | 
        <result property="nodeAttribute" column="node_attribute"/> 
 | 
        <result property="linkType" column="link_type"/> 
 | 
        <result property="linkUrl" column="link_url"/> 
 | 
        <result property="linkShowName" column="link_show_name"/> 
 | 
        <result property="pageName" column="page_name"/> 
 | 
        <result property="pageCode" column="page_code"/> 
 | 
        <result property="shopId" column="shop_id"/> 
 | 
        <result property="companyId" column="company_id" /> 
 | 
  
 | 
    </resultMap> 
 | 
  
 | 
  
 | 
    <!-- 定义ShopAdvertisType 的简单map  ,本map不添加其他的关联属性 --> 
 | 
    <resultMap type="com.matrix.system.shopXcx.bean.ShopAdvertisType" id="ShopAdvertisTypeSimpleMap"> 
 | 
        <id property="adtId" column="adt_id"/> 
 | 
        <result property="createBy" column="create_by"/> 
 | 
        <result property="createTime" column="create_time"/> 
 | 
        <result property="updateBy" column="update_by"/> 
 | 
        <result property="updateTime" column="update_time"/> 
 | 
        <result property="adtCode" column="adt_code"/> 
 | 
        <result property="adtName" column="adt_name"/> 
 | 
        <result property="adtMark" column="adt_mark"/> 
 | 
        <result property="adtCapacity" column="adt_capacity"/> 
 | 
        <result property="adtSort" column="adt_sort"/> 
 | 
  
 | 
        <result property="nodeType" column="node_type"/> 
 | 
        <result property="linkType" column="link_type"/> 
 | 
        <result property="nodeValue" column="node_value"/> 
 | 
        <result property="nodeStyle" column="node_style"/> 
 | 
        <result property="nodeAttribute" column="node_attribute"/> 
 | 
        <result property="linkUrl" column="link_url"/> 
 | 
        <result property="linkShowName" column="link_show_name"/> 
 | 
        <result property="pageName" column="page_name"/> 
 | 
        <result property="pageCode" column="page_code"/> 
 | 
        <result property="shopId" column="shop_id"/> 
 | 
        <result property="companyId" column="company_id" /> 
 | 
    </resultMap> 
 | 
  
 | 
    <!-- 字段sql --> 
 | 
    <sql id="columns"> 
 | 
        create_by, 
 | 
        create_time, 
 | 
        update_by, 
 | 
        update_time, 
 | 
            adt_id, 
 | 
            adt_code, 
 | 
            adt_name, 
 | 
            adt_mark, 
 | 
            adt_capacity, 
 | 
            adt_sort, 
 | 
            node_type, 
 | 
            node_value, 
 | 
            node_style  , 
 | 
            node_attribute, 
 | 
            link_url, 
 | 
            link_show_name, 
 | 
            link_type, 
 | 
            page_name, 
 | 
            page_code, 
 | 
            shop_id, 
 | 
            company_id 
 | 
    </sql> 
 | 
  
 | 
    <!-- 属性sql --> 
 | 
    <sql id="propertys"> 
 | 
        #{item.createBy}, 
 | 
        now(), 
 | 
        #{item.updateBy}, 
 | 
        now(), 
 | 
        #{item.adtId}, 
 | 
        #{item.adtCode}, 
 | 
        #{item.adtName}, 
 | 
        #{item.adtMark}, 
 | 
        #{item.adtCapacity}, 
 | 
        #{item.adtSort}, 
 | 
        #{item.nodeType}, 
 | 
        #{item.nodeValue}, 
 | 
        #{item.nodeStyle } , 
 | 
        #{item.nodeAttribute}, 
 | 
        #{item.linkUrl}, 
 | 
        #{item.linkShowName}, 
 | 
        #{item.linkType}, 
 | 
        #{item.pageName}, 
 | 
        #{item.pageCode}, 
 | 
        #{item.shopId}, 
 | 
        #{item.companyId} 
 | 
    </sql> 
 | 
  
 | 
    <!-- where sql --> 
 | 
    <sql id="where_sql"> 
 | 
  
 | 
        <if test="record!=null"> 
 | 
            <if test="(record.adtId!=null and record.adtId!='') or  (record.adtId!='' and record.adtId==0)  "> 
 | 
                and adt_id = #{record.adtId} 
 | 
            </if> 
 | 
            <if test="(record.adtCode!=null and record.adtCode!='') or  (record.adtCode!='' and record.adtCode==0)  "> 
 | 
                and adt_code like concat('%',#{record.adtCode},'%') 
 | 
            </if> 
 | 
            <if test="(record.adtName!=null and record.adtName!='') or  (record.adtName!='' and record.adtName==0)  "> 
 | 
                and adt_name like concat('%',#{record.adtName},'%') 
 | 
            </if> 
 | 
            <if test="(record.adtMark!=null and record.adtMark!='') or  (record.adtMark!='' and record.adtMark==0)  "> 
 | 
                and adt_mark = #{record.adtMark} 
 | 
            </if> 
 | 
            <if test="(record.adtCapacity!=null and record.adtCapacity!='') or  (record.adtCapacity!='' and record.adtCapacity==0)  "> 
 | 
                and adt_capacity = #{record.adtCapacity} 
 | 
            </if> 
 | 
            <if test="(record.adtSort!=null and record.adtSort!='') or  (record.adtSort!='' and record.adtSort==0)  "> 
 | 
                and adt_sort = #{record.adtSort} 
 | 
            </if> 
 | 
            <if test="(record.pageCode!=null and record.pageCode!='') or  (record.pageCode!='' and record.pageCode==0)  "> 
 | 
                and page_code = #{record.pageCode} 
 | 
            </if> 
 | 
            <if test="(record.shopId!=null and record.shopId!='') or  (record.shopId!='' and record.shopId==0)  "> 
 | 
                and shop_id = #{record.shopId} 
 | 
            </if> 
 | 
  
 | 
            <if test="record.companyId != null and record.companyId !='' "> 
 | 
                and company_id = #{record.companyId} 
 | 
            </if> 
 | 
  
 | 
        </if> 
 | 
  
 | 
    </sql> 
 | 
  
 | 
    <!--  插入方法   --> 
 | 
    <insert id="insert" parameterType="com.matrix.system.shopXcx.bean.ShopAdvertisType" 
 | 
            useGeneratedKeys="true" keyProperty="item.adtId"> 
 | 
        INSERT INTO shop_advertis_type ( 
 | 
        <include refid="columns"></include> 
 | 
        ) 
 | 
        VALUES ( 
 | 
        <include refid="propertys"></include> 
 | 
        ) 
 | 
    </insert> 
 | 
  
 | 
  
 | 
    <!--  批量插入   --> 
 | 
    <insert id="batchInsert" parameterType="java.util.List"> 
 | 
        INSERT INTO shop_advertis_type ( 
 | 
        <include refid="columns"></include> 
 | 
        ) 
 | 
        VALUES 
 | 
        <foreach collection="list" item="item" index="index" separator=",">( 
 | 
            <include refid="propertys"></include> 
 | 
            ) 
 | 
        </foreach> 
 | 
    </insert> 
 | 
  
 | 
  
 | 
    <!--  根据Map更新 部分更新   --> 
 | 
    <update id="updateByMap" parameterType="java.util.HashMap"> 
 | 
        UPDATE shop_advertis_type 
 | 
        <set> 
 | 
            <if test="_parameter.containsKey('adtCode')"> 
 | 
                adt_code = #{adtCode}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('adtName')"> 
 | 
                adt_name = #{adtName}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('adtMark')"> 
 | 
                adt_mark = #{adtMark}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('adtCapacity')"> 
 | 
                adt_capacity = #{adtCapacity}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('adtSort')"> 
 | 
                adt_sort = #{adtSort}, 
 | 
            </if> 
 | 
  
 | 
            <if test="_parameter.containsKey('shopId')"> 
 | 
                shop_id = #{shopId}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('nodeType')"> 
 | 
                node_type = #{nodeType}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('nodeValue')"> 
 | 
                node_value = #{nodeValue}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('nodeStyle')"> 
 | 
                node_style = #{nodeStyle}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('nodeAttribute')"> 
 | 
                node_attribute = #{nodeAttribute}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('linkUrl')"> 
 | 
                link_url = #{linkUrl}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('linkType')"> 
 | 
                link_type = #{linkType}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('linkShowName')"> 
 | 
                link_show_name = #{linkShowName}, 
 | 
            </if> 
 | 
  
 | 
            <if test="_parameter.containsKey('pageName')"> 
 | 
                page_name = #{pageName}, 
 | 
            </if> 
 | 
            <if test="_parameter.containsKey('pageCode')"> 
 | 
                page_code = #{pageCode}, 
 | 
            </if> 
 | 
  
 | 
  
 | 
            <if test="_parameter.containsKey('companyId')"> 
 | 
                company_id = #{companyId}, 
 | 
            </if> 
 | 
        </set> 
 | 
        WHERE adt_id=#{adtId} 
 | 
    </update> 
 | 
  
 | 
  
 | 
    <!--  根据对象更新 部分更新   --> 
 | 
    <update id="updateByModel" > 
 | 
        UPDATE shop_advertis_type 
 | 
        <set> 
 | 
            <if test="record.adtCode != null and record.adtCode != '' "> 
 | 
                adt_code = #{record.adtCode}, 
 | 
            </if> 
 | 
            <if test="record.adtName != null and record.adtName != '' "> 
 | 
                adt_name = #{record.adtName}, 
 | 
            </if> 
 | 
            <if test="record.adtMark != null and record.adtMark != '' "> 
 | 
                adt_mark = #{record.adtMark}, 
 | 
            </if> 
 | 
            <if test="record.adtCapacity != null "> 
 | 
                adt_capacity = #{record.adtCapacity}, 
 | 
            </if> 
 | 
            <if test="record.adtSort != null "> 
 | 
                adt_sort = #{record.adtSort}, 
 | 
            </if> 
 | 
             <if test="record.nodeType != null and record.nodeType != '' "> 
 | 
                node_type = #{record.nodeType}, 
 | 
            </if> 
 | 
             <if test="record.nodeValue != null and record.nodeValue != '' "> 
 | 
                node_value = #{record.nodeValue}, 
 | 
            </if> 
 | 
             <if test="record.nodeStyle != null and record.nodeStyle != '' "> 
 | 
                node_style = #{record.nodeStyle}, 
 | 
            </if> 
 | 
             <if test="record.nodeAttribute != null and record.nodeAttribute != '' "> 
 | 
                node_attribute = #{record.nodeAttribute}, 
 | 
            </if> 
 | 
  
 | 
             <if test="record.shopId != null and record.shopId != '' "> 
 | 
                 shop_id = #{record.shopId}, 
 | 
            </if> 
 | 
  
 | 
  
 | 
             <if test="record.linkShowName != null and record.linkShowName != '' "> 
 | 
                link_show_name = #{record.linkShowName}, 
 | 
            </if> 
 | 
             <if test="record.linkType != null and record.linkType != '' "> 
 | 
                link_type = #{record.linkType}, 
 | 
            </if> 
 | 
            <if test="record.linkUrl != null and record.linkUrl != '' "> 
 | 
                link_url = #{record.linkUrl}, 
 | 
            </if> 
 | 
             <if test="record.pageName != null and record.pageName != '' "> 
 | 
                page_name = #{record.pageName}, 
 | 
            </if> 
 | 
             <if test="record.pageCode != null and record.pageCode != '' "> 
 | 
                page_code = #{record.pageCode}, 
 | 
            </if> 
 | 
  
 | 
  
 | 
  
 | 
        </set> 
 | 
        WHERE adt_id=#{record.adtId} 
 | 
    </update> 
 | 
  
 | 
    <!-- 批量删除 --> 
 | 
    <delete id="deleteByIds" parameterType="java.util.List"> 
 | 
        delete from shop_advertis_type where adt_id in 
 | 
        <foreach collection="list" index="index" item="item" open="(" 
 | 
                 separator="," close=")"> 
 | 
            #{item} 
 | 
        </foreach> 
 | 
    </delete> 
 | 
  
 | 
    <!-- 根据id删除--> 
 | 
    <delete id="deleteById" parameterType="Integer"> 
 | 
        DELETE 
 | 
        FROM shop_advertis_type 
 | 
        where adt_id = #{adtId} 
 | 
    </delete> 
 | 
  
 | 
    <!-- 根据对象删除--> 
 | 
    <delete id="deleteByModel" parameterType="com.matrix.system.shopXcx.bean.ShopAdvertisType"> 
 | 
        DELETE FROM shop_advertis_type 
 | 
        <where> 
 | 
            <include refid="where_sql"></include> 
 | 
        </where> 
 | 
    </delete> 
 | 
  
 | 
  
 | 
    <!-- 分页查询 --> 
 | 
    <select id="selectInPage" resultMap="ShopAdvertisTypeMap"> 
 | 
        select 
 | 
        <include refid="columns"></include> 
 | 
        from shop_advertis_type 
 | 
        <where> 
 | 
            <include refid="where_sql"></include> 
 | 
        </where> 
 | 
        <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 --> 
 | 
            <if test="pageVo.sort !=null  and pageVo.order !=null"> 
 | 
                order by 
 | 
                ${pageVo.sort} ${pageVo.order} 
 | 
            </if> 
 | 
            <if test="pageVo.offset >=0  and pageVo.limit >0"> 
 | 
                limit 
 | 
                #{pageVo.offset},#{pageVo.limit} 
 | 
            </if> 
 | 
        </if> 
 | 
    </select> 
 | 
  
 | 
    <!-- 查询总条数 --> 
 | 
    <select id="selectTotalRecord" parameterType="long" resultType="java.lang.Integer"> 
 | 
        select count(*) 
 | 
        from shop_advertis_type 
 | 
        <where> 
 | 
            <include refid="where_sql"></include> 
 | 
        </where> 
 | 
    </select> 
 | 
  
 | 
    <!-- 根据id查询--> 
 | 
    <select id="selectById" resultMap="ShopAdvertisTypeMap"> 
 | 
        select 
 | 
        <include refid="columns"></include> 
 | 
        from shop_advertis_type 
 | 
        where adt_id=#{adtId} 
 | 
    </select> 
 | 
  
 | 
  
 | 
    <!-- 根据id 锁表查询--> 
 | 
    <select id="selectForUpdate" resultMap="ShopAdvertisTypeMap"> 
 | 
        select 
 | 
        <include refid="columns"></include> 
 | 
        from shop_advertis_type 
 | 
        where adt_id=#{adt_id} 
 | 
        for update 
 | 
    </select> 
 | 
  
 | 
  
 | 
    <!-- 根据对象查询--> 
 | 
    <select id="selectByModel" resultMap="ShopAdvertisTypeMap"> 
 | 
        select 
 | 
        <include refid="columns"></include> 
 | 
        from shop_advertis_type 
 | 
        <where> 
 | 
            <include refid="where_sql"></include> 
 | 
        </where> 
 | 
        order by adt_sort desc 
 | 
    </select> 
 | 
</mapper> 
 |