<?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.by4cloud.platformx.device.mapper.DeviceStocktakingRecordMapper">
|
|
<resultMap id="deviceStocktakingRecordMap" type="com.by4cloud.platformx.device.entity.DeviceStocktakingRecord">
|
<id property="id" column="id"/>
|
<result property="compId" column="comp_id"/>
|
<result property="classId" column="class_id"/>
|
<result property="deviceClassId" column="device_class_id"/>
|
<result property="deviceCode" column="device_code"/>
|
<result property="deviceId" column="device_id"/>
|
<result property="deviceModels" column="device_models"/>
|
<result property="deviceName" column="device_name"/>
|
<result property="planId" column="plan_id"/>
|
<result property="position" column="position"/>
|
<result property="recordPic" column="record_pic"/>
|
<result property="recordTime" column="record_time"/>
|
<result property="serialNo" column="serial_no"/>
|
<result property="stocktakingUserId" column="stocktaking_user_id"/>
|
<result property="abnormalMarking" column="abnormal_marking"/>
|
<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="delFlag" column="del_flag"/>
|
</resultMap>
|
<select id="selectStocktatingResultByPlanId"
|
resultType="com.by4cloud.platformx.device.entity.vo.StocktatingRecordVo">
|
select
|
d.class_id ,
|
dc.name className,
|
d.number ,
|
d.name deviceName,
|
d.specification,
|
count(serial_no) zmNum,
|
(
|
select
|
count(1)
|
from
|
device_stocktaking_record dsr
|
where
|
dsr.class_id = d.class_id
|
and dsr.abnormal_marking = 0) pdNum
|
from
|
device_inventory di
|
join device d on
|
d.id = di.device_id
|
join device_class dc on
|
d.class_id = dc.id
|
where
|
di.del_flag = '0'
|
and exists (
|
select
|
*
|
from
|
device_stocktaking_plan_scope dsps
|
where
|
dsps.class_id = d.class_id
|
and dsps.plan_id = #{id}
|
)
|
group by
|
d.class_id ,
|
dc.name ,
|
d.number ,
|
d.name,
|
d.specification
|
</select>
|
</mapper>
|