| | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | 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.core.utils.Constants; |
| | | import com.doumee.dao.business.model.BaseCateParam; |
| | | import com.doumee.dao.business.model.BaseCategory; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.service.CateParamSelectService; |
| | | import com.doumee.service.business.BaseCateParamService; |
| | | import com.doumee.service.business.BaseCategoryService; |
| | | import com.doumee.service.business.CategoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.java.Log; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author 江蹄蹄 |
| | |
| | | @Autowired |
| | | private CategoryService categoryService; |
| | | |
| | | @Autowired |
| | | private BaseCategoryService baseCategoryService; |
| | | |
| | | @Autowired |
| | | private BaseCateParamService baseCateParamService; |
| | | @Autowired |
| | | private CateParamSelectService cateParamSelectService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("business:category:create") |
| | | public ApiResponse create(@RequestBody Category category) { |
| | | return ApiResponse.success(categoryService.create(category)); |
| | | } |
| | | |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("企业新建分类") |
| | | @PostMapping("/companyCreate") |
| | | @RequiresPermissions("business:category:create") |
| | | public ApiResponse companyCreate(@RequestBody Category category) { |
| | | return ApiResponse.success(categoryService.companyCreate(category)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除") |
| | |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("企业根据ID修改") |
| | | @PostMapping("/companyUpdateById") |
| | | @RequiresPermissions("business:category:update") |
| | | public ApiResponse companyUpdateById(@RequestBody Category category) { |
| | | categoryService.companyUpdateById(category); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("business:category:query") |
| | | public ApiResponse<PageData<Category>> findPage (@RequestBody PageWrap<Category> pageWrap) { |
| | | LoginUserInfo loginUserInfo = this.getLoginUser(); |
| | | pageWrap.getModel().setCompanyId(loginUserInfo.getCompanyId()); |
| | | return ApiResponse.success(categoryService.findPage(pageWrap)); |
| | | } |
| | | |
| | |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("列表 - H5") |
| | | @ApiOperation("列表") |
| | | @PostMapping("/list") |
| | | public ApiResponse<List<Category>> findList (@RequestBody Category category) { |
| | | return ApiResponse.success(categoryService.findList(category)); |
| | |
| | | return ApiResponse.success(categoryService.findListForGoods(goodsId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("企业选择分类列表 - H5") |
| | | @PostMapping("/companyFindList") |
| | | public ApiResponse<List<Category>> companyFindList (@RequestBody Category category) { |
| | | return ApiResponse.success(categoryService.companyFindList(category)); |
| | | } |
| | | |
| | | @ApiOperation("平台分类列表") |
| | | @PostMapping("/baseCategoryList") |
| | | public ApiResponse<List<BaseCategory>> baseCategoryList () { |
| | | BaseCategory baseCategory = new BaseCategory(); |
| | | baseCategory.setIsdeleted(Constants.ZERO); |
| | | baseCategory.setStatus(Constants.ZERO); |
| | | List list = baseCategoryService.findList(baseCategory); |
| | | return ApiResponse.success(list); |
| | | } |
| | | |
| | | @ApiOperation("平台分类详情") |
| | | @GetMapping("/baseCategoryDetail") |
| | | public ApiResponse<BaseCategory> baseCategoryDetail (Integer baseCategoryId) { |
| | | |
| | | BaseCategory baseCategory = baseCategoryService.findById(baseCategoryId); |
| | | if(Objects.isNull(baseCategory)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | BaseCateParam baseCateParam = new BaseCateParam(); |
| | | baseCateParam.setIsdeleted(Constants.ZERO); |
| | | baseCateParam.setStatus(Constants.ZERO); |
| | | baseCateParam.setCategoryId(baseCategoryId); |
| | | baseCategory.setBaseCateParamList( |
| | | baseCateParamService.findList(baseCateParam) |
| | | ); |
| | | return ApiResponse.success(baseCategory); |
| | | } |
| | | |
| | | @ApiOperation("列表 - SaaSH5") |
| | | @PostMapping("/saasList") |
| | | public ApiResponse<List<Category>> saasList (@RequestBody Category category) { |
| | | return ApiResponse.success(categoryService.findListSaaS(category)); |
| | | } |
| | | |
| | | } |