NetworkMapper.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.NetworkDao">
  4. <insert id="add" parameterType="com.welampiot.dto.NetworkDTO" useGeneratedKeys="true" keyProperty="id">
  5. insert into network(network_name,devicesn,protocoltype,areaid,sectionid,createtime,net_type,gatewaytype,devicetype,userId)
  6. values
  7. (#{networkName},#{deviceSn},#{protocolType},#{areaId},#{sectionId},#{createTime},#{netType},#{gatewayType},#{deviceType},#{userId})
  8. <!-- <if test="sectionList != null and !sectionList.isEmpty()">-->
  9. <!-- where l.sectionid in-->
  10. <!-- <foreach item="dto" collection="sectionList" open="(" separator="," close=")">-->
  11. <!-- #{dto}-->
  12. <!-- </foreach>-->
  13. <!-- </if>-->
  14. </insert>
  15. <update id="update" parameterType="com.welampiot.dto.NetworkDTO">
  16. update network
  17. set
  18. network_name=#{networkName},
  19. devicesn=#{deviceSn},
  20. protocoltype=#{protocolType},
  21. areaid=#{areaId},
  22. sectionid=#{sectionId},
  23. devicetype=#{deviceType}
  24. where id = #{id}
  25. </update>
  26. <select id="getNetListByDTO" resultType="NetworkDTO">
  27. select
  28. <choose>
  29. <when test="version == 0">
  30. gl.chinese_name as area,
  31. </when>
  32. <when test="version == 1">
  33. gl.english_name as area,
  34. </when>
  35. <otherwise>
  36. gl.ru_name as area,
  37. </otherwise>
  38. </choose>
  39. n.id,n.network_name as networkName,n.devicesn as deviceSn,n.protocoltype as protocolType,n.status,
  40. n.model,n.lampcount as lampCount,n.fre_band_info as freBandInfo,n.simcard as simCard,n.operator,s.name as section
  41. from network n
  42. left join section s on n.sectionid = s.id
  43. left join global_location gl on s.pid = gl.id
  44. <if test="sectionList != null and !sectionList.isEmpty()">
  45. where n.sectionid in
  46. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  47. #{dto}
  48. </foreach>
  49. </if>
  50. </select>
  51. <select id="getNetworkDetails" resultType="NetworkDTO">
  52. select
  53. n.id,
  54. n.network_name as networkName,
  55. n.devicesn as deviceSn,
  56. n.protocoltype as protocolType,
  57. n.model,
  58. n.areaid as areaId,
  59. n.sectionid as sectionId,
  60. n.longitude,
  61. n.latitude,
  62. n.fre_band_info freBandInfo,
  63. n.simcard as simCard,
  64. n.operator,
  65. s.name as section
  66. <choose>
  67. <when test="version == 0">
  68. ,gl.chinese_name as area
  69. </when>
  70. <when test="version == 1">
  71. ,gl.english_name as area
  72. </when>
  73. <otherwise>
  74. ,gl.ru_name as area
  75. </otherwise>
  76. </choose>
  77. from network n
  78. left join section s on s.id = n.sectionid
  79. left join global_location gl on s.pid = gl.id
  80. where n.id = #{id}
  81. </select>
  82. <select id="getNetworkNavList" resultType="NetworkDTO">
  83. select
  84. n.id,
  85. n.network_name as networkName
  86. from network n
  87. <if test="sectionList != null and !sectionList.isEmpty()">
  88. where n.sectionid in
  89. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  90. #{item}
  91. </foreach>
  92. </if>
  93. </select>
  94. </mapper>