You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
8.5 KiB
XML
160 lines
8.5 KiB
XML
<?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.glxp.api.dao.purchase.SupManufacturerDao">
|
|
|
|
<select id="findCompany" parameterType="java.lang.Long"
|
|
resultType="com.glxp.api.entity.purchase.SupManufacturerEntity">
|
|
SELECT *
|
|
FROM sup_manufacturer
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<select id="findCompanyByName" parameterType="java.lang.String"
|
|
resultType="com.glxp.api.entity.purchase.SupManufacturerEntity">
|
|
SELECT *
|
|
FROM sup_manufacturer
|
|
where companyName = #{companyName}
|
|
</select>
|
|
|
|
<select id="getCompany" parameterType="com.glxp.api.req.purchase.FilterSupManufacturerRequest"
|
|
resultType="com.glxp.api.entity.purchase.SupManufacturerEntity">
|
|
SELECT sup_manufacturer.* ,sup_company.companyName as supName
|
|
<if test="productStatus!=null">
|
|
,(SELECT count(*) FROM sup_product WHERE sup_manufacturer.customerId=sup_product.customerId AND sup_product.auditStatus!=0 AND sup_product.auditStatus!=1 AND sup_product.auditStatus!=4 AND sup_manufacturer.manufacturerId=sup_product.manufacturerIdFk ) as failCout,
|
|
(SELECT count(*) FROM sup_product WHERE sup_manufacturer.customerId=sup_product.customerId AND (sup_product.auditStatus=1 OR sup_product.auditStatus=4) AND sup_manufacturer.manufacturerId=sup_product.manufacturerIdFk ) as passCout
|
|
</if>
|
|
FROM sup_manufacturer
|
|
inner join sup_company on sup_manufacturer.customerId = sup_company.customerId
|
|
<where>
|
|
<if test="id != null and id != '' and type==null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="manufacturerId != null and manufacturerId != ''">
|
|
and manufacturerId = #{manufacturerId}
|
|
</if>
|
|
<if test="companyName != null and companyName != ''">
|
|
and sup_manufacturer.companyName like concat('%',#{companyName},'%')
|
|
</if>
|
|
<if test="creditCode != null and creditCode != ''">
|
|
and creditCode like concat('%',#{creditCode},'%')
|
|
</if>
|
|
<if test="placeArea != null and placeArea != ''">
|
|
and placeArea like concat('%',#{placeArea},'%')
|
|
</if>
|
|
<if test="customerId != null and customerId != ''">
|
|
and sup_manufacturer.customerId = #{customerId}
|
|
</if>
|
|
|
|
<if test="auditStatus != null and auditStatus !=20 and auditStatus !=21 and auditStatus !=22">
|
|
and sup_manufacturer.auditStatus = #{auditStatus}
|
|
</if>
|
|
|
|
<if test="auditStatus ==20">
|
|
and (sup_manufacturer.auditStatus = 0 or sup_manufacturer.auditStatus=5 or
|
|
sup_manufacturer.auditStatus=2)
|
|
</if>
|
|
<if test="auditStatus ==21">
|
|
and <![CDATA[ sup_manufacturer.auditStatus <> 0 ]]>
|
|
</if>
|
|
|
|
<if test="auditStatus ==22">
|
|
and (sup_manufacturer.auditStatus = 1 or sup_manufacturer.auditStatus=4 )
|
|
</if>
|
|
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
|
|
<![CDATA[ and DATE_FORMAT(sup_manufacturer.updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
|
|
</if>
|
|
<if test="type != null">
|
|
and id != #{id}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<update id="modifyCompany" parameterType="com.glxp.api.entity.purchase.SupManufacturerEntity">
|
|
|
|
UPDATE sup_manufacturer
|
|
<set>
|
|
<if test="companyName != null">companyName=#{companyName},</if>
|
|
<if test="creditCode != null">creditCode=#{creditCode},</if>
|
|
<if test="companyType != null">companyType=#{companyType},</if>
|
|
<if test="placeArea != null">placeArea=#{placeArea},</if>
|
|
<if test="placeAreaCode != null">placeAreaCode=#{placeAreaCode},</if>
|
|
<if test="placeAddress != null">placeAddress=#{placeAddress},</if>
|
|
<if test="legalPersonName != null">legalPersonName=#{legalPersonName},</if>
|
|
<if test="legalPersonPapersType != null">legalPersonPapersType=#{legalPersonPapersType},</if>
|
|
<if test="legalPersonPapersCode != null">legalPersonPapersCode=#{legalPersonPapersCode},</if>
|
|
<if test="productionArea != null">productionArea=#{productionArea},</if>
|
|
<if test="productionAreaCode != null">productionAreaCode=#{productionAreaCode},</if>
|
|
<if test="productionAddress != null">productionAddress=#{productionAddress},</if>
|
|
<if test="registerStatus != null">registerStatus=#{registerStatus},</if>
|
|
<if test="productionLicenceNum != null">productionLicenceNum=#{productionLicenceNum},</if>
|
|
<if test="productionLicenceDate != null">productionLicenceDate=#{productionLicenceDate},</if>
|
|
<if test="productionRecordNum != null">productionRecordNum=#{productionRecordNum},</if>
|
|
<if test="productionRecordSection != null">productionRecordSection=#{productionRecordSection},</if>
|
|
<if test="productionRecordDate != null">productionRecordDate=#{productionRecordDate},</if>
|
|
<if test="remark != null">remark=#{remark},</if>
|
|
<if test="createTime != null">createTime=#{createTime},</if>
|
|
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
|
<if test="customerId != null">customerId=#{customerId},</if>
|
|
<if test="manufacturerId != null">manufacturerId=#{manufacturerId},</if>
|
|
<if test="auditStatus != null">auditStatus=#{auditStatus},</if>
|
|
<if test="auditComment != null">auditComment=#{auditComment},</if>
|
|
|
|
|
|
</set>
|
|
WHERE id=#{id}
|
|
|
|
</update>
|
|
|
|
<insert id="insertCompany" parameterType="com.glxp.api.entity.purchase.SupManufacturerEntity">
|
|
replace INTO sup_manufacturer(companyName, creditCode, companyType,
|
|
placeArea, placeAreaCode, placeAddress,
|
|
legalPersonName, legalPersonPapersType, legalPersonPapersCode,
|
|
productionArea, productionAreaCode, productionAddress,
|
|
registerStatus, productionLicenceNum, productionLicenceDate,
|
|
productionRecordNum, productionRecordSection, productionRecordDate,
|
|
remark, createTime, updateTime, customerId, manufacturerId,
|
|
auditStatus, auditComment)
|
|
values (#{companyName}, #{creditCode}, #{companyType},
|
|
#{placeArea}, #{placeAreaCode}, #{placeAddress},
|
|
#{legalPersonName}, #{legalPersonPapersType}, #{legalPersonPapersCode},
|
|
#{productionArea}, #{productionAreaCode}, #{productionAddress},
|
|
#{registerStatus}, #{productionLicenceNum}, #{productionLicenceDate},
|
|
#{productionRecordNum}, #{productionRecordSection}, #{productionRecordDate},
|
|
#{remark}, #{createTime}, #{updateTime}, #{customerId}, #{manufacturerId}, #{auditStatus},
|
|
#{auditComment})
|
|
</insert>
|
|
|
|
<delete id="deleteById" parameterType="Map">
|
|
DELETE
|
|
FROM sup_manufacturer
|
|
WHERE id = #{id}
|
|
</delete>
|
|
|
|
<select id="getCompanyByNameAndCode" parameterType="com.glxp.api.req.purchase.FilterSupManufacturerRequest"
|
|
resultType="com.glxp.api.entity.purchase.SupManufacturerEntity">
|
|
SELECT sup_manufacturer.* ,sup_company.companyName as supName FROM sup_manufacturer
|
|
inner join sup_company on sup_manufacturer.customerId = sup_company.customerId
|
|
<where>
|
|
<if test="companyName != null and companyName != ''">
|
|
and sup_manufacturer.companyName = #{companyName}
|
|
</if>
|
|
<if test="creditCode != null and creditCode != ''">
|
|
and creditCode = #{creditCode}
|
|
</if>
|
|
<if test="id != null and id != ''">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="customerId != null and customerId != ''">
|
|
and sup_manufacturer.customerId = #{customerId}
|
|
</if>
|
|
<if test="type != null">
|
|
and id != #{id}
|
|
</if>
|
|
<if test="manufacturerId != null and manufacturerId != ''">
|
|
and sup_manufacturer.manufacturerId = #{manufacturerId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
</mapper> |