16639036659
2023-07-11 2f2e78aaf8c6c7f3eaeffeb45e2b9aba2d88278c
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
<?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.ruoyi.doublePrevention.repository.PreventOverhaulLogRepository" >
 
    <resultMap id="BaseResultMap" type="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
        <id column="id" property="id"/>
        <result column="delete_status" property="deleteStatus" />
    </resultMap>
 
 
 
<!--    List<PreventOverhaulLog> selectOverhaulLogPage(@Param("overhaulLogReqBO") PreventOverhaulLogReqBO overhaulLogReqBO);-->
    <select id="selectOverhaulLogPage" resultType="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
        select * from prevent_overhaul_log
        <where>
            delete_status = 0
            <if test="overhaulLogReqBO.hazardCode != null and overhaulLogReqBO.hazardCode != ''">
                and hazard_code = #{overhaulLogReqBO.hazardCode}
            </if>
        </where>
    </select>
 
<!--    PreventOverhaulLog getOverhaulLogById(Long id);-->
    <select id="getOverhaulLogById" resultType="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
        select * from prevent_overhaul_log
        where delete_status = 0 and id = #{id}
    </select>
 
<!--    List<PreventOverhaulLog> listReportOverhaulLog();-->
    <select id="listReportOverhaulLog"  resultType="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
        select * from prevent_overhaul_log
        where report_switch = 0 and delete_status  = 0 and (update_report_data_time > report_time or report_time is null)
    </select>
<!--    int savePreventOverhaulLog(PreventOverhaulLog preventOverhaulLog);-->
    <insert id="savePreventOverhaulLog"  parameterType="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
        insert into  prevent_overhaul_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="uuid != null ">uuid,</if>
            <if test="deleteStatus != null ">delete_status,</if>
            <if test="gmtCreate != null ">gmt_create,</if>
            <if test="createByUserName != null and createByUserName != '' ">create_by_user_name,</if>
            <if test="gmtModitify != null ">gmt_moditify,</if>
            <if test="lastEditUserName != null and lastEditUserName != '' ">last_edit_user_name,</if>
            <if test="enterpriseId != null and enterpriseId != '' ">enterprise_id,</if>
            <if test="enterpriseUuid != null and enterpriseUuid != '' ">enterprise_uuid,</if>
            <if test="reportTime != null ">report_time,</if>
            <if test="updateReportDataTime != null ">update_report_data_time,</if>
            <if test="reportStatus != null ">report_status,</if>
            <if test="reportSwitch != null ">report_switch,</if>
            <if test="hazardCode != null and hazardCode != '' ">hazard_code,</if>
            <if test="riskUnitId != null and riskUnitId != '' ">risk_unit_id,</if>
            <if test="riskUnitUuid != null ">risk_unit_uuid,</if>
            <if test="stopStartTime != null ">stop_start_time,</if>
            <if test="stopEndTime != null ">stop_end_time,</if>
            <if test="stopReason != null ">stop_reason,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="uuid != null ">#{uuid},</if>
            <if test="deleteStatus != null ">#{deleteStatus},</if>
            <if test="gmtCreate != null ">#{gmtCreate},</if>
            <if test="createByUserName != null and createByUserName != '' ">#{createByUserName},</if>
            <if test="gmtModitify != null ">#{gmtModitify},</if>
            <if test="lastEditUserName != null and lastEditUserName != '' ">#{lastEditUserName},</if>
            <if test="enterpriseId != null and enterpriseId != '' ">#{enterpriseId},</if>
            <if test="enterpriseUuid != null and enterpriseUuid != '' ">#{enterpriseUuid},</if>
            <if test="reportTime != null ">#{reportTime},</if>
            <if test="updateReportDataTime != null ">#{updateReportDataTime},</if>
            <if test="reportStatus != null ">#{reportStatus},</if>
            <if test="reportSwitch != null ">#{reportSwitch},</if>
            <if test="hazardCode != null and hazardCode != '' ">#{hazardCode},</if>
            <if test="riskUnitId != null and riskUnitId != '' ">#{riskUnitId},</if>
            <if test="riskUnitUuid != null ">#{riskUnitUuid},</if>
            <if test="stopStartTime != null ">#{stopStartTime},</if>
            <if test="stopEndTime != null ">#{stopEndTime},</if>
            <if test="stopReason != null ">#{stopReason},</if>
        </trim>
    </insert>
 
 
<!--    int updateOverhaulLog(PreventOverhaulLogUpdateReqBO updateReqBO);-->
    <update id="updateOverhaulLog" parameterType="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
        update prevent_overhaul_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="hazardCode != null  and hazardCode != ''">hazard_code = #{updateReqBO.id},</if>
            <if test="riskUnitId != null ">risk_unit_id = #{updateReqBO.riskUnitId},</if>
            <if test="riskUnitUuid != null  and riskUnitUuid != ''">risk_unit_uuid = #{updateReqBO.riskUnitUuid},</if>
            <if test="stopStartTime != null ">stop_start_time = #{updateReqBO.stopStartTime},</if>
            <if test="stopEndTime != null ">stop_end_time = #{updateReqBO.stopEndTime},</if>
            <if test="stopReason != null  and stopReason != ''">stop_reason = #{updateReqBO.stopReason},</if>
        </trim>
        where id = #{updateReqBO.id}
    </update>
 
<!--    int deleteOverhaulLogByIds(String[] ids);-->
    <delete id="deleteOverhaulLogByIds" parameterType="String">
        delete from prevent_overhaul_log where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
 
 
    <!--    int updateOverhaulReportStatus(HandlerReportParam handlerReportParam);-->
    <update id="updateOverhaulReportStatus" parameterType="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
        update prevent_overhaul_log  set
        report_status =  #{reportStatus},
        report_time = #{reportTime}
        where id = #{handlerReportParam.id}
    </update>
</mapper>