| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?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,b.type,b.install_date installDate,b.expiration_date expirationDate
- from broadcast b left join broadcast_item bi on bi.broadcastId = b.id
- left join lamp_pole lp on b.lamp_pole_id = lp.id
- where b.lamp_pole_id != 0
- <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>
-
- </mapper>
|