lishuai
2023-12-15 5aa8fa4083b8a9bfb38123c27a42cf58518fac68
访客和普通门禁组
已修改2个文件
13 ■■■■ 文件已修改
server/dmvisit_admin/src/main/java/com/doumee/api/business/DeviceRoleController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceRoleServiceImpl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_admin/src/main/java/com/doumee/api/business/DeviceRoleController.java
@@ -77,7 +77,7 @@
    @ApiOperation("分页查询")
    @PostMapping("/page")
    @RequiresPermissions("business:devicerole:query")
    //@RequiresPermissions("business:devicerole:query")
    public ApiResponse<PageData<DeviceRole>> findPage (@RequestBody PageWrap<DeviceRole> pageWrap) {
        return ApiResponse.success(deviceRoleService.findPage(pageWrap));
    }
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceRoleServiceImpl.java
@@ -52,8 +52,8 @@
        // 获取之前是否存在默认门禁组
        DeviceRole newDeviceRole = null;
        if(Constants.ONE == deviceRole.getStatus()) {
            newDeviceRole = getDeviceRole(deviceRole.getStatus());
        if(Constants.ONE == deviceRole.getStatus() && null != deviceRole.getType()) {
            newDeviceRole = getDeviceRole(deviceRole.getStatus(), deviceRole.getType());
        }
        LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
        if(null != newDeviceRole) {
@@ -118,8 +118,8 @@
    public void updateStatusById(DeviceRole deviceRole) {
        // 获取之前是否存在默认门禁组
        DeviceRole newDeviceRole = null;
        if(Constants.ZERO == deviceRole.getIsDefault()) {
            newDeviceRole = getDeviceRole(deviceRole.getIsDefault());
        if(Constants.ONE == deviceRole.getStatus() && null != deviceRole.getType()) {
            newDeviceRole = getDeviceRole(deviceRole.getStatus(), deviceRole.getType());
        }
        LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
        List<DeviceRole> deviceRoleList = new ArrayList<>();
@@ -145,10 +145,11 @@
        }
    }
    private DeviceRole getDeviceRole(Integer status) {
    private DeviceRole getDeviceRole(Integer status, Integer type) {
        LambdaQueryWrapper<DeviceRole> query = new LambdaQueryWrapper<>();
        query.eq(DeviceRole::getIsdeleted,Constants.ZERO)
                .eq(DeviceRole::getIsDefault,Constants.ZERO)
                .eq(DeviceRole::getType,type)
                .eq(DeviceRole::getStatus,status);
        // 查询是否有默认门禁组,只能有一组默认门禁组
        DeviceRole getDeviceRole = deviceRoleMapper.selectOne(query);