危化品全生命周期管理后端
kongzy
2024-08-22 0c73654f55844e34772732914af8cc1e247aab63
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
<?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.HzWarehouseRecordMapper">
    <resultMap type="com.gkhy.hazmat.system.domain.HzWarehouseRecord" id="HzWarehouseRecordResult">
        <result property="id"       column="id"       />
        <result property="basicId"    column="basic_id"    />
        <result property="warehouseId"     column="warehouse_id"     />
        <result property="remaining"  column="remaining"  />
        <result property="num"  column="num"  />
        <result property="state"  column="state"  />
        <result property="companyId"         column="company_id"          />
        <result property="createId"         column="create_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="createName"         column="create_name"          />
        <association property="hazmatBasic" javaType="com.gkhy.hazmat.system.domain.HzHazmatBasic" resultMap="hazmatBasicResult" />
          <association property="warehouse" javaType="com.gkhy.hazmat.system.domain.HzWarehouse" resultMap="wareResult" />
    </resultMap>
 
    <resultMap id="hazmatBasicResult" type="com.gkhy.hazmat.system.domain.HzHazmatBasic">
        <id     property="id"       column="hazmat_id"        />
        <result property="name"     column="hazmat_name"      />
        <result property="cas"     column="hazmat_cas"      />
        <result property="hazmatType"     column="hazmat_type"      />
        <result property="hazmatCharacter"     column="hazmat_character"      />
        <result property="supplier"     column="hazmat_supplier"      />
        <result property="manufacturer"     column="hazmat_manufacturer"      />
        <result property="hazmatFormat"     column="hazmat_format"      />
        <result property="metering"     column="hazmat_metering"      />
        <result property="unit"     column="hazmat_unit"      />
        <result property="productSn"     column="hazmat_product_sn"      />
    </resultMap>
 
    <resultMap id="wareResult" type="com.gkhy.hazmat.system.domain.HzWarehouse">
        <id     property="id"       column="warehouse_id"        />
        <result property="name"     column="warehouse_name"      />
    </resultMap>
 
    <sql id="selectWarehouseRecordVo">
        select a.id, a.basic_id, a.warehouse_id,a.remaining,a.num,a.state,a.company_id,a.create_id,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
               b.id as hazmat_id,b.name as hazmat_name,b.cas as hazmat_cas,b.hazmat_type ,b.hazmat_character,b.supplier as hazmat_supplier,b.manufacturer as hazmat_manufacturer,
               b.hazmat_format,b.metering as hazmat_metering,b.unit as hazmat_unit,b.product_sn as hazmat_product_sn,
               c.id as warehouse_id,c.name as warehouse_name,d.name as create_name
        from hz_warehouse_record a
        left join hz_hazmat_basic b on b.id=a.basic_id
        left join hz_warehouse c on c.id=a.warehouse_id
        left join sys_user d on d.id =a.create_id
    </sql>
 
 
    <select id="selectWarehouseRecordList" resultMap="HzWarehouseRecordResult"
            parameterType="com.gkhy.hazmat.system.domain.HzWarehouseRecord">
        <include refid="selectWarehouseRecordVo"/>
        <where>
            <if test="basicId != null and basicId != ''">
                AND a.basic_id=#{basicId}
            </if>
            <if test="warehouseId != null and warehouseId != ''">
                AND a.warehouse_id=#{warehouseId}
            </if>
            <if test="companyId != null">
                AND a.company_id =#{companyId}
            </if>
        </where>
        order by a.id desc
    </select>
 
 
</mapper>