Merge remote-tracking branch 'origin/master'
# Conflicts: # cash-common/cash-common-api-config/src/main/java/com/czg/exception/CzgControllerAdvice.java
This commit is contained in:
commit
5f0b4365af
|
|
@ -18,4 +18,18 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.czg</groupId>
|
||||||
|
<artifactId>product-service</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
package com.czg;
|
package com.czg;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ww
|
* @author ww
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
@MapperScan("com.czg.service.product.mapper")
|
||||||
public class ProductApplication {
|
public class ProductApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.czg.controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-02-10 11:32
|
||||||
|
*/
|
||||||
|
public class AbcController {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.czg.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.lang.Validator;
|
||||||
|
import com.czg.annotation.LogOperation;
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.page.PageData;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.service.product.dto.ProductDTO;
|
||||||
|
import com.czg.service.product.service.ProductService;
|
||||||
|
import com.czg.utils.AssertUtil;
|
||||||
|
import com.czg.validator.ValidatorUtil;
|
||||||
|
import com.czg.validator.group.DefaultGroup;
|
||||||
|
import com.czg.validator.group.InsertGroup;
|
||||||
|
import com.czg.validator.group.UpdateGroup;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/prod/product")
|
||||||
|
public class ProductController {
|
||||||
|
private final ProductService productService;
|
||||||
|
|
||||||
|
@GetMapping("page")
|
||||||
|
@LogOperation("分页")
|
||||||
|
@SaAdminCheckPermission("prod:product:all")
|
||||||
|
public CzgResult<PageData<ProductDTO>> page(@RequestParam Map<String, Object> params){
|
||||||
|
PageData<ProductDTO> page = null;
|
||||||
|
|
||||||
|
return CzgResult.success(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("list")
|
||||||
|
@LogOperation("列表")
|
||||||
|
@SaAdminCheckPermission("prod:product:all")
|
||||||
|
public CzgResult<List<ProductDTO>> list(@RequestParam Map<String, Object> params){
|
||||||
|
List<ProductDTO> data = null;
|
||||||
|
|
||||||
|
return CzgResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@LogOperation("信息")
|
||||||
|
@SaAdminCheckPermission("prod:product:all")
|
||||||
|
public CzgResult<ProductDTO> get(@PathVariable("id") Long id){
|
||||||
|
ProductDTO data = null;
|
||||||
|
|
||||||
|
return CzgResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@LogOperation("保存")
|
||||||
|
@SaAdminCheckPermission("prod:product:all")
|
||||||
|
public CzgResult save(@RequestBody ProductDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtil.validateEntity(dto, InsertGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
//productService.save(dto);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@LogOperation("修改")
|
||||||
|
@SaAdminCheckPermission("prod:product:all")
|
||||||
|
public CzgResult update(@RequestBody ProductDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtil.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
//productService.update(dto);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@LogOperation("删除")
|
||||||
|
@SaAdminCheckPermission("prod:product:all")
|
||||||
|
public CzgResult delete(@RequestBody Long[] ids){
|
||||||
|
//效验数据
|
||||||
|
Assert.notNull(ids, "{}不能为空", "id");
|
||||||
|
AssertUtil.isArrayEmpty(ids, "请求id数组不能为空");
|
||||||
|
AssertUtil.isArrayEmpty(ids, "请求{}{}数组不能为空", "id", "的");
|
||||||
|
Validator.validateBirthday("2022-12-12", "生日格式不正确");
|
||||||
|
|
||||||
|
//productService.delete(ids);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.czg.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.lang.Validator;
|
||||||
|
import com.czg.annotation.LogOperation;
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.page.PageData;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.service.product.dto.ShopProdCategoryDTO;
|
||||||
|
import com.czg.service.product.service.ShopProdCategoryService;
|
||||||
|
import com.czg.utils.AssertUtil;
|
||||||
|
import com.czg.validator.ValidatorUtil;
|
||||||
|
import com.czg.validator.group.DefaultGroup;
|
||||||
|
import com.czg.validator.group.InsertGroup;
|
||||||
|
import com.czg.validator.group.UpdateGroup;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺商品分类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/prod/category")
|
||||||
|
public class ShopProdCategoryController {
|
||||||
|
private final ShopProdCategoryService shopProdCategoryService;
|
||||||
|
|
||||||
|
@GetMapping("page")
|
||||||
|
@LogOperation("分页")
|
||||||
|
@SaAdminCheckPermission("prod:category:all")
|
||||||
|
public CzgResult<PageData<ShopProdCategoryDTO>> page(@RequestParam Map<String, Object> params){
|
||||||
|
PageData<ShopProdCategoryDTO> page = null;
|
||||||
|
|
||||||
|
return CzgResult.success(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("list")
|
||||||
|
@LogOperation("列表")
|
||||||
|
@SaAdminCheckPermission("prod:category:all")
|
||||||
|
public CzgResult<List<ShopProdCategoryDTO>> list(@RequestParam Map<String, Object> params){
|
||||||
|
List<ShopProdCategoryDTO> data = null;
|
||||||
|
|
||||||
|
return CzgResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@LogOperation("信息")
|
||||||
|
@SaAdminCheckPermission("prod:category:all")
|
||||||
|
public CzgResult<ShopProdCategoryDTO> get(@PathVariable("id") Long id){
|
||||||
|
ShopProdCategoryDTO data = null;
|
||||||
|
|
||||||
|
return CzgResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@LogOperation("保存")
|
||||||
|
@SaAdminCheckPermission("prod:category:all")
|
||||||
|
public CzgResult save(@RequestBody ShopProdCategoryDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtil.validateEntity(dto, InsertGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
//shopProdCategoryService.save(dto);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@LogOperation("修改")
|
||||||
|
@SaAdminCheckPermission("prod:category:all")
|
||||||
|
public CzgResult update(@RequestBody ShopProdCategoryDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtil.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
//shopProdCategoryService.update(dto);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@LogOperation("删除")
|
||||||
|
@SaAdminCheckPermission("prod:category:all")
|
||||||
|
public CzgResult delete(@RequestBody Long[] ids){
|
||||||
|
//效验数据
|
||||||
|
Assert.notNull(ids, "{}不能为空", "id");
|
||||||
|
AssertUtil.isArrayEmpty(ids, "请求id数组不能为空");
|
||||||
|
AssertUtil.isArrayEmpty(ids, "请求{}{}数组不能为空", "id", "的");
|
||||||
|
Validator.validateBirthday("2022-12-12", "生日格式不正确");
|
||||||
|
|
||||||
|
//shopProdCategoryService.delete(ids);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.czg.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.lang.Validator;
|
||||||
|
import com.czg.annotation.LogOperation;
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.page.PageData;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.service.product.dto.ShopProdUnitDTO;
|
||||||
|
import com.czg.service.product.service.ShopProdUnitService;
|
||||||
|
import com.czg.utils.AssertUtil;
|
||||||
|
import com.czg.validator.ValidatorUtil;
|
||||||
|
import com.czg.validator.group.DefaultGroup;
|
||||||
|
import com.czg.validator.group.InsertGroup;
|
||||||
|
import com.czg.validator.group.UpdateGroup;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品单位
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/prod/unit")
|
||||||
|
public class ShopProdUnitController {
|
||||||
|
private final ShopProdUnitService shopProdUnitService;
|
||||||
|
|
||||||
|
@GetMapping("page")
|
||||||
|
@LogOperation("分页")
|
||||||
|
@SaAdminCheckPermission("prod:unit:all")
|
||||||
|
public CzgResult<PageData<ShopProdUnitDTO>> page(@RequestParam Map<String, Object> params){
|
||||||
|
PageData<ShopProdUnitDTO> page = null;
|
||||||
|
|
||||||
|
return CzgResult.success(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("list")
|
||||||
|
@LogOperation("列表")
|
||||||
|
@SaAdminCheckPermission("prod:unit:all")
|
||||||
|
public CzgResult<List<ShopProdUnitDTO>> list(@RequestParam Map<String, Object> params){
|
||||||
|
List<ShopProdUnitDTO> data = null;
|
||||||
|
|
||||||
|
return CzgResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@LogOperation("信息")
|
||||||
|
@SaAdminCheckPermission("prod:unit:all")
|
||||||
|
public CzgResult<ShopProdUnitDTO> get(@PathVariable("id") Long id){
|
||||||
|
ShopProdUnitDTO data = null;
|
||||||
|
|
||||||
|
return CzgResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@LogOperation("保存")
|
||||||
|
@SaAdminCheckPermission("prod:unit:all")
|
||||||
|
public CzgResult save(@RequestBody ShopProdUnitDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtil.validateEntity(dto, InsertGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
//shopProdUnitService.save(dto);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@LogOperation("修改")
|
||||||
|
@SaAdminCheckPermission("prod:unit:all")
|
||||||
|
public CzgResult update(@RequestBody ShopProdUnitDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtil.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||||
|
|
||||||
|
//shopProdUnitService.update(dto);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@LogOperation("删除")
|
||||||
|
@SaAdminCheckPermission("prod:unit:all")
|
||||||
|
public CzgResult delete(@RequestBody Long[] ids){
|
||||||
|
//效验数据
|
||||||
|
Assert.notNull(ids, "{}不能为空", "id");
|
||||||
|
AssertUtil.isArrayEmpty(ids, "请求id数组不能为空");
|
||||||
|
AssertUtil.isArrayEmpty(ids, "请求{}{}数组不能为空", "id", "的");
|
||||||
|
Validator.validateBirthday("2022-12-12", "生日格式不正确");
|
||||||
|
|
||||||
|
//shopProdUnitService.delete(ids);
|
||||||
|
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/czg_cashier?useUnicode=true&characterEncoding=utf-8
|
||||||
|
username: cashier
|
||||||
|
password: Cashier@1@
|
||||||
|
|
||||||
|
data:
|
||||||
|
redis:
|
||||||
|
host: 121.40.128.145
|
||||||
|
port: 6379
|
||||||
|
password: 111111
|
||||||
|
timeout: 1000
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
min-idle: 0
|
||||||
|
max-idle: 8
|
||||||
|
max-wait: -1ms
|
||||||
|
max-active: 16
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 101.37.12.135:8848
|
||||||
|
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.czg.service;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-02-10 11:35
|
||||||
|
*/
|
||||||
|
@SpringBootTest
|
||||||
|
public class DemoTest {
|
||||||
|
@Resource
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void encode() {
|
||||||
|
String password = "123456";
|
||||||
|
password = passwordEncoder.encode(password);
|
||||||
|
|
||||||
|
System.out.println(password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package com.czg.controller;
|
package com.czg.controller;
|
||||||
|
|
||||||
import com.czg.group.InsertGroup;
|
|
||||||
import com.czg.group.UpdateGroup;
|
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.service.system.dto.SysParamsDTO;
|
import com.czg.service.system.dto.SysParamsDTO;
|
||||||
import com.czg.service.system.service.SysParamsService;
|
import com.czg.service.system.service.SysParamsService;
|
||||||
|
import com.czg.validator.group.InsertGroup;
|
||||||
|
import com.czg.validator.group.UpdateGroup;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.czg.exception;
|
package com.czg.exception;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.exception.NotPermissionException;
|
||||||
|
import cn.hutool.core.exceptions.ValidateException;
|
||||||
import cn.dev33.satoken.exception.NotPermissionException;
|
import cn.dev33.satoken.exception.NotPermissionException;
|
||||||
import com.czg.resp.CzgRespCode;
|
import com.czg.resp.CzgRespCode;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
|
|
@ -48,6 +50,30 @@ public class CzgControllerAdvice {
|
||||||
return CzgResult.failure(CzgRespCode.PARAM_ERROR.getCode(), message);
|
return CzgResult.failure(CzgRespCode.PARAM_ERROR.getCode(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理自定义异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(value = {CzgException.class, IllegalArgumentException.class})
|
||||||
|
public CzgResult handleCzgException(CzgException ex) {
|
||||||
|
return CzgResult.failure(ex.getCode(), ex.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理Hutool的断言抛出异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(IllegalArgumentException.class)
|
||||||
|
public CzgResult handleAssertException(IllegalArgumentException ex) {
|
||||||
|
return CzgResult.failure(CzgRespCode.PARAM_ERROR.getCode(), ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理Hutool的校验工具类抛出异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(ValidateException.class)
|
||||||
|
public CzgResult handleHutoolValidateException(ValidateException ex) {
|
||||||
|
return CzgResult.failure(CzgRespCode.PARAM_ERROR.getCode(), ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
private void setErrorLog(Exception ex) {
|
private void setErrorLog(Exception ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
|
||||||
|
package com.czg.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志注解
|
||||||
|
*
|
||||||
|
* @author admin admin@cashier.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface LogOperation {
|
||||||
|
String value() default "";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
|
||||||
|
|
||||||
|
package com.czg.exception;
|
||||||
|
|
||||||
|
import com.czg.resp.CzgRespCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义异常
|
||||||
|
*
|
||||||
|
* @author admin admin@cashier.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public class CzgException extends RuntimeException {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public CzgException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.code = CzgRespCode.FAILURE.getCode();
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CzgException(String msg, Throwable e) {
|
||||||
|
super(msg, e);
|
||||||
|
this.code = CzgRespCode.FAILURE.getCode();
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
package com.czg.group;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author GYJoker
|
|
||||||
*/
|
|
||||||
public interface InsertGroup {
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
package com.czg.group;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author GYJoker
|
|
||||||
*/
|
|
||||||
public interface UpdateGroup {
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.czg.page;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页工具类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PageData<T> implements Serializable {
|
||||||
|
/**
|
||||||
|
* 总记录数
|
||||||
|
*/
|
||||||
|
private int total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表数据
|
||||||
|
*/
|
||||||
|
private List<T> list;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*
|
||||||
|
* @param list 列表数据
|
||||||
|
* @param total 总记录数
|
||||||
|
*/
|
||||||
|
public PageData(List<T> list, long total) {
|
||||||
|
this.list = list;
|
||||||
|
this.total = (int) total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
|
||||||
|
|
||||||
|
package com.czg.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验工具类
|
||||||
|
*
|
||||||
|
* @author admin admin@cashier.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public class AssertUtil {
|
||||||
|
|
||||||
|
public static void isBlank(String str, String msg) {
|
||||||
|
if (StrUtil.isBlank(str)) {
|
||||||
|
throw new CzgException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isBlank(String str, String errorMsgTemplate, Object... params) {
|
||||||
|
isBlank(str, StrUtil.format(errorMsgTemplate, params));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isNull(Object object, String msg) {
|
||||||
|
if (object == null) {
|
||||||
|
throw new CzgException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isNull(Object object, String errorMsgTemplate, Object... params) {
|
||||||
|
isNull(object, StrUtil.format(errorMsgTemplate, params));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isArrayEmpty(Object[] array, String msg) {
|
||||||
|
if (ArrayUtil.isEmpty(array)) {
|
||||||
|
throw new CzgException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isArrayEmpty(Object[] array, String errorMsgTemplate, Object... params) {
|
||||||
|
isArrayEmpty(array, StrUtil.format(errorMsgTemplate, params));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isListEmpty(List<?> list, String msg) {
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
throw new CzgException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isListEmpty(List<?> list, String errorMsgTemplate, Object... params) {
|
||||||
|
isListEmpty(list, StrUtil.format(errorMsgTemplate, params));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isMapEmpty(Map map, String msg) {
|
||||||
|
if (MapUtil.isEmpty(map)) {
|
||||||
|
throw new CzgException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void isMapEmpty(Map map, String errorMsgTemplate, Object... params) {
|
||||||
|
isMapEmpty(map, StrUtil.format(errorMsgTemplate, params));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.czg.validator;
|
||||||
|
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
|
import jakarta.validation.ConstraintViolation;
|
||||||
|
import jakarta.validation.Validation;
|
||||||
|
import jakarta.validation.Validator;
|
||||||
|
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.context.support.ResourceBundleMessageSource;
|
||||||
|
import org.springframework.validation.beanvalidation.MessageSourceResourceBundleLocator;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hibernate-validator校验工具类
|
||||||
|
* 参考文档:http://docs.jboss.org/hibernate/validator/6.0/reference/en-US/html_single/
|
||||||
|
*
|
||||||
|
* @author admin admin@cashier.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public class ValidatorUtil {
|
||||||
|
|
||||||
|
private static ResourceBundleMessageSource getMessageSource() {
|
||||||
|
ResourceBundleMessageSource bundleMessageSource = new ResourceBundleMessageSource();
|
||||||
|
bundleMessageSource.setDefaultEncoding("UTF-8");
|
||||||
|
//bundleMessageSource.setBasenames("i18n/validation", "i18n/validation_common");
|
||||||
|
return bundleMessageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验对象
|
||||||
|
* @param object 待校验对象
|
||||||
|
* @param groups 待校验的组
|
||||||
|
* @throws CzgException 校验不通过,则报CzgException异常
|
||||||
|
*/
|
||||||
|
public static void validateEntity(Object object, Class<?>... groups)
|
||||||
|
throws CzgException {
|
||||||
|
Locale.setDefault(LocaleContextHolder.getLocale());
|
||||||
|
Validator validator = Validation.byDefaultProvider().configure().messageInterpolator(
|
||||||
|
new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(getMessageSource())))
|
||||||
|
.buildValidatorFactory().getValidator();
|
||||||
|
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
|
||||||
|
if (!constraintViolations.isEmpty()) {
|
||||||
|
ConstraintViolation<Object> constraint = constraintViolations.iterator().next();
|
||||||
|
throw new CzgException(constraint.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
package com.czg.validator.group;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认 Group
|
||||||
|
*
|
||||||
|
* @author admin admin@cashier.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public interface DefaultGroup {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.czg.validator.group;
|
||||||
|
|
||||||
|
|
||||||
|
import jakarta.validation.GroupSequence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义校验顺序,如果AddGroup组失败,则UpdateGroup组不会再校验
|
||||||
|
*
|
||||||
|
* @author admin admin@cashier.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@GroupSequence({InsertGroup.class, UpdateGroup.class})
|
||||||
|
public interface Group {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
package com.czg.validator.group;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增 Group
|
||||||
|
*
|
||||||
|
* @author admin admin@cashier.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public interface InsertGroup {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
package com.czg.validator.group;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改 Group
|
||||||
|
*
|
||||||
|
* @author admin admin@cashier.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public interface UpdateGroup {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.czg.service.product.dto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-02-10 11:27
|
||||||
|
*/
|
||||||
|
public class AbcDTO {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
package com.czg.service.product.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProductDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 商品分类
|
||||||
|
*/
|
||||||
|
private String categoryId;
|
||||||
|
/**
|
||||||
|
* 商品规格
|
||||||
|
*/
|
||||||
|
private Integer specId;
|
||||||
|
/**
|
||||||
|
* 单位Id
|
||||||
|
*/
|
||||||
|
private Integer unitId;
|
||||||
|
private String shopId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 短标题--促销语
|
||||||
|
*/
|
||||||
|
private String shortTitle;
|
||||||
|
/**
|
||||||
|
* 单规格商品 single 多规格商品 sku 套餐商品 package 称重商品 weigh 团购券 coupon
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 0 固定套餐 1可选套餐
|
||||||
|
*/
|
||||||
|
private Integer groupType;
|
||||||
|
/**
|
||||||
|
* 包装费
|
||||||
|
*/
|
||||||
|
private BigDecimal packFee;
|
||||||
|
/**
|
||||||
|
* 商品封面图
|
||||||
|
*/
|
||||||
|
private String coverImg;
|
||||||
|
/**
|
||||||
|
* 商品图片(第一张为缩略图,其他为详情)
|
||||||
|
*/
|
||||||
|
private String images;
|
||||||
|
/**
|
||||||
|
* 套餐内容
|
||||||
|
*/
|
||||||
|
private String groupSnap;
|
||||||
|
/**
|
||||||
|
* 库存警戒线
|
||||||
|
*/
|
||||||
|
private Integer warnLine;
|
||||||
|
/**
|
||||||
|
* 称重 价格/千克
|
||||||
|
*/
|
||||||
|
private BigDecimal weight;
|
||||||
|
/**
|
||||||
|
* 是否允许临时改价
|
||||||
|
*/
|
||||||
|
private Integer isTempPrice;
|
||||||
|
/**
|
||||||
|
* 周 数组 'Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday'
|
||||||
|
*/
|
||||||
|
private String days;
|
||||||
|
/**
|
||||||
|
* 可用开始时间
|
||||||
|
*/
|
||||||
|
private Object startTime;
|
||||||
|
/**
|
||||||
|
* 可用结束时间
|
||||||
|
*/
|
||||||
|
private Object endTime;
|
||||||
|
/**
|
||||||
|
* 规格详情
|
||||||
|
*/
|
||||||
|
private String specInfo;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 是否热销
|
||||||
|
*/
|
||||||
|
private Integer isHot;
|
||||||
|
/**
|
||||||
|
* 是否开启库存
|
||||||
|
*/
|
||||||
|
private Integer isStock;
|
||||||
|
/**
|
||||||
|
* 是否售罄
|
||||||
|
*/
|
||||||
|
private Integer isSoldStock;
|
||||||
|
/**
|
||||||
|
* 团购卷分类,可有多个分类
|
||||||
|
*/
|
||||||
|
private String groupCategoryId;
|
||||||
|
/**
|
||||||
|
* 商品级库存数量
|
||||||
|
*/
|
||||||
|
private Integer stockNumber;
|
||||||
|
/**
|
||||||
|
* 是否上架
|
||||||
|
*/
|
||||||
|
private Integer isSale;
|
||||||
|
/**
|
||||||
|
* 退款是否退回库存
|
||||||
|
*/
|
||||||
|
private Integer isRefundStock;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
/**
|
||||||
|
* 逻辑删除
|
||||||
|
*/
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.czg.service.product.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺商品分类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopProdCategoryDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自增id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 分类名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 简称
|
||||||
|
*/
|
||||||
|
private String shortName;
|
||||||
|
/**
|
||||||
|
* 上级分类id-为0则表示是顶级
|
||||||
|
*/
|
||||||
|
private String pid;
|
||||||
|
/**
|
||||||
|
* 图标
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private String shopId;
|
||||||
|
/**
|
||||||
|
* 是否显示:1显示 0不显示
|
||||||
|
*/
|
||||||
|
private Integer isShow;
|
||||||
|
/**
|
||||||
|
* 分类描述
|
||||||
|
*/
|
||||||
|
private String detail;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 关键词
|
||||||
|
*/
|
||||||
|
private String keyWord;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.czg.service.product.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品单位
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopProdUnitDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 单位名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 小数位(个数大于0,表示小数据精度位数)
|
||||||
|
*/
|
||||||
|
private Integer decimalsDigits;
|
||||||
|
/**
|
||||||
|
* 单位类型(weight代表重量,小数单位,为number代表个数)
|
||||||
|
*/
|
||||||
|
private String unitType;
|
||||||
|
/**
|
||||||
|
* 0后台添加 -1系统默认 (公斤、瓶)
|
||||||
|
*/
|
||||||
|
private Integer isSystem;
|
||||||
|
/**
|
||||||
|
* 预留字段1-正常
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private String shopId;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.czg.service.product.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-02-10 11:27
|
||||||
|
*/
|
||||||
|
public class Abc {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
package com.czg.service.product.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Table("tb_product")
|
||||||
|
public class Product implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 商品分类
|
||||||
|
*/
|
||||||
|
private String categoryId;
|
||||||
|
/**
|
||||||
|
* 商品规格
|
||||||
|
*/
|
||||||
|
private Integer specId;
|
||||||
|
/**
|
||||||
|
* 单位Id
|
||||||
|
*/
|
||||||
|
private Integer unitId;
|
||||||
|
private String shopId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 短标题--促销语
|
||||||
|
*/
|
||||||
|
private String shortTitle;
|
||||||
|
/**
|
||||||
|
* 单规格商品 single 多规格商品 sku 套餐商品 package 称重商品 weigh 团购券 coupon
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 0 固定套餐 1可选套餐
|
||||||
|
*/
|
||||||
|
private Integer groupType;
|
||||||
|
/**
|
||||||
|
* 包装费
|
||||||
|
*/
|
||||||
|
private BigDecimal packFee;
|
||||||
|
/**
|
||||||
|
* 商品封面图
|
||||||
|
*/
|
||||||
|
private String coverImg;
|
||||||
|
/**
|
||||||
|
* 商品图片(第一张为缩略图,其他为详情)
|
||||||
|
*/
|
||||||
|
private String images;
|
||||||
|
/**
|
||||||
|
* 套餐内容
|
||||||
|
*/
|
||||||
|
private String groupSnap;
|
||||||
|
/**
|
||||||
|
* 库存警戒线
|
||||||
|
*/
|
||||||
|
private Integer warnLine;
|
||||||
|
/**
|
||||||
|
* 称重 价格/千克
|
||||||
|
*/
|
||||||
|
private BigDecimal weight;
|
||||||
|
/**
|
||||||
|
* 是否允许临时改价
|
||||||
|
*/
|
||||||
|
private Integer isTempPrice;
|
||||||
|
/**
|
||||||
|
* 周 数组 'Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday'
|
||||||
|
*/
|
||||||
|
private String days;
|
||||||
|
/**
|
||||||
|
* 可用开始时间
|
||||||
|
*/
|
||||||
|
private Object startTime;
|
||||||
|
/**
|
||||||
|
* 可用结束时间
|
||||||
|
*/
|
||||||
|
private Object endTime;
|
||||||
|
/**
|
||||||
|
* 规格详情
|
||||||
|
*/
|
||||||
|
private String specInfo;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 是否热销
|
||||||
|
*/
|
||||||
|
private Integer isHot;
|
||||||
|
/**
|
||||||
|
* 是否开启库存
|
||||||
|
*/
|
||||||
|
private Integer isStock;
|
||||||
|
/**
|
||||||
|
* 是否售罄
|
||||||
|
*/
|
||||||
|
private Integer isSoldStock;
|
||||||
|
/**
|
||||||
|
* 团购卷分类,可有多个分类
|
||||||
|
*/
|
||||||
|
private String groupCategoryId;
|
||||||
|
/**
|
||||||
|
* 商品级库存数量
|
||||||
|
*/
|
||||||
|
private Integer stockNumber;
|
||||||
|
/**
|
||||||
|
* 是否上架
|
||||||
|
*/
|
||||||
|
private Integer isSale;
|
||||||
|
/**
|
||||||
|
* 退款是否退回库存
|
||||||
|
*/
|
||||||
|
private Integer isRefundStock;
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
/**
|
||||||
|
* 逻辑删除
|
||||||
|
*/
|
||||||
|
private Integer isDel;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.czg.service.product.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺商品分类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Table("tb_shop_prod_category")
|
||||||
|
public class ShopProdCategory implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自增id
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 分类名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 简称
|
||||||
|
*/
|
||||||
|
private String shortName;
|
||||||
|
/**
|
||||||
|
* 上级分类id-为0则表示是顶级
|
||||||
|
*/
|
||||||
|
private String pid;
|
||||||
|
/**
|
||||||
|
* 图标
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private String shopId;
|
||||||
|
/**
|
||||||
|
* 是否显示:1显示 0不显示
|
||||||
|
*/
|
||||||
|
private Integer isShow;
|
||||||
|
/**
|
||||||
|
* 分类描述
|
||||||
|
*/
|
||||||
|
private String detail;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 关键词
|
||||||
|
*/
|
||||||
|
private String keyWord;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.czg.service.product.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品单位
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Table("tb_shop_prod_unit")
|
||||||
|
public class ShopProdUnit implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 单位名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 小数位(个数大于0,表示小数据精度位数)
|
||||||
|
*/
|
||||||
|
private Integer decimalsDigits;
|
||||||
|
/**
|
||||||
|
* 单位类型(weight代表重量,小数单位,为number代表个数)
|
||||||
|
*/
|
||||||
|
private String unitType;
|
||||||
|
/**
|
||||||
|
* 0后台添加 -1系统默认 (公斤、瓶)
|
||||||
|
*/
|
||||||
|
private Integer isSystem;
|
||||||
|
/**
|
||||||
|
* 预留字段1-正常
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private String shopId;
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.czg.service.product.mapper;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.Abc;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-02-10 11:27
|
||||||
|
*/
|
||||||
|
public interface AbcMapper extends BaseMapper<Abc> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.czg.service.product.mapper;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.Product;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ProductMapper extends BaseMapper<Product> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.czg.service.product.mapper;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.ShopProdCategory;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺商品分类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ShopProdCategoryMapper extends BaseMapper<ShopProdCategory> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.czg.service.product.mapper;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.ShopProdUnit;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品单位
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ShopProdUnitMapper extends BaseMapper<ShopProdUnit> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.czg.service.product.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-02-10 11:26
|
||||||
|
*/
|
||||||
|
public class AbcService {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.czg.service.product.service;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.Product;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
public interface ProductService extends IService<Product> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.czg.service.product.service;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.ShopProdCategory;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺商品分类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
public interface ShopProdCategoryService extends IService<ShopProdCategory> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.czg.service.product.service;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.ShopProdUnit;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品单位
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
public interface ShopProdUnitService extends IService<ShopProdUnit> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.czg.service.product.service.impl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-02-10 11:26
|
||||||
|
*/
|
||||||
|
public class AbcServiceImpl {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.czg.service.product.service.impl;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.Product;
|
||||||
|
import com.czg.service.product.mapper.ProductMapper;
|
||||||
|
import com.czg.service.product.service.ProductService;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.czg.service.product.service.impl;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.ShopProdCategory;
|
||||||
|
import com.czg.service.product.mapper.ShopProdCategoryMapper;
|
||||||
|
import com.czg.service.product.service.ShopProdCategoryService;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺商品分类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMapper, ShopProdCategory> implements ShopProdCategoryService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.czg.service.product.service.impl;
|
||||||
|
|
||||||
|
import com.czg.service.product.entity.ShopProdUnit;
|
||||||
|
import com.czg.service.product.mapper.ShopProdUnitMapper;
|
||||||
|
import com.czg.service.product.service.ShopProdUnitService;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品单位
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-02-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, ShopProdUnit> implements ShopProdUnitService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.product.mapper.AbcMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.czg.service.product.mapper.ProductMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.czg.service.product.mapper.ShopProdCategoryMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.czg.service.product.mapper.ShopProdUnitMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package com.czg.service.system.dto;
|
package com.czg.service.system.dto;
|
||||||
|
|
||||||
import com.czg.group.InsertGroup;
|
import com.czg.validator.group.DefaultGroup;
|
||||||
import com.czg.group.UpdateGroup;
|
import com.czg.validator.group.InsertGroup;
|
||||||
|
import com.czg.validator.group.UpdateGroup;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -14,13 +15,13 @@ import lombok.experimental.Accessors;
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class SysParamsDTO {
|
public class SysParamsDTO {
|
||||||
|
|
||||||
@NotBlank(message = "参数编码不能为空", groups = {UpdateGroup.class, InsertGroup.class})
|
@NotBlank(message = "参数编码不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||||
private String paramCode;
|
private String paramCode;
|
||||||
|
|
||||||
@NotBlank(message = "参数值不能为空", groups = {UpdateGroup.class, InsertGroup.class})
|
@NotBlank(message = "参数值不能为空", groups = DefaultGroup.class)
|
||||||
private String paramValue;
|
private String paramValue;
|
||||||
|
|
||||||
@NotNull(message = "参数类型不能为空", groups = {UpdateGroup.class, InsertGroup.class})
|
@NotNull(message = "参数类型不能为空", groups = {UpdateGroup.class, UpdateGroup.class})
|
||||||
private Integer paramType;
|
private Integer paramType;
|
||||||
private String remark;
|
private String remark;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue