Selaa lähdekoodia

系统收费商品分部

zouxuan 4 vuotta sitten
vanhempi
commit
65a4c5ecf6

+ 0 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java

@@ -5,7 +5,6 @@ import com.ym.mec.biz.dal.dto.MusicGroupGoodsAndDiscountDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.ReplacementInstrument;
 import com.ym.mec.common.dal.BaseDAO;
-
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -15,8 +14,6 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
 
     Goods lock(@Param("goodsId") Integer goodsId);
 
-    Goods getDetail(@Param("goodsId") Integer goodsId);
-
     /**
      * 通过科目编号查询商品(教材、辅件)列表
      *

+ 21 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -15,6 +15,8 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.util.collection.MapUtil;
@@ -33,11 +35,6 @@ import org.springframework.web.multipart.MultipartFile;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.ym.mec.biz.dal.dao.GoodsDao;
-import com.ym.mec.biz.dal.dao.GoodsProcurementDao;
-import com.ym.mec.biz.dal.dao.SellOrderDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.entity.Goods;
@@ -82,6 +79,8 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	private TeacherDao teacherDao;
 	@Autowired
 	private SellOrderDao sellOrderDao;
+	@Autowired
+	private OrganizationDao organizationDao;
 
 	@Override
 	public BaseDAO<Integer, Goods> getDAO() {
@@ -676,6 +675,22 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 
 	@Override
 	public Goods getDetail(Integer goodsId) {
-		return goodsDao.getDetail(goodsId);
+		Goods goods = goodsDao.get(goodsId);
+		if(StringUtils.isNotEmpty(goods.getStudentShowOrganId())){
+			goods.setStudentShowOrganName(StringUtils.join(organizationDao.findByOrganIds(goods.getStudentShowOrganId()),","));
+		}
+		if(StringUtils.isNotEmpty(goods.getEducationShowOrganId())){
+			goods.setEducationShowOrganName(StringUtils.join(organizationDao.findByOrganIds(goods.getEducationShowOrganId()),","));
+		}
+		if(StringUtils.isNotEmpty(goods.getReplacementShowOrganId())){
+			goods.setReplacementShowOrganName(StringUtils.join(organizationDao.findByOrganIds(goods.getReplacementShowOrganId()),","));
+		}
+		if(StringUtils.isNotEmpty(goods.getCourseFeeShowOrganId())){
+			goods.setCourseFeeShowOrganName(StringUtils.join(organizationDao.findByOrganIds(goods.getCourseFeeShowOrganId()),","));
+		}
+		if(StringUtils.isNotEmpty(goods.getMemberFeeShowOrganId())){
+			goods.setMemberFeeShowOrganName(StringUtils.join(organizationDao.findByOrganIds(goods.getMemberFeeShowOrganId()),","));
+		}
+		return goods;
 	}
 }

+ 0 - 18
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -54,24 +54,6 @@
 		WHERE g.id_ = #{id}
 	</select>
 
-    <!-- 根据主键查询一条记录 -->
-    <select id="getDetail" resultMap="Goods" useCache="false" flushCache="true">
-        SELECT g.*,GROUP_CONCAT(o.name_) student_show_organ_name_,
-               GROUP_CONCAT(o1.name_) education_show_organ_name_,
-               GROUP_CONCAT(o2.name_) replacement_show_organ_name_,
-               GROUP_CONCAT(o3.name_) course_fee_show_organ_name_,
-               GROUP_CONCAT(o4.name_) member_fee_show_organ_name_
-
-        FROM goods g
-                 LEFT JOIN organization o ON FIND_IN_SET(o.id_,g.student_show_organ_id_)
-                 LEFT JOIN organization o1 ON FIND_IN_SET(o1.id_,g.education_show_organ_id_)
-                 LEFT JOIN organization o2 ON FIND_IN_SET(o2.id_,g.replacement_show_organ_id_)
-                 LEFT JOIN organization o3 ON FIND_IN_SET(o3.id_,g.course_fee_show_organ_id_)
-                 LEFT JOIN organization o4 ON FIND_IN_SET(o4.id_,g.member_fee_show_organ_id_)
-		WHERE g.id_ = #{id}
-        GROUP BY g.id_
-	</select>
-
     <select id="lock" resultMap="Goods" useCache="false" flushCache="true">
 		SELECT * FROM goods WHERE id_ = #{goodsId} LOCK IN SHARE MODE
 	</select>