懒羊羊
2023-09-11 0d7f3104244ca76fdb3a8b70117c51f25dce4c36
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?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.om.productionOrdeInfo.mapper.ProductionOrdeInfoMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.om.productionOrdeInfo.entity.ProductionOrdeInfo">
        <id column="id" property="id" />
        <result column="sales_order_no" property="salesOrderNo" />
        <result column="work_order_no" property="workOrderNo" />
        <result column="production_line" property="productionLine" />
        <result column="drawing_no" property="drawingNo" />
        <result column="material_code" property="materialCode" />
        <result column="material_name" property="materialName" />
        <result column="plan_qty" property="planQty" />
        <result column="actual_qty" property="actualQty" />
        <result column="scrap_qty" property="scrapQty" />
        <result column="repair_qty" property="repairQty" />
        <result column="actual_online_qty" property="actualOnlineQty" />
        <result column="online_completion_mark" property="onlineCompletionMark" />
        <result column="demand_date" property="demandDate" />
        <result column="plan_start_time" property="planStartTime" />
        <result column="plan_end_time" property="planEndTime" />
        <result column="actual_start_time" property="actualStartTime" />
        <result column="actual_end_time" property="actualEndTime" />
        <result column="serial_number" property="serialNumber" />
        <result column="order_status" property="orderStatus" />
        <result column="spare_field_1" property="spareField1" />
        <result column="spare_field_2" property="spareField2" />
        <result column="spare_field_3" property="spareField3" />
        <result column="spare_field_4" property="spareField4" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="create_user" property="createUser" />
        <result column="update_user" property="updateUser" />
        <result column="remarks" property="remarks" />
        <result column="stream_number" property="streamNumber" />
        <result column="custom" property="custom" />
        <result column="market_area_code" property="marketAreaCode" />
        <result column="software_version_code" property="softwareVersionCode" />
        <result column="product_company_code" property="productCompanyCode" />
 
 
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        custom AS "custom", stream_number AS "streamNumber", id AS "id", sales_order_no AS "salesOrderNo", work_order_no AS "workOrderNo", production_line AS "productionLine", drawing_no AS "drawingNo", material_code AS "materialCode", material_name AS "materialName", plan_qty AS "planQty", actual_qty AS "actualQty", scrap_qty AS "scrapQty", repair_qty AS "repairQty", actual_online_qty AS "actualOnlineQty", online_completion_mark AS "onlineCompletionMark", demand_date AS "demandDate", plan_start_time AS "planStartTime", plan_end_time AS "planEndTime", actual_start_time AS "actualStartTime", actual_end_time AS "actualEndTime", serial_number AS "serialNumber", order_status AS "orderStatus", spare_field_1 AS "spareField1", spare_field_2 AS "spareField2", spare_field_3 AS "spareField3", spare_field_4 AS "spareField4", create_time AS "createTime", update_time AS "updateTime",
        create_user AS "createUser", update_user AS "updateUser", remarks AS "remarks",
        market_area_code AS "marketAreaCode",software_version_code AS "softwareVersionCode",product_company_code AS "productCompanyCode"
    </sql>
 
 
    <select id="customList" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult" parameterType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam">
        select
        <include refid="Base_Column_List"/>
        from om_production_orde_info where 1 = 1
        <if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
            and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
        </if>
        <if test="paramCondition.materialCode != null and paramCondition.materialCode != ''">
            and material_code like CONCAT('%',#{paramCondition.materialCode},'%')
        </if>
        <if test="paramCondition.orderStatus != null and paramCondition.orderStatus != ''">
            and order_status = #{paramCondition.orderStatus}
        </if>
        <if test="paramCondition.productionLine != null and paramCondition.productionLine != ''">
            and production_line like CONCAT('%',#{paramCondition.productionLine},'%')
        </if>
        order by serial_number desc
    </select>
 
    <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam">
        select
        <include refid="Base_Column_List"/>
        from om_production_orde_info where 1 = 1
    </select>
 
    <select id="customPageList" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult" parameterType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam">
        select
        <include refid="Base_Column_List"/>
        from om_production_orde_info where 1 = 1
        <if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
            and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
        </if>
        <if test="paramCondition.materialCode != null and paramCondition.materialCode != ''">
            and material_code like CONCAT('%',#{paramCondition.materialCode},'%')
        </if>
        <if test="paramCondition.orderStatus != null and paramCondition.orderStatus != ''">
            and order_status = #{paramCondition.orderStatus}
        </if>
        <if test="paramCondition.productionLine != null and paramCondition.productionLine != ''">
            and production_line like CONCAT('%',#{paramCondition.productionLine},'%')
        </if>
        order by serial_number desc
    </select>
 
    <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam">
        select
        <include refid="Base_Column_List"/>
        from om_production_orde_info where 1 = 1
    </select>
 
    <!--    <select id="lineFinishQty" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">-->
    <!--        SELECT production_line as name,sum(actual_qty)as value  FROM om_production_orde_info GROUP BY production_line-->
    <!--    </select>-->
    <select id="lineFinishQty" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">
        SELECT TOP 7 actual_start_time as actualStartTime,actual_qty as actualQty FROM om_production_orde_info WHERE plan_start_time is not null AND actual_qty IS NOT NULL ORDER BY actual_qty DESC
    </select>
 
    <select id="getOrderWeek" resultType="Map">
        SELECT SUM(plan_qty) AS planQty,COALESCE( SUM(actual_qty) ,0) AS actualQty FROM om_production_orde_info WHERE DateDiff(month,create_time,getdate())=0
    </select>
 
    <select id="getPlanQtyByDate" parameterType="java.lang.String" resultType="java.lang.Integer">
        select SUM(plan_qty) as planQty FROM om_production_orde_info WHERE CONVERT ( VARCHAR ( 100 ), create_time, 23 ) = #{paramCondition}
    </select>
 
    <select id="getActualQtyByDate" parameterType="string" resultType="integer">
        select SUM(actual_qty) as actualQty FROM om_production_orde_info WHERE CONVERT ( VARCHAR ( 100 ), create_time, 23 ) = #{testdate}
    </select>
 
    <!--    <select id="getListMonth" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">-->
    <!--        <![CDATA[-->
    <!--        select * from om_production_orde_info where datediff(dd, plan_start_time,getdate())<=6-->
    <!--        ]]>-->
    <!--    </select>-->
 
    <select id="getListMonth" resultType="cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult">
        <![CDATA[
        SELECT TOP 10 * FROM om_production_orde_info ORDER BY actual_start_time DESC
        ]]>
    </select>
 
</mapper>