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-cpt-java/src/main/resources/mybatis/mapper/trace/TraceManuOrderMapper.xml

83 lines
3.4 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.trace.TraceManuOrderMapper">
<select id="filterTraces" parameterType="com.glxp.api.req.trace.TraceManuOrderRequest"
resultType="com.glxp.api.res.trace.TraceManuOrderResponse">
SELECT tmo.*, mid.*, uc.companyName
FROM trace_manu_order tmo
LEFT JOIN user_company uc ON uc.id = tmo.companyIdFk
LEFT JOIN (
SELECT tr.recordCode, tr.createUser, tr.remark, trd.batchNo, trd.traceType
FROM trace_record_log tr
LEFT JOIN trace_product_record trd ON trd.id = tr.traceProductIdFk
) mid ON mid.recordCode = tmo.recordCode
<where>
<if test="recordCode != '' and recordCode != null">
and recordCode = #{recordCode}
</if>
<if test="companyName != '' and companyName != null">
AND companyName LIKE CONCAT('%', #{companyName}, '%')
</if>
<if test="nameCode != '' and nameCode != null">
and nameCode = #{nameCode}
</if>
<if test="cpmctymc != '' and cpmctymc != null">
and cpmctymc = #{cpmctymc}
</if>
<if test="ggxh != '' and ggxh != null">
and ggxh = #{ggxh}
</if>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
and ylqxzcrbarmc = #{ylqxzcrbarmc}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
and zczbhhzbapzbh = #{zczbhhzbapzbh}
</if>
</where>
</select>
<select id="filterTraces1" parameterType="com.glxp.api.req.trace.TraceManuOrderRequest"
resultType="com.glxp.api.res.trace.TraceManuOrderResponse">
select *
from trace_manu_order
<where>
<if test="id != '' and id != null">
and id = #{id}
</if>
<if test="billNo != '' and billNo != null">
and billNo = #{billNo}
</if>
<if test="cpmctymc != '' and cpmctymc != null">
and cpmctymc = #{cpmctymc}
</if>
<if test="ggxh != '' and ggxh != null">
and `ggxh` = #{ggxh}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
and zczbhhzbapzbh = #{zczbhhzbapzbh}
</if>
<if test="nameCode != '' and nameCode != null">
and nameCode = #{nameCode}
</if>
<if test="uuid != '' and uuid != null">
and uuid = #{uuid}
</if>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
and `ylqxzcrbarmc` = #{ylqxzcrbarmc}
</if>
<if test="nameCode != '' and nameCode != null">
and nameCode = #{nameCode}
</if>
<if test="cpmctymc != '' and cpmctymc != null">
and cpmctymc = #{cpmctymc}
</if>
<if test="ggxh != '' and ggxh != null">
and ggxh = #{ggxh}
</if>
<if test="manufactory != '' and manufactory != null">
and `manufactory` = #{manufactory}
</if>
</where>
ORDER BY id DESC
</select>
</mapper>