2021与蓝度共同重构项目,服务端
liuhaonan
2022-04-26 4db02ec887a1f4322d08d9f4b9a5e7ad12f3cce7
bug修复
已修改5个文件
51 ■■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/mapper/LightMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LightMapper.xml 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LightController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/LightMapper.java
@@ -26,7 +26,7 @@
     * @param userId
     * @return
     */
    List<String> listCode( Long userId);
    List<String> listCode( Long userId,String keyword, String deviceCode);
}
dao/src/main/resources/mapper/LightMapper.xml
@@ -5,15 +5,15 @@
<mapper namespace="com.sandu.ximon.dao.mapper.LightMapper">
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.Light">
            <id property="lightId" column="light_id" jdbcType="BIGINT"/>
            <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
            <result property="remark" column="remark" jdbcType="VARCHAR"/>
            <result property="lightPercent" column="light_percent" jdbcType="INTEGER"/>
            <result property="light2Percent" column="light2_percent" jdbcType="INTEGER"/>
            <result property="power1" column="power1" jdbcType="INTEGER"/>
            <result property="power2" column="power2" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
        <id property="lightId" column="light_id" jdbcType="BIGINT"/>
        <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="lightPercent" column="light_percent" jdbcType="INTEGER"/>
        <result property="light2Percent" column="light2_percent" jdbcType="INTEGER"/>
        <result property="power1" column="power1" jdbcType="INTEGER"/>
        <result property="power2" column="power2" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <resultMap id="listLight" type="com.sandu.ximon.dao.bo.LightBo" extends="BaseResultMap">
@@ -58,6 +58,15 @@
            <if test="clientId != null">
                AND (t2.user_id = #{clientId} OR t2.client_id = #{clientId})
            </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 t2.device_code = #{deviceCode}
            </if>
        </where>
    </select>
</mapper>
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LightController.java
@@ -115,13 +115,13 @@
        return ResponseUtil.success(lightService.controlEnergySaving());
    }
    /**
     * 获取设备码
     */
    @GetMapping("/deviceCode")
    public ResponseVO<Object> getDeviceCode(BaseConditionVO baseConditionVO) {
        return ResponseUtil.success(lightService.listDeviceCode(baseConditionVO.getPageNo() , baseConditionVO.getPageSize()));
    }
//    /**
//     * 获取设备码
//     */
//    @GetMapping("/deviceCode")
//    public ResponseVO<Object> getDeviceCode(BaseConditionVO baseConditionVO) {
//        return ResponseUtil.success(lightService.listDeviceCode(baseConditionVO.getPageNo() , baseConditionVO.getPageSize()));
//    }
    /**
     * 设置功率
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
@@ -90,7 +90,7 @@
        List<LightReportDataBo> lightReportDataBos = new ArrayList<>(pageSize);
        CommonPage<String> stringCommonPage = SpringContextHolder.getBean(LightService.class).listDeviceCode(pageNo, pageSize);
        CommonPage<String> stringCommonPage = SpringContextHolder.getBean(LightService.class).listDeviceCode(pageNo, pageSize,keyword, deviceCode);
        List<String> macList = stringCommonPage.getList();
        if (CollUtil.isEmpty(macList)) {
            return  new CommonPage();
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightService.java
@@ -471,15 +471,15 @@
    /**
     * 获取用户所有的设备码
     */
    public CommonPage<String> listDeviceCode(int pageNo, int pageSize) {
    public CommonPage<String> listDeviceCode(int pageNo, int pageSize,String keyword, String deviceCode) {
        List<String> list;
        if (SecurityUtils.getClientId() != null) {
            PageHelper.startPage(pageNo, pageSize);
            list = baseMapper.listCode(SecurityUtils.getUserId());
            list = baseMapper.listCode(SecurityUtils.getUserId(),keyword,deviceCode);
        } else {
            PageHelper.startPage(pageNo, pageSize);
            list = baseMapper.listCode(null);
            list = baseMapper.listCode(null,keyword,deviceCode);
        }
        return CommonPage.restPage(list);