双重预防项目-国泰新华二开定制版
kongzy
2024-08-14 135a322f44708b1187d37ea4b6859b5d82113e89
src/main/resources/mybatis/doublePrevention/PreventOverhaulMapper.xml
@@ -1,134 +1,134 @@
<?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"/>
        <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" resultMap="BaseResultMap">
        select * from prevent_overhaul_log
        <where>
            delete_status = 0
            <if test="overhaulLogReqBO.riskUnitId != null">
                and risk_unit_id = #{overhaulLogReqBO.riskUnitId}
            </if>
        </where>
    </select>
<!--    PreventOverhaulLog getOverhaulLogById(Long id);-->
    <select id="getOverhaulLogById" resultMap="BaseResultMap">
        select * from prevent_overhaul_log
        where delete_status = 0 and id = #{id}
    </select>
<!--    List<PreventOverhaulLog> listReportOverhaulLog();-->
    <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>
<!--    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="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 = #{preventOverhaulLog.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>
<?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"/>
        <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" resultMap="BaseResultMap">
        select * from prevent_overhaul_log
        <where>
            delete_status = 0
            <if test="overhaulLogReqBO.riskUnitId != null">
                and risk_unit_id = #{overhaulLogReqBO.riskUnitId}
            </if>
        </where>
    </select>
<!--    PreventOverhaulLog getOverhaulLogById(Long id);-->
    <select id="getOverhaulLogById" resultMap="BaseResultMap">
        select * from prevent_overhaul_log
        where delete_status = 0 and id = #{id}
    </select>
<!--    List<PreventOverhaulLog> listReportOverhaulLog();-->
    <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>
<!--    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="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 = #{preventOverhaulLog.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>