马宇豪
2023-08-25 aa2051a2327c079105110f5424f3a44ffaa0c7bb
src/main/resources/mybatis/doublePrevention/PreventOverhaulMapper.xml
@@ -4,30 +4,50 @@
    <resultMap id="BaseResultMap" type="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
        <id column="id" property="id"/>
        <id column="uuid" property="uuid"/>
        <result column="delete_status" property="deleteStatus" />
        <result column="gmt_create" property="gmtCreate" />
        <result column="create_by_user_name" property="createByUserName" />
        <result column="gmt_moditify" property="gmtModitify" />
        <result column="last_edit_user_name" property="lastEditUserName" />
        <result column="enterprise_id" property="enterpriseId" />
        <result column="enterprise_uuid" property="enterpriseUuid" />
        <result column="report_time" property="reportTime" />
        <result column="update_report_data_time" property="updateReportDataTime" />
        <result column="report_status" property="reportStatus" />
        <result column="report_switch" property="reportSwitch" />
        <result column="hazard_code" property="hazardCode" />
        <result column="risk_unit_id" property="riskUnitId" />
        <result column="risk_unit_uuid" property="riskUnitUuid" />
        <result column="stop_start_time" property="stopStartTime" />
        <result column="stop_end_time" property="stopEndTime" />
        <result column="stop_reason" property="stopReason" />
    </resultMap>
<!--    List<PreventOverhaulLog> selectOverhaulLogPage(@Param("overhaulLogReqBO") PreventOverhaulLogReqBO overhaulLogReqBO);-->
    <select id="selectOverhaulLogPage" resultType="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
    <select id="selectOverhaulLogPage" resultMap="BaseResultMap">
        select * from prevent_overhaul_log
        <where>
            delete_status = 0
            <if test="overhaulLogReqBO.hazardCode != null and overhaulLogReqBO.hazardCode != ''">
                and hazard_code = #{overhaulLogReqBO.hazardCode}
            <if test="overhaulLogReqBO.riskUnitId != null">
                and risk_unit_id = #{overhaulLogReqBO.riskUnitId}
            </if>
        </where>
    </select>
<!--    PreventOverhaulLog getOverhaulLogById(Long id);-->
    <select id="getOverhaulLogById" resultType="com.ruoyi.doublePrevention.entity.PreventOverhaulLog">
    <select id="getOverhaulLogById" resultMap="BaseResultMap">
        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 id="listReportOverhaulLog"  resultMap="BaseResultMap">
        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>
@@ -81,14 +101,16 @@
    <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>
            <if test="preventOverhaulLog.hazardCode != null  and preventOverhaulLog.hazardCode != ''">hazard_code = #{preventOverhaulLog.id},</if>
            <if test="preventOverhaulLog.riskUnitId != null ">risk_unit_id = #{preventOverhaulLog.riskUnitId},</if>
            <if test="preventOverhaulLog.riskUnitUuid != null  and preventOverhaulLog.riskUnitUuid != ''">risk_unit_uuid = #{preventOverhaulLog.riskUnitUuid},</if>
            <if test="preventOverhaulLog.stopStartTime != null ">stop_start_time = #{preventOverhaulLog.stopStartTime},</if>
            <if test="preventOverhaulLog.stopEndTime != null ">stop_end_time = #{preventOverhaulLog.stopEndTime},</if>
            <if test="preventOverhaulLog.stopReason != null  and preventOverhaulLog.stopReason != ''">stop_reason = #{preventOverhaulLog.stopReason},</if>
            <if test="preventOverhaulLog.gmtModitify != null ">gmt_moditify = #{preventOverhaulLog.gmtModitify},</if>
            <if test="preventOverhaulLog.lastEditUserName != null  and preventOverhaulLog.lastEditUserName != ''">last_edit_user_name = #{preventOverhaulLog.lastEditUserName},</if>
        </trim>
        where id = #{updateReqBO.id}
        where id = #{preventOverhaulLog.id}
    </update>
<!--    int deleteOverhaulLogByIds(String[] ids);-->