IMSupplierMapper.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.sibu.orderHelper.integral.web.dao.IMSupplierDao">
  <resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.IMSupplier">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="contact" jdbcType="VARCHAR" property="contact" />
    <result column="contact_phone" jdbcType="VARCHAR" property="contactPhone" />
    <result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
    <result column="erp_card_code" jdbcType="VARCHAR" property="erpCardCode" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="freight_remark" jdbcType="VARCHAR" property="freightRemark"/>
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="head_img" jdbcType="VARCHAR" property="headImg" />
    <result column="service_charge_rate"  property="serviceChargeRate" />
    <result column="platform_type" property="platformType" />
  </resultMap>
  <resultMap id="resultMap" type="com.sibu.orderHelper.integral.reponse.WebSupplierDetail">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="contact" jdbcType="VARCHAR" property="contact" />
    <result column="contact_phone" jdbcType="VARCHAR" property="contactPhone" />
    <result column="erp_card_code" jdbcType="VARCHAR" property="erpCardCode" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="freight_remark" jdbcType="VARCHAR" property="freightRemark"/>
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="head_img" jdbcType="VARCHAR" property="headImg" />
    <result column="service_charge_rate"  property="serviceChargeRate" />
    <result column="platform_type" property="platformType" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, contact, contact_phone,create_dt,erp_card_code,name,freight_remark,address,head_img,service_charge_rate,platform_type
  </sql>

  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="resultMap">
    select 
    id, contact, contact_phone,erp_card_code,name,freight_remark,address,head_img,platform_type,service_charge_rate
    from im_supplier
    where id = #{id}
  </select>
  <select id="findById" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
        *
    from im_supplier
    where id = #{id}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from im_supplier
    where id = #{id}
  </delete>
  <select id="selectByStoreName" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    id, contact, contact_phone,name,freight_remark,address,head_img,platform_type,service_charge_rate
    from im_supplier
    where name = #{name}
  </select>
  <insert id="insert" parameterType="com.sibu.orderHelper.integral.model.IMSupplier">
    insert into im_supplier (id, contact, contact_phone,create_dt,erp_card_code,name,
    freight_remark,address,head_img,platform_type,service_charge_rate)
    values (#{id,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR},
      #{contactPhone,jdbcType=VARCHAR},NOW(), #{erpCardCode,jdbcType=VARCHAR},
      #{name,jdbcType=VARCHAR},#{freightRemark,jdbcType=VARCHAR},#{address,jdbcType=VARCHAR}
      ,#{headImg,jdbcType=VARCHAR},#{platformType},#{serviceChargeRate,jdbcType=DECIMAL})
  </insert>
  <insert id="insertSelective" parameterType="com.sibu.orderHelper.integral.model.IMSupplier">
    insert into im_supplier
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="contact != null">
        contact,
      </if>
      <if test="contactPhone != null">
        contact_phone,
      </if>
      <if test="erpCardCode != null">
        erp_card_code,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="freightRemark != null">
        freight_remark,
      </if>
      <if test="address != null">
        address,
      </if>
      <if test="headImg != null">
        head_img,
      </if>
      <if test="serviceChargeRate != null">
        service_charge_rate,
      </if>
      create_dt
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="contact != null">
        #{contact,jdbcType=VARCHAR},
      </if>
      <if test="contactPhone != null">
        #{contactPhone,jdbcType=VARCHAR},
      </if>
      <if test="erpCardCode != null">
        #{erpCardCode,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="freightRemark != null">
        #{freightRemark,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="headImg != null">
        #{headImg,jdbcType=VARCHAR},
      </if>
      <if test="serviceChargeRate != null">
        #{serviceChargeRate,jdbcType=DECIMAL},
      </if>
      NOW()
    </trim>
  </insert>



  <update id="updateByPrimaryKeySelective" parameterType="com.sibu.orderHelper.integral.model.IMSupplier">
    update im_supplier
    <set>
      <if test="contact != null">
        contact = #{contact,jdbcType=VARCHAR},
      </if>
      <if test="contactPhone != null">
        contact_phone = #{contactPhone,jdbcType=VARCHAR},
      </if>
      <if test="erpCardCode != null">
        erp_card_code = #{erpCardCode,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="freightRemark != null">
        freight_remark = #{freightRemark,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="headImg != null">
        head_img = #{headImg,jdbcType=VARCHAR},
      </if>
      <if test="serviceChargeRate != null">
        service_charge_rate = #{serviceChargeRate,jdbcType=DECIMAL},
      </if>
      create_dt = NOW()
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.sibu.orderHelper.integral.model.IMSupplier">
    update im_supplier
    set contact = #{contact,jdbcType=VARCHAR}, contact_phone = #{contactPhone,jdbcType=VARCHAR},
    erp_card_code = #{erpCardCode,jdbcType=VARCHAR},name = #{name,jdbcType=VARCHAR},
    freight_remark = #{freightRemark,jdbcType=VARCHAR},address = #{address,jdbcType=VARCHAR},
    head_img = #{headImg,jdbcType=VARCHAR},platform_type = #{platformType},
    service_charge_rate = #{serviceChargeRate,jdbcType=DECIMAL},create_dt = NOW()
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="listSupplier"  resultMap="BaseResultMap" parameterType="map">
    select  <include refid="Base_Column_List" />
    from im_supplier
    where 1=1
    <if test="keyword != null and keyword !=''">
      and name like concat('%',#{keyword},'%')
    </if>
    <if test="contact != null and contact !=''">
      and contact like concat('%',#{contact},'%')
    </if>
    <if test="contactPhone != null and contactPhone !=''">
      and contact_phone like concat('%',#{contactPhone},'%')
    </if>
    order by create_dt desc
    LIMIT ${pageNow}, ${pageSize}
  </select>

  <select id="totalSupplier" resultType="java.lang.Integer" parameterType="map">
    select COUNT(*) from im_supplier
    where 1=1
    <if test="keyword != null and keyword !=''">
      and name like concat('%',#{keyword},'%')
    </if>
    <if test="contact != null and contact !=''">
      and contact like concat('%',#{contact},'%')
    </if>
    <if test="contactPhone != null and contactPhone !=''">
      and contact_phone like concat('%',#{contactPhone},'%')
    </if>
    <if test="supplierId != null and supplierId !=''">
      and supplier_id = #{supplierId}
    </if>
  </select>

  <select id="selectSupplier"  resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />  from im_supplier order by create_dt desc
  </select>

  <select id="paperSupplier"   resultType="com.sibu.orderHelper.integral.model.IMSupplier" parameterType="com.sibu.orderHelper.integral.request.SupplierCouponRequest">
    select <include refid="Base_Column_List" />  from im_supplier  WHERE  1 = 1


  </select>

  <select id="totalPaperSupplier"   resultType="java.lang.Integer" parameterType="com.sibu.orderHelper.integral.request.SupplierCouponRequest">
    select COUNT(*) from im_supplier  WHERE  1 = 1
    <if test="supplierId != null and supplierId !=''">
      and id = #{supplierId}
    </if>
  </select>


  <select id="paperSupplierByOrderCheckingRequest" resultMap="BaseResultMap" parameterType="com.sibu.orderHelper.integral.request.OrderCheckingRequest" >
  select <include refid="Base_Column_List" />  from im_supplier  WHERE  1 = 1
    <if test="supplierId != null and supplierId !=''">
      and id = #{supplierId}
    </if>
  </select>

</mapper>