BroadcastMapper.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.welampiot.dao.BroadcastDao">
  4. <select id="getDevListByBroadcastDTO" resultType="BroadcastDTO">
  5. select b.id,b.name,b.dev_id devId,b.address,b.online,b.vol,bi.name as proName,b.isPlay,
  6. lp.name as lampPoleName,b.type,b.install_date installDate,b.expiration_date expirationDate
  7. from broadcast b left join broadcast_item bi on bi.broadcastId = b.id
  8. left join lamp_pole lp on b.lamp_pole_id = lp.id
  9. where b.lamp_pole_id != 0
  10. <if test="sectionList != null and !sectionList.isEmpty()">
  11. and lp.sectionid in
  12. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  13. #{dto}
  14. </foreach>
  15. </if>
  16. <choose>
  17. <when test="onlineState == 0">
  18. and b.online = 0
  19. </when>
  20. <when test="onlineState == 1">
  21. and b.online = 1
  22. </when>
  23. </choose>
  24. order by convert(lp.number using gbk) asc,
  25. convert(b.name using gbk) asc,b.id desc
  26. </select>
  27. <select id="getTotalBySectionList" resultType="Integer">
  28. select count(b.id) as total from broadcast b
  29. left join lamp_pole lp on b.lamp_pole_id = lp.id
  30. <if test="sectionList != null and !sectionList.isEmpty()">
  31. where lp.sectionid in
  32. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  33. #{dto}
  34. </foreach>
  35. </if>
  36. </select>
  37. <select id="getOnlineTotalBySectionList" resultType="Integer">
  38. select count(b.id) as total from broadcast b
  39. left join lamp_pole lp on b.lamp_pole_id = lp.id
  40. where b.online = 1
  41. <if test="sectionList != null and !sectionList.isEmpty()">
  42. and lp.sectionid in
  43. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  44. #{dto}
  45. </foreach>
  46. </if>
  47. </select>
  48. <select id="getUserIdByUserName" resultType="Integer">
  49. select u.id from user u
  50. where u.username = #{username}
  51. </select>
  52. <!-- 音乐列表 -->
  53. <select id="getProListByDTO" resultType="BroadcastProListDTO">
  54. select b.id,b.name,b.url
  55. from broadcast_pro_list b
  56. where b.userId = #{userId}
  57. </select>
  58. <!-- 节目列表 -->
  59. <select id="getItemListByDTO" resultType="BroadcastItemDTO">
  60. select b.id,b.name,b.proType,b.broadcastId,b.status,b.createTime,b1.name as broadcastStr
  61. from broadcast_item b left join broadcast b1 on b.broadcastId = b1.id
  62. left join lamp_pole lp on lp.id = b1.lamp_pole_id
  63. left join section s on lp.sectionid = s.id
  64. where b.userId = #{userId}
  65. <if test="devId != null and devId != 0">
  66. and b.broadcastId = #{devId}
  67. </if>
  68. </select>
  69. </mapper>