123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <?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.welampiot.dao.BroadcastDao">
- <select id="getDevListByBroadcastDTO" resultType="BroadcastDTO">
- select b.id,b.name,b.dev_id devId,b.address,b.online,b.vol,bi.name as proName,b.isPlay,
- lp.name as lampPoleName,lp.id as lampPoleId,b.type,b.install_date installDate,b.expiration_date expirationDate
- from broadcast b
- left join broadcast_item bi on bi.id = b.itemId
- left join lamp_pole lp on b.lamp_pole_id = lp.id
- left join broadcast_pro_list as BP on b.proId = BP.id
- where b.lamp_pole_id != 0
- <if test="areaId != 0">
- and lp.areaid = #{areaId}
- </if>
- <if test="sectionId != 0">
- and lp.sectionid = #{sectionId}
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <choose>
- <when test="onlineState == 0">
- and b.online = 0
- </when>
- <when test="onlineState == 1">
- and b.online = 1
- </when>
- </choose>
- order by convert(lp.number using gbk) asc,
- convert(b.name using gbk) asc,b.id desc
- </select>
- <select id="getTotalBySectionList" resultType="Integer">
- select count(b.id) as total from broadcast b
- left join lamp_pole lp on b.lamp_pole_id = lp.id
- <if test="sectionList != null and !sectionList.isEmpty()">
- where lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getOnlineTotalBySectionList" resultType="Integer">
- select count(b.id) as total from broadcast b
- left join lamp_pole lp on b.lamp_pole_id = lp.id
- where b.online = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getUserIdByUserName" resultType="Integer">
- select u.id from user u
- where u.username = #{username}
- </select>
- <!-- 音乐列表 -->
- <select id="getProListByDTO" resultType="BroadcastProListDTO">
- select b.id,b.name,b.url
- from broadcast_pro_list b
- where b.userId = #{userId}
- </select>
- <!-- 节目列表 -->
- <select id="getItemListByDTO" resultType="BroadcastItemDTO">
- select b.id,b.name,b.proType,b.broadcastId,b.status,b.createTime,b1.name as broadcastStr
- from broadcast_item b left join broadcast b1 on b.broadcastId = b1.id
- left join lamp_pole lp on lp.id = b1.lamp_pole_id
- left join section s on lp.sectionid = s.id
- where b.userId = #{userId}
- <if test="devId != null and devId != 0">
- and b.broadcastId = #{devId}
- </if>
- </select>
- <delete id="deleteBroadcastById">
- delete
- from broadcast
- where id = #{id};
- </delete>
- <select id="getBroadcastById" resultType="BroadcastDTO">
- select b.lamp_pole_id as lampPoleId,lp.sectionid as sectionId,b.address,b.type,b.dev_id as devId,b.name,
- from broadcast b
- left join lamp_pole lp on lp.id = b.lamp_pole_id
- left join section s on lp.sectionid = s.id
- where b.id = #{id}
- </select>
- <select id="getBroadcastCountByLampPoleId" resultType="Integer">
- select count(*)
- from broadcast b
- where b.lamp_pole_id = #{lampPoleId}
- </select>
- <select id="getBroadcastDTOByLampPoleId" resultType="BroadcastDTO">
- select b.lamp_pole_id,lp.sectionid as sectionId,b.id,b.itemId as proId,
- b2.name as proName,b3.time,b.online
- from broadcast b
- left join lamp_pole lp on lp.id = b.lamp_pole_id
- left join broadcast_pro_list b3 on b3.id = b.proId
- left join broadcast_item b2 on b2.id = b.itemId
- left join section s on lp.sectionid = s.id
- where b.lamp_pole_id = #{lampPoleId}
- </select>
- <select id="checkBroadcastData" resultType="Integer">
- select count(*)
- from broadcast b
- where 1=1
- <if test="address != null and address != ''">
- and b.address = #{address}
- </if>
- <if test="lampPoleId != null and lampPoleId != 0">
- and b.lamp_pole_id != #{lampPoleId}
- </if>
- <if test="name != null and name != ''">
- and b.name = #{name}
- </if>
- <if test="id != null and id != 0">
- and b.id != #{id}
- </if>
- </select>
- <update id="updateLampPoleBroadcastData" parameterType="BroadcastDTO">
- update
- broadcast e
- set
- <if test="installDate != null and installDate != ''">e.install_date = #{installDate},</if>
- <if test="expirationDate != null and installDate != ''">e.expiration_date = #{expirationDate},</if>
- <if test="address != null and address != ''">e.address = #{address},</if>
- e.type = #{type},
- e.name = #{name}
- where 1=1
- <if test="lampPoleId != null and lampPoleId != 0">
- and e.lamp_pole_id = #{lampPoleId}
- </if>
- <if test="id != null and id != 0">
- and e.id = #{id}
- </if>
- </update>
- <update id="updateBroadcastById" parameterType="BroadcastDTO">
- update
- broadcast e
- set
- <if test="vol != null and vol != ''">e.vol = #{vol},</if>
- <if test="policyId != null and policyId != ''">e.policy_id = #{policyId},</if>
- <if test="itemId != null and itemId != ''">e.itemId = #{itemId},</if>
- e.id = #{id}
- where e.id = #{id}
- </update>
- <select id="getListByIds" resultType="com.welampiot.dto.BroadcastDTO" parameterType="String">
- select address,online,dev_id as devId,type,vol
- from broadcast b
- where id in (#{ids})
- </select>
- <select id="getOneDataByLampPoleId" parameterType="integer" resultType="BroadcastDTO">
- select isPlay,proId,itemId,id
- from broadcast
- where lamp_pole_id = #{lampPoleId} order by id desc
- </select>
-
- <select id="getData" resultType="BroadcastDTO">
- select a.id,a.online,a.isPlay,a.type,b.name as itemName,c.name as proName
- from broadcast a left join broadcast_item b on a.itemId = b.id
- left join broadcast_pro_list c on a.proId = c.id
- where a.lamp_pole_id = #{lampPoleId}
- </select>
- <select id="getCount" resultType="integer" parameterType="BroadcastDTO">
- select count(*) as total from broadcast b
- left join broadcast_item bi on bi.id = b.itemId
- left join lamp_pole lp on b.lamp_pole_id = lp.id
- left join broadcast_pro_list as BP on b.proId = BP.id
- where b.lamp_pole_id != 0
- <if test="areaId != 0">
- and lp.areaid = #{areaId}
- </if>
- <if test="sectionId != 0">
- and lp.sectionid = #{sectionId}
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <choose>
- <when test="onlineState == 0">
- and b.online = 0
- </when>
- <when test="onlineState == 1">
- and b.online = 1
- </when>
- </choose>
- order by convert(lp.number using gbk) asc,
- convert(b.name using gbk) asc,b.id desc
- </select>
- <select id="getList" parameterType="BroadcastDTO" resultType="BroadcastDTO">
- select id,name,dev_id as devId,name,vol,address,lamp_pole_id as lampPoleId from broadcast
- <trim prefix="where" prefixOverrides="and|or">
- <if test="idList != null and id">
- id in
- <foreach collection="idList" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </trim>
- </select>
- </mapper>
|