|  |  |  | 
|---|
|  |  |  | import doumeemes.core.model.PageWrap; | 
|---|
|  |  |  | import doumeemes.core.utils.Constants; | 
|---|
|  |  |  | import doumeemes.dao.business.model.Category; | 
|---|
|  |  |  | import doumeemes.dao.business.model.CategoryUnion; | 
|---|
|  |  |  | import doumeemes.dao.ext.dto.QueryCategoryExtDTO; | 
|---|
|  |  |  | import doumeemes.dao.ext.vo.CategoryExtListVO; | 
|---|
|  |  |  | import doumeemes.service.business.CategoryService; | 
|---|
|  |  |  | import doumeemes.service.business.CategoryUnionService; | 
|---|
|  |  |  | import doumeemes.service.ext.CategoryExtService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CategoryService categoryService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CategoryUnionService categoryUnionService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Category query = new Category(); | 
|---|
|  |  |  | query.setDeleted(Constants.ZERO); | 
|---|
|  |  |  | query.setCateType(category.getCateType()); | 
|---|
|  |  |  | query.setRootDepartId(getLoginUser().getRootDepartment().getId()); | 
|---|
|  |  |  | query.setCode(category.getCode()); | 
|---|
|  |  |  | List<Category> list = categoryService.findList(query); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Category query1 = new Category(); | 
|---|
|  |  |  | query1.setDeleted(Constants.ZERO); | 
|---|
|  |  |  | query1.setCateType(category.getCateType()); | 
|---|
|  |  |  | query1.setRootDepartId(getLoginUser().getRootDepartment().getId()); | 
|---|
|  |  |  | query1.setName(category.getName()); | 
|---|
|  |  |  | List<Category> list1 = categoryService.findList(query1); | 
|---|
|  |  |  | 
|---|
|  |  |  | category.setCreateTime(new Date()); | 
|---|
|  |  |  | category.setCreateUser(getLoginUser().getId()); | 
|---|
|  |  |  | category.setRootDepartId(getLoginUser().getRootDepartment().getId()); | 
|---|
|  |  |  | int r =  categoryService.create(category); | 
|---|
|  |  |  | int r =  categoryService.create(category); | 
|---|
|  |  |  | CategoryUnion categoryUnion = new CategoryUnion(); | 
|---|
|  |  |  | categoryUnion.setDeleted(Constants.ZERO); | 
|---|
|  |  |  | categoryUnion.setCreateUser(getLoginUser().getId()); | 
|---|
|  |  |  | categoryUnion.setCreateTime(new Date()); | 
|---|
|  |  |  | categoryUnion.setUpdateUser(getLoginUser().getId()); | 
|---|
|  |  |  | categoryUnion.setUpdateTime(new Date()); | 
|---|
|  |  |  | categoryUnion.setRemark(""); | 
|---|
|  |  |  | categoryUnion.setRootDepartId(getLoginUser().getRootDepartment().getId()); | 
|---|
|  |  |  | categoryUnion.setCateBigId(category.getId()); | 
|---|
|  |  |  | categoryUnionService.create(categoryUnion); | 
|---|
|  |  |  | categoryExtService.loadCom(getLoginUser().getCompany()); | 
|---|
|  |  |  | return ApiResponse.success(r ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @RequiresPermissions("ext:categoryext:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id) { | 
|---|
|  |  |  | Category category = categoryService.findById(Integer.valueOf(id)); | 
|---|
|  |  |  | category.setDeleted(Constants.ONE); | 
|---|
|  |  |  | categoryService.updateById(category); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | categoryService.deleteCategory(id); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|