|
@@ -46,6 +46,7 @@
|
|
|
<result column="course_fee_show_organ_name_" property="courseFeeShowOrganName"/>
|
|
|
<result column="member_fee_show_organ_id_" property="memberFeeShowOrganId"/>
|
|
|
<result column="member_fee_show_organ_name_" property="memberFeeShowOrganName"/>
|
|
|
+ <result column="tenant_id_" property="tenantId"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -60,7 +61,7 @@
|
|
|
|
|
|
<!-- 全查询 -->
|
|
|
<select id="findAll" resultMap="Goods">
|
|
|
- SELECT * FROM goods ORDER BY id_
|
|
|
+ SELECT * FROM goods where tenant_id_ = #{tenantId} ORDER BY id_
|
|
|
</select>
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
@@ -70,20 +71,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_,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_,tenant_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},#{replacementShowOrganId},#{courseFeeShowOrganId},#{memberFeeShowOrganId})
|
|
|
+ #{studentShowOrganId},#{educationShowOrganId},#{replacementShowOrganId},#{courseFeeShowOrganId},#{memberFeeShowOrganId},#{tenantId})
|
|
|
</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_,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_,tenant_id_)
|
|
|
VALUES
|
|
|
<foreach collection="list" separator="," item="goods">
|
|
|
(#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
|
|
@@ -92,7 +93,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.replacementShowOrganId},#{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId}
|
|
|
+ #{goods.studentShowOrganId},#{goods.educationShowOrganId},#{goods.replacementShowOrganId},#{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId},#{goods.tenantId}
|
|
|
)
|
|
|
</foreach>
|
|
|
</insert>
|
|
@@ -179,7 +180,7 @@
|
|
|
</if>
|
|
|
update_time_ = NOW()
|
|
|
</set>
|
|
|
- WHERE id_ = #{id}
|
|
|
+ WHERE id_ = #{id} and tenant_id_ = #{tenantId}
|
|
|
</update>
|
|
|
|
|
|
<update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.Goods">
|
|
@@ -275,7 +276,7 @@
|
|
|
</if>
|
|
|
update_time_ = NOW()
|
|
|
</set>
|
|
|
- WHERE id_ = #{goods.id}
|
|
|
+ WHERE id_ = #{goods.id} and tenant_id_ = #{goods.tenantId}
|
|
|
</foreach>
|
|
|
</update>
|
|
|
|
|
@@ -301,6 +302,7 @@
|
|
|
|
|
|
<sql id="queryGoodsPageSql">
|
|
|
<where>
|
|
|
+ g.tenant_id_ = #{tenantId}
|
|
|
<if test="goodsCategoryId != null">
|
|
|
AND g.goods_category_id_ = #{goodsCategoryId}
|
|
|
</if>
|
|
@@ -361,7 +363,7 @@
|
|
|
|
|
|
<sql id="queryOrganIdSql">
|
|
|
<where>
|
|
|
- AND g.status_ != 0
|
|
|
+ AND g.status_ != 0 and g.tenant_id_ = #{goodsQuery.tenantId}
|
|
|
<if test="goodsQuery.subjectId != null">
|
|
|
AND sgm.subject_id_ = #{goodsQuery.subjectId}
|
|
|
</if>
|
|
@@ -396,13 +398,13 @@
|
|
|
|
|
|
<!-- 根据 -->
|
|
|
<select id="findGoodsNumByCategoryId" resultType="int">
|
|
|
- SELECT COUNT(*) FROM goods WHERE goods_category_id_ = #{goodsCategoryId}
|
|
|
+ SELECT COUNT(*) FROM goods WHERE goods_category_id_ = #{goodsCategoryId} and tenant_id_ = #{tenantId}
|
|
|
</select>
|
|
|
<select id="findGoodsByIds" resultMap="Goods">
|
|
|
SELECT * FROM goods WHERE FIND_IN_SET(id_,#{ids})
|
|
|
</select>
|
|
|
<select id="findTypeGoods" resultMap="Goods">
|
|
|
- SELECT * FROM goods WHERE type_ = #{type} AND status_ != 0
|
|
|
+ SELECT * FROM goods WHERE type_ = #{type} AND status_ != 0 and tenant_id_ = #{tenantId}
|
|
|
</select>
|
|
|
<select id="getGoodies" resultMap="Goods">
|
|
|
SELECT * FROM goods WHERE id_ IN
|
|
@@ -459,7 +461,7 @@
|
|
|
<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.status_ != 0
|
|
|
+ WHERE sgm.subject_id_ = #{subjectId} AND g.status_ != 0 and g.tenant_id_ = #{tenantId}
|
|
|
<if test="organId != null">
|
|
|
<if test="courseViewType != null">
|
|
|
<if test="courseViewType == 2">
|
|
@@ -523,7 +525,7 @@
|
|
|
<where>
|
|
|
g.status_ != 0
|
|
|
AND g.type_ = 'INSTRUMENT'
|
|
|
- AND gc.del_flag_ = 0
|
|
|
+ AND gc.del_flag_ = 0 and g.tenant_id_ = #{tenantId}
|
|
|
<if test="organId != null">
|
|
|
AND FIND_IN_SET(#{organId},g.replacement_show_organ_id_)
|
|
|
</if>
|