feat(): 更改信息
parent
b4c8992164
commit
ba04016a1b
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu.gateway.config.properties;
|
package com.muyu.gateway.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
|
@ -35,6 +35,11 @@ public class TemplateAttributeModel extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 值
|
||||||
|
*/
|
||||||
|
private String value;
|
||||||
|
|
||||||
public static TemplateAttributeModel attributeInfoBuild(AttributeInfo attributeInfo){
|
public static TemplateAttributeModel attributeInfoBuild(AttributeInfo attributeInfo){
|
||||||
return TemplateAttributeModel.builder()
|
return TemplateAttributeModel.builder()
|
||||||
.id(attributeInfo.getId())
|
.id(attributeInfo.getId())
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.muyu.product.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ProjectInfoListResp {
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 商品名称 */
|
||||||
|
@ApiModelProperty(name = "商品名称", value = "商品名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 商品描述 */
|
||||||
|
@ApiModelProperty(name = "商品描述", value = "商品描述")
|
||||||
|
private String introduction;
|
||||||
|
|
||||||
|
/** 主类型 */
|
||||||
|
@ApiModelProperty(name = "主类型", value = "主类型")
|
||||||
|
private Long mianType;
|
||||||
|
|
||||||
|
/** 父类型 */
|
||||||
|
@ApiModelProperty(name = "父类型", value = "父类型")
|
||||||
|
private Long parentType;
|
||||||
|
|
||||||
|
/** 商品类型 */
|
||||||
|
@ApiModelProperty(name = "商品类型", value = "商品类型")
|
||||||
|
private Long type;
|
||||||
|
|
||||||
|
/** 商品图片 */
|
||||||
|
@ApiModelProperty(name = "商品图片", value = "商品图片")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/** 商品轮播图 */
|
||||||
|
@ApiModelProperty(name = "商品轮播图", value = "商品轮播图")
|
||||||
|
private String carouselImages;
|
||||||
|
|
||||||
|
/** 商品状态 */
|
||||||
|
@ApiModelProperty(name = "商品状态", value = "商品状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 规格 */
|
||||||
|
@ApiModelProperty(name = "规格", value = "规格")
|
||||||
|
private Long ruleId;
|
||||||
|
|
||||||
|
/** 品牌 */
|
||||||
|
@ApiModelProperty(name = "品牌", value = "品牌")
|
||||||
|
private Long brandId;
|
||||||
|
|
||||||
|
|
||||||
|
/** 主类型名称 */
|
||||||
|
private String mianTypeName;
|
||||||
|
/** 父类型名称 */
|
||||||
|
private String parentTypeName;
|
||||||
|
/** 商品类型名称 */
|
||||||
|
private String typeName;
|
||||||
|
/** 规格名称 */
|
||||||
|
private String ruleName;
|
||||||
|
/** 品牌名称 */
|
||||||
|
private String brandName;
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.muyu.product.cache.ProjectInfoCache;
|
import com.muyu.product.cache.ProjectInfoCache;
|
||||||
import com.muyu.product.domain.resp.ProjectDetailResp;
|
import com.muyu.product.domain.resp.ProjectDetailResp;
|
||||||
|
import com.muyu.product.domain.resp.ProjectInfoListResp;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -47,12 +48,21 @@ public class ProjectInfoController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 查询商品信息列表
|
* 查询商品信息列表
|
||||||
*/
|
*/
|
||||||
|
// @ApiOperation("获取商品信息列表")
|
||||||
|
// @RequiresPermissions("product:info:list")
|
||||||
|
// @GetMapping("/list")
|
||||||
|
// public Result<TableDataInfo<ProjectInfo>> list(ProjectInfoQueryReq projectInfoQueryReq) {
|
||||||
|
// startPage();
|
||||||
|
// List<ProjectInfo> list = projectInfoService.list(ProjectInfo.queryBuild(projectInfoQueryReq));
|
||||||
|
// return getDataTable(list);
|
||||||
|
// }
|
||||||
|
|
||||||
@ApiOperation("获取商品信息列表")
|
@ApiOperation("获取商品信息列表")
|
||||||
@RequiresPermissions("product:info:list")
|
@RequiresPermissions("product:info:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo<ProjectInfo>> list(ProjectInfoQueryReq projectInfoQueryReq) {
|
public Result<TableDataInfo<ProjectInfoListResp>> list(ProjectInfoQueryReq projectInfoQueryReq) {
|
||||||
startPage();
|
startPage();
|
||||||
List<ProjectInfo> list = projectInfoService.list(ProjectInfo.queryBuild(projectInfoQueryReq));
|
List<ProjectInfoListResp> list = projectInfoService.ProjectInfoList(ProjectInfo.queryBuild(projectInfoQueryReq));
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.product.domain.ProjectInfo;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.product.domain.req.ProjectInfoSaveReq;
|
import com.muyu.product.domain.req.ProjectInfoSaveReq;
|
||||||
import com.muyu.product.domain.resp.ProjectDetailResp;
|
import com.muyu.product.domain.resp.ProjectDetailResp;
|
||||||
|
import com.muyu.product.domain.resp.ProjectInfoListResp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品信息Service接口
|
* 商品信息Service接口
|
||||||
|
@ -34,4 +35,6 @@ public interface ProjectInfoService extends IService<ProjectInfo> {
|
||||||
* @return 商品详情
|
* @return 商品详情
|
||||||
*/
|
*/
|
||||||
ProjectDetailResp getDetailInfo (Long id);
|
ProjectDetailResp getDetailInfo (Long id);
|
||||||
|
|
||||||
|
List<ProjectInfoListResp> ProjectInfoList(ProjectInfo projectInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AttributeGroupService attributeGroupService;
|
private AttributeGroupService attributeGroupService;
|
||||||
|
@Autowired
|
||||||
|
private AsProductAttributeInfoService asProductAttributeInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询品类信息列表
|
* 查询品类信息列表
|
||||||
|
@ -371,6 +373,22 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
||||||
attributeInfoLambdaQueryWrapper.notIn(!attributeIdSet.isEmpty(), AttributeInfo::getId, attributeIdSet);
|
attributeInfoLambdaQueryWrapper.notIn(!attributeIdSet.isEmpty(), AttributeInfo::getId, attributeIdSet);
|
||||||
attributeModelList = attributeInfoService.list(attributeInfoLambdaQueryWrapper).stream().map(AttributeInfo::buildTemplateModel).toList();
|
attributeModelList = attributeInfoService.list(attributeInfoLambdaQueryWrapper).stream().map(AttributeInfo::buildTemplateModel).toList();
|
||||||
|
|
||||||
|
|
||||||
|
attributeGroupModelList.forEach(TemplateAttributeGroupModel->{
|
||||||
|
TemplateAttributeGroupModel.getAttributeList().forEach(TemplateAttributeModel->{
|
||||||
|
Long id = TemplateAttributeModel.getId();
|
||||||
|
LambdaQueryWrapper<AsProductAttributeInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AsProductAttributeInfo::getAttributeId,id);
|
||||||
|
List<AsProductAttributeInfo> list = this.asProductAttributeInfoService.list(queryWrapper);
|
||||||
|
|
||||||
|
list.forEach(AsProductAttributeInfo->{
|
||||||
|
TemplateAttributeModel.setValue(AsProductAttributeInfo.getValue());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return CategoryCommonElementResp.builder()
|
return CategoryCommonElementResp.builder()
|
||||||
.templateAttributeGroupList(attributeGroupModelList)
|
.templateAttributeGroupList(attributeGroupModelList)
|
||||||
.templateAttributeList(templateAttributeModelList)
|
.templateAttributeList(templateAttributeModelList)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.product.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.muyu.common.core.utils.ObjUtils;
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
@ -11,6 +12,8 @@ import com.muyu.product.domain.model.*;
|
||||||
import com.muyu.product.domain.req.ProjectInfoSaveReq;
|
import com.muyu.product.domain.req.ProjectInfoSaveReq;
|
||||||
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
||||||
import com.muyu.product.domain.resp.ProjectDetailResp;
|
import com.muyu.product.domain.resp.ProjectDetailResp;
|
||||||
|
import com.muyu.product.domain.resp.ProjectInfoListResp;
|
||||||
|
import com.muyu.product.mapper.RuleInfoMapper;
|
||||||
import com.muyu.product.service.*;
|
import com.muyu.product.service.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -47,7 +50,8 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AttributeInfoService attributeInfoService;
|
private AttributeInfoService attributeInfoService;
|
||||||
|
@Autowired
|
||||||
|
private RuleInfoMapper ruleInfoMapper;
|
||||||
/**
|
/**
|
||||||
* 查询商品信息列表
|
* 查询商品信息列表
|
||||||
*
|
*
|
||||||
|
@ -229,4 +233,37 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
|
||||||
.attributeGroupList(templateAttributeGroupList)
|
.attributeGroupList(templateAttributeGroupList)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ProjectInfoListResp> ProjectInfoList(ProjectInfo projectInfo) {
|
||||||
|
List<ProjectInfo> list = list(projectInfo);
|
||||||
|
LinkedList<ProjectInfoListResp> objects = new LinkedList<>();
|
||||||
|
list.forEach(s -> {
|
||||||
|
CategoryInfo mianTypeName = categoryInfoService.getById(s.getMianType());
|
||||||
|
CategoryInfo parentTypeName = categoryInfoService.getById(s.getParentType());
|
||||||
|
CategoryInfo typeName = s.getType() != null ? categoryInfoService.getById(s.getType()) : null;
|
||||||
|
|
||||||
|
RuleInfo ruleName = ruleInfoMapper.selectById(s.getRuleId());
|
||||||
|
|
||||||
|
BrandInfo brandName = brandInfoService.getById(s.getBrandId());
|
||||||
|
|
||||||
|
ProjectInfoListResp build = ProjectInfoListResp.builder()
|
||||||
|
.id(s.getId())
|
||||||
|
.name(s.getName())
|
||||||
|
.introduction(s.getIntroduction())
|
||||||
|
.mianType(s.getMianType())
|
||||||
|
.parentType(s.getParentType())
|
||||||
|
.type(s.getType()).image(s.getImage())
|
||||||
|
.carouselImages(s.getCarouselImages())
|
||||||
|
.status(s.getStatus())
|
||||||
|
.mianTypeName(mianTypeName != null ? mianTypeName.getName() : "")
|
||||||
|
.parentTypeName(parentTypeName != null ? parentTypeName.getName() : "")
|
||||||
|
.typeName(typeName != null ? typeName.getName() : "")
|
||||||
|
.ruleName(ruleName != null ? ruleName.getName() : "")
|
||||||
|
.brandName(brandName != null ? brandName.getNam() : "")
|
||||||
|
.build();
|
||||||
|
objects.add(build);
|
||||||
|
});
|
||||||
|
return objects;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue