|  | @@ -40,8 +40,6 @@
 | 
	
		
			
				|  |  |          <result column="student_show_organ_name_" property="studentShowOrganName"/>
 | 
	
		
			
				|  |  |          <result column="education_show_organ_id_" property="educationShowOrganId"/>
 | 
	
		
			
				|  |  |          <result column="education_show_organ_name_" property="educationShowOrganName"/>
 | 
	
		
			
				|  |  | -        <result column="music_show_organ_id_" property="musicShowOrganId"/>
 | 
	
		
			
				|  |  | -        <result column="music_show_organ_name_" property="musicShowOrganName"/>
 | 
	
		
			
				|  |  |          <result column="replacement_show_organ_id_" property="replacementShowOrganId"/>
 | 
	
		
			
				|  |  |          <result column="replacement_show_organ_name_" property="replacementShowOrganName"/>
 | 
	
		
			
				|  |  |          <result column="course_fee_show_organ_id_" property="courseFeeShowOrganId"/>
 | 
	
	
		
			
				|  | @@ -71,20 +69,20 @@
 | 
	
		
			
				|  |  |          (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_,stock_warning_,stock_type_
 | 
	
		
			
				|  |  | -            ,student_show_organ_id_,education_show_organ_id_,music_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_)
 | 
	
		
			
				|  |  | +            ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_)
 | 
	
		
			
				|  |  |          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},
 | 
	
		
			
				|  |  |          #{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | -        #{studentShowOrganId},#{educationShowOrganId},#{musicShowOrganId},#{replacementShowOrganId},#{courseFeeShowOrganId},#{memberFeeShowOrganId})
 | 
	
		
			
				|  |  | +        #{studentShowOrganId},#{educationShowOrganId},#{replacementShowOrganId},#{courseFeeShowOrganId},#{memberFeeShowOrganId})
 | 
	
		
			
				|  |  |      </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_,stock_warning_,stock_type_
 | 
	
		
			
				|  |  | -        ,student_show_organ_id_,education_show_organ_id_,music_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_)
 | 
	
		
			
				|  |  | +        ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_)
 | 
	
		
			
				|  |  |          VALUES
 | 
	
		
			
				|  |  |          <foreach collection="list" separator="," item="goods">
 | 
	
		
			
				|  |  |              (#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
 | 
	
	
		
			
				|  | @@ -93,7 +91,7 @@
 | 
	
		
			
				|  |  |              #{goods.stockCount},#{goods.taxStockCount},
 | 
	
		
			
				|  |  |              #{goods.stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  |              #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | -            #{goods.studentShowOrganId},#{goods.educationShowOrganId},#{goods.musicShowOrganId},#{goods.replacementShowOrganId},#{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId}
 | 
	
		
			
				|  |  | +            #{goods.studentShowOrganId},#{goods.educationShowOrganId},#{goods.replacementShowOrganId},#{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId}
 | 
	
		
			
				|  |  |              )
 | 
	
		
			
				|  |  |          </foreach>
 | 
	
		
			
				|  |  |      </insert>
 | 
	
	
		
			
				|  | @@ -107,9 +105,6 @@
 | 
	
		
			
				|  |  |              <if test="educationShowOrganId != null">
 | 
	
		
			
				|  |  |                  education_show_organ_id_ = #{educationShowOrganId},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="musicShowOrganId != null">
 | 
	
		
			
				|  |  | -                music_show_organ_id_ = #{musicShowOrganId},
 | 
	
		
			
				|  |  | -            </if>
 | 
	
		
			
				|  |  |              <if test="replacementShowOrganId != null">
 | 
	
		
			
				|  |  |                  replacement_show_organ_id_ = #{replacementShowOrganId},
 | 
	
		
			
				|  |  |              </if>
 | 
	
	
		
			
				|  | @@ -206,9 +201,6 @@
 | 
	
		
			
				|  |  |                  <if test="goods.educationShowOrganId != null">
 | 
	
		
			
				|  |  |                      education_show_organ_id_ = #{goods.educationShowOrganId},
 | 
	
		
			
				|  |  |                  </if>
 | 
	
		
			
				|  |  | -                <if test="goods.musicShowOrganId != null">
 | 
	
		
			
				|  |  | -                    music_show_organ_id_ = #{goods.musicShowOrganId},
 | 
	
		
			
				|  |  | -                </if>
 | 
	
		
			
				|  |  |                  <if test="goods.replacementShowOrganId != null">
 | 
	
		
			
				|  |  |                      replacement_show_organ_id_ = #{goods.replacementShowOrganId},
 | 
	
		
			
				|  |  |                  </if>
 | 
	
	
		
			
				|  | @@ -345,9 +337,6 @@
 | 
	
		
			
				|  |  |              <if test="educationShowOrganId != null">
 | 
	
		
			
				|  |  |                  AND FIND_IN_SET(#{educationShowOrganId},g.education_show_organ_id_)
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="musicShowOrganId != null">
 | 
	
		
			
				|  |  | -                AND FIND_IN_SET(#{musicShowOrganId},g.music_show_organ_id_)
 | 
	
		
			
				|  |  | -            </if>
 | 
	
		
			
				|  |  |              <if test="courseFeeShowOrganId != null">
 | 
	
		
			
				|  |  |                  AND FIND_IN_SET(#{courseFeeShowOrganId},g.course_fee_show_organ_id_)
 | 
	
		
			
				|  |  |              </if>
 | 
	
	
		
			
				|  | @@ -359,7 +348,7 @@
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="organId != null and organId != ''">
 | 
	
		
			
				|  |  |                  AND INTE_ARRAY (#{organId},CONCAT_WS(",",replacement_show_organ_id_,member_fee_show_organ_id_,
 | 
	
		
			
				|  |  | -                course_fee_show_organ_id_,music_show_organ_id_,education_show_organ_id_,student_show_organ_id_))
 | 
	
		
			
				|  |  | +                course_fee_show_organ_id_,education_show_organ_id_,student_show_organ_id_))
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="search!=null and search!=''">
 | 
	
		
			
				|  |  |                  AND (g.sn_=#{search} OR g.id_=#{search} OR g.name_ LIKE CONCAT('%', #{search}, '%'))
 | 
	
	
		
			
				|  | @@ -441,29 +430,22 @@
 | 
	
		
			
				|  |  |      <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.status_ != 0
 | 
	
		
			
				|  |  |          <if test="organId != null">
 | 
	
		
			
				|  |  | -            AND FIND_IN_SET(#{organId},g.organ_id_list_)
 | 
	
		
			
				|  |  | +            <if test="courseViewType != null">
 | 
	
		
			
				|  |  | +                <if test="courseViewType == 1">
 | 
	
		
			
				|  |  | +                    AND FIND_IN_SET(#{organId},g.member_fee_show_organ_id_)
 | 
	
		
			
				|  |  | +                </if>
 | 
	
		
			
				|  |  | +                <if test="courseViewType == 0">
 | 
	
		
			
				|  |  | +                    AND FIND_IN_SET(#{organId},g.course_fee_show_organ_id_)
 | 
	
		
			
				|  |  | +                </if>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="type!=null">
 | 
	
		
			
				|  |  |              AND g.type_ = #{type}
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="courseViewType != null">
 | 
	
		
			
				|  |  | -            AND FIND_IN_SET(#{courseViewType},g.course_view_type_)
 | 
	
		
			
				|  |  | -        </if>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <select id="getMusicGroupGoodsAndDiscountWithSubjects" resultMap="MusicGroupGoods">
 | 
	
		
			
				|  |  | -        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>
 | 
	
		
			
				|  |  | -    </select>
 | 
	
		
			
				|  |  |      <select id="findByIdAndStatus" resultType="java.lang.Boolean">
 | 
	
		
			
				|  |  |          SELECT COUNT(0) FROM goods WHERE status_ = #{status} AND id_ = #{goodsId}
 | 
	
		
			
				|  |  |      </select>
 | 
	
	
		
			
				|  | @@ -519,12 +501,11 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <sql id="replacementQuerySql">
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  | -            g.replacement_show_ = 1
 | 
	
		
			
				|  |  | -            AND g.status_ != 0
 | 
	
		
			
				|  |  | +            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_)
 | 
	
		
			
				|  |  | +                AND FIND_IN_SET(#{organId},g.replacement_show_organ_id_)
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="subjectId != null">
 | 
	
		
			
				|  |  |                  AND sgm.subject_id_ = #{subjectId}
 |