czt
2025-06-12 930d29f39d115fe76c305af4320c2acbcb30c445
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
<?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.ld.igds.work.mapper.ApplyOrderMapper">
 
    <!-- 新增工单 -->
    <insert id="addApplyOrder" parameterType="com.ld.igds.work.dto.ApplyOrderData">
        insert into D_APPLY_ORDER(
        ID_,
        COMPANY_ID_,
        DEPT_ID_,
        TYPE_ ,
        DEPOT_ID_,
        APPLY_USER_,
        APPLY_USER_NAME_,
        APPLY_TIME_,
        AUDIT_USER_,
        AUDIT_USER_NAME_,
        CONDUCT_USER_,
        AUDIT_TIME_,
        STATUS_,
        RECORD_,
        START_,
        END_
        )values (
        #{data.id},
        #{data.companyId},
        #{data.deptId},
        #{data.type},
        #{data.depotId},
        #{data.applyUser},
        #{data.applyUserName},
        #{data.applyTime},
        #{data.auditUser},
        #{data.auditUserName},
        #{data.conductUser},
        #{data.auditTime},
        #{data.status},
        #{data.record},
        #{data.start},
        #{data.end}
        )
    </insert>
 
    <!-- 根据条件查询工单申请 -->
    <select id="getApplyOrder" parameterType="com.ld.igds.work.dto.ApplyOrderParam" resultType="com.ld.igds.work.dto.ApplyOrderData">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        TYPE_ as type,
        DEPOT_ID_ as depotId,
        APPLY_USER_ as applyUser,
        APPLY_USER_NAME_ as applyUserName,
        APPLY_TIME_ as applyTime,
        AUDIT_USER_ as auditUser,
        AUDIT_USER_NAME_ as auditUserName,
        CONDUCT_USER_ as conductUser,
        AUDIT_TIME_ as auditTime,
        STATUS_ as status,
        RECORD_ as record,
        START_ as start,
        END_ as end
        from
        D_APPLY_ORDER
        <where>
            <if test="param.id != null and param.id != ''">and ID_ = #{param.id}</if>
            <if test="param.companyId != null and param.companyId != ''">and COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and param.deptId != ''">and DEPT_ID_ = #{param.deptId}</if>
            <if test="param.depotId != null and param.depotId != ''">and DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.applyUser != null and param.applyUser != ''">and APPLY_USER_ = #{param.applyUser}</if>
            <if test="param.start != null">and START_ <![CDATA[ <= ]]> #{param.start}</if>
            <if test="param.end != null">and END_ <![CDATA[ >= ]]> #{param.end}</if>
        </where>
    </select>
 
    <!-- 根据条件查询工单列表 -->
    <select id="getOrderList" parameterType="com.ld.igds.work.dto.ApplyOrderParam" resultType="com.ld.igds.work.dto.ApplyOrderData">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        TYPE_ as type,
        DEPOT_ID_ as depotId,
        APPLY_USER_ as applyUser,
        APPLY_USER_NAME_ as applyUserName,
        APPLY_TIME_ as applyTime,
        AUDIT_USER_ as auditUser,
        AUDIT_USER_NAME_ as auditUserName,
        CONDUCT_USER_ as conductUser,
        AUDIT_TIME_ as auditTime,
        STATUS_ as status,
        RECORD_ as record,
        START_ as start,
        END_ as end
        from
        D_APPLY_ORDER
        <where>
            <if test="param.companyId != null and param.companyId != ''">and COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and param.deptId != ''">and DEPT_ID_ = #{param.deptId}</if>
            <if test="param.applyUser != null and param.applyUser != ''">and APPLY_USER_ = #{param.applyUser}</if>
            <if test="param.status != null and param.status != ''">and STATUS_ = #{param.status}</if>
            <if test="param.auditUser != null and param.auditUser != ''">and CONDUCT_USER_ like #{param.auditUser}</if>
        </where>
        order by APPLY_TIME_ DESC
    </select>
 
    <!-- 审核工单 -->
    <update id="updateApplyOrder" parameterType="com.ld.igds.work.dto.ApplyOrderData">
        update D_APPLY_ORDER set
        AUDIT_USER_ = #{data.auditUser},
        STATUS_ = #{data.status},
        AUDIT_TIME_ = #{data.auditTime},
        AUDIT_USER_NAME_ = #{data.auditUserName}
        where ID_ = #{data.id}
    </update>
 
</mapper>