商品模块代码提交
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ShopVendorDTO;
|
||||
import com.czg.product.service.ShopVendorService;
|
||||
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-20
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/admin/product/vendor")
|
||||
public class ShopVendorController {
|
||||
private final ShopVendorService shopVendorService;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("page")
|
||||
@OperationLog("供应商-分页")
|
||||
//@SaAdminCheckPermission("shopVendor:page")
|
||||
public CzgResult<Page<ShopVendorDTO>> getShopVendorPage(ShopVendorDTO param) {
|
||||
Page<ShopVendorDTO> data = shopVendorService.getShopVendorPage(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("list")
|
||||
@OperationLog("供应商-列表")
|
||||
//@SaAdminCheckPermission("shopVendor:list")
|
||||
public CzgResult<List<ShopVendorDTO>> getShopVendorList(ShopVendorDTO param) {
|
||||
List<ShopVendorDTO> data = shopVendorService.getShopVendorList(param);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* param id 供应商id
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
@OperationLog("供应商-详情")
|
||||
//@SaAdminCheckPermission("shopVendor:info")
|
||||
public CzgResult<ShopVendorDTO> getShopVendorById(@PathVariable("id") Long id) {
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
ShopVendorDTO data = shopVendorService.getShopVendorById(id);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping
|
||||
@OperationLog("供应商-新增")
|
||||
//@SaAdminCheckPermission("shopVendor:add")
|
||||
public CzgResult<Void> addShopVendor(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopVendorDTO dto) {
|
||||
shopVendorService.addShopVendor(dto);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping
|
||||
@OperationLog("供应商-修改")
|
||||
//@SaAdminCheckPermission("shopVendor:update")
|
||||
public CzgResult<Void> updateShopVendor(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopVendorDTO dto) {
|
||||
shopVendorService.updateShopVendor(dto);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id 供应商id
|
||||
*/
|
||||
@DeleteMapping("{id}")
|
||||
@OperationLog("供应商-删除")
|
||||
//@SaAdminCheckPermission("shopVendor:delete")
|
||||
public CzgResult<Void> deleteShopVendor(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
shopVendorService.deleteShopVendor(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user