瀏覽代碼

系统收费商品

zouxuan 4 年之前
父節點
當前提交
faa8337f05

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

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dto.GoodsSellDto;
 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.biz.dal.page.GoodsQuery;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
@@ -17,10 +18,10 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
     /**
      * 通过科目编号查询商品(教材、辅件)列表
      *
-     * @param subjectId
+     * @param goodsQuery
      * @return
      */
-    List<Goods> findGoodsBySubId(@Param("subjectId") Integer subjectId, @Param("type") String type,@Param("organId")Integer organId);
+    List<Goods> findGoodsBySubId(@Param("goodsQuery") GoodsQuery goodsQuery);
 
     /**
      * 根据商品分类查找商品数量

+ 93 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/GoodsQuery.java

@@ -0,0 +1,93 @@
+package com.ym.mec.biz.dal.page;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class GoodsQuery {
+
+    @ApiModelProperty(value = "商品类型", required = false)
+    private String type;
+
+    @ApiModelProperty(value = "客户端展示分部")
+    private Integer studentShowOrganId;
+
+    @ApiModelProperty(value = "教务端展示分部")
+    private Integer educationShowOrganId;
+
+    @ApiModelProperty(value = "课程收费团展示分部")
+    private Integer courseFeeShowOrganId;
+
+    @ApiModelProperty(value = "会员收费团展示分部")
+    private Integer memberFeeShowOrganId;
+
+    @ApiModelProperty(value = "乐器置换展示分部")
+    private Integer replacementShowOrganId;
+
+    @ApiModelProperty(value = "分部")
+    private Integer organId;
+
+    private Integer subjectId;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public Integer getStudentShowOrganId() {
+        return studentShowOrganId;
+    }
+
+    public void setStudentShowOrganId(Integer studentShowOrganId) {
+        this.studentShowOrganId = studentShowOrganId;
+    }
+
+    public Integer getEducationShowOrganId() {
+        return educationShowOrganId;
+    }
+
+    public void setEducationShowOrganId(Integer educationShowOrganId) {
+        this.educationShowOrganId = educationShowOrganId;
+    }
+
+    public Integer getCourseFeeShowOrganId() {
+        return courseFeeShowOrganId;
+    }
+
+    public void setCourseFeeShowOrganId(Integer courseFeeShowOrganId) {
+        this.courseFeeShowOrganId = courseFeeShowOrganId;
+    }
+
+    public Integer getMemberFeeShowOrganId() {
+        return memberFeeShowOrganId;
+    }
+
+    public void setMemberFeeShowOrganId(Integer memberFeeShowOrganId) {
+        this.memberFeeShowOrganId = memberFeeShowOrganId;
+    }
+
+    public Integer getReplacementShowOrganId() {
+        return replacementShowOrganId;
+    }
+
+    public void setReplacementShowOrganId(Integer replacementShowOrganId) {
+        this.replacementShowOrganId = replacementShowOrganId;
+    }
+}

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

@@ -46,6 +46,8 @@ public class GoodsQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "分部")
     private String organId;
 
+    private Integer subjectId;
+
     public String getOrganId() {
         return organId;
     }

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

@@ -5,6 +5,7 @@ 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.biz.dal.page.GoodsQuery;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -34,7 +35,7 @@ public interface GoodsService extends BaseService<Integer, Goods> {
      * @param subjectId
      * @return
      */
