Browse Source

add: 乐团获取乐器接口

周箭河 5 years ago
parent
commit
13452187ac

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

@@ -11,6 +11,7 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
 
     /**
      * 通过科目编号查询商品(教材、辅件)列表
+     *
      * @param subjectId
      * @return
      */
@@ -18,8 +19,18 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
 
     /**
      * 根据商品分类查找商品数量
+     *
      * @param goodsCategoryId
      * @return
      */
     int findGoodsNumByCategoryId(@Param("goodsCategoryId") Integer goodsCategoryId);
+
+    /**
+     * 根据ids获取商品信息
+     *
+     * @param ids
+     * @return
+     */
+    List<Goods> findGoodsByIds(@Param("ids") String ids);
+
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupSubjectGoodsGroupDao.java

@@ -22,5 +22,5 @@ public interface MusicGroupSubjectGoodsGroupDao extends BaseDAO<Long, MusicGroup
      * @param subId
      * @return
      */
-    List<MusicGroupSubjectGoodsGroup> findGoodsGroup(@Param("musicGroupId") Integer musicGroupId, @Param("subId") String subId);
+    List<MusicGroupSubjectGoodsGroup> findGoodsGroup(@Param("musicGroupId") Integer musicGroupId, @Param("subId") Integer subId);
 }

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupSubjectGoodsAndInfo.java

@@ -0,0 +1,34 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 乐团报名缴费相关信息
+ */
+public class MusicGroupSubjectGoodsAndInfo {
+
+    //课程信息
+    private Map CourseScheduleInfo;
+
+    //乐团声部商品信息
+    private List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroupList;
+
+    public Map getCourseScheduleInfo() {
+        return CourseScheduleInfo;
+    }
+
+    public void setCourseScheduleInfo(Map courseScheduleInfo) {
+        CourseScheduleInfo = courseScheduleInfo;
+    }
+
+    public List<MusicGroupSubjectGoodsGroup> getMusicGroupSubjectGoodsGroupList() {
+        return musicGroupSubjectGoodsGroupList;
+    }
+
+    public void setMusicGroupSubjectGoodsGroupList(List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroupList) {
+        this.musicGroupSubjectGoodsGroupList = musicGroupSubjectGoodsGroupList;
+    }
+}

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java

