WxgzhSiteMapper.xml 3.21 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.runsa.crmapp.common.mapper.WxgzhSiteMapper" >
  <resultMap id="BaseResultMap" type="cn.runsa.crmapp.common.entity.WxgzhSite" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <result column="GZH_ID" property="gzhId" jdbcType="VARCHAR" />
    <result column="SIT_CODE" property="sitCode" jdbcType="VARCHAR" />
    <result column="STAT" property="stat" jdbcType="TINYINT" />
    <result column="QRCODE" property="qrcode" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    `GZH_ID`, `SIT_CODE`, `STAT`, `QRCODE`
  </sql>
  <insert id="insert" parameterType="cn.runsa.crmapp.common.entity.WxgzhSite" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into crm_wxgzh_site ("GZH_ID", "SIT_CODE", "STAT", 
      "QRCODE")
    values (#{gzhId,jdbcType=VARCHAR}, #{sitCode,jdbcType=VARCHAR}, #{stat,jdbcType=TINYINT}, 
      #{qrcode,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="cn.runsa.crmapp.common.entity.WxgzhSite" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into crm_wxgzh_site
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="gzhId != null" >
        "GZH_ID",
      </if>
      <if test="sitCode != null" >
        "SIT_CODE",
      </if>
      <if test="stat != null" >
        "STAT",
      </if>
      <if test="qrcode != null" >
        "QRCODE",
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="gzhId != null" >
        #{gzhId,jdbcType=VARCHAR},
      </if>
      <if test="sitCode != null" >
        #{sitCode,jdbcType=VARCHAR},
      </if>
      <if test="stat != null" >
        #{stat,jdbcType=TINYINT},
      </if>
      <if test="qrcode != null" >
        #{qrcode,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="getWxCodes" resultMap="BaseResultMap" parameterType="map">
    SELECT 
    <include refid="Base_Column_List" /> 
    FROM crm_wxgzh_site t WHERE t.GZH_ID = #{gzhId,jdbcType=VARCHAR} AND t.SIT_CODE in
    <foreach collection="sitCodes" index="index" item="item" open="(" separator="," close=")">  
       #{item}   
    </foreach>
  </select>
  <update id="batchUpdateByGzhIdAndSitCode" parameterType="java.util.List">
     <foreach collection="list" item="item" index="index" open="" close="" separator=";">
		update crm_wxgzh_site t
		<set>
		  t.QRCODE=${item.qrcode}
		</set>
		where t.GZH_ID = ${item.gzhId} and t.SIT_CODE = ${item.sitCode}
	 </foreach>
   </update>
   <insert id="batchInsertByGzhIdAndSitCode" parameterType="java.util.List">
   	insert into crm_wxgzh_site (GZH_ID, SIT_CODE, STAT, QRCODE) values 
   	<foreach item="item" index="index" collection="list" separator=",">
         (#{item.gzhId,jdbcType=VARCHAR}, #{item.sitCode,jdbcType=VARCHAR}, #{item.stat,jdbcType=TINYINT}, #{item.qrcode,jdbcType=VARCHAR})
	</foreach>
  </insert>
</mapper>