|
@@ -5,34 +5,38 @@
|
|
|
|
|
|
<select id="getFillDevices"
|
|
<select id="getFillDevices"
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
|
|
+
|
|
select
|
|
select
|
|
distinct
|
|
distinct
|
|
- a.id,
|
|
|
|
- a.dept_id,
|
|
|
|
- a.device_code,
|
|
|
|
- a.device_name,
|
|
|
|
- b.device_category_id
|
|
|
|
|
|
+ c.id,
|
|
|
|
+ c.dept_id,
|
|
|
|
+ c.device_code,
|
|
|
|
+ c.device_name,
|
|
|
|
+ b.device_category_id,
|
|
|
|
+ d.person_id user_id
|
|
from
|
|
from
|
|
- rqiot.rq_iot_device a,
|
|
|
|
- rqiot.rq_iot_model_template b
|
|
|
|
|
|
+ rqiot.rq_iot_model_template a,
|
|
|
|
+ rqiot.rq_iot_model_template_attrs b,
|
|
|
|
+ rqiot.rq_iot_device c,
|
|
|
|
+ rqiot.rq_iot_device_person d
|
|
where
|
|
where
|
|
- a.asset_class = b.device_category_id
|
|
|
|
|
|
+ a.device_category_id = b.device_category_id
|
|
and
|
|
and
|
|
- a.deleted = 0
|
|
|
|
|
|
+ a.device_category_id = c.asset_class
|
|
and
|
|
and
|
|
- b.deleted = 0
|
|
|
|
|
|
+ c.id = d.device_id
|
|
and
|
|
and
|
|
- a.device_status in ('sg','dm')
|
|
|
|
|
|
+ c.device_status in ('sg','dm')
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertFill"
|
|
<insert id="insertFill"
|
|
parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
- insert into rqiot.rq_iot_opeation_fill(device_id,device_code,device_name,device_category_id,create_time,dept_id)
|
|
|
|
|
|
+ insert into rqiot.rq_iot_opeation_fill(device_id,device_code,device_name,device_category_id,create_time,dept_id,order_id)
|
|
values
|
|
values
|
|
<foreach collection="list" item="item" separator=",">
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.deviceId},#{item.deviceCode},#{item.deviceName},
|
|
(#{item.deviceId},#{item.deviceCode},#{item.deviceName},
|
|
- #{item.deviceCategoryId},#{item.createTime},#{item.deptId})
|
|
|
|
|
|
+ #{item.deviceCategoryId},#{item.createTime},#{item.deptId},#{item.orderId})
|
|
</foreach>
|
|
</foreach>
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
@@ -94,68 +98,117 @@
|
|
|
|
|
|
<select id="fillListByUserId" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO"
|
|
<select id="fillListByUserId" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO"
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
- SELECT distinct a.*,
|
|
|
|
- b.name org_name FROM
|
|
|
|
- rqiot.rq_iot_opeation_fill a,
|
|
|
|
- rqiot.system_dept b,
|
|
|
|
|
|
+ select
|
|
|
|
+ distinct
|
|
|
|
+ a.*,
|
|
|
|
+ b.name org_name
|
|
|
|
+ from
|
|
|
|
+ rq_iot_opeation_fill a,
|
|
|
|
+ system_dept b,
|
|
|
|
+ rqiot.rq_iot_model_template_attrs c
|
|
|
|
+ where
|
|
|
|
+ a.dept_id = b.id
|
|
|
|
+ and
|
|
|
|
+ a.device_category_id = c.device_category_id
|
|
|
|
+
|
|
|
|
+ <if test="orderId != null and orderId != ''">
|
|
|
|
+ and a.order_id = #{orderId}
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="fillListByDeptId" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO"
|
|
|
|
+ resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
|
|
+ select
|
|
|
|
+ distinct
|
|
|
|
+ a.*,
|
|
|
|
+ b.name org_name
|
|
|
|
+ from
|
|
|
|
+ rq_iot_opeation_fill a,
|
|
|
|
+ system_dept b,
|
|
rqiot.rq_iot_model_template_attrs c
|
|
rqiot.rq_iot_model_template_attrs c
|
|
- WHERE DATE(a.create_time) = DATE(#{createTime})
|
|
|
|
- <if test="userId != null and userId != ''">
|
|
|
|
- and a.device_id in (select device_id from
|
|
|
|
- rqiot.rq_iot_device_person where person_id = #{userId})
|
|
|
|
- </if>
|
|
|
|
- and
|
|
|
|
|
|
+ where
|
|
a.dept_id = b.id
|
|
a.dept_id = b.id
|
|
and
|
|
and
|
|
a.device_category_id = c.device_category_id
|
|
a.device_category_id = c.device_category_id
|
|
|
|
|
|
|
|
+ <if test="orderId != null and orderId != ''">
|
|
|
|
+ and a.order_id = #{orderId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="deviceId != null and deviceId != ''">
|
|
|
|
+ and a.device_id = #{deviceId}
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
- <select id="fillListByDeptId" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO"
|
|
|
|
- resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
|
|
- SELECT * FROM
|
|
|
|
- rqiot.rq_iot_opeation_fill
|
|
|
|
- WHERE DATE(create_time) = CURDATE()
|
|
|
|
- <if test="deptId != null and deptId != ''">
|
|
|
|
- and dept_id in (SELECT d1.id
|
|
|
|
- FROM system_dept d1
|
|
|
|
- JOIN system_dept d2 ON d2.id = d1.parent_id
|
|
|
|
- WHERE d2.parent_id = #{deptId}
|
|
|
|
- union
|
|
|
|
- select id from system_dept where id = #{deptId})
|
|
|
|
- </if>
|
|
|
|
|
|
+ <select id="fillRecords" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO"
|
|
|
|
+ resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillOrderDO">
|
|
|
|
+ select a.*
|
|
|
|
+ from
|
|
|
|
+ rq_iot_opeation_fill_order a,
|
|
|
|
+ rq_iot_opeation_fill b
|
|
|
|
+ where
|
|
|
|
+ a.id = b.order_id
|
|
|
|
+ and
|
|
|
|
+ b.device_id = #{deviceId}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="rhList"
|
|
<select id="rhList"
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
- SELECT d1.id dept_id
|
|
|
|
- FROM system_dept d1
|
|
|
|
- JOIN system_dept d2 ON d2.id = d1.parent_id
|
|
|
|
- WHERE d2.parent_id = 157
|
|
|
|
- union
|
|
|
|
- select id from system_dept where id = 157
|
|
|
|
|
|
+ SELECT au.id, au.name, au.parent_id
|
|
|
|
+ FROM (SELECT * FROM system_dept WHERE parent_id IS NOT NULL) au,
|
|
|
|
+ (SELECT @parent_id := '157') pd
|
|
|
|
+ WHERE FIND_IN_SET(parent_id, @parent_id) > 0
|
|
|
|
+ AND @parent_id := concat(@parent_id, ',', id)
|
|
|
|
+ UNION
|
|
|
|
+ SELECT id, name, parent_id
|
|
|
|
+ FROM system_dept
|
|
|
|
+ WHERE id = '157'
|
|
|
|
+ ORDER BY id;
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="rdList"
|
|
<select id="rdList"
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
- SELECT d1.id dept_id
|
|
|
|
- FROM system_dept d1
|
|
|
|
- JOIN system_dept d2 ON d2.id = d1.parent_id
|
|
|
|
- WHERE d2.parent_id = 163
|
|
|
|
- union
|
|
|
|
- select id from system_dept where id = 163
|
|
|
|
|
|
+ SELECT au.id, au.name, au.parent_id
|
|
|
|
+ FROM (SELECT * FROM system_dept WHERE parent_id IS NOT NULL) au,
|
|
|
|
+ (SELECT @parent_id := '163') pd
|
|
|
|
+ WHERE FIND_IN_SET(parent_id, @parent_id) > 0
|
|
|
|
+ AND @parent_id := concat(@parent_id, ',', id)
|
|
|
|
+ UNION
|
|
|
|
+ SELECT id, name, parent_id
|
|
|
|
+ FROM system_dept
|
|
|
|
+ WHERE id = '163'
|
|
|
|
+ ORDER BY id;
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="ryList"
|
|
<select id="ryList"
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
- SELECT d1.id dept_id
|
|
|
|
- FROM system_dept d1
|
|
|
|
- JOIN system_dept d2 ON d2.id = d1.parent_id
|
|
|
|
- WHERE d2.parent_id = 158
|
|
|
|
- union
|
|
|
|
- select id from system_dept where id = 158
|
|
|
|
|
|
+ SELECT au.id, au.name, au.parent_id
|
|
|
|
+ FROM (SELECT * FROM system_dept WHERE parent_id IS NOT NULL) au,
|
|
|
|
+ (SELECT @parent_id := '158') pd
|
|
|
|
+ WHERE FIND_IN_SET(parent_id, @parent_id) > 0
|
|
|
|
+ AND @parent_id := concat(@parent_id, ',', id)
|
|
|
|
+ UNION
|
|
|
|
+ SELECT id, name, parent_id
|
|
|
|
+ FROM system_dept
|
|
|
|
+ WHERE id = '158'
|
|
|
|
+ ORDER BY id;
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="pdList1" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO"
|
|
|
|
+ resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
|
|
+ SELECT au.id, au.name, au.parent_id
|
|
|
|
+ FROM (SELECT * FROM system_dept WHERE parent_id IS NOT NULL) au,
|
|
|
|
+ (SELECT @parent_id := #{id}) pd
|
|
|
|
+ WHERE FIND_IN_SET(parent_id, @parent_id) > 0
|
|
|
|
+ AND @parent_id := concat(@parent_id, ',', id)
|
|
|
|
+ UNION
|
|
|
|
+ SELECT id, name, parent_id
|
|
|
|
+ FROM system_dept
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
+ ORDER BY id;
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+
|
|
<select id="pdList" resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
<select id="pdList" resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
|
|
select
|
|
select
|
|
distinct
|
|
distinct
|
|
@@ -242,6 +295,19 @@
|
|
limit 1
|
|
limit 1
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="getMaxFillInfo" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO"
|
|
|
|
+ resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO">
|
|
|
|
+ <!--SELECT * FROM rq_iot_device_run_log
|
|
|
|
+ WHERE
|
|
|
|
+ device_id = #{deviceId}
|
|
|
|
+ and
|
|
|
|
+ create_time = (SELECT MAX(create_time) FROM rq_iot_device_run_log WHERE
|
|
|
|
+ device_id = #{deviceId})-->
|
|
|
|
+
|
|
|
|
+ select max(total_run_time)total_run_time from rq_iot_device_run_log where device_id = #{deviceId}
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<update id="updateFillOrder" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO">
|
|
<update id="updateFillOrder" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO">
|
|
update rqiot.rq_iot_opeation_fill_order set order_status = 1 where id = #{id}
|
|
update rqiot.rq_iot_opeation_fill_order set order_status = 1 where id = #{id}
|
|
</update>
|
|
</update>
|
|
@@ -249,4 +315,8 @@
|
|
update rqiot.rq_iot_opeation_fill_order set order_status = 0 where id = #{id}
|
|
update rqiot.rq_iot_opeation_fill_order set order_status = 0 where id = #{id}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
|
|
+ <update id="updateFillOrder2" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO">
|
|
|
|
+ update rqiot.rq_iot_opeation_fill_order set order_status = 2 where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
</mapper>
|
|
</mapper>
|