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.

173 lines
6.8 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.op.mes.mapper.MesInspectionReportMapper">
<resultMap type="MesInspectionReport" id="MesInspectionReportResult">
<!-- 子表-->
<result property="id" column="id"/>
<result property="belongTo" column="belong_to"/>
<result property="bz" column="bz"/>
<result property="checkTimeS" column="check_time_s"/>
<result property="checkTimeE" column="check_time_e"/>
<result property="checkResult" column="check_result"/>
<result property="infoCode" column="info_code"/>
<result property="infoName" column="info_name"/>
<result property="tableLine" column="table_line"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<!-- 主表-->
<result property="lineCode" column="line_code"/>
<result property="productDate" column="product_date"/>
<result property="productCode" column="product_code"/>
<result property="productName" column="product_name"/>
<result property="checkDate" column="check_date"/>
<result property="bz" column="bz"/>
<result property="timeArray" column="timeArray"/>
<result property="equipmentCode" column="equipment_code"/>
<result property="equipmentName" column="equipment_name"/>
<result property="projectName" column="project_name"/>
</resultMap>
<select id="selectSelfMutualInspectionList" resultMap="MesInspectionReportResult" parameterType="MesInspectionReport">
select
mts.line_code,
mts.product_date,
mts.product_code,
mts.product_name,
mtsd.id,
mtsd.belong_to,
mtsd.check_time_s,
mtsd.check_time_e,
mtsd.check_result,
mtsd.check_time_s + '-' + mtsd.check_time_e as timeArray,
mtsd.info_code,
mtsd.info_name,
mtsd.table_line,
mtsd.bz,
mtsd.remark
from mes_table_self mts
left join mes_table_self_detial mtsd on mts.id = mtsd.belong_to
<where>
<if test="reportName == 'ConversionReportLeft'">
and CONVERT(date, mts.check_date) = dateadd(day, -1, CONVERT(date,#{checkDate}))
</if>
<if test = "reportName == 'ConversionReportRight' or reportName == 'ConversionReport' or reportName == 'CheckReport' ">
and CONVERT(date, mts.check_date) = CONVERT(date,#{checkDate})
</if>
and mts.line_code = #{lineCode}
and mts.del_flag = '0'
and mtsd.del_flag = '0'
and mts.report_name = #{reportName}
</where>
</select>
<select id="selectProjectName" resultType="java.lang.String" parameterType="java.lang.String">
select dict_label
from base_dict_data
where dict_type = #{param}
order by dict_sort asc
</select>
<select id="selectPointInspectionProjectList" resultMap="MesInspectionReportResult" parameterType="java.lang.String">
select
dict_label as info_name,
remark as project_name,
dict_sort as table_line
from base_dict_data
where dict_type = #{param}
order by dict_sort asc
</select>
<select id="selectTimeArray" resultType="java.lang.String" parameterType="MesInspectionReport">
select
mtsd.check_time_s + '-' + mtsd.check_time_e as timeArray
from mes_table_self mts
left join mes_table_self_detial mtsd on mts.id = mtsd.belong_to
<where>
and mts.del_flag = '0'
and mtsd.del_flag = '0'
<if test="reportName == 'ConversionReportLeft'">
and CONVERT(date, mts.check_date) = dateadd(day, -1, CONVERT(date,#{checkDate}))
</if>
<if test = "reportName == 'ConversionReportRight' or reportName == 'ConversionReport'">
and CONVERT(date, mts.check_date) = CONVERT(date,#{checkDate})
</if>
and mts.line_code = #{lineCode}
and mts.report_name = #{reportName}
</where>
group by mtsd.check_time_s,mtsd.check_time_e
order by mtsd.check_time_s
</select>
<select id="selectTeamArray" resultType="java.lang.String" parameterType="MesInspectionReport">
select
mtsd.remark
from mes_table_self mts
left join mes_table_self_detial mtsd on mts.id = mtsd.belong_to
where 1=1
and mts.del_flag = '0'
and mtsd.del_flag = '0'
and CONVERT(date, mts.check_date) = CONVERT(date,#{checkDate})
and mts.line_code = #{lineCode}
and mts.report_name = #{reportName}
group by mtsd.remark
order by mtsd.remark
</select>
<select id="selectSelfMutualInspectionData" resultMap="MesInspectionReportResult" parameterType="MesInspectionReport">
select top 1
mts.line_code,
mts.product_date,
mts.product_code,
mts.product_name,
mts.check_date,
mts.bz,
mts.remark,
mts.create_by
from mes_table_self mts
<where>
and mts.report_name = #{reportName}
and mts.del_flag = '0'
and mts.line_code = #{lineCode}
<if test="reportName == 'ConversionReportLeft'">
and CONVERT(date, mts.check_date) = dateadd(day, -1, CONVERT(date,#{checkDate}))
</if>
<if test = "reportName == 'ConversionReportRight' or reportName == 'ConversionReport'">
and CONVERT(date, mts.check_date) = CONVERT(date,#{checkDate})
</if>
</where>
</select>
<select id="getLineCodeList" resultMap="MesInspectionReportResult" parameterType="MesInspectionReport">
select equipment_code, equipment_name
from base_equipment
where del_flag = '0'
and equipment_category = '1'
</select>
<select id="selectCheckBoxList" resultMap="MesInspectionReportResult" parameterType="MesInspectionReport">
select
mtsd.remark, mtsd.bz
from mes_table_self mts
left join mes_table_self_detial mtsd on mts.id = mtsd.belong_to
where 1=1
and mts.del_flag = '0'
and mtsd.del_flag = '0'
and CONVERT(date, mts.check_date) = CONVERT(date,#{checkDate})
and mts.line_code = #{lineCode}
and mts.report_name = #{reportName}
group by mtsd.remark,mtsd.bz
order by mtsd.remark
</select>
</mapper>