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.
udisyncdl-java/src/main/resources/mybatis/mapper/udi/ProductInfoMapper.xml

407 lines
16 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.udidl.admin.dao.udi.ProductInfoMapper">
<select id="filterProductInfo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
SELECT * FROM productinfo
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat(#{ylqxzcrbarmc},'%')
</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="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="deviceRecordKey != '' and deviceRecordKey != null">
AND deviceRecordKey = #{deviceRecordKey}
</if>
<if test="ggxh != '' and ggxh != null">
AND ggxh LIKE concat(#{ggxh},'%')
</if>
<if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm}
</if>
<if test="updateTime!=null and updateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
</where>
</select>
<select id="filterCpmctymc" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select * from productinfo
<where>
<if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm}
</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="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="updateTime!=null and updateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
</where>
GROUP BY cpmctymc
</select>
<select id="filterUdiByTyshxydm" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
SELECT * FROM productinfo
<where>
diType = 1
<if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm}
</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="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="updateTime!=null and updateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
</where>
GROUP BY nameCode
</select>
<select id="selectAllByUuid" parameterType="java.util.List"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select * from productinfo where
uuid in (
<foreach collection="ids" item="item" index="index"
separator=",">
#{item}
</foreach>
)
</select>
<select id="selectByUuid" parameterType="Map"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select *
from productinfo
where uuid = #{uuid}
</select>
<!-- CHAR_LENGTH(nameCode) <![CDATA[ >= ]]> 14-->
<select id="filterUdiByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select p.* from productinfo p INNER JOIN
(select deviceRecordKey ,max(versionNumber) versionNumber from productinfo
<where>
<if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm}
</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="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
</where>
GROUP BY deviceRecordKey)
a on p.deviceRecordKey = a.deviceRecordKey and p.versionNumber = a.versionNumber
<where>
<if test="diType != '' and diType != null">
AND diType = #{diType}
</if>
</where>
</select>
<select id="filterUdiByNewest" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
SELECT * FROM productinfo
<where>
<if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm}
</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="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="isNewest != null">
AND isNewest = #{isNewest}
</if>
</where>
</select>
<select id="filterUuidByCreditNo" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="java.lang.String">
select p.uuid from productinfo p INNER JOIN
(select deviceRecordKey ,max(versionNumber) versionNumber from productinfo
<where>
<if test="tyshxydm != '' and tyshxydm != null">
AND tyshxydm = #{tyshxydm}
</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="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
</where>
GROUP BY deviceRecordKey)
a on p.deviceRecordKey = a.deviceRecordKey and p.versionNumber = a.versionNumber
group by uuid
</select>
<select id="filterUdi" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select * from productinfo
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc= #{ylqxzcrbarmc}
</if>
<if test="ylqxzcrbarmc == null and cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat(#{cpmctymc},'%')
</if>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null and cpmctymc != '' and cpmctymc != null">
AND cpmctymc LIKE concat('%',#{cpmctymc},'%')
</if>
<if test="nameCode != '' and nameCode != null">
AND nameCode LIKE concat(#{nameCode},'%')
</if>
<if test="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="ggxh != '' and ggxh != null">
AND ggxh LIKE concat('%',#{ggxh},'%')
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh LIKE concat('%',#{zczbhhzbapzbh},'%')
</if>
<if test="deviceRecordKey != '' and deviceRecordKey != null">
AND deviceRecordKey = #{deviceRecordKey}
</if>
<if test="updateTime!=null and updateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
<if test="isNewest != null and isNewest!=''">
AND isNewest = #{isNewest}
</if>
<if test="diType != '' and diType != null">
AND diType = #{diType}
</if>
</where>
</select>
<select id="selectByUpdateTime"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
select * from productinfo where
<![CDATA[ DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%S') ]]>
and
<![CDATA[ DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')<= DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%S') ]]>
</select>
<select id="syncDlUdi" parameterType="com.glxp.udidl.admin.req.ProductInfoFilterRequest"
resultType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
SELECT * FROM productinfo
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat(#{ylqxzcrbarmc},'%')
</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="uuid != '' and uuid != null">
AND uuid = #{uuid}
</if>
<if test="ggxh != '' and ggxh != null">
AND ggxh LIKE concat('%',#{ggxh},'%')
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND zczbhhzbapzbh = #{zczbhhzbapzbh}
</if>
<if test="deviceRecordKey != '' and deviceRecordKey != null">
AND deviceRecordKey = #{deviceRecordKey}
</if>
<if test="updateTime!=null and updateTime!=''">
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
</where>
limit #{page},#{limit}
</select>
<insert id="insertProductInfo" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
REPLACE
INTO productinfo
(
nameCode,packRatio,packLevel,bhxjsl,
bhzxxsbzsl,zxxsbzbhsydysl,bhxjcpbm,bzcj,thirdProductNo,addType,deviceRecordKey,isUseDy,thirdProductName,
cpmctymc,cplb,flbm,ggxh,qxlb,tyshxydm,ylqxzcrbarmc,zczbhhzbapzbh,ylqxzcrbarywmc,uuid,sjcpbm,versionNumber
,diType,scbssfbhph,scbssfbhxlh,scbssfbhscrq,scbssfbhsxrq,
ybbm,spmc,cphhhbh,cpms,cpbsbmtxmc,isNewest,updateTime
)
values
(
#{nameCode},
#{packRatio},
#{packLevel},
#{bhxjsl},
#{bhzxxsbzsl},
#{zxxsbzbhsydysl},
#{bhxjcpbm},
#{bzcj},
#{thirdProductNo},
#{addType},
#{deviceRecordKey},
#{isUseDy},
#{thirdProductName},
#{cpmctymc},
#{cplb},
#{flbm},
#{ggxh},
#{qxlb},
#{tyshxydm},
#{ylqxzcrbarmc},
#{zczbhhzbapzbh},
#{ylqxzcrbarywmc},
#{uuid},
#{sjcpbm},
#{versionNumber},
#{diType},
#{scbssfbhph},
#{scbssfbhxlh},
#{scbssfbhscrq},
#{scbssfbhsxrq},
#{ybbm},
#{spmc},
#{cphhhbh},
#{cpms},
#{cpbsbmtxmc},
#{isNewest},
#{updateTime}
)
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM productinfo
WHERE thirdProductNo = #{id}
</delete>
<delete id="deleteAll" parameterType="java.util.List">
DELETE FROM productinfo WHERE thirdProductNo in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<update id="updateProductInfo" parameterType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
UPDATE productinfo
<set>
<if test="nameCode != null">nameCode=#{nameCode},</if>
<if test="packRatio != null">packRatio=#{packRatio},</if>
<if test="packLevel != null">packLevel=#{packLevel},</if>
<if test="bhxjsl != null">bhxjsl=#{bhxjsl},</if>
<if test="bhzxxsbzsl != null">bhzxxsbzsl=#{bhzxxsbzsl},</if>
<if test="zxxsbzbhsydysl != null">zxxsbzbhsydysl=#{zxxsbzbhsydysl},</if>
<if test="bhxjcpbm != null">bhxjcpbm=#{bhxjcpbm},</if>
<if test="bzcj != null">bzcj=#{bzcj},</if>
<if test="thirdProductNo != null">thirdProductNo=#{thirdProductNo},</if>
<if test="addType != null">addType=#{addType},</if>
<if test="deviceRecordKey != null">deviceRecordKey=#{deviceRecordKey},</if>
<if test="isUseDy != null">isUseDy=#{isUseDy},</if>
<if test="thirdProductName != null">thirdProductName=#{thirdProductName},</if>
<if test="cpmctymc != null">cpmctymc=#{cpmctymc},</if>
<if test="cplb != null">cplb=#{cplb},</if>
<if test="flbm != null">flbm=#{flbm},</if>
<if test="ggxh != null">ggxh=#{ggxh},</if>
<if test="qxlb != null">qxlb=#{qxlb},</if>
<if test="tyshxydm != null">tyshxydm=#{tyshxydm},</if>
<if test="ylqxzcrbarmc != null">ylqxzcrbarmc=#{ylqxzcrbarmc},</if>
<if test="ylqxzcrbarywmc != null">ylqxzcrbarywmc=#{ylqxzcrbarywmc},</if>
<if test="uuid != null">uuid=#{uuid},</if>
<if test="sjcpbm != null">sjcpbm=#{sjcpbm},</if>
<if test="versionNumber != null">versionNumber=#{versionNumber},</if>
<if test="diType != null">diType=#{diType},</if>
<if test="isNewest != null">isNewest=#{isNewest},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</set>
WHERE id = #{id}
</update>
<update id="updateProductByUuid" parameterType="com.glxp.udidl.admin.entity.udi.ProductInfoEntity">
UPDATE productinfo
<set>
<if test="scbssfbhph != null">scbssfbhph=#{scbssfbhph},</if>
<if test="scbssfbhxlh != null">scbssfbhxlh=#{scbssfbhxlh},</if>
<if test="scbssfbhscrq != null">scbssfbhscrq=#{scbssfbhscrq},</if>
<if test="scbssfbhsxrq != null">scbssfbhsxrq=#{scbssfbhsxrq},</if>
<if test="ybbm != null">ybbm=#{ybbm},</if>
<if test="spmc != null">spmc=#{spmc},</if>
<if test="cphhhbh != null">cphhhbh=#{cphhhbh},</if>
<if test="cpms != null">cpms=#{cpms},</if>
<if test="cpbsbmtxmc != null">cpbsbmtxmc=#{cpbsbmtxmc},</if>
<if test="isNewest != null">isNewest=#{isNewest},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</set>
WHERE uuid = #{uuid}
</update>
<!--测试专用-->
<select id="findAllUuids" parameterType="com.glxp.udidl.admin.req.ListPageRequest" resultType="java.lang.String">
SELECT uuid
from device
group by uuid limit #{page}, #{limit}
</select>
<select id="findAllTyshxyh" resultType="java.lang.String">
SELECT tyshxydm
from productinfo
group by tyshxydm
</select>
<select id="selectByDeviceRecordKey" resultType="com.glxp.udidl.admin.dto.device.ProductDetailModel" parameterType="java.lang.String">
select nameCode,cpmctymc,packLevel,bzcj from productinfo where isNewest=1 and deviceRecordKey=#{key}
</select>
</mapper>