| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?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.xunmei.iot.mapper.IotDvsTemplateChannelMapper">
- <select id="getChannelPlanList" resultType="com.xunmei.iot.vo.videoTemplateAndPlan.VideoChannelPlanVo">
- SELECT
- d.id as device_id,
- d.device_name as channel_name,
- d.device_code as channel_code,
- i.device_name as dvs_name,
- e.net_address,
- d.org_name,
- a.`name` as template_name,
- p.plan_type,
- p.update_time as plan_update_time,
- p.fail_remark,
- p.min_time,
- p.max_time
- FROM
- iot_device_info d
- LEFT JOIN iot_device_info i ON d.host_code = i.device_code
- LEFT JOIN iot_device_info_extend e ON e.device_id = i.id
- LEFT JOIN iot_dvs_template_channel t ON d.iot_token = t.iot_token and d.host_code = t.dvs_code and d.device_code = t.channel_code
- LEFT JOIN iot_dvs_template a ON t.iot_token = a.iot_token and t.template_md5 = a.template_md5
- LEFT JOIN iot_dvs_plantype p ON d.iot_token = p.iot_token and d.host_code = p.dvs_code and d.device_code = p.channel_code
- WHERE
- d.device_type = 3
- and d.deleted = 0
- <choose>
- <when test="req.checkSub == false">
- and d.org_id=#{req.orgId}
- </when>
- <otherwise>
- and d.org_path like concat(#{req.orgPath},'%')
- </otherwise>
- </choose>
- <if test="req.channelName != null and req.channelName != ''">
- and d.device_name like concat('%',#{req.channelName},'%')
- </if>
- <if test="req.dvsName != null and req.dvsName != ''">
- and i.device_name like concat('%',#{req.dvsName},'%')
- </if>
- <if test="req.planType != null">
- and p.plan_type = #{req.planType}
- </if>
- <if test="req.templateName != null and req.templateName != ''">
- <choose>
- <when test="req.templateName == '未绑定'">
- and a.`name` is null
- </when>
- <otherwise>
- and a.`name` = #{req.templateName}
- </otherwise>
- </choose>
- </if>
- order by p.plan_type desc
- </select>
- <select id="getChannelPlanTimeList" resultType="com.xunmei.iot.vo.videoTemplateAndPlan.VideoChannelPlanTimeVo">
- SELECT
- p.type,
- p.`week`,
- p.start_time,
- p.end_time
- FROM
- iot_dvs_plantime p
- LEFT JOIN iot_device_info d ON p.dvs_code = d.host_code AND p.channel_code = d.device_code AND p.iot_token = d.iot_token
- WHERE
- d.id = #{req.deviceId}
- <if test="req.week != null and req.week != -1">
- AND p.`week` = #{req.week}
- </if>
- ORDER BY
- p.`week` ASC
- </select>
- <select id="getTemplateNameList" resultType="java.lang.String">
- SELECT `name` FROM iot_dvs_template GROUP BY `name` ORDER BY `name`
- </select>
- </mapper>
|