LpInfoStateMapper.xml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.zy.bms.mapper.lp.LpInfoStateMapper">
  4. <select id="listPage" resultType="com.zy.bms.pojo.vo.LpDeviceListVo">
  5. SELECT
  6. t1.username,
  7. t1.password,
  8. t1.sn,
  9. t1.create_time,
  10. t1.group_id,
  11. t2.*
  12. FROM
  13. device_base t1
  14. LEFT JOIN lp_info_state t2 ON t1.open_num = t2.open_num
  15. WHERE t1.type = 'lupai'
  16. <if test="io.openNum != null and io.openNum != ''">
  17. AND t1.open_num LIKE CONCAT('%',#{io.openNum},'%')
  18. </if>
  19. <if test="io.groupId != null and io.groupId > -1">
  20. AND t1.group_id = #{io.groupId}
  21. </if>
  22. <if test="io.status != null and io.status > -1">
  23. AND t2.status = #{io.status}
  24. </if>
  25. </select>
  26. <select id="listByUserId" resultType="com.zy.bms.entity.lp.LpInfoState">
  27. SELECT t2.*
  28. FROM device_base t1
  29. LEFT JOIN lp_info_state t2 ON t1.open_num = t2.open_num
  30. WHERE t1.group_id IN (SELECT group_id FROM user_privilege WHERE user_id = #{userId})
  31. </select>
  32. <select id="listByGroupId" resultType="com.zy.bms.entity.lp.LpInfoState">
  33. SELECT *
  34. FROM lp_info_state
  35. WHERE open_num IN (SELECT open_num FROM device_base WHERE type = 'lupai' AND group_id = #{groupId})
  36. </select>
  37. <update id="updateWakeAndThresh">
  38. UPDATE
  39. lp_info_state
  40. SET wake_int = #{entity.wakeInt},
  41. thresh = #{entity.thresh},
  42. update_location_flag = #{entity.updateLocationFlag}
  43. WHERE open_num = #{entity.openNum}
  44. </update>
  45. </mapper>