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.
udi-spms-java/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml

1326 lines
53 KiB
XML

2 years ago
<?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.basic.UdiRelevanceDao">
<select id="filterUdiRelevance" parameterType="com.glxp.api.req.basic.FilterUdiRelRequest"
resultType="com.glxp.api.res.basic.UdiRelevanceResponse">
select basic_udirel.*,
basic_udirel.id relId,
basic_products.originUuid,
basic_products.nameCode,
basic_products.deviceRecordKey,
basic_products.packRatio,
basic_products.packUnit,
basic_products.packLevel,
basic_products.bhxjsl,
basic_products.bhzxxsbzsl,
basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,
basic_products.bzcj,
basic_products.cpmctymc,
basic_products.cplb,
basic_products.flbm,
basic_products.ggxh,
basic_products.qxlb,
basic_products.tyshxydm,
basic_products.ylqxzcrbarmc,
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,
basic_products.sydycpbs,
basic_products.sjcpbm,
basic_products.versionNumber,
basic_products.diType,
basic_products.ybbm,
basic_products.sptm,
basic_products.manufactory,
basic_products.measname,
basic_products.productType,
basic_products.scbssfbhph,
basic_products.scbssfbhxlh,
basic_products.scbssfbhscrq,
basic_products.scbssfbhsxrq,
basic_products.cpms,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.allowNoSerial,
2 years ago
basic_products.spmc,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
basic_products.price,
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8,
basic_products.sfwblztlcp,
basic_products.cgzmraqxgxx,
basic_products.sfbjwycxsy,
basic_products.zdcfsycs,
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.categoryName
2 years ago
FROM basic_udirel
inner JOIN basic_products
ON basic_products.uuid = basic_udirel.uuid
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="supName != '' and supName != null">
AND supName LIKE concat('%', #{supName}, '%')
</if>
<if test="cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode}, '%')
</if>
<if test="thirdId != '' and thirdId != null">
AND thirdId LIKE concat(#{thirdId}, '%')
</if>
<if test="uuid != '' and uuid != null">
AND basic_udirel.uuid = #{uuid}
</if>
<if test="id != '' and id != null">
AND basic_udirel.id = #{id}
</if>
<if test="udplatCode != '' and udplatCode != null">
AND basic_udirel.udplatCode = #{udplatCode}
</if>
<if test="diType != null">
AND basic_products.diType = #{diType}
</if>
<if test="lockStatus != '' and lockStatus != null">
AND basic_udirel.lockStatus = #{lockStatus}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat(#{zczbhhzbapzbh}, '%')
</if>
<if test="lastUpdateTime != null and lastUpdateTime != ''">
<![CDATA[
and DATE_FORMAT(basic_udirel.updateTime, '%Y-%m-%d %H:%i:%S') >=
DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="mainId != '' and mainId != null">
AND mainId = #{mainId}
</if>
<if test="unionFilterStr != '' and unionFilterStr != null">
or basic_products.cpmctymc LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.ylqxzcrbarmc LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.ggxh LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.zczbhhzbapzbh LIKE concat('%', #{unionFilterStr}, '%')
</if>
<if test="isAdavence != '' and isAdavence != null">
AND isAdavence = #{isAdavence}
</if>
<if test="uniqueNameCode != '' and uniqueNameCode != null">
AND nameCode = #{uniqueNameCode}
</if>
</where>
ORDER BY modifyTime DESC
</select>
<select id="selectPackLevel" parameterType="java.lang.String"
resultType="java.lang.String">
select
basic_products.packLevel
FROM basic_udirel
inner JOIN basic_products
ON basic_products.uuid = basic_udirel.uuid
<where>
<if test="nameCode != '' and nameCode != null">
AND basic_products.nameCode = #{nameCode}
</if>
</where>
LIMIT 1
</select>
2 years ago
<select id="filterUdiJoinSup" parameterType="com.glxp.api.req.basic.FilterUdiRelRequest"
resultType="com.glxp.api.res.basic.UdiRelevanceResponse">
select basic_udirel.*,
basic_products.originUuid,
basic_products.nameCode,
basic_products.deviceRecordKey,
basic_products.packRatio,
basic_products.packUnit,
basic_products.packLevel,
basic_products.bhxjsl,
basic_products.bhzxxsbzsl,
basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,
basic_products.bzcj,
basic_products.cpmctymc,
basic_products.cplb,
basic_products.flbm,
basic_products.ggxh,
basic_products.qxlb,
basic_products.tyshxydm,
basic_products.ylqxzcrbarmc,
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,
basic_products.sydycpbs,
basic_products.sjcpbm,
basic_products.versionNumber,
basic_products.diType,
basic_products.ybbm,
basic_products.sptm,
basic_products.manufactory,
basic_products.measname,
basic_products.productType,
basic_products.scbssfbhph,
basic_products.scbssfbhxlh,
basic_products.scbssfbhscrq,
basic_products.scbssfbhsxrq,
basic_products.cpms,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.allowNoSerial,
2 years ago
basic_products.spmc,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
company_product_relevance.price,
2 years ago
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8,
basic_products.sfwblztlcp,
basic_products.cgzmraqxgxx,
basic_products.sfbjwycxsy,
basic_products.zdcfsycs,
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.categoryName,
2 years ago
company_product_relevance.unitFk,
basic_corp.name companyName
FROM basic_udirel
inner JOIN basic_products
ON basic_products.uuid = basic_udirel.uuid
left join company_product_relevance
on basic_udirel.id = company_product_relevance.udiRlIdFk
left JOIN basic_corp on basic_corp.erpId = company_product_relevance.customerId
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="supName != '' and supName != null">
AND supName LIKE concat('%', #{supName}, '%')
</if>
<if test="cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode}, '%')
</if>
<if test="thirdId != '' and thirdId != null">
AND thirdId LIKE concat(#{thirdId}, '%')
</if>
<if test="uuid != '' and uuid != null">
AND basic_udirel.uuid = #{uuid}
</if>
<if test="unitFk != '' and unitFk != null">
AND company_product_relevance.unitFk = #{unitFk}
</if>
<if test="id != '' and id != null">
AND basic_udirel.id = #{id}
</if>
<if test="udplatCode != '' and udplatCode != null">
AND basic_udirel.udplatCode = #{udplatCode}
</if>
<if test="diType != null">
AND basic_products.diType = #{diType}
</if>
<if test="lockStatus != '' and lockStatus != null">
AND basic_udirel.lockStatus = #{lockStatus}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat(#{zczbhhzbapzbh}, '%')
</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>
<if test="mainId != '' and mainId != null">
AND mainId = #{mainId}
</if>
<if test="unionFilterStr != '' and unionFilterStr != null">
or basic_products.cpmctymc LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.ylqxzcrbarmc LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.ggxh LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.zczbhhzbapzbh LIKE concat('%', #{unionFilterStr}, '%')
</if>
<if test="isAdavence != '' and isAdavence != null">
AND isAdavence = #{isAdavence}
</if>
<if test="uniqueNameCode != '' and uniqueNameCode != null">
AND nameCode = #{uniqueNameCode}
</if>
<if test="relIds != null and relIds.size() > 0">
and basic_udirel.id in
<foreach collection="relIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
<select id="filterUdiGp" parameterType="com.glxp.api.req.basic.FilterUdiRelRequest"
resultType="com.glxp.api.res.basic.UdiRelevanceResponse">
select basic_udirel.*,
bht.name classifyName,
2 years ago
basic_products.originUuid,
basic_products.nameCode,
basic_products.deviceRecordKey,
basic_products.packRatio,
basic_products.packUnit,
basic_products.packLevel,
basic_products.bhxjsl,
basic_products.bhzxxsbzsl,
basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,
basic_products.bzcj,
basic_products.cpmctymc,
basic_products.cplb,
basic_products.flbm,
basic_products.ggxh,
basic_products.qxlb,
basic_products.tyshxydm,
basic_products.ylqxzcrbarmc,
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,
basic_products.sydycpbs,
basic_products.sjcpbm,
basic_products.versionNumber,
basic_products.diType,
basic_products.ybbm,
basic_products.sptm,
basic_products.manufactory,
basic_products.measname,
basic_products.productType,
basic_products.scbssfbhph,
basic_products.scbssfbhxlh,
basic_products.scbssfbhscrq,
basic_products.scbssfbhsxrq,
basic_products.cpms,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.allowNoSerial,
2 years ago
basic_products.spmc,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
basic_products.price,
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.sfwblztlcp,
basic_products.cgzmraqxgxx,
basic_products.sfbjwycxsy,
basic_products.zdcfsycs,
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.categoryName,
2 years ago
basic_products.groupBuy,
basic_products.basicPrductRemak8
2 years ago
FROM basic_products
inner JOIN basic_udirel
ON basic_products.uuid = basic_udirel.uuid
left join basic_hosp_type bht on basic_udirel.relCode = bht.code
2 years ago
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="relCode != '' and relCode != null">
AND relCode = #{relCode}
</if>
<if test="bindType != '' and bindType != null">
AND (relCode is null
or trim(relCode) = '')
2 years ago
</if>
<if test="supName != '' and supName != null">
AND supName LIKE concat('%', #{supName}, '%')
</if>
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode}, '%')
</if>
<if test="entireCpmctymc != '' and entireCpmctymc != null">
AND cpmctymc = #{entireCpmctymc}
</if>
2 years ago
<if test="cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat('%', #{cpmctymc}, '%')
</if>
<if test="ggxh != '' and ggxh != null">
AND ggxh LIKE concat('%', #{ggxh}, '%')
</if>
<if test="unionCode != '' and unionCode != null">
and (
nameCode LIKE concat('%', #{unionCode}, '%')
or ybbm LIKE concat('%', #{unionCode}, '%')
or sptm LIKE concat('%', #{unionCode}, '%'))
2 years ago
</if>
<if test="isDisable == false">
AND (basic_udirel.isDisable is null or basic_udirel.isDisable = false)
</if>
<if test="thrPiId != '' and thrPiId != null">
and (thirdId LIKE concat('%', #{thrPiId}, '%')
or thirdId1 LIKE concat('%', #{thrPiId}, '%')
or thirdId2 LIKE concat('%', #{thrPiId}, '%')
or thirdId3 LIKE concat('%', #{thrPiId}, '%')
or thirdId4 LIKE concat('%', #{thrPiId}, '%'))
</if>
<if test="uuid != '' and uuid != null">
AND basic_udirel.uuid = #{uuid}
</if>
<if test="thirdId != '' and thirdId != null">
AND thirdId = #{thirdId}
</if>
<if test="udplatCode != '' and udplatCode != null">
AND udplatCode = #{udplatCode}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat(#{zczbhhzbapzbh}, '%')
</if>
<if test="diType != '' and diType != null">
AND diType = #{diType}
</if>
<if test="filterType != null and filterType == 1">
AND (thirdId <![CDATA[<>]]> '' or thirdId1 <![CDATA[<>]]> '' or thirdId2 <![CDATA[<>]]> '' or
thirdId3 <![CDATA[<>]]> '' or thirdId4 <![CDATA[<>]]> '')
and basic_products.originUuid <![CDATA[<>]]> ''
2 years ago
</if>
<if test="filterType != null and filterType == 2">
AND basic_products.originUuid is NULL
</if>
<if test="filterType != null and filterType == 3">
AND (mainId is NULL or mainId = '')
and basic_products.originUuid <![CDATA[<>]]> ''
2 years ago
</if>
<if test="filterType != null and filterType == 4">
AND thirdId1 is NULL
and basic_products.originUuid <![CDATA[<>]]> ''
2 years ago
</if>
<if test="filterType != null and filterType == 5">
AND thirdId2 is NULL
and basic_products.originUuid <![CDATA[<>]]> ''
2 years ago
</if>
<if test="filterType != null and filterType == 6">
AND thirdId3 is NULL
and basic_products.originUuid <![CDATA[<>]]> ''
2 years ago
</if>
<if test="filterType != null and filterType == 7">
AND thirdId4 is NULL
and basic_products.originUuid <![CDATA[<>]]> ''
2 years ago
</if>
<if test="filterType != null and filterType == 10">
AND basic_udirel.updateTime is NULL
</if>
<if test="lockStatus != '' and lockStatus != null">
AND basic_udirel.lockStatus = #{lockStatus}
</if>
<if test="mainId != '' and mainId != null">
AND mainId = #{mainId}
</if>
<if test="id != '' and id != null">
AND basic_udirel.id = #{id}
</if>
2 years ago
<if test="originUuid != null and originUuid != ''">
and originUuid = #{originUuid}
</if>
2 years ago
<if test="manufactory != null and manufactory != ''">
and manufactory LIKE concat('%', #{manufactory}, '%')
2 years ago
</if>
<if test="dispatch != null">
and basic_udirel.dispatch = #{dispatch}
</if>
<if test="groupBuy != null">
and basic_udirel.groupBuy = #{groupBuy}
</if>
2 years ago
</where>
ORDER BY modifyTime DESC
</select>
<!-- 资质证书选入产品分组查询-->
<select id="filterCertUdi" parameterType="com.glxp.api.req.basic.FilterUdiRelRequest"
resultType="com.glxp.api.res.basic.UdiRelevanceResponse">
select basic_udirel.*,
bht.name classifyName,
basic_products.originUuid,
basic_products.nameCode,
basic_products.deviceRecordKey,
basic_products.packRatio,
basic_products.packUnit,
basic_products.packLevel,
basic_products.bhxjsl,
basic_products.bhzxxsbzsl,
basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,
basic_products.bzcj,
basic_products.cpmctymc,
basic_products.cplb,
basic_products.flbm,
basic_products.ggxh,
basic_products.qxlb,
basic_products.tyshxydm,
basic_products.ylqxzcrbarmc,
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,
basic_products.sydycpbs,
basic_products.sjcpbm,
basic_products.versionNumber,
basic_products.diType,
basic_products.ybbm,
basic_products.sptm,
basic_products.manufactory,
basic_products.measname,
basic_products.productType,
basic_products.scbssfbhph,
basic_products.scbssfbhxlh,
basic_products.scbssfbhscrq,
basic_products.scbssfbhsxrq,
basic_products.cpms,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.allowNoSerial,
basic_products.spmc,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
basic_products.price,
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8,
basic_products.sfwblztlcp,
basic_products.cgzmraqxgxx,
basic_products.sfbjwycxsy,
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.categoryName
FROM basic_products
inner JOIN basic_udirel
ON basic_products.uuid = basic_udirel.uuid
left join basic_hosp_type bht on basic_udirel.relCode = bht.code
inner join company_product_relevance on company_product_relevance.udiRlIdFk = basic_udirel.id
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="manufactory != '' and manufactory != null">
AND manufactory LIKE concat('%', #{manufactory}, '%')
</if>
<if test="relCode != '' and relCode != null">
AND relCode = #{relCode}
</if>
<if test="bindType != '' and bindType != null">
AND relCode is null
or trim(relCode) = ''
</if>
<if test="supName != '' and supName != null">
AND supName LIKE concat('%', #{supName}, '%')
</if>
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode}, '%')
</if>
<if test="cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat('%', #{cpmctymc}, '%')
</if>
<if test="ggxh != '' and ggxh != null">
AND ggxh LIKE concat('%', #{ggxh}, '%')
</if>
<if test="unionCode != '' and unionCode != null">
and (
nameCode LIKE concat('%', #{unionCode}, '%')
or ybbm LIKE concat('%', #{unionCode}, '%')
or sptm LIKE concat('%', #{unionCode}, '%'))
</if>
<if test="isDisable == false">
AND (basic_udirel.isDisable is null or basic_udirel.isDisable = false)
</if>
<if test="thrPiId != '' and thrPiId != null">
and (thirdId LIKE concat('%', #{thrPiId}, '%')
or thirdId1 LIKE concat('%', #{thrPiId}, '%')
or thirdId2 LIKE concat('%', #{thrPiId}, '%')
or thirdId3 LIKE concat('%', #{thrPiId}, '%')
or thirdId4 LIKE concat('%', #{thrPiId}, '%'))
</if>
<if test="uuid != '' and uuid != null">
AND basic_udirel.uuid = #{uuid}
</if>
<if test="thirdId != '' and thirdId != null">
AND thirdId = #{thirdId}
</if>
<if test="udplatCode != '' and udplatCode != null">
AND udplatCode = #{udplatCode}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat(#{zczbhhzbapzbh}, '%')
</if>
<if test="diType != '' and diType != null">
AND diType = #{diType}
</if>
<if test="filterType != null and filterType == 1">
AND (thirdId <![CDATA[<>]]> '' or thirdId1 <![CDATA[<>]]> '' or thirdId2 <![CDATA[<>]]> '' or
thirdId3 <![CDATA[<>]]> '' or thirdId4 <![CDATA[<>]]> '')
and basic_products.originUuid <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 2">
AND basic_products.originUuid is NULL
</if>
<if test="filterType != null and filterType == 3">
AND (mainId is NULL or mainId = '')
and basic_products.originUuid <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 4">
AND thirdId1 is NULL
and basic_products.originUuid <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 5">
AND thirdId2 is NULL
and basic_products.originUuid <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 6">
AND thirdId3 is NULL
and basic_products.originUuid <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 7">
AND thirdId4 is NULL
and basic_products.originUuid <![CDATA[<>]]> ''
</if>
<if test="filterType != null and filterType == 10">
AND basic_udirel.updateTime is NULL
</if>
<if test="lockStatus != '' and lockStatus != null">
AND basic_udirel.lockStatus = #{lockStatus}
</if>
<if test="mainId != '' and mainId != null">
AND mainId = #{mainId}
</if>
<if test="id != '' and id != null">
AND basic_udirel.id = #{id}
</if>
<if test="customerId != '' and customerId != null">
AND company_product_relevance.unitFk = #{customerId}
</if>
<if test="tyshxydm != '' and tyshxydm != null">
AND basic_products.tyshxydm = #{tyshxydm}
</if>
</where>
GROUP BY cpmctymc, manufactory
</select>
2 years ago
<select id="contrastJoinSelect" parameterType="com.glxp.api.req.basic.FilterUdiRelRequest"
resultType="com.glxp.api.res.basic.UdiRelevanceResponse">
select basic_udirel.*,
basic_products.originUuid,
basic_products.nameCode,
basic_products.deviceRecordKey,
basic_products.packRatio,
basic_products.packUnit,
basic_products.packLevel,
basic_products.bhxjsl,
basic_products.bhzxxsbzsl,
basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,
basic_products.bzcj,
basic_products.cpmctymc,
basic_products.cplb,
basic_products.flbm,
basic_products.ggxh,
basic_products.qxlb,
basic_products.tyshxydm,
basic_products.ylqxzcrbarmc,
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,
basic_products.sydycpbs,
basic_products.sjcpbm,
basic_products.versionNumber,
basic_products.diType,
basic_products.ybbm,
basic_products.sptm,
basic_products.manufactory,
basic_products.measname,
basic_products.productType,
basic_products.scbssfbhph,
basic_products.scbssfbhxlh,
basic_products.scbssfbhscrq,
basic_products.scbssfbhsxrq,
basic_products.cpms,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.allowNoSerial,
2 years ago
basic_products.spmc,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
basic_products.price,
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8,
basic_products.sfwblztlcp,
basic_products.cgzmraqxgxx,
basic_products.sfbjwycxsy,
basic_products.zdcfsycs,
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.categoryName
2 years ago
from basic_udirel
INNER JOIN basic_products on basic_udirel.uuid = basic_products.uuid
<where>
<if test="uuid != '' and uuid != null">
AND basic_udirel.uuid = #{uuid}
</if>
<if test="mainId != '' and mainId != null">
AND basic_udirel.mainId = #{mainId}
</if>
<if test="originUuid != '' and originUuid != null">
AND basic_products.originUuid = #{originUuid}
</if>
<if test="id != '' and id != null">
AND basic_udirel.id = #{id}
</if>
<if test="thirdSys != '' and thirdSys != null">
<if test="thirdSys == 'thirdId'">
AND basic_udirel.thirdId = #{mainId}
</if>
<if test="thirdSys == 'thirdId1'">
AND basic_udirel.thirdId1 = #{mainId}
</if>
<if test="thirdSys == 'thirdId2'">
AND basic_udirel.thirdId2 = #{mainId}
</if>
<if test="thirdSys == 'thirdId3'">
AND basic_udirel.thirdId3 = #{mainId}
</if>
<if test="thirdSys == 'thirdId4'">
AND basic_udirel.thirdId4 = #{mainId}
</if>
</if>
</where>
</select>
<select id="selectByUuid" parameterType="java.lang.String"
resultType="com.glxp.api.entity.basic.UdiRelevanceEntity">
select *
FROM basic_udirel
<where>
<if test="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
</where>
</select>
<select id="selectById" parameterType="java.lang.Long"
resultType="com.glxp.api.entity.basic.UdiRelevanceEntity">
select *
FROM basic_udirel
WHERE id = #{id}
</select>
<select id="selectUuidById" parameterType="java.lang.String"
resultType="java.lang.String">
select uuid
FROM basic_udirel
WHERE id = #{relId}
</select>
<select id="selectByThirdId" parameterType="com.glxp.api.req.basic.FilterUdiRelRequest"
resultType="com.glxp.api.entity.basic.UdiRelevanceEntity">
select *
FROM basic_udirel
<where>
<if test="thirdId != '' and thirdId != null">
AND thirdId = #{thirdId}
</if>
<if test="thirdId1 != '' and thirdId1 != null">
AND thirdId1 = #{thirdId1}
</if>
<if test="thirdId2 != '' and thirdId2 != null">
AND thirdId2 = #{thirdId2}
</if>
<if test="thirdId3 != '' and thirdId3 != null">
AND thirdId3 = #{thirdId3}
</if>
<if test="thirdId4 != '' and thirdId4 != null">
AND thirdId4 = #{thirdId4}
</if>
<if test="mainId != '' and mainId != null">
AND mainId = #{mainId}
</if>
</where>
limit 1
</select>
<select id="filterEntity" parameterType="com.glxp.api.req.basic.FilterUdiRelRequest"
resultType="com.glxp.api.entity.basic.UdiRelevanceEntity">
select *
FROM basic_udirel
<where>
<if test="thirdId != '' and thirdId != null">
AND thirdId = #{thirdId}
</if>
<if test="thirdId1 != '' and thirdId1 != null">
AND thirdId1 = #{thirdId1}
</if>
<if test="thirdId2 != '' and thirdId2 != null">
AND thirdId2 = #{thirdId2}
</if>
<if test="thirdId3 != '' and thirdId3 != null">
AND thirdId3 = #{thirdId3}
</if>
<if test="thirdId4 != '' and thirdId4 != null">
AND thirdId4 = #{thirdId4}
</if>
<if test="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="mainId != '' and mainId != null">
AND mainId = #{mainId}
</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>
order by modifyTime desc
</select>
<insert id="insertUdiRelevance" keyProperty="id" parameterType="com.glxp.api.entity.basic.UdiRelevanceEntity">
replace
INTO basic_udirel
(id, uuid, mainId, thirdId, thirdId1, thirdId2, thirdId3, thirdId4, udplatCode, isUseDy, isDisable,
isLock,
lockStatus, isAdavence, useMuti, useNum, supName, createTime, updateTime, modifyTime, createUser,
updateUser,
remark, useExpireTime, dispatch, groupBuy, needCert)
2 years ago
values (#{id},
#{uuid},
#{mainId},
#{thirdId},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4},
#{udplatCode},
#{isUseDy},
#{isDisable},
#{isLock},
#{lockStatus},
#{isAdavence},
#{useMuti},
#{useNum},
#{supName},
#{createTime},
#{updateTime},
#{modifyTime},
#{createUser},
#{updateUser},
#{remark}, #{useExpireTime}, #{dispatch}, #{groupBuy}, #{needCert})
2 years ago
</insert>
<insert id="insertUdiRelevanceignore" keyProperty="id"
parameterType="com.glxp.api.entity.basic.UdiRelevanceEntity">
insert
ignore
INTO basic_udirel
(id, uuid, mainId, thirdId, thirdId1, thirdId2, thirdId3, thirdId4, udplatCode, isUseDy, isDisable,
isLock,
lockStatus, isAdavence, useMuti, useNum, supName, createTime, updateTime, modifyTime, createUser,
updateUser,
remark, useExpireTime, dispatch, groupBuy, needCert)
2 years ago
values (#{id},
#{uuid},
#{mainId},
#{thirdId},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4},
#{udplatCode},
#{isUseDy},
#{isDisable},
#{isLock},
#{lockStatus},
#{isAdavence},
#{useMuti},
#{useNum},
#{supName},
#{createTime},
#{updateTime},
#{modifyTime},
#{createUser},
#{updateUser},
#{remark}, #{useExpireTime}, #{dispatch}, #{groupBuy}, #{needCert})
2 years ago
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM basic_udirel
WHERE id = #{id}
</delete>
<delete id="deleteByIds" parameterType="java.util.List">
DELETE
FROM basic_udirel WHERE id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteByUuid" parameterType="Map">
DELETE
FROM basic_udirel
WHERE uuid = #{uuid}
</delete>
<update id="updateUdiRelevance" parameterType="com.glxp.api.entity.basic.UdiRelevanceEntity">
UPDATE basic_udirel
<trim prefix="set" suffixOverrides=",">
<if test="uuid != null">
uuid=#{uuid},
</if>
<if test="mainId != null">
mainId=#{mainId},
</if>
<if test="thirdId != null">
thirdId=#{thirdId},
</if>
<if test="thirdId1 != null">
thirdId1=#{thirdId1},
</if>
<if test="thirdId2 != null">
thirdId2=#{thirdId2},
</if>
<if test="thirdId3 != null">
thirdId3=#{thirdId3},
</if>
<if test="thirdId4 != null">
thirdId4=#{thirdId4},
</if>
<if test="udplatCode != null">
udplatCode=#{udplatCode},
</if>
<if test="isUseDy != null">
isUseDy=#{isUseDy},
</if>
<if test="isDisable != null">
isDisable=#{isDisable},
</if>
<if test="isLock != null">
isLock=#{isLock},
</if>
<if test="lockStatus != null">
lockStatus=#{lockStatus},
</if>
<if test="isAdavence != null">
isAdavence=#{isAdavence},
</if>
<if test="useMuti != null">
useMuti=#{useMuti},
</if>
<if test="useNum != null">
useNum=#{useNum},
</if>
<if test="supName != null">
supName=#{supName},
</if>
<if test="createTime != null">
createTime=#{createTime},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
<if test="modifyTime != null">
modifyTime=#{modifyTime},
</if>
<if test="createUser != null">
createUser=#{createUser},
</if>
<if test="updateUser != null">
updateUser=#{updateUser},
</if>
<if test="remark != null">
remark=#{remark},
</if>
<if test="useExpireTime != null">
useExpireTime=#{useExpireTime},
</if>
<if test="dispatch != null">
dispatch=#{dispatch},
</if>
<if test="groupBuy != null">
groupBuy=#{groupBuy},
</if>
<if test="lowStockNum != null">
lowStockNum=#{lowStockNum},
</if>
<if test="overStockNum != null">
overStockNum=#{overStockNum},
</if>
<if test="recentDateTime != null">
recentDateTime=#{recentDateTime},
</if>
<if test="isDateBy != null">
isDateBy=#{isDateBy},
</if>
<if test="relCode != '' and relCode != null">
relCode=#{relCode},
</if>
<if test="needCert != null">
needCert=#{needCert},
</if>
2 years ago
</trim>
WHERE id = #{id}
</update>
<select id="batchSelectByUuid" resultType="com.glxp.api.entity.basic.UdiRelevanceEntity">
select *
from basic_udirel where uuid in
<foreach collection="uuids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<select id="batchSelectByIds" resultType="com.glxp.api.entity.basic.UdiRelevanceEntity">
select *
from basic_udirel where id in
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<insert id="importUdiRelevance" parameterType="java.util.List">
replace
into basic_udirel
(id, uuid, mainId, thirdId, thirdId1, thirdId2, thirdId3, thirdId4, udplatCode, isUseDy, isDisable,
isLock,
lockStatus, isAdavence, useMuti, useNum, supName, createTime, updateTime, modifyTime, createUser,
updateUser,
remark, useExpireTime, dispatch, groupBuyneedCert)
2 years ago
values
<foreach collection="udiRelevanceEntities" item="item" index="index" separator=",">
(#{item.id},
#{item.uuid},
#{item.mainId},
#{item.thirdId},
#{item.thirdId1},
#{item.thirdId2},
#{item.thirdId3},
#{item.thirdId4},
#{item.udplatCode},
#{item.isUseDy},
#{item.isDisable},
#{item.isLock},
#{item.lockStatus},
#{item.isAdavence},
#{item.useMuti},
#{item.useNum},
#{item.supName},
#{item.createTime},
#{item.updateTime},
#{item.modifyTime},
#{item.createUser},
#{item.updateUser},
#{item.remark}, #{item.useExpireTime}, #{item.dispatch}, #{item.groupBuy}#{item.needCert})
2 years ago
</foreach>
</insert>
<select id="selectGroupByNameCode" parameterType="java.lang.String"
resultType="com.glxp.api.res.basic.UdiRelevanceResponse">
select basic_udirel.*,
basic_products.originUuid,
basic_products.nameCode,
basic_products.deviceRecordKey,
basic_products.packRatio,
basic_products.packUnit,
basic_products.packLevel,
basic_products.bhxjsl,
basic_products.bhzxxsbzsl,
basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,
basic_products.bzcj,
basic_products.cpmctymc,
basic_products.cplb,
basic_products.flbm,
basic_products.ggxh,
basic_products.qxlb,
basic_products.tyshxydm,
basic_products.ylqxzcrbarmc,
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,
basic_products.sydycpbs,
basic_products.sjcpbm,
basic_products.versionNumber,
basic_products.diType,
basic_products.ybbm,
basic_products.sptm,
basic_products.manufactory,
basic_products.measname,
basic_products.productType,
basic_products.scbssfbhph,
basic_products.scbssfbhxlh,
basic_products.scbssfbhscrq,
basic_products.scbssfbhsxrq,
basic_products.cpms,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.allowNoSerial,
2 years ago
basic_products.spmc,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
basic_products.price,
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8,
basic_products.sfwblztlcp,
basic_products.cgzmraqxgxx,
basic_products.sfbjwycxsy,
basic_products.zdcfsycs,
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.categoryName
2 years ago
FROM basic_udirel
INNER JOIN basic_products
on basic_udirel.uuid = basic_products.uuid
<where>
<if test="nameCode != null">
AND nameCode = #{nameCode}
</if>
<if test="isDisable == false">
AND (basic_udirel.isDisable is null or basic_udirel.isDisable = false)
</if>
<if test="isDisable != null and isDisable == true">
AND isDisable = #{isDisable}
</if>
<if test="isDisable != null and isDisable == false">
AND (isDisable is null or isDisable = false)
</if>
</where>
group by basic_udirel.id
</select>
<select id="selectProductNameByRelId" resultType="java.lang.String">
select basic_products.cpmctymc
from basic_udirel
left join basic_products on basic_udirel.uuid = basic_products.uuid
where basic_udirel.id = #{relId}
</select>
<update id="updateBatchById" parameterType="java.util.List">
<foreach collection="list" item="item" separator=";">
update
basic_udirel
set `relCode` = #{item.relCode}
where id = #{item.id}
</foreach>
</update>
<select id="selectRemindParams" resultType="com.glxp.api.entity.basic.UdiRelevanceEntity">
select id, lowStockNum, overStockNum, recentDateTime
2 years ago
from basic_udirel
where id = #{relId}
</select>
<select id="selectProductByRelCode" resultType="Long">
select count(*)
from basic_udirel
where basic_udirel.relCode = #{relCode}
</select>
<select id="selectRelIdByNameCode" resultType="java.lang.String">
select basic_udirel.id
from basic_udirel
inner join basic_products on basic_udirel.uuid = basic_products.uuid
where basic_products.nameCode = #{nameCode}
</select>
<select id="selectOneUdiJoinSup" resultType="com.glxp.api.res.basic.UdiRelevanceResponse">
select basic_udirel.*,
basic_products.originUuid,
basic_products.nameCode,
basic_products.deviceRecordKey,
basic_products.packRatio,
basic_products.packUnit,
basic_products.packLevel,
basic_products.bhxjsl,
basic_products.bhzxxsbzsl,
basic_products.zxxsbzbhsydysl,
basic_products.bhxjcpbm,
basic_products.bzcj,
basic_products.cpmctymc,
basic_products.cplb,
basic_products.flbm,
basic_products.ggxh,
basic_products.qxlb,
basic_products.tyshxydm,
basic_products.ylqxzcrbarmc,
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,
basic_products.sydycpbs,
basic_products.sjcpbm,
basic_products.versionNumber,
basic_products.diType,
basic_products.ybbm,
basic_products.sptm,
basic_products.manufactory,
basic_products.measname,
basic_products.productType,
basic_products.scbssfbhph,
basic_products.scbssfbhxlh,
basic_products.scbssfbhscrq,
basic_products.scbssfbhsxrq,
basic_products.cpms,
basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,
basic_products.allowNoSerial,
basic_products.spmc,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
company_product_relevance.price,
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8,
basic_products.sfwblztlcp,
basic_products.cgzmraqxgxx,
basic_products.sfbjwycxsy,
basic_products.zdcfsycs,
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.categoryName,
company_product_relevance.unitFk,
basic_corp.name companyName
FROM basic_udirel
inner JOIN basic_products
ON basic_products.uuid = basic_udirel.uuid
left join company_product_relevance
on basic_udirel.id = company_product_relevance.udiRlIdFk
left JOIN basic_corp on basic_corp.erpId = company_product_relevance.customerId
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="supName != '' and supName != null">
AND supName LIKE concat('%', #{supName}, '%')
</if>
<if test="cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode}, '%')
</if>
<if test="thirdId != '' and thirdId != null">
AND thirdId LIKE concat(#{thirdId}, '%')
</if>
<if test="uuid != '' and uuid != null">
AND basic_udirel.uuid = #{uuid}
</if>
<if test="unitFk != '' and unitFk != null">
AND company_product_relevance.unitFk = #{unitFk}
</if>
<if test="id != '' and id != null">
AND basic_udirel.id = #{id}
</if>
<if test="udplatCode != '' and udplatCode != null">
AND basic_udirel.udplatCode = #{udplatCode}
</if>
<if test="diType != null">
AND basic_products.diType = #{diType}
</if>
<if test="lockStatus != '' and lockStatus != null">
AND basic_udirel.lockStatus = #{lockStatus}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat(#{zczbhhzbapzbh}, '%')
</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>
<if test="mainId != '' and mainId != null">
AND mainId = #{mainId}
</if>
<if test="unionFilterStr != '' and unionFilterStr != null">
or basic_products.cpmctymc LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.ylqxzcrbarmc LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.ggxh LIKE concat('%', #{unionFilterStr}, '%')
or basic_products.zczbhhzbapzbh LIKE concat('%', #{unionFilterStr}, '%')
</if>
<if test="isAdavence != '' and isAdavence != null">
AND isAdavence = #{isAdavence}
</if>
<if test="uniqueNameCode != '' and uniqueNameCode != null">
AND nameCode = #{uniqueNameCode}
</if>
<if test="relIds != null and relIds.size() > 0">
and basic_udirel.id in
<foreach collection="relIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
limit 1
</select>
2 years ago
</mapper>