|
|
<?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="cn.iocoder.yudao.module.mes.dal.mysql.repairtems.RepairTemsMapper">
|
|
|
|
|
|
<!--
|
|
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
|
-->
|
|
|
|
|
|
<select id="getRepairTemsPage"
|
|
|
resultType="cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo.RepairTemsRespVO">
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
mrt.id,
|
|
|
mrt.subject_code,
|
|
|
mrt.subject_name,
|
|
|
mrt.device_type,
|
|
|
CASE
|
|
|
WHEN mrt.device_type = 1 THEN '设备'
|
|
|
WHEN mrt.device_type = 2 THEN '关键件'
|
|
|
ELSE '未知'
|
|
|
END AS deviceTypeName,
|
|
|
mrt.device_id,
|
|
|
mrt.component_id,
|
|
|
mrt.inspection_method,
|
|
|
mrt.value_type,
|
|
|
mrt.judgment_criteria,
|
|
|
mrt.is_enable,
|
|
|
mrt.creator,
|
|
|
mrt.create_time,
|
|
|
mrt.updater,
|
|
|
mrt.update_time,
|
|
|
mrt.deleted,
|
|
|
mrt.tenant_id,
|
|
|
mrt.project_content,
|
|
|
mdl.device_name as deviceName,
|
|
|
mcc.name as componentName,
|
|
|
CONCAT('(', su.username, ')', su.nickname) as creatorName
|
|
|
FROM besure.mes_repair_tems mrt
|
|
|
left join besure.mes_device_ledger mdl on mdl.id = mrt.device_id
|
|
|
left join besure.mes_critical_component mcc on mcc.id = mrt.component_id
|
|
|
left join besure.system_users su on su.id = mrt.creator
|
|
|
WHERE 1=1
|
|
|
AND mrt.deleted = 0
|
|
|
<if test="pageReqVO.subjectCode != null and pageReqVO.subjectCode != ''">
|
|
|
AND mrt.subject_code = #{pageReqVO.subjectCode}
|
|
|
</if>
|
|
|
<if test="pageReqVO.subjectName != null and pageReqVO.subjectName != ''">
|
|
|
AND mrt.subject_name LIKE CONCAT('%', #{pageReqVO.subjectName}, '%')
|
|
|
</if>
|
|
|
<if test="pageReqVO.deviceType != null and pageReqVO.deviceType != ''">
|
|
|
AND mrt.device_type = #{pageReqVO.deviceType}
|
|
|
</if>
|
|
|
<if test="pageReqVO.deviceId != null">
|
|
|
AND mrt.device_id = #{pageReqVO.deviceId}
|
|
|
</if>
|
|
|
<if test="pageReqVO.componentId != null">
|
|
|
AND mrt.component_id = #{pageReqVO.componentId}
|
|
|
</if>
|
|
|
<if test="pageReqVO.inspectionMethod != null and pageReqVO.inspectionMethod != ''">
|
|
|
AND mrt.inspection_method = #{pageReqVO.inspectionMethod}
|
|
|
</if>
|
|
|
<if test="pageReqVO.valueType != null and pageReqVO.valueType != ''">
|
|
|
AND mrt.value_type = #{pageReqVO.valueType}
|
|
|
</if>
|
|
|
<if test="pageReqVO.judgmentCriteria != null and pageReqVO.judgmentCriteria != ''">
|
|
|
AND mrt.judgment_criteria = #{pageReqVO.judgmentCriteria}
|
|
|
</if>
|
|
|
<if test="pageReqVO.isEnable != null">
|
|
|
AND mrt.is_enable = #{pageReqVO.isEnable}
|
|
|
</if>
|
|
|
|
|
|
<if test="pageReqVO.projectContent != null and pageReqVO.projectContent != ''">
|
|
|
AND mrt.project_content LIKE CONCAT('%', #{pageReqVO.projectContent}, '%')
|
|
|
</if>
|
|
|
<!-- 添加 ids 过滤条件 -->
|
|
|
<if test="pageReqVO.ids != null and pageReqVO.ids != ''">
|
|
|
AND FIND_IN_SET(mrt.id, #{pageReqVO.ids})
|
|
|
</if>
|
|
|
<!-- <if test="pageReqVO.createTime != null and pageReqVO.createTime.length == 2">-->
|
|
|
<!-- AND create_time BETWEEN #{pageReqVO.createTime[0]} AND #{pageReqVO.createTime[1]}-->
|
|
|
<!-- </if>-->
|
|
|
</select>
|
|
|
<select id="getRepairTemsList"
|
|
|
resultType="cn.iocoder.yudao.module.mes.controller.admin.repairtems.vo.RepairTemsRespVO">
|
|
|
SELECT
|
|
|
mrt.id,
|
|
|
mrt.subject_code,
|
|
|
mrt.subject_name,
|
|
|
mrt.device_type,
|
|
|
mrt.device_id,
|
|
|
mrt.component_id,
|
|
|
mrt.inspection_method,
|
|
|
mrt.value_type,
|
|
|
mrt.judgment_criteria,
|
|
|
mrt.is_enable,
|
|
|
mrt.creator,
|
|
|
mrt.create_time,
|
|
|
mrt.updater,
|
|
|
mrt.update_time,
|
|
|
mrt.deleted,
|
|
|
mrt.tenant_id,
|
|
|
mdl.device_name as deviceName,
|
|
|
mcc.name as componentName,
|
|
|
CONCAT('(', su.username, ')', su.nickname) as creatorName
|
|
|
FROM besure.mes_repair_tems mrt
|
|
|
left join besure.mes_device_ledger mdl on mdl.id = mrt.device_id
|
|
|
left join besure.mes_critical_component mcc on mcc.id = mrt.component_id
|
|
|
left join besure.system_users su on su.id = mrt.creator
|
|
|
WHERE mrt.deleted = 0
|
|
|
<if test="pageReqVO.subjectCode != null and pageReqVO.subjectCode != ''">
|
|
|
AND mrt.subject_code = #{pageReqVO.subjectCode}
|
|
|
</if>
|
|
|
<if test="pageReqVO.subjectName != null and pageReqVO.subjectName != ''">
|
|
|
AND mrt.subject_name LIKE CONCAT('%', #{pageReqVO.subjectName}, '%')
|
|
|
</if>
|
|
|
<if test="pageReqVO.deviceType != null and pageReqVO.deviceType != ''">
|
|
|
AND mrt.device_type = #{pageReqVO.deviceType}
|
|
|
</if>
|
|
|
<if test="pageReqVO.deviceId != null">
|
|
|
AND mrt.device_id = #{pageReqVO.deviceId}
|
|
|
</if>
|
|
|
<if test="pageReqVO.componentId != null">
|
|
|
AND mrt.component_id = #{pageReqVO.componentId}
|
|
|
</if>
|
|
|
<if test="pageReqVO.inspectionMethod != null and pageReqVO.inspectionMethod != ''">
|
|
|
AND mrt.inspection_method = #{pageReqVO.inspectionMethod}
|
|
|
</if>
|
|
|
<if test="pageReqVO.valueType != null and pageReqVO.valueType != ''">
|
|
|
AND mrt.value_type = #{pageReqVO.valueType}
|
|
|
</if>
|
|
|
<if test="pageReqVO.judgmentCriteria != null and pageReqVO.judgmentCriteria != ''">
|
|
|
AND mrt.judgment_criteria = #{pageReqVO.judgmentCriteria}
|
|
|
</if>
|
|
|
<if test="pageReqVO.isEnable != null">
|
|
|
AND mrt.is_enable = #{pageReqVO.isEnable}
|
|
|
</if>
|
|
|
|
|
|
<if test="pageReqVO.projectContent != null and pageReqVO.projectContent != ''">
|
|
|
AND mrt.project_content LIKE CONCAT('%', #{pageReqVO.projectContent}, '%')
|
|
|
</if>
|
|
|
<!-- 添加 ids 过滤条件 -->
|
|
|
<if test="pageReqVO.ids != null and pageReqVO.ids != ''">
|
|
|
AND FIND_IN_SET(mrt.id, #{pageReqVO.ids})
|
|
|
</if>
|
|
|
<!-- <if test="pageReqVO.createTime != null and pageReqVO.createTime.length == 2">-->
|
|
|
<!-- AND create_time BETWEEN #{pageReqVO.createTime[0]} AND #{pageReqVO.createTime[1]}-->
|
|
|
<!-- </if>-->
|
|
|
</select>
|
|
|
</mapper> |