|  | @@ -41,6 +41,7 @@
 | 
	
		
			
				|  |  |          <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"/>
 | 
	
		
			
				|  |  | +        <result column="organ_id_list_" property="organIdList"/>
 | 
	
		
			
				|  |  |      </resultMap>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 根据主键查询一条记录 -->
 | 
	
	
		
			
				|  | @@ -63,20 +64,21 @@
 | 
	
		
			
				|  |  |          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_,course_view_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_,organ_id_list_)
 | 
	
		
			
				|  |  |          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},#{courseViewType})
 | 
	
		
			
				|  |  | +        #{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{courseViewType},#{organIdList})
 | 
	
		
			
				|  |  |      </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_,course_view_type_)
 | 
	
		
			
				|  |  | +        stock_count_,tax_stock_count_,client_show_,educational_show_,music_group_show_,replacement_show_,stock_warning_,stock_type_,course_view_type_,organ_id_list_)
 | 
	
		
			
				|  |  |          VALUES
 | 
	
		
			
				|  |  |          <foreach collection="list" separator="," item="goods">
 | 
	
		
			
				|  |  |              (#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
 | 
	
	
		
			
				|  | @@ -87,13 +89,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.courseViewType})
 | 
	
		
			
				|  |  | +            #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{goods.courseViewType},#{goods.organIdList})
 | 
	
		
			
				|  |  |          </foreach>
 | 
	
		
			
				|  |  |      </insert>
 | 
	
		
			
				|  |  |      <!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  |      <update id="update" parameterType="com.ym.mec.biz.dal.entity.Goods">
 | 
	
		
			
				|  |  |          UPDATE goods
 | 
	
		
			
				|  |  |          <set>
 | 
	
		
			
				|  |  | +            <if test="organIdList != null and organIdList != ''">
 | 
	
		
			
				|  |  | +                organ_id_list_ = #{organIdList},
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  |              <if test="courseViewType != null">
 | 
	
		
			
				|  |  |                  course_view_type_ = #{courseViewType},
 | 
	
		
			
				|  |  |              </if>
 | 
	
	
		
			
				|  | @@ -190,6 +195,9 @@
 | 
	
		
			
				|  |  |          <foreach collection="goodsList" item="goods" separator=";">
 | 
	
		
			
				|  |  |              UPDATE goods
 | 
	
		
			
				|  |  |              <set>
 | 
	
		
			
				|  |  | +                <if test="goods.organIdList != null and goods.organIdList != ''">
 | 
	
		
			
				|  |  | +                    organ_id_list_ = #{goods.organIdList},
 | 
	
		
			
				|  |  | +                </if>
 | 
	
		
			
				|  |  |                  <if test="goods.courseViewType != null">
 | 
	
		
			
				|  |  |                      course_view_type_ = #{goods.courseViewType},
 | 
	
		
			
				|  |  |                  </if>
 | 
	
	
		
			
				|  | @@ -304,6 +312,9 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <sql id="queryGoodsPageSql">
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  | +            <if test="organId != null">
 | 
	
		
			
				|  |  | +                AND FIND_IN_SET(#{organId},g.organ_id_list_)
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  |              <if test="goodsCategoryId != null">
 | 
	
		
			
				|  |  |                  AND g.goods_category_id_ = #{goodsCategoryId}
 | 
	
		
			
				|  |  |              </if>
 | 
	
	
		
			
				|  | @@ -350,6 +361,9 @@
 | 
	
		
			
				|  |  |          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},g.organ_id_list_)
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 根据 -->
 | 
	
	
		
			
				|  | @@ -418,6 +432,9 @@
 | 
	
		
			
				|  |  |          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
 | 
	
		
			
				|  |  | +        <if test="organId != null">
 | 
	
		
			
				|  |  | +            AND FIND_IN_SET(#{organId},g.organ_id_list_)
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  |          <if test="type!=null">
 | 
	
		
			
				|  |  |              AND g.type_ = #{type}
 | 
	
		
			
				|  |  |          </if>
 | 
	
	
		
			
				|  | @@ -430,6 +447,9 @@
 | 
	
		
			
				|  |  |          SELECT g.* FROM subject_goods_mapper sgm
 | 
	
		
			
				|  |  |          LEFT JOIN goods g ON sgm.goods_category_id_ = g.goods_category_id_
 | 
	
		
			
				|  |  |          WHERE FIND_IN_SET(sgm.subject_id_, #{subjectIds}) and g.status_ != 0
 | 
	
		
			
				|  |  | +        <if test="organId != null">
 | 
	
		
			
				|  |  | +            AND FIND_IN_SET(#{organId},g.organ_id_list_)
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  |          <if test="type!=null">
 | 
	
		
			
				|  |  |              AND g.type_ = #{type}
 | 
	
		
			
				|  |  |          </if>
 | 
	
	
		
			
				|  | @@ -484,6 +504,9 @@
 | 
	
		
			
				|  |  |              AND g.status_ != 0
 | 
	
		
			
				|  |  |              AND g.type_ = 'INSTRUMENT'
 | 
	
		
			
				|  |  |              AND gc.del_flag_ = 0
 | 
	
		
			
				|  |  | +            <if test="organId != null">
 | 
	
		
			
				|  |  | +                AND FIND_IN_SET(#{organId},g.organ_id_list_)
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  |              <if test="subjectId != null">
 | 
	
		
			
				|  |  |                  AND sgm.subject_id_ = #{subjectId}
 | 
	
		
			
				|  |  |              </if>
 |