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.
413 lines
17 KiB
XML
413 lines
17 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.SupProductDao">
|
|
<select id="findRegistration" parameterType="java.lang.Long"
|
|
resultType="com.glxp.api.entity.purchase.SupProductEntity">
|
|
SELECT *
|
|
FROM sup_product
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<select id="findRegistrationByName" parameterType="java.lang.String"
|
|
resultType="com.glxp.api.entity.purchase.SupProductEntity">
|
|
SELECT *
|
|
FROM sup_product
|
|
where recordProductName = #{recordProductName}
|
|
</select>
|
|
|
|
<select id="filterProducts" parameterType="com.glxp.api.req.purchase.FilterPoductRequest"
|
|
resultType="com.glxp.api.entity.purchase.SupProductEntity">
|
|
SELECT sup_product.*
|
|
FROM sup_product
|
|
<where>
|
|
<if test="id != null and id != ''">
|
|
and sup_product.id = #{id}
|
|
</if>
|
|
<if test="productId != null and productId != ''">
|
|
and sup_product.productId = #{productId}
|
|
</if>
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
and sup_product.enterpriseId = #{enterpriseId}
|
|
</if>
|
|
<if test="relIdFk != null and relIdFk != ''">
|
|
and sup_product.relIdFk = #{relIdFk}
|
|
</if>
|
|
<if test="manufactory != null and manufactory != ''">
|
|
and sup_product.manufactory = #{manufactory}
|
|
</if>
|
|
|
|
<if test="recordCode != null and recordCode != ''">
|
|
and sup_product.recordCode like concat('%', #{recordCode}, '%')
|
|
</if>
|
|
<if test="recordProductName != null and recordProductName != ''">
|
|
and sup_product.recordProductName like concat('%', #{recordProductName}, '%')
|
|
</if>
|
|
<if test="recordPeopleName != null and recordPeopleName != ''">
|
|
and sup_product.recordPeopleName like concat('%', #{recordPeopleName}, '%')
|
|
</if>
|
|
<if test="manufacturerIdFk != null and manufacturerIdFk != ''">
|
|
and sup_product.manufacturerIdFk = #{manufacturerIdFk}
|
|
</if>
|
|
<if test="customerId != null and customerId != ''">
|
|
and sup_product.customerId = #{customerId}
|
|
</if>
|
|
<if test="auditStatus != null and auditStatus != 20 and auditStatus != 22 and auditStatus != 21">
|
|
and sup_product.auditStatus = #{auditStatus}
|
|
</if>
|
|
<if test="auditStatus == 20">
|
|
and (sup_product.auditStatus = 0 or sup_product.auditStatus = 5 or
|
|
sup_product.auditStatus = 2)
|
|
</if>
|
|
<if test="auditStatus == 21">
|
|
and <![CDATA[ sup_product.auditStatus <> 0
|
|
]]>
|
|
</if>
|
|
<if test="auditStatus == 22">
|
|
and (sup_product.auditStatus = 1 or sup_product.auditStatus = 4)
|
|
</if>
|
|
<if test="lastUpdateTime != null and lastUpdateTime != ''">
|
|
<![CDATA[
|
|
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
|
|
]]>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="getRegistration" parameterType="com.glxp.api.req.purchase.FilterPoductRequest"
|
|
resultType="com.glxp.api.res.purchase.SupProductResponse">
|
|
SELECT sup_product.id,
|
|
sup_product.productId,
|
|
sup_product.enterpriseId,
|
|
sup_product.recordCode,
|
|
sup_product.recordProductName,
|
|
sup_product.productManageType,
|
|
sup_product.recordPeopleName,
|
|
sup_product.recordPeopleArea,
|
|
sup_product.recordPeopleAreaCode,
|
|
sup_product.recordPeopleAddress,
|
|
sup_product.productType,
|
|
sup_product.productDirectoryCode,
|
|
sup_product.agentArea,
|
|
sup_product.agentAreaCode,
|
|
sup_product.agentAddress,
|
|
sup_product.instructions,
|
|
sup_product.productAddress,
|
|
sup_product.recordText,
|
|
sup_product.placeOrigin,
|
|
sup_product.productionRegion,
|
|
sup_product.productionCompanyName,
|
|
sup_product.afterSale,
|
|
sup_product.specification,
|
|
sup_product.structure,
|
|
sup_product.scope,
|
|
sup_product.other,
|
|
sup_product.filePath,
|
|
sup_product.manufacturerIdFk,
|
|
sup_product.customerId,
|
|
sup_product.auditStatus,
|
|
sup_product.auditComment,
|
|
sup_product.sptm,
|
|
sup_product.ybbm,
|
|
sup_product.measname,
|
|
sup_product.cpms,
|
|
sup_product.relIdFk,
|
|
sup_product.hchzsb,
|
|
sup_product.remark,
|
|
sup_product.createUser,
|
|
sup_product.createTime,
|
|
sup_product.updateUser,
|
|
sup_product.updateTime,
|
|
sup_product.manufactory,
|
|
sup_product.allowNoBatch,
|
|
sup_product.allowNoExpire,
|
|
sup_product.allowNoProduct,
|
|
sup_product.allowNoSerial,
|
|
sup_company.companyName supName,
|
|
sup_manufacturer.companyName manufacturerName,
|
|
sup_manufacturer.companyName,
|
|
sup_manufacturer.agentName
|
|
FROM sup_product
|
|
inner join sup_company
|
|
on sup_product.customerId = sup_company.customerId
|
|
INNER JOIN sup_manufacturer
|
|
on sup_manufacturer.manufacturerId =
|
|
sup_product.manufacturerIdFk
|
|
|
|
<where>
|
|
<if test="id != null and id != ''">
|
|
and sup_product.id = #{id}
|
|
</if>
|
|
<if test="productId != null and productId != ''">
|
|
and sup_product.productId = #{productId}
|
|
</if>
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
and sup_product.enterpriseId = #{enterpriseId}
|
|
</if>
|
|
<if test="recordCode != null and recordCode != ''">
|
|
and sup_product.recordCode like concat('%', #{recordCode}, '%')
|
|
</if>
|
|
<if test="recordProductName != null and recordProductName != ''">
|
|
and sup_product.recordProductName like concat('%', #{recordProductName}, '%')
|
|
</if>
|
|
<if test="recordPeopleName != null and recordPeopleName != ''">
|
|
and sup_product.recordPeopleName like concat('%', #{recordPeopleName}, '%')
|
|
</if>
|
|
<if test="manufacturerIdFk != null and manufacturerIdFk != ''">
|
|
and sup_product.manufacturerIdFk = #{manufacturerIdFk}
|
|
</if>
|
|
<if test="customerId != null and customerId != ''">
|
|
and sup_product.customerId = #{customerId}
|
|
</if>
|
|
<if test="auditStatus != null and auditStatus != 20 and auditStatus != 22 and auditStatus != 21">
|
|
and sup_product.auditStatus = #{auditStatus}
|
|
</if>
|
|
<if test="auditStatus == 20">
|
|
and (sup_product.auditStatus = 0 or sup_product.auditStatus = 5 or
|
|
sup_product.auditStatus = 2)
|
|
</if>
|
|
<if test="auditStatus == 21">
|
|
and <![CDATA[ sup_product.auditStatus <> 0
|
|
]]>
|
|
</if>
|
|
<if test="relIdFk != null and relIdFk != ''">
|
|
and sup_product.relIdFk = #{relIdFk}
|
|
</if>
|
|
<if test="manufactory != null and manufactory != ''">
|
|
and sup_product.manufactory = #{manufactory}
|
|
</if>
|
|
<if test="auditStatus == 22">
|
|
and (sup_product.auditStatus = 1 or sup_product.auditStatus = 4)
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<update id="modifyRegistration" parameterType="com.glxp.api.entity.purchase.SupProductEntity">
|
|
UPDATE sup_product
|
|
<set>
|
|
<if test="enterpriseId != null">
|
|
enterpriseId=#{enterpriseId},
|
|
</if>
|
|
<if test="recordCode != null">
|
|
recordCode=#{recordCode},
|
|
</if>
|
|
<if test="recordProductName != null">
|
|
recordProductName=#{recordProductName},
|
|
</if>
|
|
<if test="productManageType != null">
|
|
productManageType=#{productManageType},
|
|
</if>
|
|
<if test="recordPeopleName != null">
|
|
recordPeopleName=#{recordPeopleName},
|
|
</if>
|
|
<if test="recordPeopleArea != null">
|
|
recordPeopleArea=#{recordPeopleArea},
|
|
</if>
|
|
<if test="recordPeopleAreaCode != null">
|
|
recordPeopleAreaCode=#{recordPeopleAreaCode},
|
|
</if>
|
|
<if test="recordPeopleAddress != null">
|
|
recordPeopleAddress=#{recordPeopleAddress},
|
|
</if>
|
|
<if test="productType != null">
|
|
productType=#{productType},
|
|
</if>
|
|
<if test="productDirectoryCode != null">
|
|
productDirectoryCode=#{productDirectoryCode},
|
|
</if>
|
|
<if test="agentName != null">
|
|
agentName=#{agentName},
|
|
</if>
|
|
<if test="agentArea != null">
|
|
agentArea=#{agentArea},
|
|
</if>
|
|
<if test="agentAreaCode != null">
|
|
agentAreaCode=#{agentAreaCode},
|
|
</if>
|
|
<if test="agentAddress != null">
|
|
agentAddress=#{agentAddress},
|
|
</if>
|
|
<if test="instructions != null">
|
|
instructions=#{instructions},
|
|
</if>
|
|
<if test="productAddress != null">
|
|
productAddress=#{productAddress},
|
|
</if>
|
|
<if test="recordText != null">
|
|
recordText=#{recordText},
|
|
</if>
|
|
<if test="placeOrigin != null">
|
|
placeOrigin=#{placeOrigin},
|
|
</if>
|
|
<if test="productionRegion != null">
|
|
productionRegion=#{productionRegion},
|
|
</if>
|
|
<if test="productionCompanyName != null">
|
|
productionCompanyName=#{productionCompanyName},
|
|
</if>
|
|
<if test="afterSale != null">
|
|
afterSale=#{afterSale},
|
|
</if>
|
|
<if test="specification != null">
|
|
specification=#{specification},
|
|
</if>
|
|
<if test="structure != null">
|
|
structure=#{structure},
|
|
</if>
|
|
<if test="scope != null">
|
|
scope=#{scope},
|
|
</if>
|
|
<if test="other != null">
|
|
other=#{other},
|
|
</if>
|
|
<if test="filePath != null">
|
|
filePath=#{filePath},
|
|
</if>
|
|
<if test="remark != null">
|
|
remark=#{remark},
|
|
</if>
|
|
<if test="createTime != null">
|
|
createTime=#{createTime},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
updateTime=#{updateTime},
|
|
</if>
|
|
<if test="manufacturerIdFk != null">
|
|
manufacturerIdFk=#{manufacturerIdFk},
|
|
</if>
|
|
<if test="customerId != null">
|
|
customerId=#{customerId},
|
|
</if>
|
|
<if test="productId != null">
|
|
productId=#{productId},
|
|
</if>
|
|
<if test="auditStatus != null">
|
|
auditStatus=#{auditStatus},
|
|
</if>
|
|
<if test="auditComment != null">
|
|
auditComment=#{auditComment},
|
|
</if>
|
|
<if test="sptm != null">
|
|
sptm=#{sptm},
|
|
</if>
|
|
<if test="ybbm != null">
|
|
ybbm=#{ybbm},
|
|
</if>
|
|
<if test="measname != null">
|
|
measname=#{measname},
|
|
</if>
|
|
<if test="hchzsb != null">
|
|
hchzsb=#{hchzsb},
|
|
</if>
|
|
<if test="relIdFk != null">
|
|
relIdFk=#{relIdFk},
|
|
</if>
|
|
<if test="manufactory != null">
|
|
manufactory=#{manufactory},
|
|
</if>
|
|
<if test="allowNoBatch != null">
|
|
allowNoBatch=#{allowNoBatch},
|
|
</if>
|
|
<if test="allowNoExpire != null">
|
|
allowNoExpire=#{allowNoExpire},
|
|
</if>
|
|
<if test="allowNoProduct != null">
|
|
allowNoProduct=#{allowNoProduct},
|
|
</if>
|
|
<if test="allowNoSerial != null">
|
|
allowNoSerial=#{allowNoSerial},
|
|
</if>
|
|
</set>
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<insert id="insertRegistration" parameterType="com.glxp.api.entity.purchase.SupProductEntity">
|
|
replace
|
|
INTO sup_product(enterpriseId, recordCode, recordProductName,
|
|
productManageType, recordPeopleName, recordPeopleArea,
|
|
recordPeopleAreaCode, recordPeopleAddress, productType,
|
|
productDirectoryCode, agentName, agentArea,
|
|
agentAreaCode, agentAddress, instructions,
|
|
productAddress, recordText, placeOrigin,
|
|
productionRegion, productionCompanyName, afterSale,
|
|
specification, structure, `scope`,
|
|
other, filePath, remark,
|
|
createTime, updateTime, manufacturerIdFk, customerId, productId
|
|
, auditStatus, auditComment, sptm, ybbm, measname, hchzsb, relIdFk, manufactory, allowNoBatch,
|
|
allowNoExpire, allowNoProduct, allowNoSerial)
|
|
values (#{enterpriseId},
|
|
#{recordCode},
|
|
#{recordProductName},
|
|
#{productManageType},
|
|
#{recordPeopleName},
|
|
#{recordPeopleArea},
|
|
#{recordPeopleAreaCode},
|
|
#{recordPeopleAddress},
|
|
#{productType},
|
|
#{productDirectoryCode},
|
|
#{agentName},
|
|
#{agentArea},
|
|
#{agentAreaCode},
|
|
#{agentAddress},
|
|
#{instructions},
|
|
#{productAddress},
|
|
#{recordText},
|
|
#{placeOrigin},
|
|
#{productionRegion},
|
|
#{productionCompanyName},
|
|
#{afterSale},
|
|
#{specification},
|
|
#{structure},
|
|
#{scope},
|
|
#{other},
|
|
#{filePath},
|
|
#{remark},
|
|
#{createTime},
|
|
#{updateTime},
|
|
#{manufacturerIdFk},
|
|
#{customerId},
|
|
#{productId}
|
|
,
|
|
#{auditStatus},
|
|
#{auditComment},
|
|
#{sptm},
|
|
#{ybbm},
|
|
#{measname},
|
|
#{hchzsb}, #{relIdFk}, #{manufactory}, #{allowNoBatch}, #{allowNoExpire}, #{allowNoProduct},
|
|
#{allowNoSerial})
|
|
</insert>
|
|
<select id="findProduct" parameterType="com.glxp.api.entity.purchase.SupProductEntity"
|
|
resultType="java.lang.Integer" >
|
|
SELECT count(*)
|
|
FROM sup_product
|
|
inner join sup_company
|
|
on sup_product.customerId = sup_company.customerId
|
|
INNER JOIN sup_manufacturer
|
|
on sup_manufacturer.manufacturerId =
|
|
sup_product.manufacturerIdFk
|
|
WHERE sup_manufacturer.companyName=(SELECT companyName FROM sup_manufacturer WHERE manufacturerId = #{manufacturerIdFk})
|
|
and recordCode=#{recordCode} and recordProductName=#{recordProductName}
|
|
</select>
|
|
<delete id="deleteById" parameterType="Map">
|
|
DELETE
|
|
FROM sup_product
|
|
WHERE id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteByEnterpriseId" parameterType="Map">
|
|
DELETE
|
|
FROM sup_product
|
|
WHERE enterpriseId = #{enterpriseId}
|
|
</delete>
|
|
<select id="findByManufactury" parameterType="Map"
|
|
resultType="com.glxp.api.entity.purchase.SupProductEntity">
|
|
select sup_product.*
|
|
from sup_product
|
|
INNER JOIN sup_manufacturer on sup_product.manufacturerIdFk = sup_manufacturer.manufacturerId
|
|
WHERE sup_manufacturer.companyName = #{manufactory}
|
|
and sup_product.recordProductName = #{cpmctymc}
|
|
limit 1
|
|
</select>
|
|
</mapper>
|