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

1629 lines
67 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.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,
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,
basic_products.cphhhbh,
basic_products.bhltcjsl,
basic_products.bhsycjsl,
basic_products.bzgg
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>
<select id="pdaDlUdiRel" 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,
basic_products.spmc,
basic_products.cplx,
basic_products.hchzsb,
basic_products.cpdls,
basic_products.price,
basic_products.bhltcjsl,
basic_products.bhsycjsl,
basic_products.basicPrductRemak1,
basic_products.basicPrductRemak2,
basic_products.basicPrductRemak3,
basic_products.basicPrductRemak4,
basic_products.basicPrductRemak5,
basic_products.basicPrductRemak6,
basic_products.basicPrductRemak7,
basic_products.basicPrductRemak8
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="manufactory != '' and manufactory != null">
AND basic_products.manufactory LIKE concat('%', #{manufactory}, '%')
</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>
<choose>
<when test="key != null and key != ''">
GROUP BY basic_udirel.id
</when>
</choose>
</select>
<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,
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,
basic_products.bhltcjsl,
basic_products.bhsycjsl,
basic_products.cphhhbh,
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
IF ( (COUNT(DISTINCT IF(basic_products.bhltcjsl = 1,basic_products.bhsycjsl,0))-1) > 1,'多种包装规格',basic_products.bzgg) AS bzgg,
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.zczbhhzbapzbhSys,
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.zdcfsycs,
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.id as productId,
basic_products.categoryName,
basic_products.catalogname1,
basic_products.catalogname2,
basic_products.catalogname3,
basic_products.matrial,
basic_products.requireScanCode,
basic_products.prepnSpec,
basic_products.levelUnit,
basic_products.prepnUnit,
basic_products.majorStatus,
basic_products.physicType,
basic_products.packMatrial,
basic_products.storageCondition,
basic_products.transportCondition,
basic_products.indate,
basic_products.majorType,
basic_products.medicareType,
basic_products.workPlaceCount,
basic_products.bhltcjsl,
basic_products.bhsycjsl,
th.hsmc hslbName
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
left join thr_hslb th on basic_products.basicPrductRemak8 = th.hsbm
<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="productsType != '' and productsType != null">
AND basic_products.productsType = #{productsType}
</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="keyWords != '' and keyWords != null">
AND (
nameCode LIKE concat('%', #{keyWords}, '%')
or ybbm LIKE concat('%', #{keyWords}, '%')
or sptm LIKE concat('%', #{keyWords}, '%')
or basic_udirel.mainId LIKE concat('%', #{keyWords}, '%')
or basic_udirel.thirdId LIKE concat('%', #{keyWords}, '%')
or basic_udirel.thirdId1 LIKE concat('%', #{keyWords}, '%')
or basic_udirel.thirdId2 LIKE concat('%', #{keyWords}, '%')
or basic_udirel.thirdId3 LIKE concat('%', #{keyWords}, '%')
or basic_udirel.thirdId4 LIKE concat('%', #{keyWords}, '%')
or basic_udirel.thirdId4 LIKE concat('%', #{keyWords}, '%')
or basic_products.cpmctymc LIKE concat('%', #{keyWords}, '%')
or basic_products.ggxh LIKE concat('%', #{keyWords}, '%')
or basic_products.zczbhhzbapzbh LIKE concat('%', #{keyWords}, '%')
or basic_products.manufactory LIKE concat('%', #{keyWords}, '%')
or basic_products.ybbm LIKE concat(#{keyWords}, '%')
or basic_products.bzgg LIKE concat('%', #{keyWords}, '%')
or basic_products.prepnSpec LIKE concat('%', #{keyWords}, '%'))
</if>
<if test="nameCode != '' and nameCode != null">
AND (
nameCode LIKE concat('%', #{nameCode}, '%')
or ybbm LIKE concat('%', #{nameCode}, '%')
or sptm LIKE concat('%', #{nameCode}, '%')
or basic_udirel.mainId LIKE concat('%', #{nameCode}, '%')
or basic_udirel.thirdId LIKE concat('%', #{nameCode}, '%')
or basic_udirel.thirdId1 LIKE concat('%', #{nameCode}, '%')
or basic_udirel.thirdId2 LIKE concat('%', #{nameCode}, '%')
or basic_udirel.thirdId3 LIKE concat('%', #{nameCode}, '%')
or basic_udirel.thirdId4 LIKE concat('%', #{nameCode}, '%'))
</if>
<if test="cpmctymc != '' and cpmctymc != null">
AND basic_products.cpmctymc LIKE concat('%', #{cpmctymc}, '%')
</if>
<if test="entireCpmctymc != '' and entireCpmctymc != null">
AND basic_products.cpmctymc = #{entireCpmctymc}
</if>
<if test="ggxh != '' and ggxh != null">
AND basic_products.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="isDisable == true">
AND basic_udirel.isDisable = true
</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 basic_products.zczbhhzbapzbh LIKE concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="diType != '' and diType != null">
AND diType = #{diType}
</if>
<if test="filterType != null and filterType == 1 and productsType == 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 == 1 and productsType == 2">
AND (thirdId is not null or thirdId1 is not null)
</if>
<if test="filterType != null and filterType == 1 and productsType == 2">
AND basic_products.nameCode is not null
</if>
<if test="filterType != null and filterType == 2 and productsType == 1">
AND basic_products.originUuid is NULL
</if>
<if test="filterType != null and filterType == 2 and productsType == 2">
AND ((thirdId = '' or thirdId is null) or (thirdId1 = '' or thirdId1 is null)
)
</if>
<if test="filterType != null and filterType == 2 and productsType == 2">
AND ( (mainId = '' or mainId is null) or (basic_products.nameCode = '' or basic_products.nameCode is null)
)
</if>
<if test="filterType != null and filterType == 3">
AND (mainId is NULL or mainId = '')
<if test="productsType == 1">
and basic_products.originUuid <![CDATA[<>]]> ''
</if>
</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="originUuid != null and originUuid != ''">
and originUuid = #{originUuid}
</if>
<if test="manufactory != null and manufactory != ''">
and basic_products.manufactory LIKE concat('%', #{manufactory}, '%')
</if>
<if test="ybbm != null and ybbm != ''">
AND basic_products.ybbm LIKE concat(#{ybbm}, '%')
</if>
<if test="cpms != null and cpms != ''">
AND basic_products.cpms LIKE concat(#{cpms}, '%')
</if>
<if test="bzgg != null and bzgg != ''">
AND basic_products.bzgg LIKE concat('%', #{bzgg}, '%')
</if>
<if test="prepnSpec != null and prepnSpec != ''">
AND basic_products.prepnSpec LIKE concat('%', #{prepnSpec}, '%')
</if>
<if test="dispatch != null">
and basic_udirel.dispatch = #{dispatch}
</if>
<if test="groupBuy != null">
and basic_udirel.groupBuy = #{groupBuy}
</if>
</where>
GROUP BY basic_udirel.id
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.bhltcjsl,
basic_products.bhsycjsl,
basic_products.categoryName,
basic_products.cphhhbh
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,zczbhhzbapzbh
</select>
<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,
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.bhltcjsl,
basic_products.bhsycjsl,
basic_products.categoryName,
basic_products.cphhhbh
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="deviceRecordKey != '' and deviceRecordKey != null">
AND basic_products.deviceRecordKey = #{deviceRecordKey}
</if>
<if test="nameCode != '' and nameCode != null">
AND basic_products.nameCode = #{nameCode}
</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, purType, attributeType, hcType, useMuti, useNum, supName, createTime,
updateTime, modifyTime,
createUser,
updateUser,
remark, useExpireTime, `dispatch`,
groupBuy, needCert, isStack,
distributeLevelCount, useLevel,
distributeLevel,
splitEnable, autoCode, distributeMaxLevel, useMaxLevel,unpackUseTime,detailSort)
values (#{id},
#{uuid},
#{mainId},
#{thirdId},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4},
#{udplatCode},
#{isUseDy},
#{isDisable},
#{isLock},
#{lockStatus},
#{isAdavence},
#{purType},
#{attributeType},
#{hcType},
#{useMuti},
#{useNum},
#{supName},
#{createTime},
#{updateTime},
#{modifyTime},
#{createUser},
#{updateUser},
#{remark},
#{useExpireTime},
#{dispatch},
#{groupBuy},
#{needCert},
#{isStack},
#{distributeLevelCount},
#{useLevel},
#{distributeLevel},
#{splitEnable},
#{autoCode}, #{distributeMaxLevel}, #{useMaxLevel}, #{unpackUseTime},#{detailSort})
</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, purType, attributeType, hcType, useMuti, useNum, supName, createTime,
updateTime, modifyTime,
createUser,
updateUser,
remark, useExpireTime, dispatch, groupBuy, needCert, isStack)
values (#{id},
#{uuid},
#{mainId},
#{thirdId},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4},
#{udplatCode},
#{isUseDy},
#{isDisable},
#{isLock},
#{lockStatus},
#{isAdavence}, #{purType}, #{attributeType}, #{hcType},
#{useMuti},
#{useNum},
#{supName},
#{createTime},
#{updateTime},
#{modifyTime},
#{createUser},
#{updateUser},
#{remark}, #{useExpireTime}, #{dispatch}, #{groupBuy}, #{needCert}, #{isStack})
</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="purType != null">
purType=#{purType},
</if>
<if test="attributeType != null">
attributeType=#{attributeType},
</if>
<if test="hcType != null">
hcType=#{hcType},
</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>
<if test="isStack != null">
isStack=#{isStack},
</if>
<if test="payFeeCode != null">
payFeeCode=#{payFeeCode},
</if>
<if test="autoCode != null">
autoCode=#{autoCode},
</if>
<if test="splitEnable != null">
splitEnable=#{splitEnable},
</if>
<if test="distributeLevelCount != null">
distributeLevelCount=#{distributeLevelCount},
</if>
<if test="useLevel != null">
useLevel=#{useLevel},
</if>
<if test="distributeMaxLevel != null">
distributeMaxLevel=#{distributeMaxLevel},
</if>
<if test="useMaxLevel != null">
useMaxLevel=#{useMaxLevel},
</if>
<if test="distributeLevel != null">
distributeLevel=#{distributeLevel},
</if>
<if test="unpackUseTime != null">
unpackUseTime=#{unpackUseTime},
</if>
<if test="detailSort != null">
detailSort=#{detailSort},
</if>
</trim>
WHERE id = #{id}
</update>
<select id="batchSelectByUuid" resultType="com.glxp.api.entity.basic.UdiRelevanceEntity">
select *
from basic_products where basic_products.deviceRecordKey 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, purType, attributeType, hcType, useMuti, useNum, supName, createTime,
updateTime, modifyTime,
createUser,
updateUser,
remark, useExpireTime, dispatch, groupBuy, needCert, isStack)
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.purType}, #{item.attributeType}, #{item.hcType},
#{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},
#{item.isStack})
</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,
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.bhltcjsl,
basic_products.bhsycjsl,
basic_products.categoryName,
basic_products.cphhhbh
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
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,
basic_products.requireScanCode,
basic_products.bhltcjsl,
basic_products.bhsycjsl,
basic_products.bzgg,
company_product_relevance.unitFk,
basic_corp.name companyName,
basic_products.cphhhbh
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>
</mapper>