CareDeviceMapper.xml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.care.common.mapper.CareDeviceMapper">
  4. <select id="queryListByMemberId" resultType="com.care.common.vo.device.DeviceVO">
  5. select
  6. d.id ,
  7. d.dev_name as devName
  8. from care_device d
  9. where d.member_id = #{memberId}
  10. </select>
  11. <select id="queryList" resultType="com.care.common.vo.device.DeviceVO">
  12. select
  13. ceoc.*,
  14. ceo.addr as houseAddr,
  15. cs.name as stationName,
  16. csu.phone as chambPhone,
  17. csu.name as chambName
  18. from care_device ceoc
  19. left join care_house ceo on ceo.id = ceoc.house_id
  20. left join care_station cs on cs.id = ceoc.station_id
  21. left join care_sys_user csu on ceoc.chamb_id = csu.id
  22. <where>
  23. <if test="userOrgId != null">
  24. AND ceoc.org_id = #{userOrgId}
  25. </if>
  26. <if test="userStationId != null">
  27. AND ceoc.station_id = #{userStationId}
  28. </if>
  29. <if test="stationId != null">
  30. AND ceoc.station_id = #{stationId}
  31. </if>
  32. <if test="activeStatus != null and activeStatus != ''">
  33. AND ceoc.active_status = #{activeStatus}
  34. </if>
  35. <if test="chambName != null and chambName != ''">
  36. AND csu.name like CONCAT('%',#{chambName},'%')
  37. </if>
  38. <if test="status != null and status != ''">
  39. AND ceoc.status = #{status}
  40. </if>
  41. <if test="houseAddr != null and houseAddr != ''">
  42. AND ceo.addr like CONCAT('%',#{houseAddr},'%')
  43. </if>
  44. <if test="devCode != null and devCode != ''">
  45. AND ceoc.dev_code like CONCAT('%',#{devCode},'%')
  46. </if>
  47. <if test="chambId != null">
  48. AND ceoc.chamb_id = #{chambId}
  49. </if>
  50. <if test="memberId != null">
  51. AND ceoc.member_id = #{memberId}
  52. </if>
  53. </where>
  54. order by ceoc.dev_code asc
  55. </select>
  56. <update id="updateDevChamb">
  57. update care_device set chamb_id=null where id=#{id}
  58. </update>
  59. </mapper>