long
2023-09-02 e379948bb83ebcc9ce0c467a7b970f74bc00e9a1
提交 | 用户 | 时间
71e81e 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="cn.stylefeng.guns.modular.cm.passingStationCollection.mapper.PassingStationCollectionMapper">
4
5     <!-- 通用查询映射结果 -->
6     <resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.cm.passingStationCollection.entity.PassingStationCollection">
7         <id column="id" property="id" />
8         <result column="work_order_no" property="workOrderNo" />
9         <result column="sfc_code" property="sfcCode" />
10         <result column="product_code" property="productCode" />
11         <result column="production_line" property="productionLine" />
12         <result column="location_code" property="locationCode" />
13         <result column="equipment_no" property="equipmentNo" />
14         <result column="inbound_time" property="inboundTime" />
15         <result column="outbound_time" property="outboundTime" />
16         <result column="in_rs_sign" property="inRsSign" />
17         <result column="in_msg_sign" property="inMsgSign" />
18         <result column="out_rs_sign" property="outRsSign" />
19         <result column="out_msg_sign" property="outMsgSign" />
20         <result column="collection_time" property="collectionTime" />
21         <result column="spare_field_1" property="spareField1" />
22         <result column="spare_field_2" property="spareField2" />
23         <result column="create_user" property="createUser" />
24         <result column="create_time" property="createTime" />
25         <result column="update_user" property="updateUser" />
26         <result column="update_time" property="updateTime" />
27     </resultMap>
28
29     <!-- 通用查询结果列 -->
30     <sql id="Base_Column_List">
31         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"
32     </sql>
33
34
35     <select id="customList" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
36         select
37         <include refid="Base_Column_List"/>
38         from cm_passing_station_collection where 1 = 1
39         <if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
40             and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
41         </if>
42         <if test="paramCondition.productionLine != null and paramCondition.productionLine != ''">
43             and production_line like CONCAT('%',#{paramCondition.productionLine},'%')
44         </if>
45         <if test="paramCondition.sfcCode != null and paramCondition.sfcCode != ''">
46             and sfc_code like CONCAT('%',#{paramCondition.sfcCode},'%')
47         </if>
48         <if test="paramCondition.locationCode != null and paramCondition.locationCode != ''">
49             and location_code like CONCAT('%',#{paramCondition.locationCode},'%')
50         </if>
51         <if test="paramCondition.startTime != null and paramCondition.startTime != ''">
52             and create_time &gt;= #{paramCondition.startTime}
53         </if>
54         <if test="paramCondition.endTime != null and paramCondition.endTime != ''">
55             and create_time &lt;= #{paramCondition.endTime}
56         </if>
57     </select>
58
59     <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
60         select
61         <include refid="Base_Column_List"/>
62         from cm_passing_station_collection where 1 = 1
63     </select>
64
65     <select id="customPageList" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
66         select
67         <include refid="Base_Column_List"/>
68         from cm_passing_station_collection where 1 = 1
69         <if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
70             and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
71         </if>
72         <if test="paramCondition.productionLine != null and paramCondition.productionLine != ''">
73             and production_line like CONCAT('%',#{paramCondition.productionLine},'%')
74         </if>
75         <if test="paramCondition.sfcCode != null and paramCondition.sfcCode != ''">
76             and sfc_code like CONCAT('%',#{paramCondition.sfcCode},'%')
77         </if>
78         <if test="paramCondition.locationCode != null and paramCondition.locationCode != ''">
79             and location_code like CONCAT('%',#{paramCondition.locationCode},'%')
80         </if>
81         <if test="paramCondition.startTime != null and paramCondition.startTime != ''">
82             and create_time &gt;= #{paramCondition.startTime}
83         </if>
84         <if test="paramCondition.endTime != null and paramCondition.endTime != ''">
85             and create_time &lt;= #{paramCondition.endTime}
86         </if>
87     </select>
88
89     <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
90         select
91         <include refid="Base_Column_List"/>
92         from cm_passing_station_collection where 1 = 1
93     </select>
94
95     <select id="getRepairQty" resultType="Integer">
96         select COUNT(*) as repairQty from cm_passing_station_collection where DateDiff(dd,create_time,getdate())=0
97     </select>
98
99     <select id="getRepairQtyWeek" resultType="Integer">
100         select COUNT(*) as repairQty from cm_passing_station_collection where DateDiff(week,create_time,getdate())=1
101     </select>
102
103     <update id="updateSFC">
104         update cm_passing_station_collection set sfc_code = #{sfcCode} where sfc_code = #{childSfcCode}
105     </update>
106
107     <select id="PassRate" resultType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult" parameterType="cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam">
108         SELECT
109             location_code as locationCode,
110             SUM ( CASE WHEN out_rs_sign = 1 THEN 1 ELSE 0 END ) as 'qualified',
111             SUM ( CASE WHEN out_rs_sign = 2 THEN 1 ELSE 0 END ) as 'unqualified',
112             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'
113         FROM
114             cm_passing_station_collection
115         WHERE
116             1 = 1
117         <if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
118             and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
119         </if>
120         <if test="paramCondition.productionLine != null and paramCondition.productionLine != ''">
121             and production_line like CONCAT('%',#{paramCondition.productionLine},'%')
122         </if>
123         <if test="paramCondition.sfcCode != null and paramCondition.sfcCode != ''">
124             and sfc_code like CONCAT('%',#{paramCondition.sfcCode},'%')
125         </if>
126         <if test="paramCondition.locationCode != null and paramCondition.locationCode != ''">
127             and location_code = #{paramCondition.locationCode}
128         </if>
129         <if test="paramCondition.startTime != null and paramCondition.startTime != ''">
130             and create_time &gt;= #{paramCondition.startTime}
131         </if>
132         <if test="paramCondition.endTime != null and paramCondition.endTime != ''">
133             and create_time &lt;= #{paramCondition.endTime}
134         </if>
135         GROUP BY
136             location_code
137     </select>
138
139 </mapper>