商品模块代码提交
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ProdGroupDTO;
|
||||
import com.czg.product.service.ProdGroupService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品分组
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-17
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/admin/prod/group")
|
||||
public class ProdGroupController {
|
||||
private final ProdGroupService prodGroupService;
|
||||
|
||||
@GetMapping("page")
|
||||
@OperationLog("商品分组-分页")
|
||||
//@SaAdminCheckPermission("prodGroup:page")
|
||||
public CzgResult<Page<ProdGroupDTO>> getProdGroupPage(ProdGroupDTO param){
|
||||
Page<ProdGroupDTO> data = prodGroupService.getProdGroupPage(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@OperationLog("商品分组-列表")
|
||||
//@SaAdminCheckPermission("prodGroup:list")
|
||||
public CzgResult<List<ProdGroupDTO>> getProdGroupList(ProdGroupDTO param){
|
||||
List<ProdGroupDTO> data = prodGroupService.getProdGroupList(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@OperationLog("商品分组-详情")
|
||||
//@SaAdminCheckPermission("prodGroup:info")
|
||||
public CzgResult<ProdGroupDTO> getProdGroupById(@PathVariable("id") Long id){
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
ProdGroupDTO data = prodGroupService.getProdGroupById(id);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@OperationLog("商品分组-新增")
|
||||
//@SaAdminCheckPermission("prodGroup:add")
|
||||
public CzgResult<Void> addProdGroup(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ProdGroupDTO dto){
|
||||
prodGroupService.addProdGroup(dto);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@OperationLog("商品分组-修改")
|
||||
//@SaAdminCheckPermission("prodGroup:update")
|
||||
public CzgResult<Void> updateProdGroup(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ProdGroupDTO dto){
|
||||
prodGroupService.updateProdGroup(dto);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
@OperationLog("商品分组-删除")
|
||||
//@SaAdminCheckPermission("prodGroup:delete")
|
||||
public CzgResult<Void> deleteProdGroup(@PathVariable("id") Long id){
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
prodGroupService.deleteProdGroup(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("disable/{id}")
|
||||
@OperationLog("商品分组-禁用")
|
||||
//@SaAdminCheckPermission("prodGroup:able")
|
||||
public CzgResult<Void> disableProdGroup(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
prodGroupService.disableProdGroup(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("enable/{id}")
|
||||
@OperationLog("商品分组-启用")
|
||||
//@SaAdminCheckPermission("prodGroup:able")
|
||||
public CzgResult<Void> enableProdGroup(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
prodGroupService.enableProdGroup(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user