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.

114 lines
5.0 KiB
XML

2 years ago
<?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.quality.mapper.QcStaticTableMapper">
<select id="selectQcStaticTableList" parameterType="com.op.quality.domain.QcStaticTable" resultType="com.op.quality.domain.QcStaticTable">
SELECT
bs.supplier_id supplierId,
bs.supplier_code supplierCode,
bs.zh_desc supplierName
from base_supplier bs
where bs.del_flag = '0' and bs.active_flag = '1'
<if test="supplierCodes != null and supplierCodes.size()>0">
and bs.supplier_code in
<foreach collection="supplierCodes" item="supplierCode" index="index" separator="," open="(" close=")">
#{supplierCode}
</foreach>
</if>
</select>
<select id="selectPcMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
qct.supplier_code supplierCode,qct.supplier_name supplierName,
count(0) batchs,sum(qct.quality) nums
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qc.type_code = #{qc.typeCode}
and qct.del_flag = '0'
and CONVERT(varchar(7),qct.income_time, 120) = #{qc.yearMonth}
<if test="qc.checkResult != null">
and qct.check_result = #{qc.checkResult}
</if>
<if test="codes != null and codes.size()>0">
and qct.supplier_code in
<foreach collection="codes" item="item" index="index" separator="," open="(" close=")">
#{item.supplierCode}
</foreach>
</if>
group by qct.supplier_code,qct.supplier_name
</select>
<select id="selectNumMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
qct.supplier_code supplierCode,qct.supplier_name supplierName,
sum(qct.noOk_quality) noOkNums
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qc.type_code = #{qc.typeCode}
and qct.del_flag = '0'
and CONVERT(varchar(7),qct.income_time, 120) = #{qc.yearMonth}
<if test="codes != null and codes.size()>0">
and qct.supplier_code in
<foreach collection="codes" item="item" index="index" separator="," open="(" close=")">
#{item.supplierCode}
</foreach>
</if>
group by qct.supplier_code,qct.supplier_name
2 years ago
</select>
2 years ago
<select id="getProduceChartData" resultType="com.op.quality.domain.QcStaticTable">
select concat(qct.material_code,CONVERT(varchar(10),qct.income_time, 120)) materailDate,
qct.material_code materialCode,
qct.material_name materialName,
qct.sample_quality sampleQuality,
qct.aNoOkquality,
qct.bNoOkquality,
qct.cNoOkquality,
qct.income_time
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qct.del_flag = '0' and qc.type_code = 'produce'
<if test="materialCode != null "> and qct.material_code in (${materialCode})</if>
<if test="workCenter != null "> and qct.supplier_code = #{workCenter}</if>
<if test="ymArrayStart != null "> and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null "> and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>
</select>
<select id="getProduceNames" resultType="com.op.quality.domain.QcStaticTable">
select distinct qct.material_code materialCode,
qct.material_name materialName
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qct.del_flag = '0' and qc.type_code = 'produce'
<if test="materialCode != null "> and qct.material_code in (${materialCode})</if>
<if test="workCenter != null "> and qct.supplier_code = #{workCenter}</if>
<if test="ymArrayStart != null "> and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null "> and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>
</select>
<select id="getProduceChartDataYM" resultType="com.op.quality.domain.QcStaticTable">
select
concat(qct.material_code,CONVERT(varchar(7),qct.income_time, 120)) materailDate,
qct.material_code materialCode,
qct.material_name materialName,
sum(qct.sample_quality) sampleQuality,
sum(qct.aNoOkquality) aNoOkquality,
sum(qct.bNoOkquality) bNoOkquality,
sum(qct.cNoOkquality) cNoOkquality,
CONVERT(varchar(7),qct.income_time, 120) incomeTime
from qc_check_task qct
left join qc_check_type qc on qc.order_code = qct.check_type
where qct.del_flag = '0' and qc.type_code = 'produce'
<if test="materialCode != null "> and qct.material_code in (${materialCode})</if>
<if test="workCenter != null "> and qct.supplier_code = #{workCenter}</if>
<if test="ymArrayStart != null "> and CONVERT(varchar(10),qct.income_time, 120) >= #{ymArrayStart}</if>
<if test="ymArrayEnd != null "> and #{ymArrayEnd}>= CONVERT(varchar(10),qct.income_time, 120)</if>
group by qct.material_code ,
qct.material_name ,
CONVERT(varchar(7),qct.income_time, 120)
</select>
<select id="getWorkcenterList" resultType="com.op.system.api.domain.quality.FactoryDto">
select factory_name factoryName,
factory_code factoryCode
from sys_factory where f_type = 'c'
2 years ago
</select>
2 years ago
</mapper>