| | |
| | | @Override |
| | | public Result getColumnInPage(AdminColumnDto adminColumnDto) { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId(); |
| | | long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId(); |
| | | Page<AdminColumnVo> page = new Page<>(adminColumnDto.getPageNum(), adminColumnDto.getPageSize()); |
| | | ColumnEntity columnEntity = new ColumnEntity(); |
| | | columnEntity.setBelongId(belongId); |
| | | columnEntity.setCompanyId(companyId); |
| | | columnEntity.setParentId(ColumnEntity.PARENTID_DEFAULT); |
| | | IPage<AdminColumnVo> list = this.baseMapper.selectAdminColumnVoInPage(page,columnEntity); |
| | | List<AdminColumnVo> records = list.getRecords(); |
| | |
| | | Long id = adminColumnVo.getId(); |
| | | QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("parent_id",id); |
| | | objectQueryWrapper.eq("belong_id",belongId); |
| | | objectQueryWrapper.eq("company_id",companyId); |
| | | List<ColumnEntity> columnEntities = this.baseMapper.selectList(objectQueryWrapper); |
| | | List<AdminColumnVo> adminColumnVoChilds = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(columnEntities)){ |
| | |
| | | @Transactional |
| | | public Result addColumn(AdminAddColumnDto adminAddColumnDto) { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId(); |
| | | long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId(); |
| | | ColumnEntity columnEntity = new ColumnEntity(); |
| | | columnEntity.setBelongId(belongId); |
| | | columnEntity.setCompanyId(companyId); |
| | | String columnName = adminAddColumnDto.getColumnName(); |
| | | if(StrUtil.isEmpty(columnName)){ |
| | | return Result.fail("请输入栏目名称"); |
| | | } |
| | | columnEntity.setColumnName(columnName); |
| | | String columnCode = adminAddColumnDto.getColumnCode(); |
| | | if(StrUtil.isEmpty(columnCode)){ |
| | | return Result.fail("请输入栏目编码"); |
| | | } |
| | | QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("column_code",columnCode); |
| | | if(UserEntity.USER_BELONG_TOP != companyId){ |
| | | objectQueryWrapper.eq("company_id",companyId); |
| | | } |
| | | List<ColumnEntity> columnEntities = this.baseMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isNotEmpty(columnEntities)){ |
| | | return Result.fail("栏目编码不能重复"); |
| | | } |
| | | columnEntity.setColumnCode(columnCode); |
| | | String remark = adminAddColumnDto.getRemark(); |
| | | if(StrUtil.isNotEmpty(remark)){ |
| | | columnEntity.setRemark(remark); |
| | | } |
| | | String pic = adminAddColumnDto.getPic(); |
| | | if(StrUtil.isNotEmpty(pic)){ |
| | | columnEntity.setPic(pic); |
| | | } |
| | | Integer orderNum = adminAddColumnDto.getOrderNum(); |
| | | if(ObjectUtil.isNotEmpty(orderNum)){ |
| | | columnEntity.setOrderNum(orderNum); |
| | |
| | | @Override |
| | | @Transactional |
| | | public Result updateColumn(AdminUpdateColumnDto adminUpdateColumnDto) { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId(); |
| | | Long id = adminUpdateColumnDto.getId(); |
| | | if(ObjectUtil.isEmpty(id)){ |
| | | return Result.fail("栏目不存在"); |
| | |
| | | return Result.fail("栏目不存在"); |
| | | } |
| | | String columnName = adminUpdateColumnDto.getColumnName(); |
| | | if(StrUtil.isEmpty(columnName)){ |
| | | return Result.fail("请输入栏目名称"); |
| | | } |
| | | columnEntity.setColumnName(columnName); |
| | | String columnCode = adminUpdateColumnDto.getColumnCode(); |
| | | if(StrUtil.isEmpty(columnCode)){ |
| | | return Result.fail("请输入栏目编码"); |
| | | } |
| | | QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("column_code",columnCode); |
| | | if(UserEntity.USER_BELONG_TOP != companyId){ |
| | | objectQueryWrapper.eq("company_id",companyId); |
| | | } |
| | | List<ColumnEntity> columnEntities = this.baseMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isNotEmpty(columnEntities) && columnEntities.size() > 1){ |
| | | return Result.fail("栏目编码不能重复"); |
| | | } |
| | | columnEntity.setColumnCode(columnCode); |
| | | String remark = adminUpdateColumnDto.getRemark(); |
| | | if(StrUtil.isNotEmpty(remark)){ |
| | | columnEntity.setRemark(remark); |
| | | } |
| | | String pic = adminUpdateColumnDto.getPic(); |
| | | if(StrUtil.isNotEmpty(pic)){ |
| | | columnEntity.setPic(pic); |
| | | } |
| | | Integer orderNum = adminUpdateColumnDto.getOrderNum(); |
| | | if(ObjectUtil.isNotEmpty(orderNum)){ |
| | | columnEntity.setOrderNum(orderNum); |
| | |
| | | @Override |
| | | public Result getColumnInList() { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId(); |
| | | List<AdminColumnVo> records = this.baseMapper.selectColumnInListByParentId(ColumnEntity.PARENTID_DEFAULT,belongId); |
| | | long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId(); |
| | | List<AdminColumnVo> records = this.baseMapper.selectColumnInListByParentId(ColumnEntity.PARENTID_DEFAULT,companyId); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminColumnVo adminColumnVo : records){ |
| | | Long id = adminColumnVo.getId(); |
| | | QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("parent_id",id); |
| | | objectQueryWrapper.eq("belong_id",belongId); |
| | | objectQueryWrapper.eq("company_id",companyId); |
| | | List<ColumnEntity> columnEntities = this.baseMapper.selectList(objectQueryWrapper); |
| | | List<AdminColumnVo> adminColumnVoChilds = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(columnEntities)){ |