规格列表回显
parent
c9d7cd5653
commit
79a7391d39
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.product.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 共有属性组
|
||||
* @Date 2024-3-6 下午 02:29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TemplateAttributeGroupModel extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 组名称
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 属性组下属性集合
|
||||
*/
|
||||
private List<TemplateAttributeModel> attributeList;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.product.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 共有属性
|
||||
* @Date 2024-3-6 下午 02:30
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TemplateAttributeModel extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.muyu.product.domain.resp;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.model.TemplateAttributeGroupModel;
|
||||
import com.muyu.product.domain.model.TemplateAttributeModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品类别公共元素
|
||||
* @Date 2024-3-6 下午 02:25
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CategoryCommonElementResp extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 共有属性组
|
||||
*/
|
||||
private List<TemplateAttributeGroupModel> templateAttributeGroupList;
|
||||
|
||||
/**
|
||||
* 共有属性
|
||||
*/
|
||||
private List<TemplateAttributeModel> templateAttributeList;
|
||||
|
||||
/**
|
||||
* 自有属性(所有未包含属性)
|
||||
*/
|
||||
private List<TemplateAttributeModel> attributeList;
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.product.controller;
|
|||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -45,10 +46,13 @@ public class BrandInfoController extends BaseController {
|
|||
@ApiOperation("获取品牌信息列表")
|
||||
@RequiresPermissions("product:brand:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<BrandInfo>> list(BrandInfoQueryReq brandInfoQueryReq) {
|
||||
startPage();
|
||||
public Result list(BrandInfoQueryReq brandInfoQueryReq) {
|
||||
boolean isPage = brandInfoQueryReq.getParams().get("isPage") == null || Convert.toBool(brandInfoQueryReq.getParams().get("isPage"), true);
|
||||
if (isPage){
|
||||
startPage();
|
||||
}
|
||||
List<BrandInfo> list = brandInfoService.list(BrandInfo.queryBuild(brandInfoQueryReq));
|
||||
return getDataTable(list);
|
||||
return isPage ? getDataTable(list) : Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.muyu.product.domain.AttributeGroup;
|
|||
import com.muyu.product.domain.AttributeInfo;
|
||||
import com.muyu.product.domain.BrandInfo;
|
||||
import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
||||
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -80,6 +81,17 @@ public class CategoryInfoController extends BaseController {
|
|||
return Result.success(categoryInfoService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品类信息详细信息
|
||||
*/
|
||||
@ApiOperation("获取品类信息共有属性信息")
|
||||
@RequiresPermissions("product:category:query")
|
||||
@GetMapping(value = "/getTemplateAttribute/{cateGoryId}")
|
||||
@ApiImplicitParam(name = "cateGoryId", value = "cateGoryId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<CategoryCommonElementResp> getTemplateAttributeByCateGoryId(@PathVariable("cateGoryId") Long cateGoryId) {
|
||||
return Result.success(categoryInfoService.getTemplateAttributeByCateGoryId(cateGoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增品类信息
|
||||
*/
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.controller;
|
|||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||
import io.swagger.annotations.*;
|
||||
|
@ -47,10 +48,13 @@ public class RuleInfoController extends BaseController {
|
|||
@ApiOperation("获取商品规格列表")
|
||||
@RequiresPermissions("product:rule:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<RuleInfoResp>> list(RuleInfoQueryReq ruleInfoQueryReq) {
|
||||
startPage();
|
||||
public Result list(RuleInfoQueryReq ruleInfoQueryReq) {
|
||||
boolean isPage = ruleInfoQueryReq.getParams().get("isPage") == null || Convert.toBool(ruleInfoQueryReq.getParams().get("isPage"), true);
|
||||
if (isPage){
|
||||
startPage();
|
||||
}
|
||||
TableDataInfo<RuleInfoResp> tableDataInfo = ruleInfoService.queryList(ruleInfoQueryReq);
|
||||
return Result.success(tableDataInfo);
|
||||
return isPage ? Result.success(tableDataInfo) : Result.success(tableDataInfo.getRows());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.muyu.product.domain.BrandInfo;
|
|||
import com.muyu.product.domain.CategoryInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
||||
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
||||
|
||||
/**
|
||||
|
@ -59,4 +60,11 @@ public interface CategoryInfoService extends IService<CategoryInfo> {
|
|||
* @return 父级以上的属性、属性组、品牌集合
|
||||
*/
|
||||
CategoryParentCommonElementResp parentCommonElement (Long categoryId);
|
||||
|
||||
/**
|
||||
* 通过品类ID获取品类共有属性
|
||||
* @param cateGoryId 品类ID
|
||||
* @return 品类共有属性
|
||||
*/
|
||||
CategoryCommonElementResp getTemplateAttributeByCateGoryId (Long cateGoryId);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class BrandInfoServiceImpl extends ServiceImpl<BrandInfoMapper, BrandInfo
|
|||
|
||||
|
||||
if (ObjUtils.notNull(brandInfo.getNam())){
|
||||
queryWrapper.eq(BrandInfo::getNam, brandInfo.getNam());
|
||||
queryWrapper.like(BrandInfo::getNam, brandInfo.getNam());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(brandInfo.getLogo())){
|
||||
|
|
|
@ -10,6 +10,9 @@ import com.muyu.common.core.utils.ObjUtils;
|
|||
import com.muyu.product.domain.*;
|
||||
import com.muyu.product.domain.base.CategoryBase;
|
||||
import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||
import com.muyu.product.domain.model.TemplateAttributeGroupModel;
|
||||
import com.muyu.product.domain.model.TemplateAttributeModel;
|
||||
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
||||
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
||||
import com.muyu.product.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -271,4 +274,28 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
|||
.brandInfoList(getCommon(categoryId, asCategoryBrandService, brandInfoService))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过品类ID获取品类共有属性
|
||||
*
|
||||
* @param cateGoryId 品类ID
|
||||
*
|
||||
* @return 品类共有属性
|
||||
*/
|
||||
@Override
|
||||
public CategoryCommonElementResp getTemplateAttributeByCateGoryId (Long cateGoryId) {
|
||||
|
||||
List<TemplateAttributeGroupModel> attributeGroupModelList = new ArrayList<>();
|
||||
|
||||
List<TemplateAttributeModel> templateAttributeModelList = new ArrayList<>();
|
||||
|
||||
List<TemplateAttributeModel> attributeModelList = new ArrayList<>();
|
||||
|
||||
|
||||
return CategoryCommonElementResp.builder()
|
||||
.templateAttributeGroupList(attributeGroupModelList)
|
||||
.templateAttributeList(templateAttributeModelList)
|
||||
.attributeList(attributeModelList)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
|
@ -94,9 +95,11 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
|
|||
return ruleAttrInfoService.list(queryWrapper).stream().map(RuleAttrAddModel::infoBuild).toList();
|
||||
}))
|
||||
.toList();
|
||||
boolean isPage = ruleInfoQueryReq.getParams().get("isPage") == null || Convert.toBool(ruleInfoQueryReq.getParams().get("isPage"), true);
|
||||
|
||||
return TableDataInfo.<RuleInfoResp>builder()
|
||||
.rows(ruleInfoRespList)
|
||||
.total(new PageInfo<>(list).getTotal())
|
||||
.total(isPage ? new PageInfo<>(list).getTotal() : 0)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue