2021与蓝度共同重构项目,服务端
liuhaonan
2022-03-21 ceb66c0a1dcfcfdd7c331d104f66be9e033ac902
bug修复
已修改5个文件
71 ■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/domain/Pole.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LightReportDataMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/PoleMapper.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/domain/Pole.java
@@ -38,6 +38,11 @@
    private Integer deviceType;
    /**
     *
     */
    private Long userId;
    /**
     * 客户id
     */
    private Long clientId;
dao/src/main/resources/mapper/LightReportDataMapper.xml
@@ -51,15 +51,18 @@
            light_report_data t1
                LEFT JOIN pole t2 USING ( device_code )
        <where>
            1 = 1
            <if test="deviceCode != null and deviceCode != ''">
                AND t1.device_code = #{deviceCode}
            </if>
            <if test="keyword != null and keyword != ''">
                AND (
                t1.device_code LIKE CONCAT('%', #{keyword},'%')
                OR t2.pole_name LIKE CONCAT('%', #{keyword},'%')
                )
            </if>
            <if test="deviceCode != null and keyword != ''">
                AND t1.device_code = #{deviceCode}
            </if>
        </where>
        ORDER BY t1.light_report_data_id DESC
    </select>
dao/src/main/resources/mapper/PoleMapper.xml
@@ -9,6 +9,7 @@
            <result property="poleCode" column="pole_code" jdbcType="BIGINT"/>
            <result property="poleName" column="pole_name" jdbcType="VARCHAR"/>
            <result property="deviceType" column="device_type" jdbcType="INTEGER"/>
            <result property="userId" column="user_id" jdbcType="BIGINT"/>
            <result property="clientId" column="client_id" jdbcType="BIGINT"/>
            <result property="province" column="province" jdbcType="VARCHAR"/>
            <result property="city" column="city" jdbcType="VARCHAR"/>
@@ -25,10 +26,10 @@
    <sql id="Base_Column_List">
        id,pole_code,pole_name,
        device_type,client_id,province,
        city,region,address,
        lon,lat,device_code,
        on_line_state,binding_count,create_time,
        update_time
        device_type,user_id,client_id,
        province,city,region,
        address,lon,lat,
        device_code,on_line_state,binding_count,
        create_time,update_time
    </sql>
</mapper>
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -205,4 +205,15 @@
    }
    /**
     * 查找自己拥有的灯杆
     */
    @PostMapping("/getOwnerPole")
    public ResponseVO<Object> getOwnerPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
        //public ResponseVO<Object> setMac() {
        return ResponseUtil.success(poleService.getOwnerPole(baseConditionVO,keyword));
        // return ResponseUtil.success(poleService.setMac());
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.sandu.common.execption.BusinessException;
import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.redis.RedisService;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.dto.DeviceStatus;
@@ -60,6 +61,7 @@
    private final RedisService redisService;
    private final PoleBindingService poleBindingService;
    private final PoleGroupRelationService groupRelationService;
    private final ClientService clientService;
    public boolean addPole(PoleParam param) {
        Pole pole = new Pole();
@@ -649,4 +651,37 @@
        }
        return r;
    }
    public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword) {
        LambdaQueryWrapper<Pole> eq;
        if(SecurityUtils.getClientId()!=null){
            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
            if(clientService.findClientId()){
                eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, SecurityUtils.getUserId());
            }else{
                eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, SecurityUtils.getUserId());
            }
        }else {
            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
            eq = Wrappers.lambdaQuery(Pole.class);
        }
        if (!keyword.isEmpty()){
            eq.like(Pole::getPoleName,keyword).or(
                    code->{
                        code.like(Pole::getPoleCode,keyword);
                    }
            ).or(
                    deviceCode->{
                        deviceCode.like(Pole::getDeviceCode,keyword);
                    }
            );
        }
        List<Pole> list ;
        list =list(eq);
        setCount(list);
        setOnline(list);
        return list;
    }
}