123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?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.care.common.mapper.CareDeviceMapper">
- <select id="queryListByMemberId" resultType="com.care.common.vo.device.DeviceVO">
- select
- d.id ,
- d.dev_name as devName
- from care_device d
- where d.member_id = #{memberId}
- </select>
- <select id="queryList" resultType="com.care.common.vo.device.DeviceVO">
- select
- ceoc.*,
- ceo.addr as houseAddr,
- cs.name as stationName,
- csu.phone as chambPhone,
- csu.name as chambName
- from care_device ceoc
- left join care_house ceo on ceo.id = ceoc.house_id
- left join care_station cs on cs.id = ceoc.station_id
- left join care_sys_user csu on ceoc.chamb_id = csu.id
- <where>
- <if test="userOrgId != null">
- AND ceoc.org_id = #{userOrgId}
- </if>
- <if test="userStationId != null">
- AND ceoc.station_id = #{userStationId}
- </if>
- <if test="stationId != null">
- AND ceoc.station_id = #{stationId}
- </if>
- <if test="activeStatus != null and activeStatus != ''">
- AND ceoc.active_status = #{activeStatus}
- </if>
- <if test="chambName != null and chambName != ''">
- AND csu.name like CONCAT('%',#{chambName},'%')
- </if>
- <if test="status != null and status != ''">
- AND ceoc.status = #{status}
- </if>
- <if test="houseAddr != null and houseAddr != ''">
- AND ceo.addr like CONCAT('%',#{houseAddr},'%')
- </if>
- <if test="devCode != null and devCode != ''">
- AND ceoc.dev_code like CONCAT('%',#{devCode},'%')
- </if>
- <if test="chambId != null">
- AND ceoc.chamb_id = #{chambId}
- </if>
- <if test="memberId != null">
- AND ceoc.member_id = #{memberId}
- </if>
- </where>
- order by ceoc.dev_code asc
- </select>
- <update id="updateDevChamb">
- update care_device set chamb_id=null where id=#{id}
- </update>
- </mapper>
|