IMSupplierMapper.xml 1.7 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.dao.IMSupplierDao">
  <select id="findByProductId" resultMap="BaseResultMap" parameterType="java.util.Map">
    SELECT spl.* FROM im_supplier spl left join im_product_supplier ips on spl.id=ips.supplier_id
    where ips.product_id=#{productId}
    limit 1
  </select>
  <select id="findByProductIdIn" resultMap="BaseResultMap" parameterType="java.util.Map">
    SELECT spl.* FROM im_supplier spl left join im_product_supplier ips on spl.id=ips.supplier_id
    where ips.product_id in
    <foreach collection="productIds" item="productId" open="(" close=")"  separator=",">
      #{productId}
    </foreach>
  </select>
    <select id="findByIdIn" resultMap="BaseResultMap" parameterType="java.util.Map">
      SELECT
        *
      FROM  im_supplier
      where id in
        <foreach collection="supplierIds" item="supplierId" open="(" close=")"  separator=",">
            #{supplierId}
        </foreach>
    </select>

  <resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.IMSupplier">
    <id column="id"  property="id" />
    <result column="name"    property="name" />
    <result column="contact"  property="contact" />
    <result column="contact_phone"  property="contactPhone" />
    <result column="create_dt" property="createDt"/>
    <result column="erp_card_code"  property="erpCardCode" />
    <result column="sort_name"  property="sortName" />
    <result column="freight_remark"  property="freightRemark"/>
    <result column="head_img"  property="headImg"/>
    <result column="platform_type"  property="platformType"/>

  </resultMap>
</mapper>