| | |
| | | import com.gkhy.exam.common.api.CommonPage; |
| | | import com.gkhy.exam.common.api.CommonResult; |
| | | import com.gkhy.exam.common.utils.SecurityUtils; |
| | | import com.gkhy.exam.system.domain.Catalogue; |
| | | import com.gkhy.exam.system.domain.CatalogueData; |
| | | import com.gkhy.exam.system.domain.CatalogueDataFile; |
| | | import com.gkhy.exam.system.domain.SysCompany; |
| | | import com.gkhy.exam.system.domain.*; |
| | | import com.gkhy.exam.system.domain.req.CatalogueDataReq; |
| | | import com.gkhy.exam.system.domain.req.CatalogueReq; |
| | | import com.gkhy.exam.system.domain.vo.CatalogueDataVo; |
| | | import com.gkhy.exam.system.domain.vo.CatalogueVo; |
| | | import com.gkhy.exam.system.mapper.CatalogueMapper; |
| | | import com.gkhy.exam.system.mapper.CompanyIndustryTemplateMapper; |
| | | import com.gkhy.exam.system.mapper.SysCompanyMapper; |
| | | import com.gkhy.exam.system.service.CatalogueService; |
| | | import com.gkhy.exam.system.service.SysCompanyService; |
| | |
| | | private CatalogueMapper catalogueMapper; |
| | | @Autowired |
| | | private SysCompanyMapper sysCompanyMapper; |
| | | @Autowired |
| | | private CompanyIndustryTemplateMapper companyIndustryTemplateMapper; |
| | | |
| | | /** |
| | | * 目录管理 |
| | |
| | | |
| | | @Override |
| | | public CommonResult insertCatalogueData(CatalogueDataReq catalogue) { |
| | | List<CatalogueData> catalogueData1 = catalogueMapper.selectByCompanyId(catalogue.getCompanyId()); |
| | | //校验 |
| | | List<CatalogueData> catalogueData1 = catalogueMapper.selectByCompanyId(catalogue.getCompanyId(),catalogue.getCatalogueId()); |
| | | if (catalogueData1.size()>0){ |
| | | return CommonResult.failed("当前企业已有数据,请勿重复添加"); |
| | | } |
| | | CatalogueData catalogueData = new CatalogueData(); |
| | | BeanUtils.copyProperties(catalogue,catalogueData); |
| | | catalogueData.setCreateBy(SecurityUtils.getUsername()); |
| | | catalogueData.setCreateTime(LocalDate.now()); |
| | | //新增数据 |
| | | Integer i = catalogueMapper.insertCatalogueData(catalogueData); |
| | | // List<CatalogueDataFile> files = catalogue.getFiles(); |
| | | if (i>0){ |
| | |
| | | |
| | | @Override |
| | | public CommonResult deletedCatalogueData(Integer catalogueDataId) { |
| | | //删除数据所属文件 |
| | | CatalogueData catalogue = catalogueMapper.selectCatalogueDataById(catalogueDataId); |
| | | CatalogueDataFile catalogueDataFile = new CatalogueDataFile(); |
| | | catalogueDataFile.setCompanyId(catalogue.getCompanyId()); |
| | | catalogueDataFile.setCatalogueId(catalogue.getCatalogueId()); |
| | | catalogueDataFile.setDelFlag(2); |
| | | catalogueDataFile.setUpdateTime(LocalDate.now()); |
| | | catalogueDataFile.setUpdateBy(SecurityUtils.getUsername()); |
| | | catalogueMapper.updateCatalogueDataFileByCompanyId(catalogueDataFile); |
| | | //删除数据 |
| | | CatalogueData catalogueData = new CatalogueData(); |
| | | catalogueData.setId(catalogueDataId); |
| | | catalogueData.setDelFlag(2); |
| | | catalogueData.setUpdateBy(SecurityUtils.getUsername()); |
| | | catalogueData.setUpdateTime(LocalDate.now()); |
| | | Integer i = catalogueMapper.updateCatalogueData(catalogueData); |
| | | if (i>9){ |
| | | if (i>0){ |
| | | return CommonResult.success(); |
| | | } |
| | | return CommonResult.failed(); |
| | |
| | | |
| | | @Override |
| | | public CommonResult insertCatalogueDataFile(CatalogueDataFile catalogueDataFile) { |
| | | CompanyIndustryTemplate companyIndustryTemplate = companyIndustryTemplateMapper.selectCompanyIndustryTemplate(catalogueDataFile.getName()); |
| | | if (companyIndustryTemplate!=null){ |
| | | catalogueDataFile.setFilePath(companyIndustryTemplate.getFilePath()); |
| | | catalogueDataFile.setFileName(companyIndustryTemplate.getFileName()); |
| | | } |
| | | catalogueDataFile.setCreateTime(LocalDate.now()); |
| | | catalogueDataFile.setCreateBy(SecurityUtils.getUsername()); |
| | | catalogueMapper.insertCatalogueDataFile(catalogueDataFile); |
| | |
| | | |
| | | @Override |
| | | public CommonResult updateCatalogueDataFile(CatalogueDataFile catalogueDataFile) { |
| | | CompanyIndustryTemplate companyIndustryTemplate = companyIndustryTemplateMapper.selectCompanyIndustryTemplate(catalogueDataFile.getName()); |
| | | if (companyIndustryTemplate!=null){ |
| | | catalogueDataFile.setFilePath(companyIndustryTemplate.getFilePath()); |
| | | catalogueDataFile.setFileName(companyIndustryTemplate.getFileName()); |
| | | }else { |
| | | catalogueDataFile.setFileName(null); |
| | | catalogueDataFile.setFilePath(null); |
| | | } |
| | | catalogueDataFile.setCreateBy(SecurityUtils.getUsername()); |
| | | catalogueDataFile.setCreateTime(LocalDate.now()); |
| | | catalogueDataFile.setUpdateBy(SecurityUtils.getUsername()); |
| | | catalogueDataFile.setUpdateTime(LocalDate.now()); |
| | | catalogueMapper.updateCatalogueDataFile(catalogueDataFile); |
| | | catalogueMapper.deleteByCatalogueDataFileId(catalogueDataFile.getId()); |
| | | catalogueMapper.insertCatalogueDataFile(catalogueDataFile); |
| | | return CommonResult.success(); |
| | | } |
| | | |
| | |
| | | catalogueMapper.updateCatalogueDataFile(catalogueDataFile); |
| | | return CommonResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public CommonResult selectCatalogueDataFileList(CatalogueReq catalogueReq) { |
| | | return CommonResult.success(catalogueMapper.selectCatalogueDataFile(catalogueReq.getCompanyId(),catalogueReq.getCatalogueId())); |
| | | } |
| | | } |