| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mdm.controller.admin.brand; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mdm.controller.admin.brand.vo.MdmBrandPageReqVO; |
| | | import cn.iocoder.yudao.module.mdm.controller.admin.brand.vo.MdmBrandSaveReqVO; |
| | | import cn.iocoder.yudao.module.mdm.dal.dataobject.brand.MdmBrandDO; |
| | | import cn.iocoder.yudao.module.mdm.service.brand.MdmBrandService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - MDM åç") |
| | | @RestController |
| | | @RequestMapping("/mdm/brand") |
| | | @Validated |
| | | public class MdmBrandController { |
| | | |
| | | @Resource |
| | | private MdmBrandService brandService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建åç") |
| | | @PreAuthorize("@ss.hasPermission('mdm:brand:create')") |
| | | public CommonResult<Long> createBrand(@Valid @RequestBody MdmBrandSaveReqVO createReqVO) { |
| | | return success(brandService.createBrand(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°åç") |
| | | @PreAuthorize("@ss.hasPermission('mdm:brand:update')") |
| | | public CommonResult<Boolean> updateBrand(@Valid @RequestBody MdmBrandSaveReqVO updateReqVO) { |
| | | brandService.updateBrand(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/update-status") |
| | | @Operation(summary = "æ´æ°åçç¶æ") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1") |
| | | @Parameter(name = "status", description = "ç¶æ", required = true, example = "0") |
| | | @PreAuthorize("@ss.hasPermission('mdm:brand:update')") |
| | | public CommonResult<Boolean> updateBrandStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status) { |
| | | brandService.updateBrandStatus(id, status); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤åç") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1") |
| | | @PreAuthorize("@ss.hasPermission('mdm:brand:delete')") |
| | | public CommonResult<Boolean> deleteBrand(@RequestParam("id") Long id) { |
| | | brandService.deleteBrand(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾åç") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1") |
| | | @PreAuthorize("@ss.hasPermission('mdm:brand:query')") |
| | | public CommonResult<MdmBrandDO> getBrand(@RequestParam("id") Long id) { |
| | | return success(brandService.getBrand(id)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾åçå页") |
| | | @PreAuthorize("@ss.hasPermission('mdm:brand:query')") |
| | | public CommonResult<PageResult<MdmBrandDO>> getBrandPage(@Valid MdmBrandPageReqVO pageReqVO) { |
| | | return success(brandService.getBrandPage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "è·å¾åçå表") |
| | | @PreAuthorize("@ss.hasPermission('mdm:brand:query')") |
| | | public CommonResult<List<MdmBrandDO>> getBrandList() { |
| | | return success(brandService.getBrandList(null)); |
| | | } |
| | | |
| | | @GetMapping("/list-by-ids") |
| | | @Operation(summary = "è·å¾åçå表") |
| | | @Parameter(name = "ids", description = "ç¼å·å表", required = true, example = "1,2,3") |
| | | @PreAuthorize("@ss.hasPermission('mdm:brand:query')") |
| | | public CommonResult<List<MdmBrandDO>> getBrandListByIds(@RequestParam("ids") List<Long> ids) { |
| | | return success(brandService.getBrandList(ids)); |
| | | } |
| | | |
| | | } |