<?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" />
|
<result column="beat_time" property="beatTime" />
|
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
beat_time AS "beatTime", 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="snCodeSize" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
|
select DISTINCT sfc_code as sfcCode FROM cm_passing_station_collection WHERE sfc_code LIKE CONCAT('%',#{dateLike},'%') GROUP BY sfc_code
|
</select>
|
|
<select id="getMaxSnCode" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
|
SELECT * FROM cm_passing_station_collection ORDER BY create_time DESC LIMIT 1
|
</select>
|
|
<select id="getBeatTimeList" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="String">
|
SELECT * FROM cm_passing_station_collection WHERE sfc_code = #{sfcCode} ORDER BY location_code
|
</select>
|
|
<select id="bottomLeftChart2" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult">
|
SELECT COUNT(*) AS num,location_code AS locationCode FROM cm_passing_station_collection GROUP BY location_code
|
</select>
|
|
</mapper>
|