@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * 对应数据库表(goods):
@@ -92,6 +93,9 @@ public class Goods {
 	/** 发布时间 */
 	@ApiModelProperty(value = "附件商品列表编号(用逗号分开)",required = false)
 	private String complementGoodsIdList;
+
+	/** 辅件列表 */
+	private List<Goods> goodsList;
 	
 	/** 创建时间 */
 	private java.util.Date createTime;
@@ -274,6 +278,14 @@ public class Goods {
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
+
+	public List<Goods> getGoodsList() {
+		return goodsList;
+	}
+
+	public void setGoodsList(List<Goods> goodsList) {
+		this.goodsList = goodsList;
+	}
 			
 	@Override
 	public String toString() {

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupSubjectGoodsGroup.java

@@ -39,6 +39,8 @@ public class MusicGroupSubjectGoodsGroup {
 
 	@ApiModelProperty(value = "商品名称列表",required = false)
 	private List<String> goodsName;
+
+	private List<Goods> goodsList;
 	
 	/**  */
 	private java.util.Date createTime;
@@ -135,4 +137,11 @@ public class MusicGroupSubjectGoodsGroup {
 		return ToStringBuilder.reflectionToString(this);
 	}
 
+	public List<Goods> getGoodsList() {
+		return goodsList;
+	}
+
+	public void setGoodsList(List<Goods> goodsList) {
+		this.goodsList = goodsList;
+	}
 }

+ 10 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -11,16 +11,25 @@ public interface GoodsService extends BaseService<Integer, Goods> {
 
     /**
      * 通过科目编号查询商品(教材、辅件)列表
+     *
      * @param subjectId
      * @return
      */
-    List<Goods> findGoodsBySubId(Integer subjectId,Integer goodsCategoryId);
+    List<Goods> findGoodsBySubId(Integer subjectId, Integer goodsCategoryId);
 
     /**
      * 根据商品分类id查找商品数量
+     *
      * @param goodsCategoryId
      * @return
      */
     int findGoodsNumByCategoryId(@Param("goodsCategoryId") Integer goodsCategoryId);
 
+    /**
+     * 根据ids获取商品信息
+     * @param ids
+     * @return
+     */
+    List<Goods> findGoodsByIds(String ids);
+
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupSubjectGoodsGroupService.java

@@ -3,6 +3,16 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
 import com.ym.mec.common.service.BaseService;
 
+import java.util.List;
+
 public interface MusicGroupSubjectGoodsGroupService extends BaseService<Long, MusicGroupSubjectGoodsGroup> {
 
+    /**
+     * 获取乐团声部对应的商品
+     * @param musicGroupId
+     * @param subId
+     * @return
+     */
+    List<MusicGroupSubjectGoodsGroup> findGoodsGroup(Integer musicGroupId, Integer subId);
+
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupSubjectPlanService.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfo;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
 import com.ym.mec.common.service.BaseService;
 
@@ -16,4 +17,13 @@ public interface MusicGroupSubjectPlanService extends BaseService<Integer, Music
      */
     List<MusicGroupSubjectPlan> getMusicSubjectClassPlan(@Param("musicGroupId") int musicGroupId);
 
+
+    /**
+     * 获取乐团声部报名缴费商品信息
+     * @param musicGroupId
+     * @param subjectId
+     * @return
+     */
+    MusicGroupSubjectGoodsAndInfo getSubjectGoodsAndInfo(Integer musicGroupId, Integer subjectId);
+
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SubjectService.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.SubjectApplyDetailDto;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SubjectGoodsMapper;
 import com.ym.mec.biz.dal.page.SubjectQueryInfo;
@@ -15,6 +16,7 @@ public interface SubjectService extends BaseService<Integer, Subject> {
 
     /**
      * 通过乐团编号查询科目列表
+     *
      * @param musicGroupId
      * @return
      */
@@ -22,6 +24,7 @@ public interface SubjectService extends BaseService<Integer, Subject> {
 
     /**
      * 分页查询科目树状列表
+     *
      * @param queryInfo
      * @return
      */
@@ -29,6 +32,7 @@ public interface SubjectService extends BaseService<Integer, Subject> {
 
     /**
      * 通过乐团收费类型,获取默认的声部列表
+     *
      * @param musicGroupId
      * @return
      */
@@ -36,6 +40,7 @@ public interface SubjectService extends BaseService<Integer, Subject> {
 
     /**
      * 通过乐团编号获取声部列表以及声部报名、缴费、计划人数
+     *
      * @param musicGroupId
      * @return
      */
@@ -43,12 +48,14 @@ public interface SubjectService extends BaseService<Integer, Subject> {
 
     /**
      * 修改、新增科目树状列表
+     *
      * @param subject
      */
     void upSetSubject(Subject subject);
 
     /**
      * 修改、保存声部与乐器关联
+     *
      * @param subjectGoodsMappers
      */
     void markGoods(List<SubjectGoodsMapper> subjectGoodsMappers);

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -30,4 +30,9 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	public int findGoodsNumByCategoryId(Integer goodsCategoryId){
 		return goodsDao.findGoodsNumByCategoryId(goodsCategoryId);
 	}
+
+	@Override
+	public List<Goods> findGoodsByIds(String ids) {
+		return goodsDao.findGoodsByIds(ids);
+	}
 }

+ 7 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectGoodsGroupServiceImpl.java

@@ -9,6 +9,8 @@ import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
+import java.util.List;
+
 @Service
 public class MusicGroupSubjectGoodsGroupServiceImpl extends BaseServiceImpl<Long, MusicGroupSubjectGoodsGroup>  implements MusicGroupSubjectGoodsGroupService {
 	
@@ -19,5 +21,9 @@ public class MusicGroupSubjectGoodsGroupServiceImpl extends BaseServiceImpl<Long
 	public BaseDAO<Long, MusicGroupSubjectGoodsGroup> getDAO() {
 		return musicGroupSubjectGoodsGroupDao;
 	}
-	
+
+	@Override
+    public List<MusicGroupSubjectGoodsGroup> findGoodsGroup(Integer musicGroupId, Integer subId) {
+        return musicGroupSubjectGoodsGroupDao.findGoodsGroup(musicGroupId, subId);
+    }
 }

+ 38 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -1,17 +1,24 @@
 package com.ym.mec.biz.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfo;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
+import com.ym.mec.biz.dal.enums.GoodsType;
+import com.ym.mec.biz.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
-import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, MusicGroupSubjectPlan> implements MusicGroupSubjectPlanService {
@@ -22,6 +29,15 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
     @Autowired
 	private StudentRegistrationService studentRegistrationService;
 
+    @Autowired
+    private GoodsService goodsService;
+
+    @Autowired
+    private MusicGroupSubjectGoodsGroupService musicGroupSubjectGoodsGroupService;
+
+    @Autowired
+    private MusicGroupService musicGroupService;
+
     @Override
     public BaseDAO<Integer, MusicGroupSubjectPlan> getDAO() {
         return musicGroupSubjectPlanDao;
@@ -36,4 +52,24 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 		}
         return musicSubjectClassPlans;
     }
+
+    @Override
+    public MusicGroupSubjectGoodsAndInfo getSubjectGoodsAndInfo(Integer musicGroupId, Integer subjectId) {
+        MusicGroup musicGroup = musicGroupService.get(musicGroupId.toString());
+
+        Map<String,Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
+
+        List<MusicGroupSubjectGoodsGroup> goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroup(musicGroupId, subjectId);
+        goodsGroups.forEach(goodsGroup -> {
+            if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
+                goodsGroup.getGoodsList().forEach(goods -> {
+                    goods.setGoodsList(goodsService.findGoodsByIds(goods.getComplementGoodsIdList()));
+                });
+            }
+        });
+        MusicGroupSubjectGoodsAndInfo musicGroupSubjectGoodsAndInfo = new MusicGroupSubjectGoodsAndInfo();
+        musicGroupSubjectGoodsAndInfo.setMusicGroupSubjectGoodsGroupList(goodsGroups);
+        musicGroupSubjectGoodsAndInfo.setCourseScheduleInfo(courseForm);
+        return musicGroupSubjectGoodsAndInfo;
+    }
 }

+ 92 - 92
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java

@@ -20,106 +20,106 @@ import java.util.Date;
 import java.util.List;
 
 @Service
-public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject>  implements SubjectService {
-
-	@Autowired
-	private SubjectDao subjectDao;
-	@Autowired
-	private StudentRegistrationDao studentRegistrationDao;
-	@Autowired
-	private SubjectGoodsMapperDao subjectGoodsMapperDao;
-
-	@Override
-	public BaseDAO<Integer, Subject> getDAO() {
-		return subjectDao;
-	}
-
-	@Override
-	public List<Subject> findSubByMusicGroupId(Integer musicGroupId) {
-		return subjectDao.findSubByMusicGroupId(musicGroupId);
-	}
-
-	@Override
-	public PageInfo<Subject> queryPageTree(SubjectQueryInfo queryInfo) {
-		PageInfo<Subject> pageInfo = queryPage(queryInfo);
-		for (Subject subject:pageInfo.getRows()) {
-			subject = getTree(subject,queryInfo.getDelFlag());
-		}
-		return pageInfo;
-	}
-
-	@Override
-	public List<Subject> findDefaultSubByGroupId(Integer musicGroupId) {
-		return subjectDao.findDefaultSubByGroupId(musicGroupId);
-	}
-
-	@Override
-	public List<SubjectApplyDetailDto> findSubApplyDetail(Integer musicGroupId) {
-		List<SubjectApplyDetailDto> subApplyDetail = subjectDao.findSubApplyDetail(musicGroupId);
-		subApplyDetail.forEach(detail ->{
-			detail.setPayNum(studentRegistrationDao.countPayNum(musicGroupId,detail.getSubjectId()));
-		});
-		return subApplyDetail;
-	}
-
-	@Override
-	public void upSetSubject(Subject subject) {
-		Integer parentId = upset(subject, null);
-		List<Subject> subjects = subject.getSubjects();
-		if(subjects != null && subjects.size() > 0){
-			subjects.forEach(e->{
-				upset(e, parentId);
-			});
-		}
-	}
-
-	@Override
-	public void markGoods(List<SubjectGoodsMapper> subjectGoodsMappers) {
-		subjectGoodsMappers.forEach(e->{
+public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implements SubjectService {
+
+    @Autowired
+    private SubjectDao subjectDao;
+    @Autowired
+    private StudentRegistrationDao studentRegistrationDao;
+    @Autowired
+    private SubjectGoodsMapperDao subjectGoodsMapperDao;
+
+    @Override
+    public BaseDAO<Integer, Subject> getDAO() {
+        return subjectDao;
+    }
+
+    @Override
+    public List<Subject> findSubByMusicGroupId(Integer musicGroupId) {
+        return subjectDao.findSubByMusicGroupId(musicGroupId);
+    }
+
+    @Override
+    public PageInfo<Subject> queryPageTree(SubjectQueryInfo queryInfo) {
+        PageInfo<Subject> pageInfo = queryPage(queryInfo);
+        for (Subject subject : pageInfo.getRows()) {
+            subject = getTree(subject, queryInfo.getDelFlag());
+        }
+        return pageInfo;
+    }
+
+    @Override
+    public List<Subject> findDefaultSubByGroupId(Integer musicGroupId) {
+        return subjectDao.findDefaultSubByGroupId(musicGroupId);
+    }
+
+    @Override
+    public List<SubjectApplyDetailDto> findSubApplyDetail(Integer musicGroupId) {
+        List<SubjectApplyDetailDto> subApplyDetail = subjectDao.findSubApplyDetail(musicGroupId);
+        subApplyDetail.forEach(detail -> {
+            detail.setPayNum(studentRegistrationDao.countPayNum(musicGroupId, detail.getSubjectId()));
+        });
+        return subApplyDetail;
+    }
+
+    @Override
+    public void upSetSubject(Subject subject) {
+        Integer parentId = upset(subject, null);
+        List<Subject> subjects = subject.getSubjects();
+        if (subjects != null && subjects.size() > 0) {
+            subjects.forEach(e -> {
+                upset(e, parentId);
+            });
+        }
+    }
+
+    @Override
+    public void markGoods(List<SubjectGoodsMapper> subjectGoodsMappers) {
+        subjectGoodsMappers.forEach(e -> {
             upsetGoods(e);
         });
-	}
+    }
 
-	private void upsetGoods(SubjectGoodsMapper subjectGoodsMapper){
-        if(subjectGoodsMapper.getId() != null){
-            if(subjectGoodsMapper.getDelFlag()){
+    private void upsetGoods(SubjectGoodsMapper subjectGoodsMapper) {
+        if (subjectGoodsMapper.getId() != null) {
+            if (subjectGoodsMapper.getDelFlag()) {
                 subjectGoodsMapperDao.delete(subjectGoodsMapper.getId());
                 return;
             }
             subjectGoodsMapper.setUpdateTime(new Date());
             subjectGoodsMapperDao.update(subjectGoodsMapper);
-        }else {
+        } else {
             subjectGoodsMapperDao.insert(subjectGoodsMapper);
         }
-	}
-
-
-	private Integer upset(Subject subject,Integer parentId){
-		if(parentId != null){
-			subject.setParentSubjectId(parentId);
-		}
-		if(subject.getId() != null){
-			subject.setUpdateTime(new Date());
-			subjectDao.update(subject);
-		}else {
-			subjectDao.insert(subject);
-		}
-		return subject.getId();
-	}
-
-	private Subject getTree(Subject sub,YesOrNoEnum yesOrNoEnum){
-		//得到根节点对象
-		//获取子节点list
-		List<Subject> subjects = subjectDao.findByParentId(sub.getCode(),yesOrNoEnum);
-		//如果存在子节点
-		if(subjects != null && subjects.size() > 0) {
-			//将子节点list放入父节点对象
-			sub.setSubjects(subjects);
-			//遍历子节点....
-			for (Subject subject : subjects) {
-				getTree(subject,yesOrNoEnum);
-			}
-		}
-		return sub;
-	}
+    }
+
+
+    private Integer upset(Subject subject, Integer parentId) {
+        if (parentId != null) {
+            subject.setParentSubjectId(parentId);
+        }
+        if (subject.getId() != null) {
+            subject.setUpdateTime(new Date());
+            subjectDao.update(subject);
+        } else {
+            subjectDao.insert(subject);
+        }
+        return subject.getId();
+    }
+
+    private Subject getTree(Subject sub, YesOrNoEnum yesOrNoEnum) {
+        //得到根节点对象
+        //获取子节点list
+        List<Subject> subjects = subjectDao.findByParentId(sub.getCode(), yesOrNoEnum);
+        //如果存在子节点
+        if (subjects != null && subjects.size() > 0) {
+            //将子节点list放入父节点对象
+            sub.setSubjects(subjects);
+            //遍历子节点....
+            for (Subject subject : subjects) {
+                getTree(subject, yesOrNoEnum);
+            }
+        }
+        return sub;
+    }
 }

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

@@ -143,4 +143,7 @@
     <select id="findGoodsNumByCategoryId" resultType="int">
         SELECT COUNT(*) FROM goods WHERE goods_category_id_ = #{goodsCategoryId}
     </select>
+    <select id="findGoodsByIds" resultMap="Goods">
+        SELECT * FROM goods WHERE FIND_IN_SET(id_,#{ids})
+    </select>
 </mapper>

+ 89 - 90
mec-biz/src/main/resources/config/mybatis/MusicGroupSubjectGoodsGroupMapper.xml

@@ -3,106 +3,105 @@
 <!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
 <mapper namespace="com.ym.mec.biz.dal.dao.MusicGroupSubjectGoodsGroupDao">
 
-	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup"
-		id="MusicGroupSubjectGoodsGroup">
-		<result column="id_" property="id" />
-		<result column="name_" property="name" />
-		<result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
-		<result column="music_group_id_" property="musicGroupId" />
-		<result column="subject_id_" property="subjectId" />
-		<result column="goods_id_list_" property="goodsIdList" />
-		<result column="create_time_" property="createTime" />
-		<result column="update_time_" property="updateTime" />
-		<result column="price_" property="price" />
-	</resultMap>
+    <resultMap type="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup"
+               id="MusicGroupSubjectGoodsGroup">
+        <result column="id_" property="id"/>
+        <result column="name_" property="name"/>
+        <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="music_group_id_" property="musicGroupId"/>
+        <result column="subject_id_" property="subjectId"/>
+        <result column="goods_id_list_" property="goodsIdList"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+        <result column="price_" property="price"/>
+    </resultMap>
 
-	<!-- 根据主键查询一条记录 -->
-	<select id="get" resultMap="MusicGroupSubjectGoodsGroup">
-		SELECT
-		* FROM music_group_subject_goods_group WHERE id_ = #{id}
-	</select>
+    <!-- 根据主键查询一条记录 -->
+    <select id="get" resultMap="MusicGroupSubjectGoodsGroup">
+        SELECT
+        * FROM music_group_subject_goods_group WHERE id_ = #{id}
+    </select>
 
-	<!-- 全查询 -->
-	<select id="findAll" resultMap="MusicGroupSubjectGoodsGroup">
-		SELECT * FROM
-		music_group_subject_goods_group ORDER BY id_
-	</select>
+    <!-- 全查询 -->
+    <select id="findAll" resultMap="MusicGroupSubjectGoodsGroup">
+        SELECT *
+        FROM music_group_subject_goods_group
+        ORDER BY id_
+    </select>
 
-	<!-- 向数据库增加一条记录 -->
-	<insert id="insert"
-		parameterType="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup"
-		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO music_group_subject_goods_group
-		(id_,name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_)
-		VALUES(#{id},#{name},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{subjectId},#{goodsIdList},NOW(),NOW(),#{price})
-	</insert>
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insert"
+            parameterType="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup"
+            useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+        INSERT INTO music_group_subject_goods_group
+        (id_,name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_)
+        VALUES(#{id},#{name},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{subjectId},#{goodsIdList},NOW(),NOW(),#{price})
+    </insert>
 
     <insert id="batchInsert" parameterType="java.util.List">
-		INSERT INTO music_group_subject_goods_group (id_,name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_) VALUES
-		<foreach collection="mappers" item="item" index="index" separator=",">
-			VALUES(#{item.id},#{item.name},#{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.musicGroupId},#{item.subjectId},#{item.goodsIdList},NOW(),NOW(),#{item.price})
-		</foreach>
-	</insert>
+        INSERT INTO music_group_subject_goods_group
+        (id_,name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_) VALUES
+        <foreach collection="mappers" item="item" index="index" separator=",">
+            VALUES(#{item.id},#{item.name},#{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.musicGroupId},#{item.subjectId},#{item.goodsIdList},NOW(),NOW(),#{item.price})
+        </foreach>
+    </insert>
 
     <!-- 根据主键查询一条记录 -->
-	<update id="update"
-		parameterType="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup">
-		UPDATE music_group_subject_goods_group
-		<set>
-			<if test="price != null">
-				price_ = #{price},
-			</if>
-			<if test="subjectId != null">
-				subject_id_ = #{subjectId},
-			</if>
-			<if test="goodsIdList != null">
-				goods_id_list_ = #{goodsIdList},
-			</if>
-			<if test="updateTime != null">
-				update_time_ = #{updateTime},
-			</if>
-			<if test="type != null">
-				type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-			</if>
-			<if test="musicGroupId != null">
-				music_group_id_ = #{musicGroupId},
-			</if>
-			<if test="name != null">
-				name_ = #{name},
-			</if>
-		</set>
-		WHERE id_ = #{id}
-	</update>
+    <update id="update"
+            parameterType="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup">
+        UPDATE music_group_subject_goods_group
+        <set>
+            <if test="price != null">
+                price_ = #{price},
+            </if>
+            <if test="subjectId != null">
+                subject_id_ = #{subjectId},
+            </if>
+            <if test="goodsIdList != null">
+                goods_id_list_ = #{goodsIdList},
+            </if>
+            <if test="updateTime != null">
+                update_time_ = #{updateTime},
+            </if>
+            <if test="type != null">
+                type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="musicGroupId != null">
+                music_group_id_ = #{musicGroupId},
+            </if>
+            <if test="name != null">
+                name_ = #{name},
+            </if>
+        </set>
+        WHERE id_ = #{id}
+    </update>
 
-	<!-- 根据主键删除一条记录 -->
-	<delete id="delete">
-		DELETE FROM music_group_subject_goods_group
-		WHERE id_ = #{id}
-	</delete>
+    <!-- 根据主键删除一条记录 -->
+    <delete id="delete">
+        DELETE FROM music_group_subject_goods_group
+        WHERE id_ = #{id}
+    </delete>
 
-	<!-- 分页查询 -->
-	<select id="queryPage" resultMap="MusicGroupSubjectGoodsGroup"
-		parameterType="map">
-		SELECT * FROM music_group_subject_goods_group ORDER BY id_
-		<include refid="global.limit" />
-	</select>
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="MusicGroupSubjectGoodsGroup"
+            parameterType="map">
+        SELECT * FROM music_group_subject_goods_group ORDER BY id_
+        <include refid="global.limit"/>
+    </select>
 
-	<!-- 查询当前表的总记录数 -->
-	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM
-		music_group_subject_goods_group
-	</select>
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*)
+        FROM music_group_subject_goods_group
+    </select>
 
-	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup" id="findGoodsGroupMap">
-		<result column="name_" property="name" />
-		<result column="type_" property="type" />
-		<result column="price_" property="price" />
-		<result column="id_" property="id" />
-		<collection property="goodsName" column="goods_name_" ofType="java.lang.String" javaType="java.util.List"/>
-	</resultMap>
+    <resultMap type="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup" extends="MusicGroupSubjectGoodsGroup" id="findGoodsGroupMap">
+        <collection property="goodsList" resultMap="com.ym.mec.biz.dal.dao.GoodsDao.Goods" columnPrefix="g_" />
+    </resultMap>
     <select id="findGoodsGroup" resultMap="findGoodsGroupMap">
-		SELECT mgs.name_,mgs.type_,mgs.price_,g.name_ goods_name_,mgs.id_ FROM music_group_subject_goods_group mgs
-		LEFT JOIN goods g ON g.id_ IN (mgs.goods_id_list_)
-		WHERE mgs.music_group_id_ = #{musicGroupId} AND mgs.subject_id_ = #{subId}
-	</select>
+        SELECT mgs.*, g.id_ g_id_,g.name_ g_name_,g.market_price_  g_market_price_,g.complement_goods_id_list_ g_complement_goods_id_list_
+        FROM music_group_subject_goods_group mgs,goods g
+        WHERE FIND_IN_SET (g.id_ ,mgs.goods_id_list_)
+        AND mgs.music_group_id_ = #{musicGroupId} AND mgs.subject_id_ = #{subId}
+    </select>
 </mapper>

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -22,7 +22,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
-		http.csrf().disable().authorizeRequests().antMatchers("/v2/api-docs", "/register/findSubByMusicGroupId").permitAll().anyRequest().authenticated().and().httpBasic();
+		http.csrf().disable().authorizeRequests().antMatchers("/v2/api-docs", "/register/findSubByMusicGroupId","/register/findGoodsGroups").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 25 - 0
mec-student/src/main/java/com/ym/mec/student/controller/RegisterController.java

@@ -1,7 +1,14 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfo;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.common.controller.BaseController;
@@ -12,6 +19,9 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 @RequestMapping("register")
 @Api(tags = "乐团注册")
 @RestController
@@ -21,6 +31,10 @@ public class RegisterController extends BaseController {
     private StudentRegistrationService studentRegistrationService;
     @Autowired
     private SubjectService subjectService;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
+    @Resource
+    private SysUserFeignService sysUserFeignService;
 
 
     @ApiOperation(value = "新增学生报名信息")
@@ -36,4 +50,15 @@ public class RegisterController extends BaseController {
     public Object findSubByMusicGroupId(Integer musicGroupId) {
         return succeed(subjectService.findSubByMusicGroupId(musicGroupId));
     }
+
+
+    @ApiOperation(value = "获取乐团声部的乐器和辅件")
+    @GetMapping("/findGoodsGroups")
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer")})
+    public Object findGoodsGroups(Integer musicGroupId) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        MusicGroupSubjectGoodsAndInfo subjectGoodsAndInfo = musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, 1);
+        return succeed(subjectGoodsAndInfo);
+    }
+
 }