heheng
2025-10-15 a4f1e1a9b97f7606347ba1b6a5c5957c3fc28a59
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
<?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.gkhy.system.mapper.HazardsMapper">
 
 
    <resultMap id="BaseResultMap" type="com.gkhy.system.domain.Hazards">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="hazard_name" property="hazardName" jdbcType="VARCHAR" />
        <result column="hazard_description" property="hazardDescription" jdbcType="VARCHAR" />
        <result column="hazard_source" property="hazardSource" jdbcType="INTEGER" />
        <result column="hazard_level" property="hazardLevel" jdbcType="INTEGER" />
        <result column="hazard_place" property="hazardPlace" jdbcType="VARCHAR" />
        <result column="hazard_room" property="hazardRoom" jdbcType="VARCHAR" />
        <result column="reform_dept_id" property="reformDeptId" jdbcType="BIGINT" />
        <result column="reform_user_id" property="reformUserId" jdbcType="BIGINT" />
        <result column="hazard_pics" property="hazardPics" jdbcType="VARCHAR" />
        <result column="state" property="state" jdbcType="INTEGER" />
        <result column="reform_period" property="reformPeriod" jdbcType="TIMESTAMP" />
        <result column="rectification_measures" property="rectificationMeasures" jdbcType="VARCHAR" />
        <result column="reason_analysis" property="reasonAnalysis" jdbcType="VARCHAR" />
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="del_flag" property="delFlag" jdbcType="VARCHAR" />
        <result column="create_by" property="createBy" jdbcType="VARCHAR" />
        <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
        <result column="reform_pics" property="reformPics" jdbcType="VARCHAR" />
        <result column="reform_dept_name" property="reformDeptName" jdbcType="VARCHAR" />
        <result column="reform_user_name" property="reformUserName" jdbcType="VARCHAR" />
    </resultMap>
 
    <select id="getHazardsList" resultMap="BaseResultMap" parameterType="com.gkhy.system.domain.Hazards">
        select a.*, b.dept_name as reform_dept_name, c.nick_name as reform_user_name
        from hazards a
                 left join sys_dept b on a.reform_dept_id = b.dept_id
                 left join sys_user c on a.reform_user_id = c.user_id
        where a.del_flag = '0'
        <if test="hazardName != null and hazardName != ''">
            and a.hazard_name like concat('%',#{hazardName},'%')
        </if>
        <if test="hazardDescription != null and hazardDescription != ''">
            and a.hazard_description like concat('%',#{hazardDescription},'%')
        </if>
        <if test="hazardSource != null">
            and a.hazard_source = #{hazardSource}
        </if>
        <if test="hazardLevel != null">
            and a.hazard_level = #{hazardLevel}
        </if>
        <if test="hazardPlace != null and hazardPlace != ''">
            and a.hazard_place like concat('%',#{hazardPlace},'%')
        </if>
        <if test="hazardRoom != null and hazardRoom != ''">
            and a.hazard_room like concat('%',#{hazardRoom},'%')
        </if>
        <if test="reformDeptId != null">
            and a.reform_dept_id = #{reformDeptId}
        </if>
        <if test="reformUserId != null">
            and a.reform_user_id = #{reformUserId}
        </if>
        <if test="state != null">
            and a.state = #{state}
        </if>
        order by a.create_time desc
    </select>
</mapper>