| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- <?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="cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper">
- <select id="getFillDevices"
- resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
- select
- distinct
- c.id,
- c.dept_id,
- c.device_code,
- c.device_name,
- b.device_category_id,
- d.person_id user_id
- from
- 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
- a.device_category_id = b.device_category_id
- and
- a.device_category_id = c.asset_class
- and
- c.id = d.device_id
- and
- c.device_status in ('sg','dm')
- </select>
- <select id="getFillById" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO"
- resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
- select * from rqiot.rq_iot_opeation_fill_order where id = #{id}
- </select>
- <select id="getFillDevices1"
- resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
- select
- distinct
- c.id,
- c.dept_id,
- c.device_code,
- c.device_name,
- b.device_category_id,
- d.person_id user_id
- from
- 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
- a.device_category_id = b.device_category_id
- and
- a.device_category_id = c.asset_class
- and
- c.id = d.device_id
- and
- c.device_status in ('sg','dm')
- and c.device_id in
- <foreach item="deviceId" collection="array" open="(" separator="," close=")">
- #{deviceId}
- </foreach>
- </select>
- <insert id="insertFill"
- 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,order_id)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.deviceId},#{item.deviceCode},#{item.deviceName},
- #{item.deviceCategoryId},#{item.createTime},#{item.deptId},#{item.orderId})
- </foreach>
- </insert>
- <insert id="insertFillOrder"
- parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
- insert into rqiot.rq_iot_opeation_fill_order(dept_id,order_name,
- order_status,create_time,order_type,user_name,user_id)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.deptId},#{item.orderName},#{item.orderStatus},
- #{item.createTime},#{item.orderType},#{item.userName},#{item.userId})
- </foreach>
- </insert>
- <insert id="insertLog"
- parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO">
- insert into rqiot.rq_iot_device_run_log
- (dept_id,device_id,device_code,point_code,fill_content,create_time,point_name,total_run_time)
- values
- <foreach collection="list" item="item" separator=",">
- (#{item.deptId},#{item.deviceId},#{item.deviceCode},
- #{item.pointCode},#{item.fillContent},#{item.createTime},#{item.pointName},#{item.totalRunTime})
- </foreach>
- </insert>
- <!-- <select id="fillList" 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>-->
- <select id="fillList" 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="userId != null and userId != ''">
- and device_id in (select device_id from
- rqiot.rq_iot_device_person where person_id = #{userId})
- </if>
- </select>
- <select id="fills" 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 1=1
- and c.device_id in
- <foreach item="deviceId" collection="array" open="(" separator="," close=")">
- #{deviceId}
- </foreach>
- </select>
- <update id="upFill" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
- update rqiot.rq_iot_opeation_fill set dept_id = #{deptId} where device_id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{deviceId}
- </foreach>
- </update>
- <select id="deviceList" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO"
- resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
- select device_id from
- rqiot.rq_iot_device_person where person_id = #{userId}
- </select>
- <select id="fillListByUserId" 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
- 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
- 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>
- <if test="deviceId != null and deviceId != ''">
- and a.device_id = #{deviceId}
- </if>
- </select>
- <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}
- <if test="orderName != null and orderName != ''">
- and a.order_name like #{orderName}
- </if>
- <if test="orderStatus != null and orderStatus != ''">
- and a.order_status like #{orderStatus}
- </if>
- </select>
- <select id="rhList"
- 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 := '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 id="rdList"
- 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 := '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 id="ryList"
- 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 := '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 id="flList" 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 rq_iot_product_classify 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 rqiot.rq_iot_product_classify
- WHERE id = #{id}
- ORDER BY id;
- </select>
- <select id="pdList" resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
- select
- distinct
- a.id user_id,
- a.nickname user_name,
- a.dept_id,
- a.mobile
- from
- system_users a,
- rq_iot_device_person b
- where
- a.id = b.person_id
- </select>
- <select id="fillList1" 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_order
- WHERE 1=1
- <if test="deptId != null and deptId != ''">
- and dept_id = #{deptId}
- </if>
- </select>
- <select id="getAttrsById" parameterType="cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO"
- resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotModelTemplateAttrsDO">
- select
- name,
- type,
- model_attr,
- is_sum
- from
- rqiot.rq_iot_model_template_attrs
- where
- device_category_id = #{deviceCategoryId} and deleted = 0
- </select>
- <update id="updateFill" parameterType="cn.iocoder.yudao.module.pms.controller.admin.vo.IotOpeationModelPageReqVO">
- update rqiot.rq_iot_opeation_fill
- set is_fill = '1'
- where device_id = #{deviceId}
- and DATE(create_time) = DATE(#{createTime})
- </update>
- <select id="getFillList" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO"
- resultType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO">
- select distinct b.* from
- rq_iot_opeation_fill b
- where
- b.order_id = #{orderId}
- and
- DATE(b.create_time)=DATE(#{createTime})
- order by b.create_time desc
- </select>
- <select id="getDeivceFillInfo" 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
- point_name,
- fill_content,
- (select max(total_run_time) from rq_iot_device_run_log where device_id = #{deviceId})total_run_time
- FROM rq_iot_device_run_log
- WHERE
- device_id = #{deviceId}
- and
- DATE(create_time) = DATE(#{createTime})
- order by id
- desc
- limit 1
- </select>
- <select id="getLogInfo" 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
- *
- FROM rq_iot_device_run_log
- WHERE
- device_id = #{deviceId}
- and
- point_name = #{pointName}
- and
- DATE(create_time) = DATE(#{createTime})
- order by id
- desc
- limit 1
- </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}
- and
- point_name=#{pointName}
- </select>
- <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>
- <update id="updateFillOrder1" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO">
- update rqiot.rq_iot_opeation_fill_order set order_status = 0 where id = #{id}
- </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>
- <select id="carList"
- resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotZHBD.DeviceZHBDDO">
- select distinct device_code ,car_id from rqiot.rq_iot_car_zhbd
- </select>
- <update id="upLocation"
- parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotZHBD.DeviceZHBDDO">
- update rq_iot_device set location= #{location} where device_code = #{deviceCode}
- </update>
- </mapper>
|