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.
spms-java/api-admin/src/main/resources/mybatis/mapper/receipt/MipsBarcodeDao.xml

142 lines
4.6 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.sale.admin.dao.receipt.MipsBarcodeDao">
<select id="selectByOrderId" parameterType="Map" resultType="com.glxp.sale.admin.entity.receipt.MipsBarcodeEntity">
select * FROM mips_barcode WHERE orderId = #{orderId} and (pCode ='' or pCode = 'null')
</select>
<select id="filterBarcodes" parameterType="com.glxp.sale.admin.req.receipt.MipsBarcodeRequest"
resultType="com.glxp.sale.admin.entity.receipt.MipsBarcodeEntity">
select * FROM mips_barcode
<where>
<if test="code != '' and code!=null">
and code = #{code}
</if>
<if test="codeLevel != '' and codeLevel!=null">
and codeLevel = #{codeLevel}
</if>
<if test="pCode != '' and pCode!=null">
and pCode = #{pCode}
</if>
<if test="orderId != '' and orderId!=null">
and orderId = #{orderId}
</if>
<if test="batchNo != '' and batchNo!=null">
and batchNo = #{batchNo}
</if>
<if test="packFlag != '' and packFlag!=null">
and packFlag = #{packFlag}
</if>
<if test="dtflag != '' and dtflag!=null">
and dtflag = #{dtflag}
</if>
</where>
</select>
<select id="filterStock" parameterType="com.glxp.sale.admin.req.receipt.FilterStockRequest"
resultType="com.glxp.sale.admin.entity.receipt.StockDetailEntity">
select * from mips_barcode
left JOIN druginfo on substring(mips_barcode.`code`,1,7) = druginfo.nameCode
<where>
<if test="orderId != '' and orderId!=null">
and orderId = #{orderId}
</if>
<if test="batchNo != '' and batchNo!=null">
and batchNo = #{batchNo}
</if>
<if test="code != '' and code!=null">
and code = #{code}
</if>
<if test="codeLevel != '' and codeLevel!=null">
and codeLevel = #{codeLevel}
</if>
<if test="pCode != '' and pCode!=null">
and pCode = #{pCode}
</if>
</where>
GROUP BY batchNo
</select>
<select id="selectCountByBatchno" parameterType="com.glxp.sale.admin.req.receipt.FilterBatchnoCount"
resultType="java.lang.Integer">
select count(0) FROM mips_barcode
<where>
<if test="batchNo != '' and batchNo!=null">
and batchNo = #{batchNo}
</if>
<if test="codeLevel != '' and codeLevel!=null">
and codeLevel = #{codeLevel}
</if>
<if test="packFlag != '' and packFlag!=null">
and packFlag = #{packFlag}
</if>
</where>
</select>
<insert id="insertList" parameterType="java.util.List">
replace INTO mips_barcode
(
orderId,
code,
pCode,
packFlag,
codeLevel,
batchNo,
manufacturingDate,
expirationDate,
closeFlag,
comments,
count,
lastModifyTime,
dtflag
)
VALUES
<foreach collection="barcodeEntities" item="item" index="index"
separator=",">
(
#{item.orderId},
#{item.code},
#{item.pCode},
#{item.packFlag},
#{item.codeLevel},
#{item.batchNo},
#{item.manufacturingDate},
#{item.expirationDate},
#{item.closeFlag},
#{item.comments},
#{item.count},
#{item.lastModifyTime},
#{item.dtflag}
)
</foreach>
</insert>
<delete id="deleteByOrderId" parameterType="Map">
DELETE FROM mips_barcode WHERE orderId = #{orderId}
</delete>
<delete id="deleteByCodes" parameterType="java.util.List">
DELETE FROM mips_barcode
WHERE code in
<foreach collection="codes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
<update id="updateDtFlag" parameterType="java.util.List">
UPDATE mips_barcode SET dtflag = 1
WHERE code in
<foreach collection="codes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</update>
</mapper>