jiazx0107@163.com
2023-05-17 620eab6cca2bc9ef9ea6d3067a0a5ba1deadbd1c
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
<?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.ld.igds.phone35.mapper.Phone35Mapper">
 
    <!-- 根据仓库获取气体信息 -->
    <select id="getGasByDepot" resultType="com.ld.igds.phone35.dto.DtoPhoneGas" parameterType="java.lang.String">
        SELECT
        d.ID_ as depotId,
        d.NAME_ as depotName,
        g.PER_CO2_ as perCo2,
        g.PER_O2_ as perO2,
        g.PER_PH3_ as perPh3,
        g.PER_N2_ as perN2,
        g.RECEIVE_DATE_ as receiveDate,
        g.CHECK_USER_ as checkUser
        FROM d_depot d
        LEFT JOIN
        (SELECT * FROM(SELECT DISTINCT * from d_gas ORDER BY RECEIVE_DATE_ DESC) a GROUP BY DEPOT_ID_) g
        ON d.ID_ = g.DEPOT_ID_
        WHERE
        d.COMPANY_ID_ = #{companyId}
        <if test="deptId != null and deptId != ''">AND d.DEPT_ID_ = #{deptId}</if>
        ORDER BY d.ID_
    </select>
 
    <!-- 根据仓库获取虫害信息 -->
    <select id="getPestByDepot" resultType="com.ld.igds.phone35.dto.DtoPhonePest" parameterType="java.lang.String">
        SELECT
        d.ID_ as depotId,
        d.NAME_ as depotName,
        d.DEPOT_STATUS_ as depotStatus,
        g.PEST_MAX_ as pestNum,
        g.REMARK_ as isPest,
        g.RECEIVE_DATE_ as receiveDate
        FROM d_depot d
        LEFT JOIN
        (SELECT * FROM(SELECT DISTINCT * from d_pest ORDER BY RECEIVE_DATE_ DESC) a GROUP BY DEPOT_ID_) g
        ON d.ID_ = g.DEPOT_ID_
        WHERE
        d.COMPANY_ID_ = #{companyId}
        <if test="deptId != null and deptId != ''">AND d.DEPT_ID_ = #{deptId}</if>
        ORDER BY d.ID_
    </select>
 
</mapper>