| | |
| | | */ |
| | | @Mapper |
| | | public interface AirEquipmentMapper extends BaseMapper<AirEquipment> { |
| | | List<Long> listAirEquipmentId(String keyword, Long clientId); |
| | | |
| | | List<AirEquipmentBo> listAirEquipmentByIds(List<Long> airEquipmentIdList); |
| | | List<AirEquipmentBo> listAirEquipmentByIds(String keyword, Long clientId); |
| | | } |
| | | |
| | | |
| | |
| | | List<Monitor> listMonitorByKeyword1(String keyword, int bindingState1, int bindingState2); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | List<Long> listMonitorId(String keyword, Long clientId, int bindingState); |
| | | |
| | | List<MonitorBo> listMonitorByIds(List<Long> airEquipmentIdList); |
| | | List<MonitorBo> listMonitorByIds(String keyword, Long clientId, int bindingState); |
| | | } |
| | | |
| | | |
| | |
| | | public interface WaterQualityEquipmentMapper extends BaseMapper<WaterQualityEquipment> { |
| | | List<WaterQualityEquipmentBo> listWaterQualityEquipment(); |
| | | |
| | | List<Long> WaterQualityEquipmentId(String keyword, Long clientId); |
| | | |
| | | List<WaterQualityEquipmentBo> listWaterQualityEquipmentByIds(List<Long> waterQualityEquipmentIdList); |
| | | List<WaterQualityEquipmentBo> listWaterQualityEquipmentByIds(String keyword, Long clientId); |
| | | } |
| | |
| | | <mapper namespace="com.sandu.ximon.dao.mapper.AirEquipmentMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.AirEquipment"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="mac" column="mac" jdbcType="VARCHAR"/> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="mac" column="mac" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | |
| | | create_time,user_id,light_pole_id, |
| | | mac |
| | | </sql> |
| | | |
| | | <select id="listAirEquipmentId" resultType="java.lang.Long"> |
| | | SELECT |
| | | MAX(t1.id) AS air_equipment_id |
| | | FROM |
| | | air_equipment t1 |
| | | <if test="keyword != null and keyword != ''"> |
| | | LEFT JOIN pole_binding t2 ON t1.mac = t2.device_code |
| | | AND t2.device_type = 3 |
| | | LEFT JOIN pole t3 ON t3.id = t2.pole_id |
| | | </if> |
| | | <where> |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | </if> |
| | | <if test="clientId != null"> |
| | | AND t3.client_id = #{clientId} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | t1.mac |
| | | </select> |
| | | |
| | | <select id="listAirEquipmentByIds" resultType="com.sandu.ximon.dao.bo.AirEquipmentBo"> |
| | | SELECT |
| | |
| | | AND t2.device_type = 3 |
| | | LEFT JOIN pole t3 ON t3.id = t2.pole_id |
| | | <where> |
| | | t1.id IN |
| | | <foreach collection="airEquipmentIdList" open="(" close=")" item="airId" separator=","> |
| | | #{airId} |
| | | </foreach> |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | </if> |
| | | <if test="clientId != null"> |
| | | AND t3.client_id = #{clientId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | t1.id DESC |
| | | </select> |
| | | |
| | | <select id="listMonitorId" resultType="java.lang.Long"> |
| | | <select id="listMonitorByIds" resultType="com.sandu.ximon.dao.bo.MonitorBo"> |
| | | SELECT |
| | | MAX(t1.id) AS monitor_id |
| | | t1.*, t2.pole_id, |
| | | t3.pole_name |
| | | FROM |
| | | monitor t1 |
| | | <if test="keyword != null and keyword != ''"> |
| | | LEFT JOIN pole_binding t2 ON t1.device_serial = t2.device_code |
| | | AND t2.device_type = 7 |
| | | LEFT JOIN pole t3 ON t3.id = t2.pole_id |
| | | </if> |
| | | LEFT JOIN pole_binding t2 ON t1.device_serial = t2.device_code |
| | | AND t2.device_type = 7 |
| | | 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}), '%') |
| | |
| | | AND t1.binding_state = #{bindingState} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | t1.device_serial |
| | | </select> |
| | | |
| | | <select id="listMonitorByIds" resultType="com.sandu.ximon.dao.bo.MonitorBo"> |
| | | SELECT |
| | | t1.*, t2.pole_id, |
| | | t3.pole_name |
| | | FROM |
| | | monitor t1 |
| | | LEFT JOIN pole_binding t2 ON t1.device_serial = t2.device_code |
| | | AND t2.device_type = 7 |
| | | LEFT JOIN pole t3 ON t3.id = t2.pole_id |
| | | <where> |
| | | t1.id IN |
| | | <foreach collection="airEquipmentIdList" open="(" close=")" item="airId" separator=","> |
| | | #{airId} |
| | | </foreach> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="WaterQualityEquipmentId" resultType="java.lang.Long"> |
| | | SELECT |
| | | MAX(t1.id) AS water_quality_equipment_id |
| | | FROM |
| | | water_quality_equipment t1 |
| | | <if test="keyword != null and keyword != ''"> |
| | | 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 |
| | | </if> |
| | | <where> |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | </if> |
| | | <if test="clientId != null"> |
| | | AND t3.client_id = #{clientId} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | t1.water_quality_equipment_code |
| | | </select> |
| | | |
| | | <select id="listWaterQualityEquipmentByIds" resultType="com.sandu.ximon.dao.bo.WaterQualityEquipmentBo"> |
| | | SELECT |
| | | t1.*, t2.pole_id, |
| | |
| | | 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> |
| | | t1.id IN |
| | | <foreach collection="waterQualityEquipmentIdList" open="(" close=")" item="airId" separator=","> |
| | | #{airId} |
| | | </foreach> |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | </if> |
| | | <if test="clientId != null"> |
| | | AND t3.client_id = #{clientId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | public List<AirEquipmentBo> listAirEquipmentByKeyword(BaseConditionVO baseConditionVO, String keyword) { |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | PageHelper.startPage(baseConditionVO.getPageNo(),baseConditionVO.getPageSize()); |
| | | List<Long> listAirEquipmentId = airEquipmentMapper.listAirEquipmentId(keyword,clientId); |
| | | if(CollUtil.isEmpty(listAirEquipmentId)){ |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | List<AirEquipmentBo> airEquipmentBos = airEquipmentMapper.listAirEquipmentByIds(listAirEquipmentId); |
| | | |
| | | List<AirEquipmentBo> airEquipmentBos = airEquipmentMapper.listAirEquipmentByIds(keyword,clientId); |
| | | return airEquipmentBos; |
| | | } |
| | | |
| | |
| | | public List<MonitorBo> listMonitorByKeyword(BaseConditionVO baseConditionVO, MonitorParam monitorParam) { |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Long> listAirEquipmentId; |
| | | |
| | | List<MonitorBo> monitorList; |
| | | //绑定状态:已绑定/未绑定/全部 |
| | | if (monitorParam.getBindingState() == null || 2 == monitorParam.getBindingState()) { |
| | | //全部 |
| | | int bindingState = 2; |
| | | listAirEquipmentId = monitorMapper.listMonitorId(monitorParam.getKeyword(), clientId, bindingState); |
| | | monitorList = monitorMapper.listMonitorByIds(monitorParam.getKeyword(), clientId, bindingState); |
| | | } else { |
| | | listAirEquipmentId = monitorMapper.listMonitorId(monitorParam.getKeyword(), clientId, monitorParam.getBindingState()); |
| | | monitorList = monitorMapper.listMonitorByIds(monitorParam.getKeyword(), clientId, monitorParam.getBindingState()); |
| | | } |
| | | if (CollUtil.isEmpty(listAirEquipmentId)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | |
| | | List<MonitorBo> monitorList = monitorMapper.listMonitorByIds(listAirEquipmentId); |
| | | return monitorList; |
| | | } |
| | | |
| | |
| | | public List<WaterQualityEquipmentBo> listWaterQualityEquipmentByKeyword(BaseConditionVO baseConditionVO, String keyword) { |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Long> listAirEquipmentId = waterQualityEquipmentMapper.WaterQualityEquipmentId(keyword, clientId); |
| | | if (CollUtil.isEmpty(listAirEquipmentId)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | List<WaterQualityEquipmentBo> waterQualityEquipmentBoList = waterQualityEquipmentMapper.listWaterQualityEquipmentByIds(listAirEquipmentId); |
| | | |
| | | List<WaterQualityEquipmentBo> waterQualityEquipmentBoList = waterQualityEquipmentMapper.listWaterQualityEquipmentByIds(keyword, clientId); |
| | | return waterQualityEquipmentBoList; |
| | | } |
| | | |