|
@@ -58,34 +58,34 @@
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<select id="get" resultMap="Goods" useCache="false" flushCache="true">
|
|
|
- SELECT * FROM goods g
|
|
|
- WHERE g.id_ = #{id}
|
|
|
- </select>
|
|
|
+ SELECT * FROM goods g
|
|
|
+ WHERE g.id_ = #{id}
|
|
|
+ </select>
|
|
|
|
|
|
<select id="lock" resultMap="Goods" useCache="false" flushCache="true">
|
|
|
- SELECT * FROM goods WHERE id_ = #{goodsId} LOCK IN SHARE MODE
|
|
|
- </select>
|
|
|
+ SELECT * FROM goods WHERE id_ = #{goodsId} LOCK IN SHARE MODE
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 全查询 -->
|
|
|
<select id="findAll" resultMap="Goods">
|
|
|
- SELECT * FROM goods where tenant_id_ = #{tenantId} ORDER BY id_
|
|
|
- </select>
|
|
|
+ SELECT * FROM goods where tenant_id_ = #{tenantId} ORDER BY id_
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Goods" useGeneratedKeys="true" keyColumn="id"
|
|
|
keyProperty="id">
|
|
|
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_,stock_warning_,stock_type_
|
|
|
+ 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_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_)
|
|
|
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},
|
|
|
+ #{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},#{freeFeeShowOrganId},#{tenantId},#{organCostPrice})
|
|
|
</insert>
|
|
|
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
|
@@ -94,7 +94,7 @@
|
|
|
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_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_)
|
|
|
+ member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_)
|
|
|
VALUES
|
|
|
<foreach collection="list" separator="," item="goods">
|
|
|
(#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
|
|
@@ -104,7 +104,7 @@
|
|
|
#{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.freeFeeShowOrganId},#{goods.tenantId},#{goods.organCostPrice}
|
|
|
+ #{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId},#{goods.freeFeeShowOrganId},#{goods.tenantId},#{goods.organCostPrice}
|
|
|
)
|
|
|
</foreach>
|
|
|
</insert>
|
|
@@ -112,12 +112,12 @@
|
|
|
<update id="update" parameterType="com.ym.mec.biz.dal.entity.Goods">
|
|
|
UPDATE goods
|
|
|
<set>
|
|
|
- student_show_organ_id_ = #{studentShowOrganId},
|
|
|
- education_show_organ_id_ = #{educationShowOrganId},
|
|
|
- replacement_show_organ_id_ = #{replacementShowOrganId},
|
|
|
- course_fee_show_organ_id_ = #{courseFeeShowOrganId},
|
|
|
- member_fee_show_organ_id_ = #{memberFeeShowOrganId},
|
|
|
- free_fee_show_organ_id_ = #{freeFeeShowOrganId},
|
|
|
+ student_show_organ_id_ = #{studentShowOrganId},
|
|
|
+ education_show_organ_id_ = #{educationShowOrganId},
|
|
|
+ replacement_show_organ_id_ = #{replacementShowOrganId},
|
|
|
+ course_fee_show_organ_id_ = #{courseFeeShowOrganId},
|
|
|
+ member_fee_show_organ_id_ = #{memberFeeShowOrganId},
|
|
|
+ free_fee_show_organ_id_ = #{freeFeeShowOrganId},
|
|
|
<if test="agreeCostPrice != null">
|
|
|
agree_cost_price_ = #{agreeCostPrice},
|
|
|
</if>
|
|
@@ -193,7 +193,7 @@
|
|
|
<if test="stockType != null">
|
|
|
stock_type_ = #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
</if>
|
|
|
- update_time_ = NOW()
|
|
|
+ update_time_ = NOW()
|
|
|
</set>
|
|
|
WHERE id_ = #{id} and tenant_id_ = #{tenantId}
|
|
|
</update>
|
|
@@ -295,7 +295,7 @@
|
|
|
<if test="goods.stockType != null">
|
|
|
stock_type_ = #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
</if>
|
|
|
- update_time_ = NOW()
|
|
|
+ update_time_ = NOW()
|
|
|
</set>
|
|
|
WHERE id_ = #{goods.id} and tenant_id_ = #{goods.tenantId}
|
|
|
</foreach>
|
|
@@ -303,8 +303,8 @@
|
|
|
|
|
|
<!-- 根据主键删除一条记录 -->
|
|
|
<delete id="delete">
|
|
|
- DELETE FROM goods WHERE id_ = #{id}
|
|
|
- </delete>
|
|
|
+ DELETE FROM goods WHERE id_ = #{id}
|
|
|
+ </delete>
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="Goods" parameterType="map">
|
|
@@ -323,7 +323,7 @@
|
|
|
|
|
|
<sql id="queryGoodsPageSql">
|
|
|
<where>
|
|
|
- g.tenant_id_ = #{tenantId}
|
|
|
+ g.tenant_id_ = #{tenantId}
|
|
|
<if test="goodsCategoryId != null">
|
|
|
AND g.goods_category_id_ = #{goodsCategoryId}
|
|
|
</if>
|
|
@@ -388,7 +388,7 @@
|
|
|
|
|
|
<sql id="queryOrganIdSql">
|
|
|
<where>
|
|
|
- AND g.status_ != 0 and g.tenant_id_ = #{goodsQuery.tenantId}
|
|
|
+ AND g.status_ != 0 and g.tenant_id_ = #{goodsQuery.tenantId}
|
|
|
<if test="goodsQuery.subjectId != null">
|
|
|
AND sgm.subject_id_ = #{goodsQuery.subjectId}
|
|
|
</if>
|
|
@@ -515,7 +515,7 @@
|
|
|
|
|
|
<select id="getGoodsInfo" resultMap="Goods">
|
|
|
SELECT g.*,gc.name_ goods_category_name_ FROM goods g
|
|
|
- LEFT JOIN goods_category gc on g.goods_category_id_ = gc.id_
|
|
|
+ LEFT JOIN goods_category gc on g.goods_category_id_ = gc.id_
|
|
|
WHERE g.id_=#{id}
|
|
|
</select>
|
|
|
|
|
@@ -585,4 +585,12 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
+
|
|
|
+ <update id="updateStatus">
|
|
|
+ update goods set status_= #{status}
|
|
|
+ where id_ in
|
|
|
+ <foreach collection="goodIdList" separator="," open="(" close=")" item="item">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
</mapper>
|