| | |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.Category; |
| | |
| | | import com.doumee.service.business.CategoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("business:category:create") |
| | | public ApiResponse create(@RequestBody Category category) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | category.setLoginUserInfo(user); |
| | | return ApiResponse.success(categoryService.create(category)); |
| | | } |
| | | |
| | |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("business:category:update") |
| | | public ApiResponse updateById(@RequestBody Category category) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | category.setLoginUserInfo(user); |
| | | categoryService.updateById(category); |
| | | return ApiResponse.success(null); |
| | | } |