| | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringPool; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xcong.farmer.cms.common.contants.AppContants; |
| | | import com.xcong.farmer.cms.common.response.Result; |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminAddColumnDto; |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminColumnDto; |
| | |
| | | columnEntity.setIsNav(adminAddColumnDto.getIsNav()); |
| | | columnEntity.setContentType(adminAddColumnDto.getContentType()); |
| | | this.baseMapper.insert(columnEntity); |
| | | return Result.ok("添加成功"); |
| | | return Result.ok("添加成功", columnEntity.getId()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public Result getWebColumnInList(HttpServletRequest request) { |
| | | StringBuffer requestURL = request.getRequestURL(); |
| | | List<CompanyEntity> companyEntities = companyMapper.selectList(new QueryWrapper<>()); |
| | | Long companyId = 0L; |
| | | if(CollUtil.isNotEmpty(companyEntities)){ |
| | | for(CompanyEntity companyEntity : companyEntities){ |
| | | boolean contains = StrUtil.contains(requestURL, companyEntity.getWebAddress()); |
| | | if(contains){ |
| | | companyId = companyEntity.getId(); |
| | | } |
| | | } |
| | | } |
| | | String website = request.getHeader(AppContants.WEBSITE_HEADER); |
| | | Long companyId = getCompanyIdFromWebsite(website); |
| | | List<WebColumnVo> records = this.baseMapper.selectWebColumnInListByParentId(ColumnEntity.PARENTID_DEFAULT,companyId); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(WebColumnVo webColumnVo : records){ |
| | |
| | | } |
| | | return Result.ok(records); |
| | | } |
| | | |
| | | private Long getCompanyIdFromWebsite(String website){ |
| | | List<CompanyEntity> companyEntities = companyMapper.selectList(new QueryWrapper<>()); |
| | | Long companyId = 0L; |
| | | if(CollUtil.isNotEmpty(companyEntities)){ |
| | | for(CompanyEntity companyEntity : companyEntities){ |
| | | boolean contains = StrUtil.contains(companyEntity.getWebAddress(), website); |
| | | if(contains){ |
| | | companyId = companyEntity.getId(); |
| | | } |
| | | } |
| | | } |
| | | return companyId; |
| | | } |
| | | } |