| | |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.erp.model.openapi.request.RoleListRequest; |
| | | import com.doumee.core.erp.model.openapi.response.DeviceListResponse; |
| | | import com.doumee.core.erp.model.openapi.response.RoleListResponse; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.DeviceMapper; |
| | | import com.doumee.dao.business.DeviceRoleMapper; |
| | | import com.doumee.dao.business.model.Device; |
| | | import com.doumee.dao.business.model.DeviceRole; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 门禁角色信息表Service实现 |
| | |
| | | @Autowired |
| | | private DeviceRoleMapper deviceRoleMapper; |
| | | |
| | | |
| | | @Override |
| | | public Integer create(DeviceRole deviceRole) { |
| | | |
| | |
| | | .eq(DeviceRole::getStatus,Constants.ONE); |
| | | List<DeviceRole> deviceRoles = deviceRoleMapper.selectList(query); |
| | | if (CollectionUtils.isNotEmpty(deviceRoles) && Constants.equalsInteger(Constants.ONE,deviceRole.getStatus())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"同一个用户类型,只能有一个默认角色"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"管理内部员工只能有一个默认门禁组"); |
| | | } |
| | | |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); |
| | |
| | | .eq(DeviceRole::getStatus,Constants.ONE); |
| | | List<DeviceRole> deviceRoles = deviceRoleMapper.selectList(query); |
| | | if (CollectionUtils.isNotEmpty(deviceRoles) && Constants.equalsInteger(Constants.ONE,deviceRole.getStatus())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"同一个用户类型,只能有一个默认角色"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"管理内部员工只能有一个默认门禁组"); |
| | | } |
| | | deviceRole.setIsDefault(Constants.equalsInteger(Constants.ONE,deviceRole.getStatus()) ? 0 : 1); |
| | | deviceRoleMapper.updateById(deviceRole); |
| | |
| | | .eq(DeviceRole::getStatus,Constants.ONE); |
| | | List<DeviceRole> deviceRoles = deviceRoleMapper.selectList(query); |
| | | if (CollectionUtils.isNotEmpty(deviceRoles) && Constants.equalsInteger(Constants.ONE,deviceRole.getStatus())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"同一个用户类型,只能有一个默认角色"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"管理内部员工只能有一个默认门禁组"); |
| | | } |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); |
| | | DeviceRole update = new DeviceRole(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |