Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
a77c829287
|
|
@ -1,7 +1,7 @@
|
||||||
package cn.ysk.cashier.controller.product;
|
package cn.ysk.cashier.controller.product;
|
||||||
|
|
||||||
import cn.ysk.cashier.dto.product.PadProductGroupDTO;
|
import cn.ysk.cashier.dto.product.PadProductCategoryDTO;
|
||||||
import cn.ysk.cashier.mybatis.service.TbPadProductGroupService;
|
import cn.ysk.cashier.mybatis.service.TbPadProductCategoryService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
@ -12,64 +12,64 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pad商品自定义分组
|
* Pad商品自定义分类
|
||||||
* @author tankaikai
|
* @author tankaikai
|
||||||
* @since 2024-10-22 16:38
|
* @since 2024-10-22 16:38
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/pad/productGroup")
|
@RequestMapping("/api/pad/productCategory")
|
||||||
@Api(tags="Pad商品自定义分组")
|
@Api(tags="Pad商品自定义分类")
|
||||||
public class TbPadProductGroupController {
|
public class TbPadProductCategoryController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TbPadProductGroupService mpPadProductGroupService;
|
private TbPadProductCategoryService mpPadProductCategoryService;
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@ApiOperation("分页")
|
@ApiOperation("分页")
|
||||||
public ResponseEntity page(@RequestParam Map<String, Object> params) {
|
public ResponseEntity page(@RequestParam Map<String, Object> params) {
|
||||||
Map<String, Object> page = mpPadProductGroupService.findPage(params);
|
Map<String, Object> page = mpPadProductCategoryService.findPage(params);
|
||||||
return ResponseEntity.ok().body(page);
|
return ResponseEntity.ok().body(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@ApiOperation("详情")
|
@ApiOperation("详情")
|
||||||
public ResponseEntity get(@PathVariable("id") Long id) {
|
public ResponseEntity get(@PathVariable("id") Long id) {
|
||||||
PadProductGroupDTO data = mpPadProductGroupService.get(id);
|
PadProductCategoryDTO data = mpPadProductCategoryService.get(id);
|
||||||
return ResponseEntity.ok().body(data);
|
return ResponseEntity.ok().body(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
public ResponseEntity save(@RequestBody PadProductGroupDTO dto) {
|
public ResponseEntity save(@RequestBody PadProductCategoryDTO dto) {
|
||||||
mpPadProductGroupService.save(dto);
|
mpPadProductCategoryService.save(dto);
|
||||||
return ResponseEntity.ok().body(dto.getId());
|
return ResponseEntity.ok().body(dto.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
public ResponseEntity update(@RequestBody PadProductGroupDTO dto) {
|
public ResponseEntity update(@RequestBody PadProductCategoryDTO dto) {
|
||||||
mpPadProductGroupService.update(dto);
|
mpPadProductCategoryService.update(dto);
|
||||||
return ResponseEntity.ok().body(dto.getId());
|
return ResponseEntity.ok().body(dto.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("{id}")
|
@DeleteMapping("{id}")
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
public ResponseEntity delete(@PathVariable("id") Long id) {
|
public ResponseEntity delete(@PathVariable("id") Long id) {
|
||||||
mpPadProductGroupService.delete(id);
|
mpPadProductCategoryService.delete(id);
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("sort")
|
@PostMapping("sort")
|
||||||
@ApiOperation("排序")
|
@ApiOperation("排序")
|
||||||
public ResponseEntity sort(@RequestBody List<PadProductGroupDTO> sortList) {
|
public ResponseEntity sort(@RequestBody List<PadProductCategoryDTO> sortList) {
|
||||||
mpPadProductGroupService.sort(sortList);
|
mpPadProductCategoryService.sort(sortList);
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("copy/{id}")
|
@PostMapping("copy/{id}")
|
||||||
@ApiOperation("复制")
|
@ApiOperation("复制")
|
||||||
public ResponseEntity copy(@PathVariable("id") Long id) {
|
public ResponseEntity copy(@PathVariable("id") Long id) {
|
||||||
mpPadProductGroupService.copy(id);
|
mpPadProductCategoryService.copy(id);
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9,13 +9,13 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pad商品自定义分组
|
* Pad商品自定义分类
|
||||||
*
|
*
|
||||||
* @author tankaikai
|
* @author tankaikai
|
||||||
* @since 2024-10-22 17:07
|
* @since 2024-10-22 17:07
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class PadProductGroupDTO implements Serializable {
|
public class PadProductCategoryDTO implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -34,7 +34,7 @@ public class PadProductGroupDTO implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 商品分类id
|
* 商品分类id
|
||||||
*/
|
*/
|
||||||
private Long productGroupId;
|
private Long productCategoryId;
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
|
@ -72,9 +72,9 @@ public class PadProductGroupDTO implements Serializable {
|
||||||
private String padLayoutName;
|
private String padLayoutName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 布局类型
|
* 分类名称
|
||||||
*/
|
*/
|
||||||
private String productGroupName;
|
private String productCategoryName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品id列表
|
* 商品id列表
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package cn.ysk.cashier.mybatis.mapper;
|
package cn.ysk.cashier.mybatis.mapper;
|
||||||
|
|
||||||
import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail;
|
import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pad商品自定义分组明细
|
* Pad商品自定义分类明细
|
||||||
*
|
*
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
* @since 2.0 2024-10-22
|
* @since 2.0 2024-10-22
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TbPadProductGroupDetailMapper extends BaseMapper<TbPadProductGroupDetail> {
|
public interface TbPadProductCategoryDetailMapper extends BaseMapper<TbPadProductCategoryDetail> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.ysk.cashier.mybatis.mapper;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.dto.product.PadProductCategoryDTO;
|
||||||
|
import cn.ysk.cashier.pojo.product.TbPadProductCategory;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pad商品自定义分类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 2.0 2024-10-22
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TbPadProductCategoryMapper extends BaseMapper<TbPadProductCategory> {
|
||||||
|
|
||||||
|
List<PadProductCategoryDTO> findList(Map<String, Object> params);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package cn.ysk.cashier.mybatis.mapper;
|
|
||||||
|
|
||||||
import cn.ysk.cashier.dto.product.PadProductGroupDTO;
|
|
||||||
import cn.ysk.cashier.pojo.product.TbPadProductGroup;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pad商品自定义分组
|
|
||||||
*
|
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
|
||||||
* @since 2.0 2024-10-22
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface TbPadProductGroupMapper extends BaseMapper<TbPadProductGroup> {
|
|
||||||
|
|
||||||
List<PadProductGroupDTO> findList(Map<String, Object> params);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package cn.ysk.cashier.mybatis.service;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pad商品自定义分类明细
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 2.0 2024-10-22
|
||||||
|
*/
|
||||||
|
public interface TbPadProductCategoryDetailService extends IService<TbPadProductCategoryDetail> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package cn.ysk.cashier.mybatis.service;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.dto.product.PadProductCategoryDTO;
|
||||||
|
import cn.ysk.cashier.pojo.product.TbPadProductCategory;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pad商品自定义分类
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 2.0 2024-10-22
|
||||||
|
*/
|
||||||
|
public interface TbPadProductCategoryService extends IService<TbPadProductCategory> {
|
||||||
|
|
||||||
|
Map<String,Object> findPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
PadProductCategoryDTO get(Long id);
|
||||||
|
|
||||||
|
void save(PadProductCategoryDTO dto);
|
||||||
|
|
||||||
|
void update(PadProductCategoryDTO dto);
|
||||||
|
|
||||||
|
void sort(List<PadProductCategoryDTO> sortList);
|
||||||
|
|
||||||
|
void delete(Long id);
|
||||||
|
|
||||||
|
void copy(Long id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
package cn.ysk.cashier.mybatis.service;
|
|
||||||
|
|
||||||
import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pad商品自定义分组明细
|
|
||||||
*
|
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
|
||||||
* @since 2.0 2024-10-22
|
|
||||||
*/
|
|
||||||
public interface TbPadProductGroupDetailService extends IService<TbPadProductGroupDetail> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
package cn.ysk.cashier.mybatis.service;
|
|
||||||
|
|
||||||
import cn.ysk.cashier.dto.product.PadProductGroupDTO;
|
|
||||||
import cn.ysk.cashier.pojo.product.TbPadProductGroup;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pad商品自定义分组
|
|
||||||
*
|
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
|
||||||
* @since 2.0 2024-10-22
|
|
||||||
*/
|
|
||||||
public interface TbPadProductGroupService extends IService<TbPadProductGroup> {
|
|
||||||
|
|
||||||
Map<String,Object> findPage(Map<String, Object> params);
|
|
||||||
|
|
||||||
PadProductGroupDTO get(Long id);
|
|
||||||
|
|
||||||
void save(PadProductGroupDTO dto);
|
|
||||||
|
|
||||||
void update(PadProductGroupDTO dto);
|
|
||||||
|
|
||||||
void sort(List<PadProductGroupDTO> sortList);
|
|
||||||
|
|
||||||
void delete(Long id);
|
|
||||||
|
|
||||||
void copy(Long id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.ysk.cashier.mybatis.service.impl;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryDetailMapper;
|
||||||
|
import cn.ysk.cashier.mybatis.service.TbPadProductCategoryDetailService;
|
||||||
|
import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pad商品自定义分类明细
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 2.0 2024-10-22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TbPadProductCategoryDetailServiceImpl extends ServiceImpl<TbPadProductCategoryDetailMapper, TbPadProductCategoryDetail> implements TbPadProductCategoryDetailService {
|
||||||
|
|
||||||
|
public QueryWrapper<TbPadProductCategoryDetail> getWrapper(Map<String, Object> params){
|
||||||
|
QueryWrapper<TbPadProductCategoryDetail> wrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
wrapper.orderByDesc("id");
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,16 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.map.MapProxy;
|
import cn.hutool.core.map.MapProxy;
|
||||||
import cn.ysk.cashier.dto.product.PadProductGroupDTO;
|
import cn.ysk.cashier.dto.product.PadProductCategoryDTO;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbPadLayoutMapper;
|
import cn.ysk.cashier.mybatis.mapper.TbPadLayoutMapper;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupDetailMapper;
|
import cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryDetailMapper;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupMapper;
|
import cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryMapper;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbProductMapper;
|
import cn.ysk.cashier.mybatis.mapper.TbProductMapper;
|
||||||
import cn.ysk.cashier.mybatis.service.TbPadProductGroupService;
|
import cn.ysk.cashier.mybatis.service.TbPadProductCategoryService;
|
||||||
import cn.ysk.cashier.pojo.product.TbPadLayout;
|
import cn.ysk.cashier.pojo.product.TbPadLayout;
|
||||||
import cn.ysk.cashier.pojo.product.TbPadProductGroup;
|
import cn.ysk.cashier.pojo.product.TbPadProductCategory;
|
||||||
import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail;
|
import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail;
|
||||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||||
import cn.ysk.cashier.utils.PageUtil;
|
import cn.ysk.cashier.utils.PageUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
|
|
@ -31,19 +31,19 @@ import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pad商品自定义分组
|
* Pad商品自定义分类
|
||||||
*
|
*
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
* @since 2.0 2024-10-22
|
* @since 2.0 2024-10-22
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupMapper, TbPadProductGroup> implements TbPadProductGroupService {
|
public class TbPadProductCategoryServiceImpl extends ServiceImpl<TbPadProductCategoryMapper, TbPadProductCategory> implements TbPadProductCategoryService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TbPadLayoutMapper tbPadLayoutMapper;
|
private TbPadLayoutMapper tbPadLayoutMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TbPadProductGroupDetailMapper tbPadProductGroupDetailMapper;
|
private TbPadProductCategoryDetailMapper tbPadProductCategoryDetailMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TbProductMapper tbProductMapper;
|
private TbProductMapper tbProductMapper;
|
||||||
|
|
||||||
|
|
@ -52,16 +52,16 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupM
|
||||||
MapProxy mapProxy = MapProxy.create(params);
|
MapProxy mapProxy = MapProxy.create(params);
|
||||||
int pageNum = mapProxy.getInt("page", 1);
|
int pageNum = mapProxy.getInt("page", 1);
|
||||||
int pageSize = mapProxy.getInt("size", 10);
|
int pageSize = mapProxy.getInt("size", 10);
|
||||||
Page<PadProductGroupDTO> page = new Page<>(pageNum, pageSize);
|
Page<PadProductCategoryDTO> page = new Page<>(pageNum, pageSize);
|
||||||
page.addOrder(OrderItem.asc("sort"));
|
page.addOrder(OrderItem.asc("sort"));
|
||||||
params.put("page", page);
|
params.put("page", page);
|
||||||
List<PadProductGroupDTO> list = baseMapper.findList(params);
|
List<PadProductCategoryDTO> list = baseMapper.findList(params);
|
||||||
return PageUtil.toPlusPage(list, Convert.toInt(page.getTotal()));
|
return PageUtil.toPlusPage(list, Convert.toInt(page.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PadProductGroupDTO get(Long id) {
|
public PadProductCategoryDTO get(Long id) {
|
||||||
TbPadProductGroup entity = baseMapper.selectById(id);
|
TbPadProductCategory entity = baseMapper.selectById(id);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new BadRequestException("id对应的数据不存在");
|
throw new BadRequestException("id对应的数据不存在");
|
||||||
}
|
}
|
||||||
|
|
@ -72,14 +72,14 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupM
|
||||||
Map<String,Object> params = new HashMap<>(2);
|
Map<String,Object> params = new HashMap<>(2);
|
||||||
params.put("id", id);
|
params.put("id", id);
|
||||||
params.put("shopId", entity.getShopId());
|
params.put("shopId", entity.getShopId());
|
||||||
List<PadProductGroupDTO> list = baseMapper.findList(params);
|
List<PadProductCategoryDTO> list = baseMapper.findList(params);
|
||||||
PadProductGroupDTO dto = list.get(0);
|
PadProductCategoryDTO dto = list.get(0);
|
||||||
if(entity.getProductGroupId().longValue() == 0L){
|
if(entity.getProductCategoryId().longValue() == 0L){
|
||||||
dto.setProductGroupName("推荐菜");
|
dto.setProductCategoryName("推荐菜");
|
||||||
}
|
}
|
||||||
List<TbPadProductGroupDetail> subList = tbPadProductGroupDetailMapper.selectList(Wrappers.<TbPadProductGroupDetail>lambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, entity.getId()));
|
List<TbPadProductCategoryDetail> subList = tbPadProductCategoryDetailMapper.selectList(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId()));
|
||||||
if(CollUtil.isNotEmpty(subList)){
|
if(CollUtil.isNotEmpty(subList)){
|
||||||
List<Long> productIdList = subList.stream().map(TbPadProductGroupDetail::getProductId).collect(Collectors.toList());
|
List<Long> productIdList = subList.stream().map(TbPadProductCategoryDetail::getProductId).collect(Collectors.toList());
|
||||||
dto.setProductIdList(productIdList);
|
dto.setProductIdList(productIdList);
|
||||||
List<List<Long>> splitIdList = CollUtil.split(productIdList, 10);
|
List<List<Long>> splitIdList = CollUtil.split(productIdList, 10);
|
||||||
List<TbProduct> productList = dto.getProductList();
|
List<TbProduct> productList = dto.getProductList();
|
||||||
|
|
@ -94,14 +94,14 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupM
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void save(PadProductGroupDTO dto) {
|
public void save(PadProductCategoryDTO dto) {
|
||||||
Long padLayoutId = dto.getPadLayoutId();
|
Long padLayoutId = dto.getPadLayoutId();
|
||||||
if (padLayoutId == null) {
|
if (padLayoutId == null) {
|
||||||
throw new BadRequestException("布局版式id不能为空");
|
throw new BadRequestException("布局版式id不能为空");
|
||||||
}
|
}
|
||||||
Long productGroupId = dto.getProductGroupId();
|
Long productCategoryId = dto.getProductCategoryId();
|
||||||
if (productGroupId == null) {
|
if (productCategoryId == null) {
|
||||||
throw new BadRequestException("商品分组不能为空");
|
throw new BadRequestException("商品分类不能为空");
|
||||||
}
|
}
|
||||||
Long shopId = dto.getShopId();
|
Long shopId = dto.getShopId();
|
||||||
if (shopId == null) {
|
if (shopId == null) {
|
||||||
|
|
@ -129,23 +129,23 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupM
|
||||||
if (productIdList.size() > maximum.intValue()) {
|
if (productIdList.size() > maximum.intValue()) {
|
||||||
throw new BadRequestException("商品数量不能超过布局版式最大限制:" + maximum.intValue());
|
throw new BadRequestException("商品数量不能超过布局版式最大限制:" + maximum.intValue());
|
||||||
}
|
}
|
||||||
TbPadProductGroup entity = new TbPadProductGroup();
|
TbPadProductCategory entity = new TbPadProductCategory();
|
||||||
BeanUtil.copyProperties(dto, entity);
|
BeanUtil.copyProperties(dto, entity);
|
||||||
entity.setCreateTime(new Date());
|
entity.setCreateTime(new Date());
|
||||||
super.save(entity);
|
super.save(entity);
|
||||||
for (Long productId : productIdList) {
|
for (Long productId : productIdList) {
|
||||||
TbPadProductGroupDetail subEntity = new TbPadProductGroupDetail();
|
TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail();
|
||||||
subEntity.setProductId(productId);
|
subEntity.setProductId(productId);
|
||||||
subEntity.setPadProductGroupId(entity.getId());
|
subEntity.setPadProductCategoryId(entity.getId());
|
||||||
subEntity.setCreateTime(new Date());
|
subEntity.setCreateTime(new Date());
|
||||||
tbPadProductGroupDetailMapper.insert(subEntity);
|
tbPadProductCategoryDetailMapper.insert(subEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(PadProductGroupDTO dto) {
|
public void update(PadProductCategoryDTO dto) {
|
||||||
Long id = dto.getId();
|
Long id = dto.getId();
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw new BadRequestException("id不能为空");
|
throw new BadRequestException("id不能为空");
|
||||||
|
|
@ -154,9 +154,9 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupM
|
||||||
if (padLayoutId == null) {
|
if (padLayoutId == null) {
|
||||||
throw new BadRequestException("布局版式id不能为空");
|
throw new BadRequestException("布局版式id不能为空");
|
||||||
}
|
}
|
||||||
Long productGroupId = dto.getProductGroupId();
|
Long productCategoryId = dto.getProductCategoryId();
|
||||||
if (productGroupId == null) {
|
if (productCategoryId == null) {
|
||||||
throw new BadRequestException("商品分组不能为空");
|
throw new BadRequestException("商品分类不能为空");
|
||||||
}
|
}
|
||||||
Long shopId = dto.getShopId();
|
Long shopId = dto.getShopId();
|
||||||
if (shopId == null) {
|
if (shopId == null) {
|
||||||
|
|
@ -184,7 +184,7 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupM
|
||||||
if (productIdList.size() > maximum.intValue()) {
|
if (productIdList.size() > maximum.intValue()) {
|
||||||
throw new BadRequestException("商品数量不能超过布局版式最大限制:" + maximum.intValue());
|
throw new BadRequestException("商品数量不能超过布局版式最大限制:" + maximum.intValue());
|
||||||
}
|
}
|
||||||
TbPadProductGroup entity = baseMapper.selectById(id);
|
TbPadProductCategory entity = baseMapper.selectById(id);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new BadRequestException("id对应的数据不存在");
|
throw new BadRequestException("id对应的数据不存在");
|
||||||
}
|
}
|
||||||
|
|
@ -192,23 +192,23 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupM
|
||||||
entity.setUpdateTime(new Date());
|
entity.setUpdateTime(new Date());
|
||||||
super.updateById(entity);
|
super.updateById(entity);
|
||||||
for (Long productId : productIdList) {
|
for (Long productId : productIdList) {
|
||||||
tbPadProductGroupDetailMapper.delete(Wrappers.<TbPadProductGroupDetail>lambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, entity.getId()));
|
tbPadProductCategoryDetailMapper.delete(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId()));
|
||||||
TbPadProductGroupDetail subEntity = new TbPadProductGroupDetail();
|
TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail();
|
||||||
subEntity.setProductId(productId);
|
subEntity.setProductId(productId);
|
||||||
subEntity.setPadProductGroupId(entity.getId());
|
subEntity.setPadProductCategoryId(entity.getId());
|
||||||
subEntity.setCreateTime(new Date());
|
subEntity.setCreateTime(new Date());
|
||||||
tbPadProductGroupDetailMapper.insert(subEntity);
|
tbPadProductCategoryDetailMapper.insert(subEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void sort(List<PadProductGroupDTO> sortList) {
|
public void sort(List<PadProductCategoryDTO> sortList) {
|
||||||
if(CollUtil.isEmpty(sortList)) {
|
if(CollUtil.isEmpty(sortList)) {
|
||||||
throw new BadRequestException("排序列表不能为空");
|
throw new BadRequestException("排序列表不能为空");
|
||||||
}
|
}
|
||||||
for (PadProductGroupDTO dto : sortList) {
|
for (PadProductCategoryDTO dto : sortList) {
|
||||||
super.update(null, Wrappers.<TbPadProductGroup>lambdaUpdate().eq(TbPadProductGroup::getId, dto.getId()).set(TbPadProductGroup::getSort, dto.getSort()));
|
super.update(null, Wrappers.<TbPadProductCategory>lambdaUpdate().eq(TbPadProductCategory::getId, dto.getId()).set(TbPadProductCategory::getSort, dto.getSort()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,13 +216,13 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl<TbPadProductGroupM
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(Long id) {
|
public void delete(Long id) {
|
||||||
super.removeById(id);
|
super.removeById(id);
|
||||||
tbPadProductGroupDetailMapper.delete(Wrappers.<TbPadProductGroupDetail>lambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, id));
|
tbPadProductCategoryDetailMapper.delete(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void copy(Long id) {
|
public void copy(Long id) {
|
||||||
PadProductGroupDTO dto = get(id);
|
PadProductCategoryDTO dto = get(id);
|
||||||
dto.setId(null);
|
dto.setId(null);
|
||||||
dto.setCreateTime(null);
|
dto.setCreateTime(null);
|
||||||
dto.setUpdateTime(null);
|
dto.setUpdateTime(null);
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package cn.ysk.cashier.mybatis.service.impl;
|
|
||||||
|
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupDetailMapper;
|
|
||||||
import cn.ysk.cashier.mybatis.service.TbPadProductGroupDetailService;
|
|
||||||
import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pad商品自定义分组明细
|
|
||||||
*
|
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
|
||||||
* @since 2.0 2024-10-22
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class TbPadProductGroupDetailServiceImpl extends ServiceImpl<TbPadProductGroupDetailMapper, TbPadProductGroupDetail> implements TbPadProductGroupDetailService {
|
|
||||||
|
|
||||||
public QueryWrapper<TbPadProductGroupDetail> getWrapper(Map<String, Object> params){
|
|
||||||
QueryWrapper<TbPadProductGroupDetail> wrapper = new QueryWrapper<>();
|
|
||||||
|
|
||||||
wrapper.orderByDesc("id");
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -9,15 +9,15 @@ import lombok.EqualsAndHashCode;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pad商品自定义分组
|
* Pad商品自定义分类
|
||||||
*
|
*
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
* @since 2.0 2024-10-22
|
* @since 2.0 2024-10-22
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper=false)
|
||||||
@TableName("tb_pad_product_group")
|
@TableName("tb_pad_product_category")
|
||||||
public class TbPadProductGroup {
|
public class TbPadProductCategory {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -36,7 +36,7 @@ public class TbPadProductGroup {
|
||||||
/**
|
/**
|
||||||
* 商品分类id
|
* 商品分类id
|
||||||
*/
|
*/
|
||||||
private Long productGroupId;
|
private Long productCategoryId;
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,15 +9,15 @@ import lombok.EqualsAndHashCode;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pad商品自定义分组明细
|
* Pad商品自定义分类明细
|
||||||
*
|
*
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
* @since 2.0 2024-10-22
|
* @since 2.0 2024-10-22
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper=false)
|
||||||
@TableName("tb_pad_product_group_detail")
|
@TableName("tb_pad_product_category_detail")
|
||||||
public class TbPadProductGroupDetail {
|
public class TbPadProductCategoryDetail {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -26,9 +26,9 @@ public class TbPadProductGroupDetail {
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* Pad商品自定义分组id
|
* Pad商品自定义分类id
|
||||||
*/
|
*/
|
||||||
private Long padProductGroupId;
|
private Long padProductCategoryId;
|
||||||
/**
|
/**
|
||||||
* 商品id
|
* 商品id
|
||||||
*/
|
*/
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.ysk.cashier.mybatis.mapper.TbPadProductGroupMapper">
|
<mapper namespace="cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryMapper">
|
||||||
|
|
||||||
<select id="findList" resultType="cn.ysk.cashier.dto.product.PadProductGroupDTO">
|
<select id="findList" resultType="cn.ysk.cashier.dto.product.PadProductCategoryDTO">
|
||||||
SELECT
|
SELECT
|
||||||
t1.*,
|
t1.*,
|
||||||
t3.name as productGroupName,
|
t3.name as productCategoryName,
|
||||||
GROUP_CONCAT(t4.name) as productNames,
|
GROUP_CONCAT(t4.name) as productNames,
|
||||||
t5.code as padLayoutCode,
|
t5.code as padLayoutCode,
|
||||||
t5.name as padLayoutName
|
t5.name as padLayoutName
|
||||||
FROM
|
FROM
|
||||||
tb_pad_product_group t1
|
tb_pad_product_category t1
|
||||||
LEFT JOIN tb_pad_product_group_detail t2 on t1.id = t2.pad_product_group_id
|
LEFT JOIN tb_pad_product_category_detail t2 on t1.id = t2.pad_product_category_id
|
||||||
LEFT JOIN tb_product_group t3 on t1.product_group_id = t3.id
|
LEFT JOIN tb_shop_category t3 on t1.product_category_id = t3.id
|
||||||
LEFT JOIN tb_product t4 on t2.product_id = t4.id
|
LEFT JOIN tb_product t4 on t2.product_id = t4.id
|
||||||
LEFT JOIN tb_pad_layout t5 on t1.pad_layout_id = t5.id
|
LEFT JOIN tb_pad_layout t5 on t1.pad_layout_id = t5.id
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
<if test="customName != null and customName != ''">
|
<if test="customName != null and customName != ''">
|
||||||
and t1.custom_name like concat(#{customName},'%')
|
and t1.custom_name like concat(#{customName},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="productGroupId != null and productGroupId != ''">
|
<if test="productCategoryId != null and productCategoryId != ''">
|
||||||
and t1.product_group_id = #{productGroupId}
|
and t1.product_category_id = #{productCategoryId}
|
||||||
</if>
|
</if>
|
||||||
<if test="padLayoutId != null and padLayoutId != ''">
|
<if test="padLayoutId != null and padLayoutId != ''">
|
||||||
and t1.pad_layout_id = #{padLayoutId}
|
and t1.pad_layout_id = #{padLayoutId}
|
||||||
Loading…
Reference in New Issue