master:app查询时分类接口调整;
parent
0468bb45c2
commit
0719d7a23b
|
|
@ -79,6 +79,12 @@ public class SysProductCategoryController extends XktBaseController {
|
|||
return R.ok(BeanUtil.copyToList(prodCateService.selectList(BeanUtil.toBean(listVO, ProdCateListDTO.class)), ProdCateListResVO.class));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商品分类列表", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/app/list")
|
||||
public R<List<ProdCateListResVO>> appList(@RequestBody ProdCateListVO listVO) {
|
||||
return R.ok(BeanUtil.copyToList(prodCateService.selectAppList(BeanUtil.toBean(listVO, ProdCateListDTO.class)), ProdCateListResVO.class));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据1级分类获取二级分类列表", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/sub/{parCateId}")
|
||||
public R<List<ProdCateVO>> getSubListByParCateId(@PathVariable Long parCateId) {
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ public class StoreProdVO {
|
|||
@NotBlank(message = "商品分类名称不能为空!")
|
||||
private String prodCateName;
|
||||
@ApiModelProperty(value = "工厂货号")
|
||||
@Size(min = 0, max = 15, message = "工厂货号不能超过60个字!")
|
||||
@Size(min = 0, max = 20, message = "工厂货号不能超过20个字!")
|
||||
private String factoryArtNum;
|
||||
@ApiModelProperty(value = "商品货号", required = true)
|
||||
@Size(min = 0, max = 15, message = "商品货号不能超过60个字!")
|
||||
@Size(min = 0, max = 20, message = "商品货号不能超过20个字!")
|
||||
@NotBlank(message = "商品货号不能为空!")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "商品标题", required = true)
|
||||
|
|
|
|||
|
|
@ -3399,8 +3399,8 @@ CREATE TABLE `store_product`
|
|||
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '档口商品ID',
|
||||
`store_id` bigint UNSIGNED NOT NULL COMMENT '档口ID',
|
||||
`prod_cate_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '商品分类ID',
|
||||
`factory_art_num` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工厂货号',
|
||||
`prod_art_num` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品货号',
|
||||
`factory_art_num` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工厂货号',
|
||||
`prod_art_num` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品货号',
|
||||
`prod_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品标题',
|
||||
`prod_weight` decimal(10, 2) NULL DEFAULT NULL COMMENT '商品重量',
|
||||
`produce_price` int UNSIGNED NULL DEFAULT NULL COMMENT '生产价格',
|
||||
|
|
@ -3651,7 +3651,7 @@ CREATE TABLE `store_product_detail`
|
|||
(
|
||||
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '商品详情ID',
|
||||
`store_prod_id` bigint UNSIGNED NOT NULL COMMENT '档口商品ID',
|
||||
`detail` blob NOT NULL COMMENT '详情内容',
|
||||
`detail` mediumblob NOT NULL COMMENT '详情内容',
|
||||
`version` bigint UNSIGNED NOT NULL COMMENT '版本号',
|
||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
|
|
|
|||
|
|
@ -54,6 +54,14 @@ public interface ISysProductCategoryService {
|
|||
*/
|
||||
List<ProdCateListResDTO> selectList(ProdCateListDTO listDTO);
|
||||
|
||||
/**
|
||||
* 获取商品分类列表
|
||||
*
|
||||
* @param listDTO 查询入参
|
||||
* @return List<ProdCateListResDTO>
|
||||
*/
|
||||
List<ProdCateListResDTO> selectAppList(ProdCateListDTO listDTO);
|
||||
|
||||
/**
|
||||
* 获取APP首页商品分类
|
||||
*
|
||||
|
|
|
|||
|
|
@ -143,6 +143,35 @@ public class SysProductCategoryServiceImpl implements ISysProductCategoryService
|
|||
return this.buildCateTree(resList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分类列表
|
||||
*
|
||||
* @param listDTO 查询入参
|
||||
* @return List<ProdCateListDTO>
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<ProdCateListResDTO> selectAppList(ProdCateListDTO listDTO) {
|
||||
LambdaQueryWrapper<SysProductCategory> queryWrapper = new LambdaQueryWrapper<SysProductCategory>()
|
||||
.eq(SysProductCategory::getDelFlag, Constants.UNDELETED)
|
||||
// 排除最顶层的父级分类
|
||||
.ne(SysProductCategory::getParentId, 0)
|
||||
.orderByAsc(Arrays.asList(SysProductCategory::getOrderNum, SysProductCategory::getId));
|
||||
if (StringUtils.isNotBlank(listDTO.getName())) {
|
||||
queryWrapper.like(SysProductCategory::getName, listDTO.getName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(listDTO.getStatus())) {
|
||||
queryWrapper.eq(SysProductCategory::getStatus, listDTO.getStatus());
|
||||
}
|
||||
List<SysProductCategory> prodCateList = this.prodCateMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(prodCateList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<ProdCateListResDTO> resList = prodCateList.stream()
|
||||
.map(x -> BeanUtil.toBean(x, ProdCateListResDTO.class).setProdCateId(x.getId())).collect(Collectors.toList());
|
||||
return this.buildCateTree(resList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员获取商品分类树
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue