jiaosong
2023-08-18 b07d4b83387e670ad2d1fc921037fb24fe4e836b
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("新建")
@@ -75,6 +80,16 @@
        category.setCreateUser(getLoginUser().getId());
        category.setRootDepartId(getLoginUser().getRootDepartment().getId());
       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 +99,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);
    }