49 changed files with 1703 additions and 53 deletions
@ -0,0 +1,85 @@ |
|||
package com.qs.serve.common.util; |
|||
|
|||
import com.qs.serve.common.framework.exception.BusinessException; |
|||
import lombok.experimental.UtilityClass; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.hibernate.validator.HibernateValidator; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import javax.validation.ConstraintViolation; |
|||
import javax.validation.Validation; |
|||
import javax.validation.Validator; |
|||
import javax.validation.ValidatorFactory; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
/** |
|||
* validate方法中校验工具类 |
|||
* <p> |
|||
* 只要在实体中加上相应的validate的相关注解即可 |
|||
* </p> |
|||
* |
|||
* @author Zed |
|||
*/ |
|||
@UtilityClass |
|||
public class ValidateTools { |
|||
/** |
|||
* 初始化检查器 |
|||
*/ |
|||
private static final ValidatorFactory VALIDATOR_FACTORY = Validation.byProvider(HibernateValidator.class).configure().failFast(false).buildValidatorFactory(); |
|||
private static final Validator VALIDATOR = VALIDATOR_FACTORY.getValidator(); |
|||
/** |
|||
* 校验返回异常信息 |
|||
* |
|||
* @param t 实体 |
|||
* @param <T> 实体泛型 |
|||
*/ |
|||
public static <T> String validStr(T t) { |
|||
// 构造返回信息
|
|||
StringBuilder validMessage = new StringBuilder(); |
|||
// 检查实体T
|
|||
Set<ConstraintViolation<T>> set = VALIDATOR.validate(t); |
|||
// 循环set,获取检查结果
|
|||
for (ConstraintViolation<T> vo : set) { |
|||
validMessage.append(vo.getMessage()).append(";"); |
|||
} |
|||
return validMessage.toString(); |
|||
} |
|||
/** |
|||
* 校验实体抛出异常 |
|||
* |
|||
* @param t 实体 |
|||
* @param <T> 实体泛型 |
|||
*/ |
|||
public static <T> void valid(T t) { |
|||
String validStr = validStr(t); |
|||
// 抛出业务异常
|
|||
if (StringUtils.isNotBlank(validStr)) { |
|||
throw new BusinessException(validStr,500); |
|||
} |
|||
} |
|||
/** |
|||
* 校验集合抛出异常 |
|||
* |
|||
* @param list 列表 |
|||
* @param <T> 实体泛型 |
|||
*/ |
|||
public static <T> void valid(List<T> list) { |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
throw new BusinessException("数据不存在!",500); |
|||
} |
|||
// 构造返回信息
|
|||
StringBuilder validMessageTotal = new StringBuilder(); |
|||
// 遍历
|
|||
for (int i = 0; i < list.size(); i++) { |
|||
String validStr = validStr(list.get(i)); |
|||
if (StringUtils.isNotBlank(validStr)) { |
|||
String msg = String.format("第%d条数据校验结果:[%s]\n", i + 1, validStr); |
|||
validMessageTotal.append(msg); |
|||
} |
|||
} |
|||
// 抛出业务异常
|
|||
if (StringUtils.isNotBlank(validMessageTotal.toString())) { |
|||
throw new BusinessException(validMessageTotal.toString(),500); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,150 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.*; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionBatchBo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
import com.qs.serve.modules.sys.entity.dto.SysDeptTreeNode; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.service.BmsRegionService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 区域档案 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/region") |
|||
public class BmsRegionController { |
|||
|
|||
private BmsRegionService bmsRegionService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<PageVo<BmsRegion>> getPage(BmsRegion param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsRegion> regionWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsRegion> list = bmsRegionService.list(regionWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 树查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<List<BmsRegionTreeVo>> getTree(BmsRegion param){ |
|||
return R.ok(bmsRegionService.getTree(param)); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<BmsRegion> getById(@PathVariable("id") String id){ |
|||
BmsRegion bmsRegion = bmsRegionService.getById(id); |
|||
return R.ok(bmsRegion); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:region:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){ |
|||
BmsRegion param = CopierUtil.copy(regionBo,new BmsRegion()); |
|||
bmsRegionService.flushLevel(param); |
|||
boolean result = bmsRegionService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增区域档案 |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:region:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){ |
|||
BmsRegion param = CopierUtil.copy(regionBo,new BmsRegion()); |
|||
if(param.getId()==null){ |
|||
param.setId(IdUtil.getSnowFlakeId()+""); |
|||
} |
|||
bmsRegionService.flushLevel(param); |
|||
boolean result = bmsRegionService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* (批量)编辑 |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/editBatch") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:region:insert')") |
|||
public R<?> editBatch(@RequestBody @Valid BmsRegionBatchBo regionBo){ |
|||
for (BmsRegionBatchBo.BmsRegionBo bmsRegionBo : regionBo.getRegionList()) { |
|||
BmsRegion region = CopierUtil.copy(bmsRegionBo,new BmsRegion()); |
|||
if(region.getId()==null){ |
|||
region.setId(IdUtil.getSnowFlakeId()+""); |
|||
bmsRegionService.save(region); |
|||
}else { |
|||
BmsRegion dbRegion = bmsRegionService.getById(region.getId()); |
|||
if(dbRegion==null){ |
|||
bmsRegionService.save(region); |
|||
}else { |
|||
bmsRegionService.updateById(region); |
|||
} |
|||
} |
|||
} |
|||
bmsRegionService.flushAllLevel(); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除区域档案 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:region:delete')") |
|||
public R<?> deleteById(@PathVariable("id") String id){ |
|||
boolean result = bmsRegionService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,103 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 供应商 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/supplier") |
|||
public class BmsSupplierController { |
|||
|
|||
private BmsSupplierService bmsSupplierService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:supplier:query')") |
|||
public R<PageVo<BmsSupplier>> getPage(BmsSupplier param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsSupplier> supplierWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsSupplier> list = bmsSupplierService.list(supplierWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:supplier:query')") |
|||
public R<BmsSupplier> getById(@PathVariable("id") String id){ |
|||
BmsSupplier bmsSupplier = bmsSupplierService.getById(id); |
|||
return R.ok(bmsSupplier); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSupplier param){ |
|||
boolean result = bmsSupplierService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增供应商 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:supplier:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsSupplier param){ |
|||
boolean result = bmsSupplierService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除供应商 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:supplier:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
bmsSupplierService.removeById(id); |
|||
return R.ok(); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,77 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 区域档案 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_region") |
|||
public class BmsRegion implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
private String id; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 编码 */ |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级ID */ |
|||
@Length(max = 32,message = "父级ID长度不能超过32字") |
|||
private String pid; |
|||
|
|||
/** 层级 */ |
|||
private Integer level; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,77 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 供应商 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_supplier") |
|||
public class BmsSupplier implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 一级区域ID */ |
|||
@NotNull(message = "一级区域ID不能为空") |
|||
private Long regionFirst; |
|||
|
|||
/** 二级区域ID */ |
|||
private Long regionSecond; |
|||
|
|||
/** 三级区域ID */ |
|||
private Long regionThird; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,34 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/10 |
|||
*/ |
|||
@Data |
|||
public class BmsRegionBatchBo { |
|||
|
|||
private List<BmsRegionBo> regionList; |
|||
|
|||
@Data |
|||
public static class BmsRegionBo{ |
|||
/** id */ |
|||
private String id; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 编码 */ |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级ID */ |
|||
@Length(max = 32,message = "父级ID长度不能超过32字") |
|||
private String pid; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/10 |
|||
*/ |
|||
@Data |
|||
public class BmsRegionTreeVo extends TreeNode { |
|||
|
|||
/** id */ |
|||
private String id; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 编码 */ |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级ID */ |
|||
@Length(max = 32,message = "父级ID长度不能超过32字") |
|||
private String pid; |
|||
|
|||
/** 层级 */ |
|||
private Integer level; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
|
|||
/** |
|||
* 区域档案 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-10 |
|||
*/ |
|||
public interface BmsRegionMapper extends BaseMapper<BmsRegion> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
|
|||
/** |
|||
* 供应商 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-10 |
|||
*/ |
|||
public interface BmsSupplierMapper extends BaseMapper<BmsSupplier> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,25 @@ |
|||
package com.qs.serve.modules.bms.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 区域档案 服务接口 |
|||
* @author YenHex |
|||
* @date 2022-10-10 |
|||
*/ |
|||
public interface BmsRegionService extends IService<BmsRegion> { |
|||
|
|||
List<BmsRegionTreeVo> getTree(BmsRegion param); |
|||
|
|||
void flushLevel(BmsRegion param); |
|||
|
|||
void flushAllLevel(); |
|||
|
|||
void updateLevel(String id,Integer level); |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
|
|||
/** |
|||
* 供应商 服务接口 |
|||
* @author YenHex |
|||
* @date 2022-10-10 |
|||
*/ |
|||
public interface BmsSupplierService extends IService<BmsSupplier> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,92 @@ |
|||
package com.qs.serve.modules.bms.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import com.qs.serve.common.util.*; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.service.BmsRegionService; |
|||
import com.qs.serve.modules.bms.mapper.BmsRegionMapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 区域档案 服务实现类 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BmsRegionServiceImpl extends ServiceImpl<BmsRegionMapper,BmsRegion> implements BmsRegionService { |
|||
|
|||
@Override |
|||
public List<BmsRegionTreeVo> getTree(BmsRegion param) { |
|||
LambdaQueryWrapper<BmsRegion> regionWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsRegion> list = this.list(regionWrapper); |
|||
List<BmsRegionTreeVo> treeVoList = list.stream().map(region->{ |
|||
BmsRegionTreeVo treeNode = CopierUtil.copy(region,new BmsRegionTreeVo()); |
|||
treeNode.setId(region.getId()); |
|||
treeNode.setParentId(region.getPid()); |
|||
treeNode.setSort(0); |
|||
return treeNode; |
|||
}).collect(Collectors.toList()); |
|||
return TreeUtil.buildByRecursive(treeVoList,TreeUtil.DEFAULT_PID_STRING); |
|||
} |
|||
|
|||
@Override |
|||
public void flushLevel(BmsRegion param) { |
|||
if(StringUtils.hasText(param.getPid())){ |
|||
BmsRegion parent = this.getById(param.getPid()); |
|||
if(parent!=null){ |
|||
if(parent.getLevel()>2){ |
|||
Assert.throwEx("最高支持3层级"); |
|||
} |
|||
param.setLevel(parent.getLevel()+1); |
|||
}else { |
|||
param.setPid(null); |
|||
param.setLevel(1); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void flushAllLevel() { |
|||
List<BmsRegionTreeVo> treeVoList = this.getTree(new BmsRegion()); |
|||
for (BmsRegionTreeVo firstTree : treeVoList) { |
|||
if(firstTree.getLevel()==null||firstTree.getLevel()!=1){ |
|||
this.updateLevel(firstTree.getId(),1); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(firstTree.getChildren())){ |
|||
for (TreeNode secondTreeNode : firstTree.getChildren()) { |
|||
BmsRegionTreeVo secondTree = (BmsRegionTreeVo)secondTreeNode; |
|||
if(secondTree.getLevel()==null||secondTree.getLevel()!=2){ |
|||
this.updateLevel(secondTree.getId(),2); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(secondTree.getChildren())){ |
|||
for (TreeNode thirdTreeNode : secondTree.getChildren()) { |
|||
BmsRegionTreeVo thirdTree = (BmsRegionTreeVo)thirdTreeNode; |
|||
if(thirdTree.getLevel()==null||thirdTree.getLevel()!=3){ |
|||
this.updateLevel(thirdTree.getId(),3); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void updateLevel(String id, Integer level) { |
|||
BmsRegion param = new BmsRegion(); |
|||
param.setId(id); |
|||
param.setLevel(level); |
|||
this.updateById(param); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.bms.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import com.qs.serve.modules.bms.mapper.BmsSupplierMapper; |
|||
|
|||
/** |
|||
* 供应商 服务实现类 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BmsSupplierServiceImpl extends ServiceImpl<BmsSupplierMapper,BmsSupplier> implements BmsSupplierService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,103 @@ |
|||
package com.qs.serve.modules.goods.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.goods.entity.GoodsBrand; |
|||
import com.qs.serve.modules.goods.service.GoodsBrandService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 商品 品牌 后台接口 |
|||
* @author YenHex |
|||
* @since 2022-10-11 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("goods/brand") |
|||
public class GoodsBrandController { |
|||
|
|||
private GoodsBrandService goodsBrandService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('goods:brand:query')") |
|||
public R<PageVo<GoodsBrand>> getPage(GoodsBrand param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<GoodsBrand> brandWrapper = new LambdaQueryWrapper<>(param); |
|||
List<GoodsBrand> list = goodsBrandService.list(brandWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.GOODS, title = "品牌", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('goods:brand:query')") |
|||
public R<GoodsBrand> getById(@PathVariable("id") String id){ |
|||
GoodsBrand goodsBrand = goodsBrandService.getById(id); |
|||
return R.ok(goodsBrand); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.GOODS, title = "品牌", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('goods:brand:update')") |
|||
public R<?> updateById(@RequestBody @Valid GoodsBrand param){ |
|||
boolean result = goodsBrandService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增品牌 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.GOODS, title = "品牌", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('goods:brand:insert')") |
|||
public R<?> save(@RequestBody @Valid GoodsBrand param){ |
|||
boolean result = goodsBrandService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除品牌 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.GOODS, title = "品牌", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('goods:brand:delete')") |
|||
public R<?> deleteById(@PathVariable("id") String id){ |
|||
boolean result = goodsBrandService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,103 @@ |
|||
package com.qs.serve.modules.goods.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.goods.entity.GoodsSeries; |
|||
import com.qs.serve.modules.goods.service.GoodsSeriesService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 商品 系列 后台接口 |
|||
* @author YenHex |
|||
* @since 2022-10-11 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("goods/series") |
|||
public class GoodsSeriesController { |
|||
|
|||
private GoodsSeriesService goodsSeriesService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('goods:series:query')") |
|||
public R<PageVo<GoodsSeries>> getPage(GoodsSeries param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<GoodsSeries> seriesWrapper = new LambdaQueryWrapper<>(param); |
|||
List<GoodsSeries> list = goodsSeriesService.list(seriesWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.GOODS, title = "系列", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('goods:series:query')") |
|||
public R<GoodsSeries> getById(@PathVariable("id") String id){ |
|||
GoodsSeries goodsSeries = goodsSeriesService.getById(id); |
|||
return R.ok(goodsSeries); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.GOODS, title = "系列", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('goods:series:update')") |
|||
public R<?> updateById(@RequestBody @Valid GoodsSeries param){ |
|||
boolean result = goodsSeriesService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增系列 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.GOODS, title = "系列", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('goods:series:insert')") |
|||
public R<?> save(@RequestBody @Valid GoodsSeries param){ |
|||
boolean result = goodsSeriesService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除系列 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.GOODS, title = "系列", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('goods:series:delete')") |
|||
public R<?> deleteById(@PathVariable("id") String id){ |
|||
boolean result = goodsSeriesService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,83 @@ |
|||
package com.qs.serve.modules.goods.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 品牌 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-11 |
|||
*/ |
|||
@Data |
|||
@TableName("goods_brand") |
|||
public class GoodsBrand implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** PK */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 编码 */ |
|||
@NotBlank(message = "编码不能为空") |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 16,message = "名称长度不能超过16字") |
|||
private String name; |
|||
|
|||
/** 描述 */ |
|||
@Length(max = 255,message = "描述长度不能超过255字") |
|||
private String description; |
|||
|
|||
/** 图片 */ |
|||
@Length(max = 255,message = "图片长度不能超过255字") |
|||
private String picUrl; |
|||
|
|||
/** 排序 */ |
|||
private Integer sort; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
} |
|||
|
@ -0,0 +1,83 @@ |
|||
package com.qs.serve.modules.goods.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 系列 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-11 |
|||
*/ |
|||
@Data |
|||
@TableName("goods_series") |
|||
public class GoodsSeries implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** PK */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 编码 */ |
|||
@NotBlank(message = "编码不能为空") |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 16,message = "名称长度不能超过16字") |
|||
private String name; |
|||
|
|||
/** 描述 */ |
|||
@Length(max = 255,message = "描述长度不能超过255字") |
|||
private String description; |
|||
|
|||
/** 图片 */ |
|||
@Length(max = 255,message = "图片长度不能超过255字") |
|||
private String picUrl; |
|||
|
|||
/** 排序 */ |
|||
private Integer sort; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
} |
|||
|
@ -0,0 +1,39 @@ |
|||
package com.qs.serve.modules.goods.entity.bo; |
|||
|
|||
import com.qs.serve.modules.goods.entity.GoodsSku; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/11 |
|||
*/ |
|||
public class GoodSkuInfoVo { |
|||
|
|||
private List<GoodsSku> skuList; |
|||
|
|||
|
|||
|
|||
//规格列表
|
|||
public static class SpecInfo{ |
|||
Integer sort; |
|||
String specName; |
|||
List<SpecValue> specValues; |
|||
} |
|||
|
|||
public static class SpecValue{ |
|||
String specValueId; |
|||
String specValue; |
|||
} |
|||
|
|||
public static class SkuVo{ |
|||
//....
|
|||
|
|||
List<SkuComboValue> skuSpecValueInfos; |
|||
} |
|||
|
|||
public static class SkuComboValue{ |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
package com.qs.serve.modules.goods.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/10 |
|||
*/ |
|||
@Data |
|||
public class GoodsCategoryTreeVo extends TreeNode { |
|||
|
|||
/** PK */ |
|||
@TableId(type = IdType.AUTO) |
|||
private String id; |
|||
|
|||
/** (1:开启;0:关闭) */ |
|||
@NotBlank(message = "(1:开启;0:关闭)不能为空") |
|||
@Length(max = 2,message = "(1:开启;0:关闭)长度不能超过2字") |
|||
private String enable; |
|||
|
|||
@NotBlank(message = "编码不能为空") |
|||
private String code; |
|||
|
|||
/** 父分类编号 */ |
|||
@Length(max = 32,message = "父分类编号长度不能超过32字") |
|||
private String parentId; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 16,message = "名称长度不能超过16字") |
|||
private String name; |
|||
|
|||
/** 描述 */ |
|||
@Length(max = 255,message = "描述长度不能超过255字") |
|||
private String description; |
|||
|
|||
/** 图片 */ |
|||
@Length(max = 255,message = "图片长度不能超过255字") |
|||
private String picUrl; |
|||
|
|||
/** 排序 */ |
|||
private Integer sort; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.qs.serve.modules.goods.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/10 |
|||
*/ |
|||
@Data |
|||
public class GoodsSpuBatchTasteBo { |
|||
|
|||
/** 口味商品数据列表 */ |
|||
@NotNull |
|||
List<GoodsSpuTasteBo> tasteProducts; |
|||
|
|||
} |
@ -0,0 +1,76 @@ |
|||
package com.qs.serve.modules.goods.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 口味品类 |
|||
* @author YenHex |
|||
* @since 2022/10/10 |
|||
*/ |
|||
@Data |
|||
public class GoodsSpuTasteBo { |
|||
|
|||
/** 商品编码 */ |
|||
@NotBlank(message = "商品编码不能为空") |
|||
@Length(max = 32,message = "商品编码长度不能超过32字") |
|||
private String productCode; |
|||
|
|||
/** 存货编码 */ |
|||
@NotBlank(message = "SKU编码不能为空") |
|||
@Length(max = 32,message = "商品编码长度不能超过32字") |
|||
private String invCode; |
|||
|
|||
/** 商品名字 */ |
|||
@NotBlank(message = "商品名字不能为空") |
|||
@Length(max = 200,message = "商品名字长度不能超过200字") |
|||
private String name; |
|||
|
|||
/** 分类编码 */ |
|||
@NotNull(message = "分类编码不能为空") |
|||
private String categoryCode; |
|||
|
|||
/** 品牌编码 */ |
|||
private String brandCode; |
|||
|
|||
/** 系列编码 */ |
|||
private String seriesCode; |
|||
|
|||
/** 商品组图片 */ |
|||
private String[] picUrls; |
|||
|
|||
/** 存货商品图片 */ |
|||
private String invPicUrl; |
|||
|
|||
/** 味道 */ |
|||
@NotNull(message = "味道不能为空") |
|||
private String tasteValue; |
|||
|
|||
/** 包装 */ |
|||
@NotNull(message = "包装不能为空") |
|||
private String packValue; |
|||
|
|||
/** 产品口味 */ |
|||
private String productTasteValue; |
|||
|
|||
/** 销售价格 */ |
|||
@NotNull(message = "销售价格不能为空") |
|||
private BigDecimal salesPrice; |
|||
|
|||
/** 市场价 */ |
|||
@NotNull(message = "市场价不能为空") |
|||
private BigDecimal marketPrice; |
|||
|
|||
/** 重量(kg) */ |
|||
@NotNull(message = "重量(kg)不能为空") |
|||
private BigDecimal weight; |
|||
|
|||
/** 体积(m³) */ |
|||
@NotNull(message = "体积(m³)不能为空") |
|||
private BigDecimal volume; |
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package com.qs.serve.modules.goods.entity.dto; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/11 |
|||
*/ |
|||
public class GoodSkuSpecValueDto { |
|||
|
|||
Integer sort; |
|||
Long specValueId; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.goods.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.goods.entity.GoodsBrand; |
|||
|
|||
/** |
|||
* 品牌 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-11 |
|||
*/ |
|||
public interface GoodsBrandMapper extends BaseMapper<GoodsBrand> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.goods.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.goods.entity.GoodsSeries; |
|||
|
|||
/** |
|||
* 系列 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-11 |
|||
*/ |
|||
public interface GoodsSeriesMapper extends BaseMapper<GoodsSeries> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.goods.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.goods.entity.GoodsBrand; |
|||
|
|||
/** |
|||
* 品牌 服务接口 |
|||
* @author YenHex |
|||
* @date 2022-10-11 |
|||
*/ |
|||
public interface GoodsBrandService extends IService<GoodsBrand> { |
|||
GoodsBrand getByCode(String code); |
|||
} |
|||
|
@ -0,0 +1,16 @@ |
|||
package com.qs.serve.modules.goods.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.goods.entity.GoodsSeries; |
|||
|
|||
/** |
|||
* 系列 服务接口 |
|||
* @author YenHex |
|||
* @date 2022-10-11 |
|||
*/ |
|||
public interface GoodsSeriesService extends IService<GoodsSeries> { |
|||
|
|||
GoodsSeries getByCode(String code); |
|||
|
|||
} |
|||
|
@ -0,0 +1,30 @@ |
|||
package com.qs.serve.modules.goods.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.qs.serve.modules.goods.entity.GoodsSeries; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.goods.entity.GoodsBrand; |
|||
import com.qs.serve.modules.goods.service.GoodsBrandService; |
|||
import com.qs.serve.modules.goods.mapper.GoodsBrandMapper; |
|||
|
|||
/** |
|||
* 品牌 服务实现类 |
|||
* @author YenHex |
|||
* @since 2022-10-11 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class GoodsBrandServiceImpl extends ServiceImpl<GoodsBrandMapper,GoodsBrand> implements GoodsBrandService { |
|||
|
|||
@Override |
|||
public GoodsBrand getByCode(String code) { |
|||
LambdaQueryWrapper<GoodsBrand> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(GoodsBrand::getCode,code); |
|||
return getOne(lqw,false); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,30 @@ |
|||
package com.qs.serve.modules.goods.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.qs.serve.modules.goods.entity.GoodsSpu; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.goods.entity.GoodsSeries; |
|||
import com.qs.serve.modules.goods.service.GoodsSeriesService; |
|||
import com.qs.serve.modules.goods.mapper.GoodsSeriesMapper; |
|||
|
|||
/** |
|||
* 系列 服务实现类 |
|||
* @author YenHex |
|||
* @since 2022-10-11 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class GoodsSeriesServiceImpl extends ServiceImpl<GoodsSeriesMapper,GoodsSeries> implements GoodsSeriesService { |
|||
|
|||
@Override |
|||
public GoodsSeries getByCode(String code) { |
|||
LambdaQueryWrapper<GoodsSeries> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(GoodsSeries::getCode,code); |
|||
return getOne(lqw,false); |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue