<?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>
|