<?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.stylefeng.guns.modular.cm.passingStationCollection.mapper.PassingStationCollectionMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.cm.passingStationCollection.entity.PassingStationCollection">
|
<id column="id" property="id" />
|
<result column="work_order_no" property="workOrderNo" />
|
<result column="sfc_code" property="sfcCode" />
|
<result column="product_code" property="productCode" />
|
<result column="production_line" property="productionLine" />
|
<result column="location_code" property="locationCode" />
|
<result column="equipment_no" property="equipmentNo" />
|
<result column="inbound_time" property="inboundTime" />
|
<result column="outbound_time" property="outboundTime" />
|
<result column="in_rs_sign" property="inRsSign" />
|
<result column="in_msg_sign" property="inMsgSign" />
|
<result column="out_rs_sign" property="outRsSign" />
|
<result column="out_msg_sign" property="outMsgSign" />
|
<result column="collection_time" property="collectionTime" />
|
<result column="spare_field_1" property="spareField1" />
|
<result column="spare_field_2" property="spareField2" />
|
<result column="create_user" property="createUser" />
|
<result column="create_time" property="createTime" />
|
<result column="update_user" property="updateUser" />
|
<result column="update_time" property="updateTime" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id AS "id", work_order_no AS "workOrderNo", sfc_code AS "sfcCode", product_code AS "productCode", production_line AS "productionLine", location_code AS "locationCode", equipment_no AS "equipmentNo", inbound_time AS "inboundTime", outbound_time AS "outboundTime", in_rs_sign AS "inRsSign", in_msg_sign AS "inMsgSign", out_rs_sign AS "outRsSign", out_msg_sign AS "outMsgSign", collection_time AS "collectionTime", spare_field_1 AS "spareField1", spare_field_2 AS "spareField2", create_user AS "createUser", create_time AS "createTime", update_user AS "updateUser", update_time AS "updateTime"
|
</sql>
|
|
|
<select id="customList" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
|
select
|
<include refid="Base_Column_List"/>
|
from cm_passing_station_collection where 1 = 1
|
<if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
|
and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
|
</if>
|
<if test="paramCondition.productionLine != null and paramCondition.productionLine != ''">
|
and production_line like CONCAT('%',#{paramCondition.productionLine},'%')
|
</if>
|
<if test="paramCondition.sfcCode != null and paramCondition.sfcCode != ''">
|
and sfc_code like CONCAT('%',#{paramCondition.sfcCode},'%')
|
</if>
|
<if test="paramCondition.locationCode != null and paramCondition.locationCode != ''">
|
and location_code like CONCAT('%',#{paramCondition.locationCode},'%')
|
</if>
|
<if test="paramCondition.startTime != null and paramCondition.startTime != ''">
|
and create_time >= #{paramCondition.startTime}
|
</if>
|
<if test="paramCondition.endTime != null and paramCondition.endTime != ''">
|
and create_time <= #{paramCondition.endTime}
|
</if>
|
</select>
|
|
<select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
|
select
|
<include refid="Base_Column_List"/>
|
from cm_passing_station_collection where 1 = 1
|
</select>
|
|
<select id="customPageList" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
|
select
|
<include refid="Base_Column_List"/>
|
from cm_passing_station_collection where 1 = 1
|
<if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
|
and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
|
</if>
|
<if test="paramCondition.productionLine != null and paramCondition.productionLine != ''">
|
and production_line like CONCAT('%',#{paramCondition.productionLine},'%')
|
</if>
|
<if test="paramCondition.sfcCode != null and paramCondition.sfcCode != ''">
|
and sfc_code like CONCAT('%',#{paramCondition.sfcCode},'%')
|
</if>
|
<if test="paramCondition.locationCode != null and paramCondition.locationCode != ''">
|
and location_code like CONCAT('%',#{paramCondition.locationCode},'%')
|
</if>
|
<if test="paramCondition.startTime != null and paramCondition.startTime != ''">
|
and create_time >= #{paramCondition.startTime}
|
</if>
|
<if test="paramCondition.endTime != null and paramCondition.endTime != ''">
|
and create_time <= #{paramCondition.endTime}
|
</if>
|
</select>
|
|
<select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
|
select
|
<include refid="Base_Column_List"/>
|
from cm_passing_station_collection where 1 = 1
|
</select>
|
|
<select id="getRepairQty" resultType="Integer">
|
select COUNT(*) as repairQty from cm_passing_station_collection where DateDiff(dd,create_time,getdate())=0
|
</select>
|
|
<select id="getRepairQtyWeek" resultType="Integer">
|
select COUNT(*) as repairQty from cm_passing_station_collection where DateDiff(week,create_time,getdate())=1
|
</select>
|
|
<update id="updateSFC">
|
update cm_passing_station_collection set sfc_code = #{sfcCode} where sfc_code = #{childSfcCode}
|
</update>
|
|
<select id="PassRate" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
|
SELECT
|
location_code as locationCode,
|
SUM ( CASE WHEN out_rs_sign = 1 THEN 1 ELSE 0 END ) as 'qualified',
|
SUM ( CASE WHEN out_rs_sign = 2 THEN 1 ELSE 0 END ) as 'unqualified',
|
FORMAT(CAST(SUM ( CASE WHEN out_rs_sign = 1 THEN 1 ELSE 0 END )*1.00 / COUNT(location_code) AS DECIMAL(8,6)),'P') as 'passRate'
|
FROM
|
cm_passing_station_collection
|
WHERE
|
1 = 1
|
<if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
|
and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
|
</if>
|
<if test="paramCondition.productionLine != null and paramCondition.productionLine != ''">
|
and production_line like CONCAT('%',#{paramCondition.productionLine},'%')
|
</if>
|
<if test="paramCondition.sfcCode != null and paramCondition.sfcCode != ''">
|
and sfc_code like CONCAT('%',#{paramCondition.sfcCode},'%')
|
</if>
|
<if test="paramCondition.locationCode != null and paramCondition.locationCode != ''">
|
and location_code = #{paramCondition.locationCode}
|
</if>
|
<if test="paramCondition.startTime != null and paramCondition.startTime != ''">
|
and create_time >= #{paramCondition.startTime}
|
</if>
|
<if test="paramCondition.endTime != null and paramCondition.endTime != ''">
|
and create_time <= #{paramCondition.endTime}
|
</if>
|
GROUP BY
|
location_code
|
</select>
|
|
<select id="bigCenterRightTable" resultType="Integer">
|
SELECT COUNT(*) AS sumNumber FROM cm_passing_station_collection
|
WHERE 1 = 1
|
AND location_code = 'OP170'
|
AND work_order_no = #{workOrderNo}
|
AND create_time BETWEEN #{startTime} AND #{endTime}
|
<if test="qualifiedFlag != null and qualifiedFlag != ''">
|
and out_rs_sign = #{qualifiedFlag}
|
</if>
|
</select>
|
|
<select id="centerLeftData" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult">
|
SELECT ISNULL(C.num, '0') AS num, L.location_code
|
FROM (
|
SELECT 'OP150' AS location_code
|
UNION ALL
|
SELECT 'OP100'
|
UNION ALL
|
SELECT 'OP140'
|
UNION ALL
|
SELECT 'OP070'
|
UNION ALL
|
SELECT 'EOP080'
|
UNION ALL
|
SELECT 'EOP090'
|
) AS L
|
LEFT JOIN (
|
SELECT COUNT(*) AS num, location_code
|
FROM cm_passing_station_collection
|
WHERE work_order_no = #{workOrderNo}
|
AND out_rs_sign = '2'
|
GROUP BY location_code
|
|
) AS C ON L.location_code = C.location_code
|
ORDER BY C.num DESC
|
</select>
|
|
<select id="getUnqualifiedQuantity" resultType="Integer">
|
SELECT
|
COUNT(*)
|
FROM
|
cm_passing_station_collection
|
WHERE 1 = 1
|
AND location_code IN ( 'OP150', 'OP100', 'OP140', 'OP070', 'EOP080', 'EOP090' )
|
AND work_order_no = #{workOrderNo}
|
AND out_rs_sign = '2'
|
</select>
|
</mapper>
|