浏览代码

商品新增乐团收费模式字段,乐团选择商品时关联

zouxuan 4 年之前
父节点
当前提交
7dad5577da

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

@@ -135,7 +135,7 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
      *
      * @return
      */
-    List<MusicGroupGoodsAndDiscountDto> getMusicGroupGoodsAndDiscount(@Param("subjectId") Integer subjectId, @Param("type") String type);
+    List<MusicGroupGoodsAndDiscountDto> getMusicGroupGoodsAndDiscount(@Param("subjectId") Integer subjectId, @Param("type") String type, @Param("courseViewType") Integer courseViewType);
 
     List<MusicGroupGoodsAndDiscountDto> getMusicGroupGoodsAndDiscountWithSubjects(@Param("subjectIds") String subjectIds, @Param("type") String type);
 

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

@@ -138,6 +138,9 @@ public class Goods {
 	@ApiModelProperty(value = "乐团是否展示")
 	private YesOrNoEnum musicGroupShow;
 
+	@ApiModelProperty(value = "乐团收费模式")
+	private String courseViewType;
+
 	@ApiModelProperty(value = "乐器置换是否展示")
 	private YesOrNoEnum replacementShow;
 
@@ -147,6 +150,14 @@ public class Goods {
 	@ApiModelProperty(value = "库存预警")
 	private YesOrNoEnum stockWarning;
 
+	public String getCourseViewType() {
+		return courseViewType;
+	}
+
+	public void setCourseViewType(String courseViewType) {
+		this.courseViewType = courseViewType;
+	}
+
 	public YesOrNoEnum getStockWarning() {
 		return stockWarning;
 	}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/GoodsQueryInfo.java

@@ -40,6 +40,16 @@ public class GoodsQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "乐器置换是否展示:0否,1是")
     private Integer replacementShow;
 
+    private String courseViewType;
+
+    public String getCourseViewType() {
+        return courseViewType;
+    }
+
+    public void setCourseViewType(String courseViewType) {
+        this.courseViewType = courseViewType;
+    }
+
     public Integer getGroupGoods() {
         return groupGoods;
     }

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

@@ -1,17 +1,13 @@
 package com.ym.mec.biz.service;
 
-import com.ym.mec.biz.dal.dto.GoodsBatchNoDto;
 import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.GoodsProcurement;
 import com.ym.mec.biz.dal.entity.SellOrder;
 import com.ym.mec.biz.dal.enums.AccountType;
 import com.ym.mec.common.service.BaseService;
-
 import org.apache.ibatis.annotations.Param;
 import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
 import java.util.List;
 
 public interface GoodsService extends BaseService<Integer, Goods> {

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

@@ -82,5 +82,5 @@ public interface MusicGroupSubjectPlanService extends BaseService<Integer, Music
      * @param chargeTypeId
      * @return
      */
-    List<MusicGroupGoodsAndDiscountDto> getSubjectGoods(Integer subjectId, String type, Integer chargeTypeId);
+    List<MusicGroupGoodsAndDiscountDto> getSubjectGoods(Integer subjectId, String type, Integer chargeTypeId,Integer courseViewType);
 }

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

@@ -233,8 +233,8 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
     }
 
     @Override
