jiangping
2023-08-28 cc6980b59225459f47f88b48bf4271e52de347c8
server/src/main/java/doumeemes/api/ext/CategoryExtController.java
@@ -8,9 +8,11 @@
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;
@@ -45,6 +47,9 @@
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private CategoryUnionService categoryUnionService;
    @PreventRepeat
    @ApiOperation("新建")
@@ -58,12 +63,14 @@
        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);
@@ -74,7 +81,17 @@
        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 );
    }
@@ -84,9 +101,8 @@
    @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);
    }