CompanyInfoMapper.xml 11.1 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="com.sunyo.wlpt.dispatch.mapper.CompanyInfoMapper">
  <resultMap id="BaseResultMap" type="com.sunyo.wlpt.dispatch.domain.CompanyInfo">
    <!--@mbg.generated-->
    <!--@Table company_info-->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="company_name" jdbcType="VARCHAR" property="companyName" />
    <result column="company_address" jdbcType="VARCHAR" property="companyAddress" />
    <result column="company_mobile" jdbcType="VARCHAR" property="companyMobile" />
    <result column="company_id" jdbcType="VARCHAR" property="companyId" />
    <result column="company_representative" jdbcType="VARCHAR" property="companyRepresentative" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, company_name, company_address, company_mobile, company_id, company_representative
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from company_info
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--@mbg.generated-->
    delete from company_info
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.sunyo.wlpt.dispatch.domain.CompanyInfo">
    <!--@mbg.generated-->
    insert into company_info (id, company_name, company_address, 
      company_mobile, company_id, company_representative
      )
    values (#{id,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, #{companyAddress,jdbcType=VARCHAR}, 
      #{companyMobile,jdbcType=VARCHAR}, #{companyId,jdbcType=VARCHAR}, #{companyRepresentative,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.sunyo.wlpt.dispatch.domain.CompanyInfo">
    <!--@mbg.generated-->
    insert into company_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="companyName != null">
        company_name,
      </if>
      <if test="companyAddress != null">
        company_address,
      </if>
      <if test="companyMobile != null">
        company_mobile,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
      <if test="companyRepresentative != null">
        company_representative,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="companyName != null">
        #{companyName,jdbcType=VARCHAR},
      </if>
      <if test="companyAddress != null">
        #{companyAddress,jdbcType=VARCHAR},
      </if>
      <if test="companyMobile != null">
        #{companyMobile,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="companyRepresentative != null">
        #{companyRepresentative,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.wlpt.dispatch.domain.CompanyInfo">
    <!--@mbg.generated-->
    update company_info
    <set>
      <if test="companyName != null">
        company_name = #{companyName,jdbcType=VARCHAR},
      </if>
      <if test="companyAddress != null">
        company_address = #{companyAddress,jdbcType=VARCHAR},
      </if>
      <if test="companyMobile != null">
        company_mobile = #{companyMobile,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        company_id = #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="companyRepresentative != null">
        company_representative = #{companyRepresentative,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.dispatch.domain.CompanyInfo">
    <!--@mbg.generated-->
    update company_info
    set company_name = #{companyName,jdbcType=VARCHAR},
      company_address = #{companyAddress,jdbcType=VARCHAR},
      company_mobile = #{companyMobile,jdbcType=VARCHAR},
      company_id = #{companyId,jdbcType=VARCHAR},
      company_representative = #{companyRepresentative,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update company_info
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="company_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.companyName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="company_address = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.companyAddress,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="company_mobile = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.companyMobile,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="company_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.companyId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="company_representative = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.companyRepresentative,jdbcType=VARCHAR}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=VARCHAR}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update company_info
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="company_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.companyName != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.companyName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="company_address = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.companyAddress != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.companyAddress,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="company_mobile = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.companyMobile != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.companyMobile,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="company_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.companyId != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.companyId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="company_representative = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.companyRepresentative != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.companyRepresentative,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=VARCHAR}
    </foreach>
  </update>
  <insert id="batchInsert" parameterType="map">
    <!--@mbg.generated-->
    insert into company_info
    (id, company_name, company_address, company_mobile, company_id, company_representative
      )
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.id,jdbcType=VARCHAR}, #{item.companyName,jdbcType=VARCHAR}, #{item.companyAddress,jdbcType=VARCHAR}, 
        #{item.companyMobile,jdbcType=VARCHAR}, #{item.companyId,jdbcType=VARCHAR}, #{item.companyRepresentative,jdbcType=VARCHAR}
        )
    </foreach>
  </insert>
  <insert id="insertOrUpdate" parameterType="com.sunyo.wlpt.dispatch.domain.CompanyInfo">
    <!--@mbg.generated-->
    insert into company_info
    (id, company_name, company_address, company_mobile, company_id, company_representative
      )
    values
    (#{id,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, #{companyAddress,jdbcType=VARCHAR}, 
      #{companyMobile,jdbcType=VARCHAR}, #{companyId,jdbcType=VARCHAR}, #{companyRepresentative,jdbcType=VARCHAR}
      )
    on duplicate key update 
    id = #{id,jdbcType=VARCHAR}, 
    company_name = #{companyName,jdbcType=VARCHAR}, 
    company_address = #{companyAddress,jdbcType=VARCHAR}, 
    company_mobile = #{companyMobile,jdbcType=VARCHAR}, 
    company_id = #{companyId,jdbcType=VARCHAR}, 
    company_representative = #{companyRepresentative,jdbcType=VARCHAR}
  </insert>
  <insert id="insertOrUpdateSelective" parameterType="com.sunyo.wlpt.dispatch.domain.CompanyInfo">
    <!--@mbg.generated-->
    insert into company_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="companyName != null">
        company_name,
      </if>
      <if test="companyAddress != null">
        company_address,
      </if>
      <if test="companyMobile != null">
        company_mobile,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
      <if test="companyRepresentative != null">
        company_representative,
      </if>
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="companyName != null">
        #{companyName,jdbcType=VARCHAR},
      </if>
      <if test="companyAddress != null">
        #{companyAddress,jdbcType=VARCHAR},
      </if>
      <if test="companyMobile != null">
        #{companyMobile,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="companyRepresentative != null">
        #{companyRepresentative,jdbcType=VARCHAR},
      </if>
    </trim>
    on duplicate key update 
    <trim suffixOverrides=",">
      <if test="id != null">
        id = #{id,jdbcType=VARCHAR},
      </if>
      <if test="companyName != null">
        company_name = #{companyName,jdbcType=VARCHAR},
      </if>
      <if test="companyAddress != null">
        company_address = #{companyAddress,jdbcType=VARCHAR},
      </if>
      <if test="companyMobile != null">
        company_mobile = #{companyMobile,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        company_id = #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="companyRepresentative != null">
        company_representative = #{companyRepresentative,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
</mapper>