-    public List<MusicGroupGoodsAndDiscountDto> getSubjectGoods(Integer subjectId, String type, Integer chargeTypeId) {
-        List<MusicGroupGoodsAndDiscountDto> goodsList = goodsDao.getMusicGroupGoodsAndDiscount(subjectId, type);
+    public List<MusicGroupGoodsAndDiscountDto> getSubjectGoods(Integer subjectId, String type, Integer chargeTypeId,Integer courseViewType) {
+        List<MusicGroupGoodsAndDiscountDto> goodsList = goodsDao.getMusicGroupGoodsAndDiscount(subjectId, type,courseViewType);
         if (chargeTypeId == null || (type != null && !"INSTRUMENT".equals(type))) {
             return goodsList;
         }

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

@@ -40,6 +40,7 @@
         <result column="music_group_show_" property="musicGroupShow" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="replacement_show_" property="replacementShow" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="stock_warning_" property="stockWarning" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="course_view_type_" property="courseViewType"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -62,20 +63,20 @@
         INSERT INTO goods
         (goods_category_id_,sn_,name_,brand_,specification_,image_,stock_count_,tax_stock_count_,sell_count_,market_price_,
         discount_price_,group_purchase_price_,brief_,desc_,is_new_,is_top_,status_,memo_,publish_time_,
-        complement_goods_id_list_,update_time_,create_time_,type_,agree_cost_price_,client_show_,educational_show_,music_group_show_,replacement_show_,stock_warning_,stock_type_)
+        complement_goods_id_list_,update_time_,create_time_,type_,agree_cost_price_,client_show_,educational_show_,music_group_show_,replacement_show_,stock_warning_,stock_type_,course_view_type_)
         VALUES(#{goodsCategoryId},#{sn},#{name},#{brand},#{specification},#{image},#{stockCount},#{taxStockCount},#{sellCount},#{marketPrice},
         #{discountPrice},#{groupPurchasePrice},#{brief},#{desc},
         #{isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{memo},#{publishTime},#{complementGoodsIdList},now(),now(),#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{agreeCostPrice},
         #{clientShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{educationalShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{musicGroupShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{replacementShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
+        #{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{courseViewType})
     </insert>
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO goods
         (goods_category_id_,name_,brand_,specification_,image_,market_price_,
         discount_price_,group_purchase_price_,brief_,desc_,update_time_,create_time_,type_,agree_cost_price_,sn_,
-        stock_count_,tax_stock_count_,client_show_,educational_show_,music_group_show_,replacement_show_,stock_warning_,stock_type_)
+        stock_count_,tax_stock_count_,client_show_,educational_show_,music_group_show_,replacement_show_,stock_warning_,stock_type_,course_view_type_)
         VALUES
         <foreach collection="list" separator="," item="goods">
             (#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
@@ -86,13 +87,16 @@
         	#{goods.musicGroupShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         	#{goods.replacementShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{goods.stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
+            #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{goods.courseViewType})
         </foreach>
     </insert>
     <!-- 根据主键查询一条记录 -->
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.Goods">
         UPDATE goods
         <set>
+            <if test="courseViewType != null">
+                course_view_type_ = #{courseViewType},
+            </if>
             <if test="agreeCostPrice != null">
                 agree_cost_price_ = #{agreeCostPrice},
             </if>
@@ -186,6 +190,9 @@
         <foreach collection="goodsList" item="goods" separator=";">
             UPDATE goods
             <set>
+                <if test="goods.courseViewType != null">
+                    course_view_type_ = #{goods.courseViewType},
+                </if>
                 <if test="goods.agreeCostPrice != null">
                     agree_cost_price_ = #{goods.agreeCostPrice},
                 </if>
@@ -326,6 +333,9 @@
             </if>
             <if test="musicGroupShow!=null">
                 AND g.music_group_show_=#{musicGroupShow}
+                <if test="courseViewType != null">
+                    AND FIND_IN_SET(#{courseViewType},g.course_view_type_)
+                </if>
             </if>
             <if test="replacementShow!=null">
                 AND g.replacement_show_=#{replacementShow}
@@ -407,10 +417,13 @@
     <select id="getMusicGroupGoodsAndDiscount" resultMap="MusicGroupGoods">
         SELECT g.* FROM subject_goods_mapper sgm
         LEFT JOIN goods g ON sgm.goods_category_id_ = g.goods_category_id_
-        WHERE sgm.subject_id_ = #{subjectId} AND g.music_group_show_=1 AND g.status_ != 0
+        WHERE sgm.subject_id_ = #{subjectId} AND g.music_group_show_ = 1 AND g.status_ != 0
         <if test="type!=null">
             AND g.type_ = #{type}
         </if>
+        <if test="courseViewType != null">
+            AND FIND_IN_SET(g.course_view_type_ = #{courseViewType})
+        </if>
     </select>
 
     <select id="getMusicGroupGoodsAndDiscountWithSubjects" resultMap="MusicGroupGoods">

+ 4 - 3
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupSubjectPlanController.java

@@ -73,15 +73,16 @@ public class MusicGroupSubjectPlanController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('musicGroupSubjectPlan/getSubjectGoods')")
     @ApiImplicitParams({ @ApiImplicitParam(name = "subjectId", value = "科目编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "type", value = "INSTRUMENT 乐器, ACCESSORIES 教辅", required = true, dataType = "String"),
-            @ApiImplicitParam(name = "chargeTypeId", value = "收费模式id", required = true, dataType = "Integer")
+            @ApiImplicitParam(name = "chargeTypeId", value = "收费模式id", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "courseViewType", value = "收费模式", required = true, dataType = "Integer")
     })
-    public HttpResponseResult getSubjectGoods(String subjectIds, String type, Integer chargeTypeId) {
+    public HttpResponseResult getSubjectGoods(String subjectIds, String type, Integer chargeTypeId,Integer courseViewType) {
         if(StringUtils.isBlank(subjectIds)){
             return succeed();
         }
         Map<String, List<MusicGroupGoodsAndDiscountDto>> result = new HashMap<>();
         for (String subjectIdStr : subjectIds.split(",")) {
-            result.put(subjectIdStr, musicGroupSubjectPlanService.getSubjectGoods(Integer.valueOf(subjectIdStr), type, chargeTypeId));
+            result.put(subjectIdStr, musicGroupSubjectPlanService.getSubjectGoods(Integer.valueOf(subjectIdStr), type, chargeTypeId,courseViewType));
         }
         return succeed(result);
     }