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_,stock_warning_,stock_type_)
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},#{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
#{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
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_,stock_warning_,stock_type_)
VALUES
(#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
#{goods.discountPrice},#{goods.groupPurchasePrice},#{goods.brief},#{goods.desc},now(),now(),
#{goods.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{goods.agreeCostPrice},#{goods.sn},
#{goods.stockCount},#{goods.taxStockCount},#{goods.clientShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
#{goods.educationalShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
#{goods.musicGroupShow,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})
UPDATE goods
agree_cost_price_ = #{agreeCostPrice},
specification_ = #{specification},
status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
is_top_ = #{isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
sn_ = #{sn},
market_price_ = #{marketPrice},
memo_ = #{memo},
is_new_ = #{isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
group_purchase_price_ = #{groupPurchasePrice},
name_ = #{name},
stock_count_ = #{stockCount},
goods_category_id_ = #{goodsCategoryId},
brand_ = #{brand},
brief_ = #{brief},
discount_price_ = #{discountPrice},
sell_count_ = #{sellCount},
image_ = #{image},
desc_ = #{desc},
publish_time_ = #{publishTime},
complement_goods_id_list_ = #{complementGoodsIdList},
tax_stock_count_ = #{taxStockCount},
client_show_ = #{clientShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
educational_show_ = #{educationalShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
music_group_show_ = #{musicGroupShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
stock_warning_ = #{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
stock_type_ = #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
update_time_ = NOW()
WHERE id_ = #{id}
UPDATE goods
agree_cost_price_ = #{goods.agreeCostPrice},
specification_ = #{goods.specification},
status_ = #{goods.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
is_top_ = #{goods.isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
type_ = #{goods.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
sn_ = #{goods.sn},
market_price_ = #{goods.marketPrice},
memo_ = #{goods.memo},
is_new_ = #{goods.isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
group_purchase_price_ = #{goods.groupPurchasePrice},
name_ = #{goods.name},
stock_count_ = #{goods.stockCount},
goods_category_id_ = #{goods.goodsCategoryId},
brand_ = #{goods.brand},
brief_ = #{goods.brief},
discount_price_ = #{goods.discountPrice},
sell_count_ = #{goods.sellCount},
image_ = #{goods.image},
desc_ = #{goods.desc},
publish_time_ = #{goods.publishTime},
complement_goods_id_list_ = #{goods.complementGoodsIdList},
tax_stock_count_ = #{goods.taxStockCount},
client_show_ = #{goods.clientShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
educational_show_ = #{goods.educationalShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
music_group_show_ = #{goods.musicGroupShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
stock_warning_ = #{goods.stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
stock_type_ = #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
update_time_ = NOW()
WHERE id_ = #{goods.id}
DELETE FROM goods WHERE id_ = #{id}
AND g.goods_category_id_ = #{goodsCategoryId}
AND g.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
AND g.is_new_ = #{isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
AND g.is_top_ = #{isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
AND g.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
AND g.complement_goods_id_list_ IS NULL
AND g.complement_goods_id_list_ IS NOT NULL
AND g.client_show_=#{clientShow}
AND g.educational_show_=#{educationalShow}
AND g.music_group_show_=#{musicGroupShow}
AND (g.sn_=#{search} OR g.id_=#{search} OR g.name_ LIKE CONCAT('%', #{search}, '%'))
AND sgm.subject_id_ = #{subjectId}
AND g.brand_ = #{brand}
AND g.specification_ = #{specification}