-    List<Goods> findGoodsBySubId(Integer subjectId,String type,Integer organId);
+    List<Goods> findGoodsBySubId(GoodsQuery goodsQuery);
 
     /**
      * 根据商品分类id查找商品数量

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

@@ -17,6 +17,7 @@ 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.GoodsQuery;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.util.collection.MapUtil;
@@ -176,8 +177,8 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	}
 
 	@Override
-	public List<Goods> findGoodsBySubId(Integer subjectId,String type,Integer organId) {
-		return goodsDao.findGoodsBySubId(subjectId,type,organId);
+	public List<Goods> findGoodsBySubId(GoodsQuery goodsQuery) {
+		return goodsDao.findGoodsBySubId(goodsQuery);
 	}
 
 	public int findGoodsNumByCategoryId(Integer goodsCategoryId){

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

@@ -360,13 +360,40 @@
     <select id="findGoodsBySubId" resultMap="Goods">
         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.type_ = #{type} and g.status_ != 0
-        <if test="organId != null">
-            AND FIND_IN_SET (#{organId},CONCAT_WS(",",replacement_show_organ_id_,member_fee_show_organ_id_,
-            course_fee_show_organ_id_,education_show_organ_id_,student_show_organ_id_))
-        </if>
+        <include refid="queryOrganIdSql"/>
     </select>
 
+    <sql id="queryOrganIdSql">
+        <where>
+                AND g.status_ != 0
+            <if test="goodsQuery.subjectId != null">
+                AND sgm.subject_id_ = #{goodsQuery.subjectId}
+            </if>
+            <if test="goodsQuery.type != null and goodsQuery.type != ''">
+                AND g.type_ = #{goodsQuery.type}
+            </if>
+            <if test="goodsQuery.studentShowOrganId != null">
+                AND FIND_IN_SET(#{goodsQuery.studentShowOrganId},g.student_show_organ_id_)
+            </if>
+            <if test="goodsQuery.educationShowOrganId != null">
+                AND FIND_IN_SET(#{goodsQuery.educationShowOrganId},g.education_show_organ_id_)
+            </if>
+            <if test="goodsQuery.courseFeeShowOrganId != null">
+                AND FIND_IN_SET(#{goodsQuery.courseFeeShowOrganId},g.course_fee_show_organ_id_)
+            </if>
+            <if test="goodsQuery.memberFeeShowOrganId!=null">
+                AND FIND_IN_SET(#{goodsQuery.memberFeeShowOrganId},g.member_fee_show_organ_id_)
+            </if>
+            <if test="goodsQuery.replacementShowOrganId!=null">
+                AND FIND_IN_SET(#{goodsQuery.replacementShowOrganId},g.replacement_show_organ_id_)
+            </if>
+            <if test="goodsQuery.organId != null">
+                AND FIND_IN_SET (#{goodsQuery.organId},CONCAT_WS(",",replacement_show_organ_id_,member_fee_show_organ_id_,
+                course_fee_show_organ_id_,education_show_organ_id_,student_show_organ_id_))
+            </if>
+        </where>
+    </sql>
+
     <!-- 根据 -->
     <select id="findGoodsNumByCategoryId" resultType="int">
         SELECT COUNT(*) FROM goods WHERE goods_category_id_ = #{goodsCategoryId}

+ 3 - 5
mec-web/src/main/java/com/ym/mec/web/controller/GoodsController.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.GoodsCategory;
 import com.ym.mec.biz.dal.entity.GoodsProcurement;
 import com.ym.mec.biz.dal.enums.AccountType;
+import com.ym.mec.biz.dal.page.GoodsQuery;
 import com.ym.mec.biz.service.GoodsCategoryService;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
@@ -154,10 +155,7 @@ public class GoodsController extends BaseController {
     @ApiOperation(value = "通过科目编号、商品分类 查询商品(教材、辅件)列表")
     @GetMapping("/queryGoodsBySubId")
     @PreAuthorize("@pcs.hasPermissions('goods/queryGoodsBySubId')")
-    @ApiImplicitParams({ @ApiImplicitParam(name = "subjectId", value = "科目编号", required = true, dataType = "Integer"),
-            @ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer"),
-            @ApiImplicitParam(name = "type", value = "INSTRUMENT 乐器, ACCESSORIES 教辅", required = true, dataType = "String")})
-    public Object findGoodsBySubId(Integer subjectId,String type,Integer organId){
-        return succeed(goodsService.findGoodsBySubId(subjectId,type,organId));
+    public Object findGoodsBySubId(GoodsQuery goodsQuery){
+        return succeed(goodsService.findGoodsBySubId(goodsQuery));
     }
 }