危化品全生命周期管理后端
heheng
2025-02-26 996c091a4913ac768324b7ea69a8494ba9d6ece0
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
<?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.hazmat.system.mapper.HzTabooWarningMapper">
    <resultMap type="com.gkhy.hazmat.system.domain.vo.HzTabooWarningVO" id="HzTabooWarningResult">
        <result property="id"       column="id"       />
        <result property="state"    column="state"    />
        <result property="tabooBasicId"    column="taboo_basic_id"    />
        <result property="basicId"         column="basic_id"          />
<!--        <result property="companyId"    column="company_id"    />-->
        <result property="tabooBasicName"    column="taboo_basic_name"    />
        <result property="cupboardName"         column="cupboard_name"          />
        <result property="warehouseId"    column="warehouse_id"    />
        <result property="cupboardId"    column="cupboard_id"    />
<!--        <result property="version"         column="version"          />-->
        <result property="createBy"       column="create_by"       />
        <result property="createTime"     column="create_time"     />
        <result property="updateBy"       column="update_by"       />
        <result property="updateTime"     column="update_time"     />
        <result property="remark"         column="remark"          />
        <result property="basicName"    column="basic_name"    />
        <result property="warehouseName"     column="warehouse_name"      />
    </resultMap>
 
 
    <sql id="selectHzTabooWarningVo">
        select aa.id,aa.warning_type,aa.state,aa.taboo_basic_id,aa.create_by,aa.create_time,aa.update_time,
               aa.update_by,aa.version,aa.warehouse_id,a.basic_id,a.company_id,
               b.name as basic_name,
               c.name as warehouse_name,aa.cupboard_id,d.cupboard_name as cupboard_name,bb.name as taboo_basic_name
        from hz_taboo_warning aa
                 left join hz_entry_record a on aa.entry_id=a.id
                 left join hz_hazmat_basic b on b.id=a.basic_id
                 left join hz_warehouse c on c.id=aa.warehouse_id
                 left join hz_warehouse_cupboard d on d.id=aa.cupboard_id
                 left join hz_hazmat_basic bb on bb.id=aa.taboo_basic_id
    </sql>
    <select id="selectHzTabooWarningList" resultMap="HzTabooWarningResult"
            parameterType="com.gkhy.hazmat.system.domain.HzEntryRecord">
        <include refid="selectHzTabooWarningVo"/>
        <where>
            and aa.del_flag = 0
            <if test="companyId != null">
                AND aa.company_id= #{companyId}
            </if>
            <if test="state != null">
                AND aa.state= #{state}
            </if>
 
            <if test="warningType != null and warningType == 1">
                AND aa.warning_type = 1
            </if>
            <if test="warningType != null and warningType == 2">
                AND aa.warning_type != 1
            </if>
        </where>
        order by aa.state asc,aa.warning_type asc,aa.create_time desc
    </select>
 
 
</mapper>