wms/nflg-wms-repository/src/main/resources/mapper/QmsPdiDetectionRulesMapper.xml

96 lines
3.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.nflg.wms.repository.mapper.QmsPdiDetectionRulesMapper">
<!-- 分页查询PDI检测规则 -->
<select id="searchPage" resultType="com.nflg.wms.common.pojo.vo.QmsPdiDetectionRulesVO">
SELECT
r.id,
r.rule_no,
r.model_no,
r.order_no,
r.inspector_id,
u.user_name AS inspector_name,
r.inspection_cycle,
r.inspection_type,
r.inspection_version,
r.maintenance_enable,
r.enable,
r.publish_enable,
r.publish_by,
r.publish_time,
r.create_by,
r.create_time,
r.update_by,
r.update_time
FROM qms_pdi_detection_rules r
LEFT JOIN "user" u ON u.id = r.inspector_id
<where>
<if test="qo.modelNo != null and qo.modelNo != ''">
AND r.model_no = #{qo.modelNo}
</if>
<if test="qo.orderNo != null and qo.orderNo != ''">
AND r.order_no = #{qo.orderNo}
</if>
<if test="qo.publishTimeStart != null">
AND r.publish_time &gt;= #{qo.publishTimeStart}
</if>
<if test="qo.publishTimeEnd != null">
AND r.publish_time &lt;= #{qo.publishTimeEnd}
</if>
</where>
ORDER BY r.id DESC
</select>
<!-- 导出PDI检测规则 -->
<select id="listForExport" resultType="com.nflg.wms.common.pojo.dto.QmsPdiDetectionRulesExportDTO">
SELECT
r.rule_no,
r.model_no,
r.order_no,
u.user_name AS inspector_name,
r.inspection_cycle,
CASE r.inspection_type WHEN 0 THEN '新机检测' WHEN 1 THEN '库存检测' ELSE '' END AS inspection_type_name,
r.inspection_version,
CASE r.maintenance_enable WHEN true THEN '已维护' ELSE '未维护' END AS maintenance_enable_name,
CASE r.enable WHEN true THEN '已启用' ELSE '未启用' END AS enable_name,
CASE r.publish_enable WHEN true THEN '已发布' ELSE '未发布' END AS publish_enable_name,
r.publish_by,
r.publish_time,
r.create_by,
r.create_time
FROM qms_pdi_detection_rules r
LEFT JOIN "user" u ON u.id = r.inspector_id
<where>
<if test="ids != null and ids.size() > 0">
AND r.id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
ORDER BY r.id DESC
</select>
<!-- 导出机型 -->
<select id="listMachineForExport" resultType="com.nflg.wms.common.pojo.dto.QmsPdiMachineExportDTO">
SELECT
r.model_no,
r.order_no,
CASE r.inspection_type WHEN 0 THEN '新机检测' WHEN 1 THEN '库存检测' ELSE '' END AS inspection_type_name,
r.inspection_version,
CASE r.publish_enable WHEN true THEN '已发布' ELSE '未发布' END AS publish_enable_name
FROM qms_pdi_detection_rules r
<where>
<if test="ids != null and ids.size() > 0">
AND r.id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
ORDER BY r.id DESC
</select>
</mapper>