回显,列表回值

main
尚志豪123 2024-11-20 02:24:40 +08:00
parent bd14c00bc4
commit c96798b9da
8 changed files with 97 additions and 30 deletions

View File

@ -1,9 +1,19 @@
package com.muyu.goods.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.goods.domain.ActivityTeamInfo;
import com.muyu.goods.service.ActivityTeamInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author
* @Packagecom.muyu.goods.controller
@ -15,4 +25,17 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/ActivityTeamInfo")
public class ActivityTeamInfoController {
@Autowired
private ActivityTeamInfoService activityTeamInfoService;
/**
*
*/
@ApiOperation("商品拼团信息列表")
@GetMapping("/list")
public Result<List<ActivityTeamInfo>> list() {
return Result.success(activityTeamInfoService.list());
}
}

View File

@ -92,6 +92,17 @@ public class ProjectInfo extends BaseEntity {
private Long brandId;
private String mianTypeName;
private String parentTypeName;
private String typeName;
private String ruleIdName;
private String brandIdName;
/**
*
*/
@ -107,6 +118,11 @@ public class ProjectInfo extends BaseEntity {
.status(projectInfoQueryReq.getStatus())
.ruleId(projectInfoQueryReq.getRuleId())
.brandId(projectInfoQueryReq.getBrandId())
.mianTypeName(null)
.parentTypeName(null)
.typeName(null)
.ruleIdName(null)
.brandIdName(null)
.build();
}

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain.req;
import com.muyu.product.domain.ProjectSkuInfo;
import com.muyu.product.domain.model.AttrValueModel;
import com.muyu.product.domain.model.ProductSkuModel;
import com.muyu.product.domain.model.ProjectAddModel;
@ -28,6 +29,8 @@ public class ProjectInfoSaveReq extends BaseEntity {
private static final long serialVersionUID = 1L;
// private Long id;
/**
*
*/
@ -42,5 +45,9 @@ public class ProjectInfoSaveReq extends BaseEntity {
* SKu
*/
private List<ProductSkuModel> productSkuList;
/**
* SKu
*/
private List<ProjectSkuInfo> projectSkuInfoList;
}

View File

@ -4,8 +4,10 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.muyu.product.cache.ProjectInfoCache;
import com.muyu.product.domain.ProjectUpdInfo;
import com.muyu.product.domain.*;
import com.muyu.product.domain.resp.ProjectDetailResp;
import com.muyu.product.service.BrandInfoService;
import com.muyu.product.service.RuleInfoService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -22,7 +24,6 @@ import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.product.domain.ProjectInfo;
import com.muyu.product.domain.req.ProjectInfoQueryReq;
import com.muyu.product.domain.req.ProjectInfoSaveReq;
import com.muyu.product.domain.req.ProjectInfoEditReq;
@ -44,6 +45,10 @@ public class ProjectInfoController extends BaseController {
@Autowired
private ProjectInfoCache projectInfoCache;
@Autowired
private RuleInfoService ruleInfoService;
@Autowired
private BrandInfoService brandInfoService;
/**
*
@ -51,9 +56,25 @@ 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);
// }
public Result<TableDataInfo<ProjectInfo>> list(ProjectInfoQueryReq projectInfoQueryReq) {
startPage();
List<ProjectInfo> list = projectInfoService.list(ProjectInfo.queryBuild(projectInfoQueryReq));
//
for (ProjectInfo info : list) {
RuleInfo byId = ruleInfoService.getById(info.getRuleId());
info.setRuleIdName(byId.getName());
}
//
for (ProjectInfo info : list) {
BrandInfo byId = brandInfoService.getById(info.getBrandId());
info.setRuleIdName(byId.getNam());
}
return getDataTable(list);
}
@ -80,8 +101,8 @@ public class ProjectInfoController extends BaseController {
// public Result<ProjectInfo> getInfo(@PathVariable("id") Long id) {
// return Result.success(projectInfoCache.get(id));
// }
public Result<ProjectUpdInfo> getInfo(@PathVariable("id") Long id) {
ProjectUpdInfo projectUpdInfo = projectInfoService.get(id);
public Result<ProjectInfoSaveReq> getInfo(@PathVariable("id") Long id) {
ProjectInfoSaveReq projectUpdInfo = projectInfoService.get(id);
return Result.success(projectUpdInfo);
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AttributeInfo;
import com.muyu.product.domain.ProjectInfo;
import com.muyu.product.domain.ProjectSkuInfo;
import org.apache.ibatis.annotations.Param;
/**
@ -19,4 +20,6 @@ public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {
* @return
*/
AttributeInfo selectProject(@Param("aLong") Long aLong);
ProjectSkuInfo selectProjectSkuInfo(@Param("aLong") Long aLong);
}

View File

@ -3,7 +3,6 @@ package com.muyu.product.service;
import java.util.List;
import com.muyu.product.domain.ProjectInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.ProjectUpdInfo;
import com.muyu.product.domain.req.ProjectInfoSaveReq;
import com.muyu.product.domain.resp.ProjectDetailResp;
@ -38,5 +37,6 @@ public interface ProjectInfoService extends IService<ProjectInfo> {
/**
*
*/
ProjectUpdInfo get(Long id);
ProjectInfoSaveReq get(Long id);
}

View File

@ -1,7 +1,6 @@
package com.muyu.product.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.muyu.common.core.utils.ObjUtils;
@ -44,6 +43,8 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
@Autowired
private BrandInfoService brandInfoService;
// @Autowired
// private RuleInfoService ruleInfoService;
@Autowired
private AttributeInfoService attributeInfoService;
@ -101,10 +102,6 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
queryWrapper.eq(ProjectInfo::getBrandId, projectInfo.getBrandId());
}
return list(queryWrapper);
}
@ -233,10 +230,7 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
*
*/
@Override
public ProjectUpdInfo get(Long id) {
// CategoryInfo;
// RuleInfo;
public ProjectInfoSaveReq get(Long id) {
// 商品信息
ProjectInfo info = this.getById(id);
// 商品属性表中间表
@ -244,26 +238,25 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
queryWrapper.eq(AsProductAttributeInfo::getProductId,id);
List<AsProductAttributeInfo> attributeInfoList = asProductAttributeInfoService.list(queryWrapper);
List<Long> longs = attributeInfoList.stream().map(AsProductAttributeInfo::getAttributeId).toList();
ArrayList<AttributeInfo> arrayList = new ArrayList<>();
List<AttributeInfo> arrayList = new ArrayList<>();
for (Long aLong : longs) {
AttributeInfo attributeInfo = projectInfoMapper.selectProject(aLong);
arrayList.add(attributeInfo);
}
//
return ProjectUpdInfo.builder()
.id(info.getId())
.name(info.getName())
.introduction(info.getIntroduction())
.mianType(info.getMianType())
.parentType(info.getParentType())
.type(info.getType())
.image(info.getImage())
.carouselImages(info.getCarouselImages())
.status(info.getStatus())
.ruleId(info.getRuleId())
.brandId(info.getBrandId())
// sku
LambdaQueryWrapper<ProjectSkuInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(ProjectSkuInfo::getProjectId,id);
List<ProjectSkuInfo> projectSkuInfoList = projectSkuInfoService.list(queryWrapper1);
List<Long> longs1 = projectSkuInfoList.stream().map(ProjectSkuInfo::getId).toList();
ArrayList<ProjectSkuInfo> skuInfoArrayList = new ArrayList<>();
for (Long aLong : longs1) {
ProjectSkuInfo projectSkuInfo = projectInfoMapper.selectProjectSkuInfo(aLong);
skuInfoArrayList.add(projectSkuInfo);
}
return ProjectInfoSaveReq.builder()
.projectAddModel(info)
.attrValueList(arrayList)
.projectSkuInfoList(skuInfoArrayList)
.build();
}
}

View File

@ -30,4 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectProject" resultType="com.muyu.product.domain.AttributeInfo">
select * from attribute_info where id = #{aLong}
</select>
<select id="selectProjectSkuInfo" resultType="com.muyu.product.domain.ProjectSkuInfo"
parameterType="java.lang.Long">
select * from project_sku_info where id = #{aLong}
</select>
</mapper>