存酒接口
This commit is contained in:
@@ -1,19 +1,78 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.storage.ShopStorageGoodDTO;
|
||||
import com.czg.account.entity.ShopStorageGood;
|
||||
import com.czg.account.service.ShopStorageGoodService;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.resp.CzgResult;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.PageUtil;
|
||||
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 com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 存酒管理
|
||||
* 存酒商品管理
|
||||
* @author Administrator
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping
|
||||
@RequestMapping("/admin/storageGood")
|
||||
public class ShopStorageGoodController {
|
||||
@Resource
|
||||
private ShopStorageGoodService shopStorageGoodService;
|
||||
|
||||
/**
|
||||
* 获取存酒商品列表
|
||||
* @param name 商品名
|
||||
* @return 列表
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "storageGood:list", name = "获取存酒商品列表")
|
||||
@GetMapping
|
||||
public CzgResult<Page<ShopStorageGood>> list(String name) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper().eq(ShopStorageGood::getShopId, StpKit.USER.getShopId());
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
queryWrapper.eq(ShopStorageGood::getName, name);
|
||||
}
|
||||
return CzgResult.success(shopStorageGoodService.page(PageUtil.buildPage(), queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取存酒商品详情
|
||||
* @param id 商品id
|
||||
* @return 列表
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "storageGood:detail", name = "获取存酒商品详情")
|
||||
@GetMapping("/detail")
|
||||
public CzgResult<ShopStorageGood> detail(@RequestParam Integer id) {
|
||||
return CzgResult.success(shopStorageGoodService.getOne(new QueryWrapper().eq(ShopStorageGood::getShopId, StpKit.USER.getShopId()).eq(ShopStorageGood::getId, id)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑存酒商品
|
||||
* @return 列表
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "storageGood:edit", name = "存酒商品编辑")
|
||||
@PutMapping("/edit")
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated({UpdateGroup.class}) ShopStorageGoodDTO shopStorageGoodDTO) {
|
||||
return CzgResult.success(shopStorageGoodService.edit(StpKit.USER.getShopId(), shopStorageGoodDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑存酒商品
|
||||
* @return 列表
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "storageGood:add", name = "存酒商品新增")
|
||||
@PutMapping("/add")
|
||||
public CzgResult<Boolean> add(@RequestBody @Validated({InsertGroup.class}) ShopStorageGoodDTO shopStorageGoodDTO) {
|
||||
return CzgResult.success(shopStorageGoodService.saveInfo(StpKit.USER.getShopId(), shopStorageGoodDTO));
|
||||
}
|
||||
|
||||
|
||||
// @SaAdminCheckPermission("")
|
||||
// public CzgResult<>
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user