qushaowei
2024-09-29 454545bd4207d99d153e263c68f821f856f0e884
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
<?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.InspectionCycleMapper">
 
    <select id="page" resultType="Map">
        select
        t1.id id,
        t1.code code,
        t1.cycle name,
        t1.version version,
        t1.create_by createBy,
        t1.create_time createTime,
        t1.update_by updateBy,
        t1.update_time updateTime,
        t1.version_status versionStatus,
        t1.cycle cycle,
        t1.cycle_unit cycleUnit,
        t1.unit unit,
        t1.start_condition startCondition,
        t1.arrange_way arrangeWay,
        t1.audit_status auditStatus,
        t1.first_inspection_time as firstInspectionTime,
        t1.take_effect_time as takeEffectTime,
        t1.lose_efficacy_time as loseEfficacyTime,
        CONVERT(  VARCHAR(100), t1.first_inspection_time, 23 ) firstInspectionTime1,
        CONVERT(  VARCHAR(100), t1.first_inspection_time, 8 ) firstInspectionTime2,
        t1.lead_time leadTime,
        t1.effective_time effectiveTime,
        t2.item_text cycleUnitName,
        t3.item_text unitName,
        t4.item_text startConditionName,
        t5.item_text arrangeWayName,
        t6.item_text versionStatusName,
        t1.overdue_dispose_mode as overdueDisposeMode,
        t1.according_calendar as accordingCalendar,
        t8.item_text overdueDisposeModeName,
        t9.item_text accordingCalendarName
        from mom_eam_inspection_cycle t1
        left join (select * from v_sys_dict where dict_code = 'cycle_unit') t2 on t1.cycle_unit=t2.item_value
        left join (select * from v_sys_dict where dict_code = 'cycle_time_unit') t3 on t1.unit=t3.item_value
        left join (select * from v_sys_dict where dict_code = 'start_condition') t4 on t1.start_condition=t4.item_value
        left join (select * from v_sys_dict where dict_code = 'arrange_way') t5 on t1.arrange_way=t5.item_value
        left join (select * from v_sys_dict where dict_code = 'version_status') t6 on t1.version_status=t6.item_value
        left join (select * from v_sys_dict where dict_code = 'overdue_dispose_mode') t8 on t1.overdue_dispose_mode=t8.item_value
        left join (select * from v_sys_dict where dict_code = 'according_calendar') t9 on t1.according_calendar=t9.item_value
        where 1=1
        <if test="inspectionCycle.version!=null and inspectionCycle.version!= ''">
            and t1.version=#{inspectionCycle.version}
        </if>
        <if test="inspectionCycle.versionStatus!=null and inspectionCycle.versionStatus!= ''">
            and t1.version_status=#{inspectionCycle.versionStatus}
        </if>
        <if test="inspectionCycle.versionStatus == null ">
            and t1.version_status='2'
        </if>
        <if test="inspectionCycle.enterpriseId!=null and inspectionCycle.enterpriseId!= ''">
            and t1.enterprise_id=#{inspectionCycle.enterpriseId}
        </if>
        <if test="inspectionCycle.code!=null and inspectionCycle.code!= ''">
            and t1.code like concat('%',#{inspectionCycle.code},'%')
        </if>
        <if test="inspectionCycle.name!=null and inspectionCycle.name!= ''">
            and t1.name like concat('%',#{inspectionCycle.name},'%')
        </if>
        order by t1.create_time desc
    </select>
 
    <select id="getAllVersion" resultType="Integer">
        select
        version
        from mom_eam_inspection_cycle
        where del_flag = 0
    </select>
 
    <select id="getUsableVersion" resultType="Integer">
        select
        t1.version version
        from mom_eam_inspection_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>
 
    <select id="getInspectionOrder" resultType="org.jeecg.modules.eam.entity.InspectionCycle">
        select DISTINCT t1.num inspectionStandardNum,
        t1.equipment_id,
        t2.daily_inspection_standard_id inspectionStandardId,
        t3.*,
        t4.team_id teamId
        from mom_eam_daily_inspection_standard t1
            left join mom_eam_daily_inspection_standard_detail t2 on t1.id = t2.daily_inspection_standard_id
            left join mom_eam_inspection_cycle t3 on t3.id = t2.inspection_cycle_id
            left join mom_eam_equipment t4 on t4.id = t1.equipment_id
            where t1.version_status = 2 and t1.status = 1 and t1.del_flag=0 and t3.name is not NULL
    </select>
 
</mapper>