危化品全生命周期管理后端
“djh”
2025-03-06 9c4cd9c77bb92b22a2099c56afb0b5dc3c898470
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
<?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.HzHazmatBasicMapper">
    <resultMap type="com.gkhy.hazmat.system.domain.HzHazmatBasic" id="HzHazmatBasicResult">
        <result property="id"       column="id"       />
        <result property="name"    column="name"    />
        <result property="cas"     column="cas"     />
        <result property="hazmatType"  column="hazmat_type"  />
        <result property="hazmatCharacter"  column="hazmat_character"  />
        <result property="supplier"  column="supplier"  />
        <result property="manufacturer"  column="manufacturer"  />
        <result property="hazmatFormat"  column="hazmat_format"  />
        <result property="minPackage"  column="min_package"  />
        <result property="kind"  column="kind"  />
        <result property="metering"  column="metering"  />
        <result property="unit"  column="unit"  />
        <result property="price"  column="price"  />
        <result property="perBox"  column="per_box"  />
        <result property="safeNum"  column="safe_num"  />
        <result property="threshold"  column="threshold"  />
        <result property="productSn"  column="product_sn"  />
        <result property="delFlag"  column="del_flag"  />
        <result property="peculiarityType"         column="peculiarity_type"          />
        <result property="peculiarityNumber"         column="peculiarity_number"          />
        <result property="companyId"         column="company_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="maxEntry"         column="max_entry"          />
        <result property="companyName"         column="company_name"          />
        <result property="riskType" column="risk_type"/>
    </resultMap>
 
    <sql id="selectHazmatBasicVo">
        select a.id, a.name, a.cas, a.hazmat_type,a.min_package, a.kind,a.hazmat_character,a.supplier,a.manufacturer,a.hazmat_format,a.metering,
               a.unit,a.price,a.per_box,a.safe_num,a.threshold,a.product_sn,a.company_id,a.version,a.peculiarity_type,a.peculiarity_number, a.create_by, a.create_time,
               a.update_by, a.update_time, a.remark,a.max_entry,b.name as company_name,hs.risk_type
        from hz_hazmat_basic a
        left join sys_company b on b.id=a.company_id
        LEFT JOIN hz_secientific hs ON a.secientific_id = hs.id
    </sql>
 
    <update id="deleteHazmatBasicById" parameterType="java.lang.Long">
        update hz_hazmat_basic set del_flag=1 where id=#{hazmatBasicId}
    </update>
 
    <select id="checkProductSnUnique" resultType="com.gkhy.hazmat.system.domain.HzHazmatBasic">
        select id,product_sn from hz_hazmat_basic where product_sn=#{productSn} and company_id=#{companyId} and del_flag=0 limit 1
    </select>
 
    <select id="selectHazmatBasicList" resultMap="HzHazmatBasicResult"
            parameterType="com.gkhy.hazmat.system.domain.HzHazmatBasic">
        <include refid="selectHazmatBasicVo"/>
        <where>
            and a.del_flag=0
            <if test="name != null and name != ''">
                AND a.name like concat('%', #{name}, '%')
            </if>
            <if test="cas != null and cas != ''">
                AND a.cas like concat('%', #{cas}, '%')
            </if>
            <if test="productSn != null and productSn != ''">
                AND a.product_sn like concat('%', #{productSn}, '%')
            </if>
            <if test="companyId != null">
                AND a.company_id =#{companyId}
            </if>
            <if test="kind != null">
                AND a.kind =#{kind}
            </if>
            <if test="supplier != null and supplier != ''">
                AND a.supplier like concat(#{supplier}, '%')
            </if>
        </where>
        order by a.id desc
    </select>
 
    <select id="selectHazmatBasicListByIds" resultType="com.gkhy.hazmat.system.domain.HzHazmatBasic">
        select * from hz_hazmat_basic where del_flag=0 and  id in
        <foreach collection="basicIds" item="basicId" open="(" separator="," close=")">
            #{basicId}
        </foreach>
    </select>
</mapper>