<?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.sandu.ximon.dao.mapper.WaterQualityEquipmentMapper">
|
|
<resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.WaterQualityEquipment">
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
<!-- <result property="belongTo" column="belong_to" jdbcType="VARCHAR"/>-->
|
<result property="waterQualityEquipmentCode" column="water_quality_equipment_code" jdbcType="VARCHAR"/>
|
<result property="equipmentState" column="equipment_state" jdbcType="INTEGER"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
|
<select id="listWaterQualityEquipment" resultType="com.sandu.ximon.dao.bo.WaterQualityEquipmentBo">
|
SELECT
|
t1.*, t2.pole_id,
|
t3.pole_name
|
FROM
|
water_quality_equipment t1
|
LEFT JOIN pole_binding t2 ON t1.water_quality_equipment_code = t2.device_code
|
AND t2.device_type = 4
|
LEFT JOIN pole t3 ON t3.id = t2.pole_id
|
ORDER BY
|
t1.id DESC
|
</select>
|
|
|
<select id="listWaterQualityEquipmentByIds" resultType="com.sandu.ximon.dao.bo.WaterQualityEquipmentBo">
|
SELECT
|
t1.*, t2.pole_id,
|
t3.pole_name
|
FROM
|
water_quality_equipment t1
|
LEFT JOIN pole_binding t2 ON t1.water_quality_equipment_code = t2.device_code
|
AND t2.device_type = 4
|
LEFT JOIN pole t3 ON t3.id = t2.pole_id
|
|
<where>
|
<if test="keyword != null and keyword != ''">
|
AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
|
</if>
|
<if test="clientId != null">
|
AND (t3.user_id = #{clientId} OR t3.client_id = #{clientId})
|
</if>
|
</where>
|
</select>
|
|
|
</mapper>
|