bug
luoyisheng
2025-02-24 ccd758bcd9b357b365c28f62efde203faa83fb93
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?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.sinata.system.mapper.MwMicroEquipmentRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.sinata.system.domain.MwMicroEquipmentRecord">
        <id column="ID" property="id" />
        <result column="DEL_FLAG" property="delFlag" />
        <result column="CREATE_BY" property="createBy" />
        <result column="CREATE_TIME" property="createTime" />
        <result column="UPDATE_BY" property="updateBy" />
        <result column="UPDATE_TIME" property="updateTime" />
        <result column="EQUIPMENT_ID" property="equipmentId" />
        <result column="REMARK" property="remark" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        DEL_FLAG,
        CREATE_BY,
        CREATE_TIME,
        UPDATE_BY,
        UPDATE_TIME,
        ID, EQUIPMENT_ID, REMARK
    </sql>
    <select id="pageList" resultType="com.sinata.system.domain.vo.MwMicroEquipmentRecordVO">
        SELECT mmer.ID,
        mmer.EQUIPMENT_ID,
        mmer.REMARK,
        mmer.BOX_NUM,
        mmer.BAG_NUM,
        mmer.TOTAL_WEIGHT,
        mmer.USE_TIME,
        mme.EQUIPMENT_NAME,
        sd.DEPARTMENT_NAME AS hospitalName,
        su.NICK_NAME
        FROM MW_MICRO_EQUIPMENT_RECORD mmer
        LEFT JOIN MW_MICRO_EQUIPMENT mme ON mmer.EQUIPMENT_ID = mme.ID
        LEFT JOIN SYS_DEPARTMENT sd ON mme.DEPARTMENT_ID = sd.ID
        LEFT JOIN SYS_USER su ON mmer.OPERATOR_ID = su.USER_ID
        <where>
            mmer.DEL_FLAG = 0
            <if test="treeCode !=null and treeCode != ''">
                AND sd.TREE_CODE like concat(#{treeCode},'%')
            </if>
            <if test="query.equipmentName != null and query.equipmentName !=''">
                AND mme.EQUIPMENT_NAME like concat('%',#{query.equipmentName},'%')
            </if>
            <if test="query.equipmentNumber != null and query.equipmentNumber != ''">
                AND mme.EQUIPMENT_NUMBER like concat('%',#{query.equipmentNumber},'%')
            </if>
            <if test="query.useTimeStart != null and query.useTimeEnd != null">
                AND mmer.USE_TIME BETWEEN #{query.useTimeStart} AND #{query.useTimeEnd}
            </if>
        </where>
        ORDER BY mmer.USE_TIME DESC
    </select>
    <select id="getList" resultType="com.sinata.system.domain.vo.MwMicroEquipmentRecordVO">
        SELECT mmer.ID,
        mmer.EQUIPMENT_ID,
        mmer.REMARK,
        mmer.BOX_NUM,
        mmer.BAG_NUM,
        mmer.TOTAL_WEIGHT,
        mmer.USE_TIME,
        mme.EQUIPMENT_NAME,
        sd.DEPARTMENT_NAME AS hospitalName,
        su.NICK_NAME
        FROM MW_MICRO_EQUIPMENT_RECORD mmer
        LEFT JOIN MW_MICRO_EQUIPMENT mme ON mmer.EQUIPMENT_ID = mme.ID
        LEFT JOIN SYS_DEPARTMENT sd ON mme.DEPARTMENT_ID = sd.ID
        LEFT JOIN SYS_USER su ON mmer.OPERATOR_ID = su.USER_ID
        <where>
            mmer.DEL_FLAG = 0
            <if test="treeCode !=null and treeCode != ''">
                AND sd.TREE_CODE like concat(#{treeCode},'%')
            </if>
            <if test="query.equipmentName != null and query.equipmentName !=''">
                AND mme.EQUIPMENT_NAME like concat('%',#{query.equipmentName},'%')
            </if>
            <if test="query.equipmentNumber != null and query.equipmentNumber != ''">
                AND mme.EQUIPMENT_NUMBER like concat('%',#{query.equipmentNumber},'%')
            </if>
            <if test="query.useTimeStart != null and query.useTimeEnd != null">
                AND mmer.USE_TIME BETWEEN #{query.useTimeStart} AND #{query.useTimeEnd}
            </if>
            <if test="query.ids != null and query.ids.size()>0">
                AND mmer.ID IN
                <foreach collection="query.ids" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </if>
        </where>
        ORDER BY mmer.USE_TIME DESC
    </select>
    <select id="getStaticsData" resultType="com.sinata.system.domain.vo.MwMicroEquipmentStaticsVO">
        SELECT mmer.BAG_NUM, mmer.TOTAL_WEIGHT, mmer.USE_TIME, mcr.WEIGHT, mcr.WASTE_TYPE
        FROM MW_MICRO_EQUIPMENT_RECORD mmer
        LEFT JOIN MW_MICRO_EQUIPMENT_RECORD_ITEM mmeri
        ON mmer.ID = mmeri.EQUIPMENT_RECORD_ID
        LEFT JOIN MW_COLLECT_RECORD mcr on mcr.ID = mmeri.COLLECT_RECORD_ID
        LEFT JOIN MW_MICRO_EQUIPMENT mme ON mme.ID = mmer.EQUIPMENT_ID
        LEFT JOIN SYS_DEPARTMENT sd ON sd.ID = mme.DEPARTMENT_ID
        <where>
            mmer.DEL_FLAG = 0
            <if test="query.equipmentId != null">
                AND mmer.EQUIPMENT_ID = #{query.equipmentId}
            </if>
            <if test="query.startTime !=null and query.endTime != null">
                AND mmer.USE_TIME BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
        </where>
        GROUP BY mmer.ID
    </select>
 
</mapper>