| | |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminNavigationBarDto; |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminUpdateBarDto; |
| | | import com.xcong.farmer.cms.modules.system.entity.NavigationBarEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.UserEntity; |
| | | import com.xcong.farmer.cms.modules.system.mapper.NavigationBarMapper; |
| | | import com.xcong.farmer.cms.modules.system.mapper.UserRoleMapper; |
| | | import com.xcong.farmer.cms.modules.system.service.INavigationBarService; |
| | | import com.xcong.farmer.cms.modules.system.util.LoginUserUtil; |
| | | import com.xcong.farmer.cms.modules.system.vo.AdminNavigationBarVo; |
| | | import com.xcong.farmer.cms.modules.system.vo.AdminSeeBarInfoVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Override |
| | | public Result getBarInPage(AdminNavigationBarDto adminNavigationBarDto) { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId(); |
| | | Page<AdminNavigationBarVo> page = new Page<>(adminNavigationBarDto.getPageNum(), adminNavigationBarDto.getPageSize()); |
| | | NavigationBarEntity navigationBarEntity = new NavigationBarEntity(); |
| | | navigationBarEntity.setParentId(NavigationBarEntity.PARENTID_DEFAULT); |
| | | navigationBarEntity.setCompanyId(companyId); |
| | | IPage<AdminNavigationBarVo> list = navigationBarMapper.selectAdminNavigationBarVoInPage(page,navigationBarEntity); |
| | | List<AdminNavigationBarVo> records = list.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | |
| | | @Override |
| | | @Transactional |
| | | public Result addBar(AdminAddBarDto adminAddBarDto) { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId(); |
| | | NavigationBarEntity navigationBarEntity = new NavigationBarEntity(); |
| | | navigationBarEntity.setCompanyId(companyId); |
| | | String barName = adminAddBarDto.getBarName(); |
| | | if(StrUtil.isEmpty(barName)){ |
| | | return Result.fail("请输入导航栏标题"); |
| | | } |
| | | navigationBarEntity.setBarName(barName); |
| | | Long parentId = adminAddBarDto.getParentId(); |
| | | if(ObjectUtil.isEmpty(parentId)){ |
| | |
| | | navigationBarEntity.setParentId(parentId); |
| | | } |
| | | String linkUrl = adminAddBarDto.getLinkUrl(); |
| | | if(StrUtil.isNotEmpty(linkUrl)){ |
| | | navigationBarEntity.setLinkUrl(linkUrl); |
| | | } |
| | | Integer orderNum = adminAddBarDto.getOrderNum(); |
| | | if(ObjectUtil.isNotEmpty(orderNum)){ |
| | | navigationBarEntity.setOrderNum(orderNum); |
| | | } |
| | | String pic = adminAddBarDto.getPic(); |
| | | if(StrUtil.isNotEmpty(pic)){ |
| | | navigationBarEntity.setPic(pic); |
| | | } |
| | | String remark = adminAddBarDto.getRemark(); |
| | | if(StrUtil.isNotEmpty(remark)){ |
| | | navigationBarEntity.setRemark(remark); |
| | | } |
| | | navigationBarMapper.insert(navigationBarEntity); |
| | | return Result.ok("添加成功"); |
| | | } |
| | |
| | | return Result.fail("导航栏不存在"); |
| | | } |
| | | String barName = adminUpdateMenuDto.getBarName(); |
| | | if(StrUtil.isEmpty(barName)){ |
| | | return Result.fail("请输入导航栏标题"); |
| | | } |
| | | navigationBarEntity.setBarName(barName); |
| | | Long parentId = adminUpdateMenuDto.getParentId(); |
| | | if(ObjectUtil.isEmpty(parentId)){ |
| | |
| | | navigationBarEntity.setParentId(parentId); |
| | | } |
| | | String linkUrl = adminUpdateMenuDto.getLinkUrl(); |
| | | if(StrUtil.isNotEmpty(linkUrl)){ |
| | | navigationBarEntity.setLinkUrl(linkUrl); |
| | | } |
| | | Integer orderNum = adminUpdateMenuDto.getOrderNum(); |
| | | if(ObjectUtil.isNotEmpty(orderNum)){ |
| | | navigationBarEntity.setOrderNum(orderNum); |
| | | } |
| | | String pic = adminUpdateMenuDto.getPic(); |
| | | if(StrUtil.isNotEmpty(pic)){ |
| | | navigationBarEntity.setPic(pic); |
| | | } |
| | | String remark = adminUpdateMenuDto.getRemark(); |
| | | if(StrUtil.isNotEmpty(remark)){ |
| | | navigationBarEntity.setRemark(remark); |
| | | } |
| | | navigationBarMapper.updateById(navigationBarEntity); |
| | | return Result.ok("更新成功"); |
| | | } |
| | | |
| | | @Override |
| | | public Result getBarInList() { |
| | | List<AdminNavigationBarVo> records = navigationBarMapper.selectAdminNavigationBarVoByParentId(NavigationBarEntity.PARENTID_DEFAULT); |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId(); |
| | | List<AdminNavigationBarVo> records = navigationBarMapper.selectAdminNavigationBarVoByParentId(NavigationBarEntity.PARENTID_DEFAULT,companyId); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminNavigationBarVo adminNavigationBarVo : records){ |
| | | Long id = adminNavigationBarVo.getId(); |
| | | List<NavigationBarEntity> navigationBarEntities = navigationBarMapper.selectListByParentId(id); |
| | | List<NavigationBarEntity> navigationBarEntities = navigationBarMapper.selectListByParentId(id,companyId); |
| | | List<AdminNavigationBarVo> adminNavigationBarVoChilds = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(navigationBarEntities)){ |
| | | for(NavigationBarEntity navigationBarEntityChild : navigationBarEntities){ |