商品模块代码提交
This commit is contained in:
parent
140f9344e0
commit
604387850e
|
|
@ -1,6 +1,5 @@
|
|||
package com.czg.controller;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ShopProdUnitDTO;
|
||||
import com.czg.product.service.ShopProdUnitService;
|
||||
|
|
@ -32,7 +31,7 @@ public class ShopProdUnitController {
|
|||
|
||||
@GetMapping("page")
|
||||
@OperationLog("商品单位-分页")
|
||||
@SaAdminCheckPermission("prod:unit:page")
|
||||
//@SaAdminCheckPermission("prod:unit:page")
|
||||
public CzgResult<Page<ShopProdUnitDTO>> page(ShopProdUnitDTO param) {
|
||||
Page<ShopProdUnitDTO> data = shopProdUnitService.page(param);
|
||||
return CzgResult.success(data);
|
||||
|
|
@ -40,7 +39,7 @@ public class ShopProdUnitController {
|
|||
|
||||
@GetMapping("list")
|
||||
@OperationLog("商品单位-列表")
|
||||
@SaAdminCheckPermission("prod:unit:list")
|
||||
//@SaAdminCheckPermission("prod:unit:list")
|
||||
public CzgResult<List<ShopProdUnitDTO>> list(ShopProdUnitDTO param) {
|
||||
List<ShopProdUnitDTO> data = shopProdUnitService.list(param);
|
||||
return CzgResult.success(data);
|
||||
|
|
@ -48,7 +47,7 @@ public class ShopProdUnitController {
|
|||
|
||||
@GetMapping("{id}")
|
||||
@OperationLog("商品单位-信息")
|
||||
@SaAdminCheckPermission("prod:unit:info")
|
||||
//@SaAdminCheckPermission("prod:unit:info")
|
||||
public CzgResult<ShopProdUnitDTO> get(@PathVariable("id") Long id) {
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
ShopProdUnitDTO data = shopProdUnitService.get(id);
|
||||
|
|
@ -57,7 +56,7 @@ public class ShopProdUnitController {
|
|||
|
||||
@PostMapping
|
||||
@OperationLog("商品单位-保存")
|
||||
@SaAdminCheckPermission("prod:unit:save")
|
||||
//@SaAdminCheckPermission("prod:unit:save")
|
||||
public CzgResult<Void> save(@RequestBody ShopProdUnitDTO dto) {
|
||||
//效验数据
|
||||
ValidatorUtil.validateEntity(dto, InsertGroup.class, DefaultGroup.class);
|
||||
|
|
@ -69,7 +68,7 @@ public class ShopProdUnitController {
|
|||
|
||||
@PutMapping
|
||||
@OperationLog("商品单位-修改")
|
||||
@SaAdminCheckPermission("prod:unit:update")
|
||||
//@SaAdminCheckPermission("prod:unit:update")
|
||||
public CzgResult<Void> update(@RequestBody ShopProdUnitDTO dto) {
|
||||
//效验数据
|
||||
ValidatorUtil.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||
|
|
@ -81,7 +80,7 @@ public class ShopProdUnitController {
|
|||
|
||||
@DeleteMapping("{id}")
|
||||
@OperationLog("商品单位-启用")
|
||||
@SaAdminCheckPermission("prod:unit:delete")
|
||||
//@SaAdminCheckPermission("prod:unit:delete")
|
||||
public CzgResult<Void> delete(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
|
|
@ -91,7 +90,7 @@ public class ShopProdUnitController {
|
|||
|
||||
@PostMapping("disable/{id}")
|
||||
@OperationLog("商品单位-禁用")
|
||||
@SaAdminCheckPermission("prod:unit:able")
|
||||
//@SaAdminCheckPermission("prod:unit:able")
|
||||
public CzgResult<Void> disable(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
|
|
@ -101,7 +100,7 @@ public class ShopProdUnitController {
|
|||
|
||||
@PostMapping("enable/{id}")
|
||||
@OperationLog("商品单位-启用")
|
||||
@SaAdminCheckPermission("prod:unit:able")
|
||||
//@SaAdminCheckPermission("prod:unit:able")
|
||||
public CzgResult<Void> enable(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.czg.product.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import com.mybatisflex.core.keygen.KeyGenerators;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
|
|
@ -25,7 +27,7 @@ public class ShopProdUnit implements Serializable {
|
|||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
@Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
|
||||
private Long id;
|
||||
/**
|
||||
* 单位名称
|
||||
|
|
@ -50,9 +52,11 @@ public class ShopProdUnit implements Serializable {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
|||
Long shopId = StpKit.USER.getLoginIdAsLong();
|
||||
return UpdateChain.of(ShopProdUnit.class)
|
||||
.set(ShopProdUnit::getStatus, StatusEnum.ENABLED.value())
|
||||
.where(ShopProdUnit::getId).eq(id)
|
||||
.eq(ShopProdUnit::getId, id)
|
||||
.eq(ShopProdUnit::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue