Ver Fonte

Merge branch 'zx_saas_goods' of http://git.dayaedu.com/yonge/mec into zx_saas_goods

刘俊驰 há 1 ano atrás
pai
commit
9d18ea185b

+ 1 - 1
mec-application/src/main/java/com/ym/mec/web/controller/GoodsCategoryController.java

@@ -22,7 +22,7 @@ public class GoodsCategoryController extends BaseController {
     @PostMapping("/del")
     @PreAuthorize("@pcs.hasPermissions('category/del')")
     public Object del(Integer id) {
-        return succeed(goodsCategoryService.delete(id));
+        return succeed(goodsCategoryService.get(id));
     }
 
     @ApiOperation(value = "新增、修改商品类型")

+ 1 - 1
mec-application/src/main/resources/columnMapper.ini

@@ -34,7 +34,7 @@
 组合商品图片 = image
 子商品名称 = subGoodsName
 SKU = sku
-子商品成本 = subGoodsPrice
+子商品成本 = goodsPrice
 
 [财务支出导入模板]
 财务流程编号 = financialProcessNo

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectGoodsMapperDao.java

@@ -36,4 +36,6 @@ public interface SubjectGoodsMapperDao extends BaseDAO<Long, SubjectGoodsMapper>
      * @return
      */
     List<SubjectGoodsDto> querySubjectGoods(Map<String, Object> params);
+
+    List<SubjectGoodsMapper> queryByCategoryIds(@Param("categoryIdList") List<Integer> categoryIdList);
 }

+ 9 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsCategoryService.java

@@ -8,8 +8,10 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
+import java.util.Map;
 
-public interface GoodsCategoryService extends BaseService<Integer, GoodsCategory> {
+//public interface GoodsCategoryService extends BaseService<Integer, GoodsCategory> {
+public interface GoodsCategoryService{
     /**
      * 新增、修改商品类型
      * @param goodsCategory
@@ -29,4 +31,10 @@ public interface GoodsCategoryService extends BaseService<Integer, GoodsCategory
      * @param goodsIds
      */
     void updateSubjectGoods(Long subjectGoodsMapperId, String goodsIds);
+
+    GoodsCategory get(Integer goodsCategoryId);
+
+    List<GoodsCategory> queryPage(GoodsCategoryQueryInfo queryInfo);
+
+    Map<Integer,String> getNameMap();
 }

+ 100 - 21
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsCategoryServiceImpl.java

@@ -1,53 +1,64 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.GoodsCategoryDao;
+import com.alibaba.fastjson.JSON;
+import com.ym.mec.biz.dal.dao.SubjectDao;
 import com.ym.mec.biz.dal.dao.SubjectGoodsMapperDao;
 import com.ym.mec.biz.dal.dto.SubjectGoodsDto;
-import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.GoodsCategory;
+import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SubjectGoodsMapper;
-import com.ym.mec.biz.dal.enums.AccountType;
 import com.ym.mec.biz.dal.enums.GoodsType;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.service.GoodsCategoryService;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.dto.ProductCategoryDto;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.mall.MallFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
-public class GoodsCategoryServiceImpl extends BaseServiceImpl<Integer, GoodsCategory>  implements GoodsCategoryService {
-	
-	@Autowired
-	private GoodsCategoryDao goodsCategoryDao;
+//public class GoodsCategoryServiceImpl extends BaseServiceImpl<Integer, GoodsCategory>  implements GoodsCategoryService {
+public class GoodsCategoryServiceImpl implements GoodsCategoryService {
+
+//	@Autowired
+//	private GoodsCategoryDao goodsCategoryDao;
 	@Autowired
 	private SubjectGoodsMapperDao subjectGoodsMapperDao;
 
-	@Override
-	public BaseDAO<Integer, GoodsCategory> getDAO() {
-		return goodsCategoryDao;
-	}
+	@Autowired
+	private MallFeignService mallFeignService;
+
+	@Autowired
+	private SubjectDao subjectDao;
+
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void upsetGoodsCategory(GoodsCategory goodsCategory) {
-		goodsCategory.setParentId(0);
+//		goodsCategory.setParentId(0);
 		if(goodsCategory.getId() != null){
-			goodsCategory.setUpdateTime(new Date());
-			goodsCategoryDao.update(goodsCategory);
+//			goodsCategory.setUpdateTime(new Date());
+//			goodsCategoryDao.update(goodsCategory);
 			//删除关联
 			subjectGoodsMapperDao.delByGoodsCategoryId(goodsCategory.getId());
-		}else {
-			goodsCategoryDao.insert(goodsCategory);
 		}
+//		else {
+//			goodsCategoryDao.insert(goodsCategory);
+//		}
 		List<Integer> subjectIds = goodsCategory.getSubjectIds();
 		subjectGoodsMapperDao.batchAdd(goodsCategory.getId(),subjectIds, goodsCategory.getTenantId());
 	}
@@ -64,7 +75,9 @@ public class GoodsCategoryServiceImpl extends BaseServiceImpl<Integer, GoodsCate
 			pageInfo.setTotal(count);
 			params.put("offset", pageInfo.getOffset());
 			dataList = subjectGoodsMapperDao.querySubjectGoods(params);
+			Map<Integer, String> nameMap = getNameMap();
 			dataList.forEach(e->{
+				e.setGoodsCategoryName(nameMap.getOrDefault(e.getGoodsCategoryId(),""));
 				e.setInstrument(e.getGoodsList().stream().filter(goods -> goods.getType() == GoodsType.INSTRUMENT).collect(Collectors.toList()));
 				e.setAccessories(e.getGoodsList().stream().filter(goods -> goods.getType() == GoodsType.ACCESSORIES).collect(Collectors.toList()));
 				e.setGoodsList(null);
@@ -85,4 +98,70 @@ public class GoodsCategoryServiceImpl extends BaseServiceImpl<Integer, GoodsCate
 		subjectGoodsMapper.setUpdateTime(new Date());
 		subjectGoodsMapperDao.update(subjectGoodsMapper);
 	}
+
+	@Override
+	public GoodsCategory get(Integer goodsCategoryId) {
+		mallFeignService.listWithChildren();
+		List<ProductCategoryDto> productCategoryDtos = treeToList(mallFeignService.listWithChildren());
+		Optional<ProductCategoryDto> first = productCategoryDtos.stream().filter(next -> next.getId().equals(Long.valueOf(goodsCategoryId))).findFirst();
+		if(first.isPresent()){
+			ProductCategoryDto productCategoryDto = first.get();
+			GoodsCategory goodsCategory = new GoodsCategory();
+			goodsCategory.setId(goodsCategoryId);
+			goodsCategory.setName(productCategoryDto.getName());
+			return goodsCategory;
+		}
+		return null;
+	}
+
+	@Override
+	public List<GoodsCategory> queryPage(GoodsCategoryQueryInfo queryInfo) {
+		List<ProductCategoryDto> productCategoryDtos = treeToList(mallFeignService.listWithChildren());
+		List<ProductCategoryDto> childrens = productCategoryDtos.stream().map(ProductCategoryDto::getChildren).flatMap(Collection::stream).collect(Collectors.toList());
+		List<GoodsCategory> goodsCategories = JSON.parseArray(JSON.toJSONString(childrens), GoodsCategory.class);
+
+		List<Integer> categoryIdList = goodsCategories.stream().map(GoodsCategory::getId).distinct().collect(Collectors.toList());
+		if (!categoryIdList.isEmpty()) {
+			List<SubjectGoodsMapper> mappers = subjectGoodsMapperDao.queryByCategoryIds(categoryIdList);
+
+			List<Integer> subjectIdList = mappers.stream().filter(next -> !StringUtils.isEmpty(next.getSubjectId()))
+					.map(next -> Integer.valueOf(next.getSubjectId())).distinct().collect(Collectors.toList());
+			Map<Integer, Subject> subjectIfdNameMap = subjectDao.findBySubjectIds(subjectIdList).stream().collect(Collectors.toMap(Subject::getId, Function.identity()));
+
+			Map<Integer, List<SubjectGoodsMapper>> groupByCategoryId = mappers.stream().collect(Collectors.groupingBy(SubjectGoodsMapper::getGoodsCategoryId));
+
+			goodsCategories.forEach(next -> {
+				List<SubjectGoodsMapper> goodsMappers = groupByCategoryId.getOrDefault(next.getId(), new ArrayList<>());
+				if (!goodsMappers.isEmpty()) {
+					List<Subject> subjectList =
+							goodsMappers.stream().filter(o -> subjectIfdNameMap.containsKey(Integer.valueOf(o.getSubjectId()))).map(o -> subjectIfdNameMap.get(Integer.valueOf(o.getSubjectId()))).collect(Collectors.toList());
+					next.setSubjects(subjectList);
+				}
+			});
+		}
+		return goodsCategories;
+	}
+
+	@Override
+	public Map<Integer, String> getNameMap() {
+		return treeToList(mallFeignService.listWithChildren()).stream()
+				.collect(Collectors.toMap(next->next.getId().intValue(), ProductCategoryDto::getName));
+	}
+
+	public List<ProductCategoryDto> treeToList(List<ProductCategoryDto> categoryList) {
+		if (categoryList.isEmpty()) {
+			return new ArrayList<>();
+		}
+		List<ProductCategoryDto> result = new ArrayList<>();
+		categoryList.forEach(next -> {
+			result.add(next);
+			String name = next.getName();
+			List<ProductCategoryDto> children = next.getChildren();
+			if (!CollectionUtils.isEmpty(children)) {
+				children.forEach(c -> c.setName(name + "/" + c.getName()));
+				result.addAll(children);
+			}
+		});
+		return result;
+	}
 }

+ 59 - 24
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -630,7 +630,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		goodsCategoryQueryInfo.setRows(9999);
 
 		List<ProductCategoryDto> categoryList = mallFeignService.listWithChildren();
-		List<ProductCategoryDto> allCategoryList = treeToList(categoryList);
+		List<ProductCategoryDto> allCategoryList = categoryList.stream().map(ProductCategoryDto::getChildren).filter(next->!next.isEmpty()).flatMap(Collection::stream).collect(Collectors.toList());
 		Map<String, Long> categoryIdNameMap = allCategoryList
 				.stream().collect(Collectors.toMap(ProductCategoryDto::getName, ProductCategoryDto::getId));
 		Set<String> categoryNames = categoryIdNameMap.keySet();
@@ -668,6 +668,11 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 			}
 		});
 
+		List<String> snSet = firstSheet.stream().map(next -> next.get("组合商品货号").toString()).filter(StringUtils::isNotEmpty).distinct().collect(Collectors.toList());
+		List<String> existSnList = goodsDao.findBySns(snSet).stream().map(Goods::getSn).distinct().collect(Collectors.toList());
+
+		Map<String, Long> brandNameIdMap = mallFeignService.getList().stream().collect(Collectors.toMap(BrandDto::getName, BrandDto::getId));
+
 		List<JSONObject> jsonObjectList = new ArrayList<>();
 		for (Map.Entry<String, List<Map<String, Object>>> sheetData : sheetsListMap.entrySet()) {
 			List<Map<String, Object>> rows = sheetData.getValue();
@@ -686,6 +691,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 			String lineErrMsg = "错误行号:第%s行,%s";
 			Map<String, String> beforeGoods = new HashMap<>();
 
+			Map<String, String> snNameMap = new HashMap<>();
 			for (int i = 0; i < rows.size(); i++) {
 				JSONObject objectMap = new JSONObject();
 				int rowNum = i + 2;
@@ -709,24 +715,36 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 						if ("subGoodsName".equals(fieldCode) || "sku".equals(fieldCode) || "subGoodsPrice".equals(fieldCode)) {
 							lineErrList.add("字段‘" + fieldName + "’为空");
 						} else {
-							if (!beforeGoods.containsKey(fieldCode)) {
-								lineErrList.add("字段‘" + fieldName + "’为空");
-								continue;
-							} else {
+							if (beforeGoods.containsKey(fieldCode)) {
 								value = beforeGoods.get(fieldCode);
+							} else {
+								if (!("educationShowOrganName".equals(fieldCode)
+										|| "courseFeeShowOrganName".equals(fieldCode)
+										|| "memberFeeShowOrganName".equals(fieldCode)
+										|| "freeFeeShowOrganName".equals(fieldCode)
+										|| "replacementShowOrganName".equals(fieldCode))) {
+									lineErrList.add("字段‘" + fieldName + "’为空");
+									continue;
+								}
 							}
 						}
 					} else {
 						beforeGoods.put(fieldCode, value);
 					}
-//					if("sn".equals(fieldCode)){
-//						if (snSet.contains(value)) {
-//							lineErrList.add("货号[" + value + "]重复");
-//						} else {
-//							snSet.add(value);
-//						}
-//					}
-//					else
+					if("sn".equals(fieldCode)){
+						if (existSnList.contains(value)) {
+							lineErrList.add("货号[" + value + "]已存在");
+						} else {
+							String goodsName = row.get("组合商品名称").toString();
+							if (snNameMap.containsKey(value) && !snNameMap.get(value).equals(goodsName)) {
+								lineErrList.add("货号[" + value + "]重复");
+							} else {
+								snNameMap.put(value, goodsName);
+							}
+							objectMap.put(fieldCode, value);
+						}
+					}
+					else
 					if ("marketPrice".equals(fieldCode)
 							|| "discountPrice".equals(fieldCode)
 							|| "groupPurchasePrice".equals(fieldCode)) {
@@ -761,17 +779,19 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 							|| "freeFeeShowOrganName".equals(fieldCode)
 							|| "replacementShowOrganName".equals(fieldCode)
 					) {
-						List<String> orgIds = new ArrayList<>();
-						for (String orgName : value.split(",")) {
-							if (!orgNameIdMap.containsKey(orgName)) {
-								lineErrList.add("字段‘" + fieldName + "’:‘" + value + "’分部不支持");
-							} else {
-								orgIds.add(orgNameIdMap.get(orgName).toString());
+						if (StringUtils.isNotEmpty(value)) {
+							List<String> orgIds = new ArrayList<>();
+							for (String orgName : value.split("[,,]")) {
+								if (!orgNameIdMap.containsKey(orgName)) {
+									lineErrList.add("字段‘" + fieldName + "’:‘" + value + "’分部不支持");
+								} else {
+									orgIds.add(orgNameIdMap.get(orgName).toString());
+								}
 							}
+							String join = String.join(",", orgIds);
+							String fieldKey = fieldCode.replaceAll("Name", "Id");
+							objectMap.put(fieldKey, join);
 						}
-						String join = String.join(",", orgIds);
-						String fieldKey = fieldCode.replaceAll("Name", "Id");
-						objectMap.put(fieldKey, join);
 					} else if ("subGoodsName".equals(fieldCode)) {
 						subGoodsName = value;
 						if (StringUtils.isNotEmpty(subGoodsSku)) {
@@ -805,10 +825,25 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 						if (BigDecimal.ZERO.compareTo(subGoodsPrice) > 0) {
 							lineErrList.add("字段‘" + fieldName + "’不能为负数");
 						}
-					} else {
+					} else if ("brand".equals(fieldCode)) {
+						if (brandNameIdMap.containsKey(value)) {
+							objectMap.put("brand", brandNameIdMap.get(value));
+						} else {
+							lineErrList.add("组合商品品牌‘" + value + "’不支持");
+						}
+					}
+					else {
 						objectMap.put(fieldCode, value);
 					}
 				}
+				// 校验分部可售是否都为空
+				if (!objectMap.containsKey("educationShowOrganId") &&
+						!objectMap.containsKey("courseFeeShowOrganId") &&
+						!objectMap.containsKey("memberFeeShowOrganId") &&
+						!objectMap.containsKey("freeFeeShowOrganId") &&
+						!objectMap.containsKey("replacementShowOrganId")) {
+					lineErrList.add("可售分部至少需要选择一个");
+				}
 				if (!lineErrList.isEmpty()) {
 					errList.add(String.format(lineErrMsg, rowNum, String.join(",", lineErrList)));
 				}
@@ -1341,7 +1376,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 
 		String basePath = new ApplicationHome(this.getClass()).getSource().getParentFile().getPath();
 		String format = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
-		File file = new File(basePath + File.separator + "goods_group_import_err" + format + ".csv");
+		File file = new File(basePath + File.separator + format + ".csv");
 		try {
 			if (!file.getParentFile().exists()) {
 				file.getParentFile().mkdirs();

+ 24 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -14,9 +14,11 @@ import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.dto.ProductCategoryDto;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.tenant.TenantContextHolder;
+import com.ym.mec.mall.MallFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -44,6 +46,8 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
     private StudentInstrumentDao studentInstrumentDao;
     @Autowired
     private SysCouponCodeDao sysCouponCodeDao;
+    @Autowired
+    private MallFeignService mallFeignService;
 
     @Override
     public BaseDAO<Integer, StudentGoodsSell> getDAO() {
@@ -146,6 +150,8 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
             return null;
         }
         List<Goods> goodies = goodsDao.getGoodiesAndCate(goodsIds);
+        List<ProductCategoryDto> productCategoryDtos = treeToList(mallFeignService.listWithChildren());
+        Map<Long, String> categoryIdNameMap = productCategoryDtos.stream().collect(Collectors.toMap(next -> next.getId(), next -> next.getName()));
         List<StudentInstrument> studentInstruments = new ArrayList<>();
         for (Goods goods : goodies) {
             StudentInstrument studentInstrument = new StudentInstrument();
@@ -153,7 +159,7 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
             studentInstrument.setOrganId(studentGoodsSell.getOrganId());
             studentInstrument.setGoodsId(goods.getId());
             studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
-            studentInstrument.setGoodsCategoryName(goods.getGoodsCategoryName());
+            studentInstrument.setGoodsCategoryName(categoryIdNameMap.getOrDefault(Long.valueOf(goods.getGoodsCategoryId()),""));
             studentInstrument.setGoodsName(goods.getName());
             studentInstrument.setGoodsBrand(goods.getBrand());
             studentInstrument.setSpecification(goods.getSpecification());
@@ -178,4 +184,21 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
         }
         return studentGoodsSell;
     }
+
+    public List<ProductCategoryDto> treeToList(List<ProductCategoryDto> categoryList) {
+        if (categoryList.isEmpty()) {
+            return new ArrayList<>();
+        }
+        List<ProductCategoryDto> result = new ArrayList<>();
+        categoryList.forEach(next -> {
+            result.add(next);
+            String name = next.getName();
+            List<ProductCategoryDto> children = next.getChildren();
+            if (!org.springframework.util.CollectionUtils.isEmpty(children)) {
+                children.forEach(c -> c.setName(name + "/" + c.getName()));
+                result.addAll(children);
+            }
+        });
+        return result;
+    }
 }

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java

@@ -5,9 +5,11 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.stream.Collectors;
 
+import com.ym.mec.mall.MallFeignService;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -447,7 +449,9 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
         List<Goods> goodies = goodsDao.getGoodsByBaseGoodsId(76);
         List<Integer> goodsIds = goodies.stream().map(Goods::getId).collect(Collectors.toList());
         List<StudentInstrument> oldStudentInstruments = studentInstrumentDao.getOldStudentInstrument(startTime, goodsIds);
+        Map<Integer, String> nameMap = goodsCategoryService.getNameMap();
         for (StudentInstrument oldStudentInstrument : oldStudentInstruments) {
+            oldStudentInstrument.setGoodsCategoryName(nameMap.getOrDefault(oldStudentInstrument.getGoodsCategoryId(),""));
             oldStudentInstrument.setChangeOrderId(oldStudentInstrument.getOrderId());
             if (oldStudentInstrument.getEndTime().compareTo(nowDate) > 0) {
                 oldStudentInstrument.setStatus(1);

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/GoodsCategoryMapper.xml

@@ -24,7 +24,7 @@
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="GoodsCategory">
-		SELECT * FROM goods_category WHERE id_ = #{id} 
+		SELECT * FROM goods_category WHERE id_ = #{id}
 	</select>
 
     <!-- 全查询 -->

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml

@@ -266,7 +266,7 @@
         spo.organ_id_,
         g.id_ goods_id_,
         g.goods_category_id_,
-        gc.name_ goods_category_name_,
+<!--        gc.name_ goods_category_name_,-->
         g.name_ goods_name_,
         g.brand_ goods_brand_,
         g.specification_,
@@ -278,7 +278,7 @@
         LEFT JOIN student_payment_order spo ON spo.id_ = spod.payment_order_id_
         LEFT JOIN student_payment_order_detail spod2 ON spod2.payment_order_id_ = spo.id_
         LEFT JOIN goods g ON g.id_ = spod2.goods_id_list_
-        LEFT JOIN goods_category gc on g.goods_category_id_ = gc.id_
+<!--        LEFT JOIN goods_category gc on g.goods_category_id_ = gc.id_-->
         WHERE spo.status_ = 'SUCCESS'
         AND spod2.type_ = 'MUSICAL'
         AND (

+ 11 - 2
mec-biz/src/main/resources/config/mybatis/SubjectGoodsMapperMapper.xml

@@ -89,11 +89,12 @@
     </select>
     <select id="querySubjectGoods" resultMap="querySubjectGoodsMap">
         SELECT sgc.*,g.type_ goods_type_,g.name_ goods_name_,g.id_ goods_id_ FROM
-        (SELECT s.name_ subject_name_,s.id_ subject_id_,gc.id_ goods_category_id_,gc.name_ goods_category_name_,
+        (SELECT s.name_ subject_name_,s.id_ subject_id_,sgm.goods_category_id_ goods_category_id_,
         sgm.goods_id_list_,sgm.id_ subject_goods_mapper_id_
         FROM subject_goods_mapper sgm
         LEFT JOIN `subject` s ON s.id_ = sgm.subject_id_
-        LEFT JOIN goods_category gc ON gc.id_ = sgm.goods_category_id_ <include refid="global.limit"/>) sgc
+<!--        LEFT JOIN goods_category gc ON gc.id_ = sgm.goods_category_id_ -->
+        <include refid="global.limit"/>) sgc
         LEFT JOIN goods g ON FIND_IN_SET(g.id_,sgc.goods_id_list_)
         where g.tenant_id_ = #{tenantId}
     </select>
@@ -109,4 +110,12 @@
             <result property="type" column="goods_type_"/>
         </collection>
     </resultMap>
+
+    <select id="queryByCategoryIds" resultMap="SubjectGoodsMapper">
+        select t.* from subject_goods_mapper t
+        where t.goods_category_id_ in
+        <foreach collection="categoryIdList" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
 </mapper>