zenglf
2023-08-18 499d6294b4b7881c5797a59a183c5fc0105599dd
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
<?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="org.jeecg.modules.eam.mapper.EquipmentTransferMapper">
    <select id="getEquipmentTransferList" parameterType="String" resultType="Map">
 
        SELECT
        t1.id,
        t1.num,
        t1.audit_status as auditStatus,
        t1.out_enterprise_id as outEnterpriseId,
        t1.in_enterprise_id as inEnterpriseId,
        t1.transfer_type as transferType,
        t1.remark,
        t1.equipment_transfer_catrgory_id as equipmentTransferCatrgoryId,
        t1.create_by as createBy,
        t1.update_by as updateBy,
        t1.update_time as updateTime,
        t1.create_time as createTime,
        t2.item_text as audit_status,
        t3.id AS inEnterpriseId,
        t3.name as inEnterpriseName,
        t4.id AS inEnterpriseId,
        t4.name as outEnterpriseName
        FROM
        mom_eam_equipment_transfer t1
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'audit_status' ) t2 ON t2.item_value = t1.audit_status
        LEFT JOIN mom_base_enterprise t3 ON t1.in_enterprise_id = t3.id
        LEFT JOIN mom_base_enterprise t4 ON t1.out_enterprise_id = t4.id
        where t1.del_flag = 0  and t1.transfer_type ='reduce'
        <if test="num != 'null' and num != ''">
            and num like concat('%',#{num},'%')
        </if>
        <if test="auditStatus != 'null' and auditStatus != ''">
            and audit_status like concat('%',#{auditStatus},'%')
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getEquipmentTransferAddList" parameterType="String" resultType="Map">
 
        SELECT
        t1.id,
        t1.num,
        t1.audit_status as auditStatus,
        t1.equipment_transfer_catrgory_id as equipmentTransferCatrgoryId,
        t1.out_enterprise_id as outEnterpriseId,
        t1.in_enterprise_id as inEnterpriseId,
        t1.transfer_type as transferType,
        t1.remark,
        t1.create_by as createBy,
        t1.update_by as updateBy,
        t1.update_time as updateTime,
        t1.create_time as createTime,
        t2.item_text as audit_status,
        t3.id AS inEnterpriseId,
        t3.name as inEnterpriseName,
        t4.id AS inEnterpriseId,
        t4.name as outEnterpriseName
        FROM
        mom_eam_equipment_transfer t1
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'audit_status' ) t2 ON t2.item_value = t1.audit_status
        LEFT JOIN mom_base_enterprise t3 ON t1.in_enterprise_id = t3.id
        LEFT JOIN mom_base_enterprise t4 ON t1.out_enterprise_id = t4.id
        where  t1.del_flag = 0  and t1.transfer_type ='add'
        <if test="num != 'null' and num != ''">
            and num like concat('%',#{num},'%')
        </if>
        <if test="auditStatus != 'null' and auditStatus != ''">
            and audit_status like concat('%',#{auditStatus},'%')
        </if>
        ORDER BY t1.create_time desc
    </select>
 
 
    <select id="getAllVersion" resultType="Integer">
        select version
        from mom_eam_maintenance_cycle
        where del_flag = 0
    </select>
 
    <select id="getUsableVersion" resultType="Integer">
        select t1.version version
        from mom_eam_maintenance_cycle t1
                 left join
             (select * from mom_sys_data_version where business_type = '设备调出' and del_flag = 0) t2
             on t1.id = t2.business_id
        where t2.version_status = '2'
          and t1.del_flag = 0
    </select>
</mapper>