|
@@ -8,24 +8,14 @@
|
|
|
|
|
|
<resultMap type="com.ym.mec.biz.dal.entity.LiveGoods" id="LiveGoods">
|
|
|
<result column="id_" property="id" />
|
|
|
- <result column="goods_category_id_" property="goodsCategoryId" />
|
|
|
- <result column="sn_" property="sn" />
|
|
|
<result column="name_" property="name" />
|
|
|
- <result column="brand_" property="brand" />
|
|
|
- <result column="specification_" property="specification" />
|
|
|
<result column="image_" property="image" />
|
|
|
<result column="stock_count_" property="stockCount" />
|
|
|
<result column="sell_count_" property="sellCount" />
|
|
|
<result column="current_price_" property="currentPrice" />
|
|
|
<result column="original_price_" property="originalPrice" />
|
|
|
- <result column="brief_" property="brief" />
|
|
|
+ <result column="goods_detail_url_" property="goodsDetailUrl" />
|
|
|
<result column="desc_" property="desc" />
|
|
|
- <result column="new_flag_" property="newFlag" />
|
|
|
- <result column="top_flag_" property="topFlag" />
|
|
|
- <result column="status_" property="status" />
|
|
|
- <result column="memo_" property="memo" />
|
|
|
- <result column="publish_time_" property="publishTime" />
|
|
|
- <result column="complement_goods_id_list_" property="complementGoodsIdList" />
|
|
|
<result column="create_time_" property="createTime" />
|
|
|
<result column="update_time_" property="updateTime" />
|
|
|
<result column="tenant_id_" property="tenantId" />
|
|
@@ -43,70 +33,42 @@
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LiveGoods" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- INSERT INTO live_goods (goods_category_id_,sn_,name_,brand_,specification_,image_,stock_count_,sell_count_,current_price_,
|
|
|
- original_price_,brief_,desc_,new_flag_,top_flag_,status_,memo_,publish_time_,complement_goods_id_list_,
|
|
|
+ INSERT INTO live_goods (name_,image_,stock_count_,sell_count_,current_price_,
|
|
|
+ original_price_,goods_detail_url_,desc_,
|
|
|
create_time_,update_time_,tenant_id_)
|
|
|
- VALUES(#{id},#{goodsCategoryId},#{sn},#{name},#{brand},#{specification},#{image},#{stockCount},#{sellCount},#{currentPrice},
|
|
|
- #{originalPrice},#{brief},#{desc},#{newFlag},#{topFlag},#{status},#{memo},NOW(),#{complementGoodsIdList},
|
|
|
- NOW(),NOW(),#{tenantId})
|
|
|
+ VALUES(#{name},#{image},#{stockCount},#{sellCount},#{currentPrice},
|
|
|
+ #{originalPrice},#{goodsDetailUrl},#{desc},NOW(),NOW(),#{tenantId})
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<update id="update" parameterType="com.ym.mec.biz.dal.entity.LiveGoods">
|
|
|
UPDATE live_goods <set>
|
|
|
- <if test="specification != null">
|
|
|
- specification_ = #{specification},
|
|
|
- </if>
|
|
|
- <if test="status != null">
|
|
|
- status_ = #{status},
|
|
|
- </if>
|
|
|
- <if test="topFlag != null">
|
|
|
- top_flag_ = #{topFlag},
|
|
|
- </if>
|
|
|
- <if test="newFlag != null">
|
|
|
- new_flag_ = #{newFlag},
|
|
|
- </if>
|
|
|
- <if test="sn != null">
|
|
|
- sn_ = #{sn},
|
|
|
- </if>
|
|
|
<if test="tenantId != null">
|
|
|
- tenant_id_ = #{tenantId},
|
|
|
+ tenant_id_ = #{tenantId},
|
|
|
</if>
|
|
|
<if test="originalPrice != null">
|
|
|
- original_price_ = #{originalPrice},
|
|
|
- </if>
|
|
|
- <if test="memo != null">
|
|
|
- memo_ = #{memo},
|
|
|
+ original_price_ = #{originalPrice},
|
|
|
</if>
|
|
|
<if test="name != null">
|
|
|
- name_ = #{name},
|
|
|
- </if>
|
|
|
- <if test="complementGoodsIdList != null">
|
|
|
- complement_goods_id_list_ = #{complementGoodsIdList},
|
|
|
+ name_ = #{name},
|
|
|
</if>
|
|
|
<if test="stockCount != null">
|
|
|
- stock_count_ = #{stockCount},
|
|
|
+ stock_count_ = #{stockCount},
|
|
|
</if>
|
|
|
<if test="currentPrice != null">
|
|
|
- current_price_ = #{currentPrice},
|
|
|
- </if>
|
|
|
- <if test="goodsCategoryId != null">
|
|
|
- goods_category_id_ = #{goodsCategoryId},
|
|
|
- </if>
|
|
|
- <if test="brand != null">
|
|
|
- brand_ = #{brand},
|
|
|
- </if>
|
|
|
- <if test="brief != null">
|
|
|
- brief_ = #{brief},
|
|
|
+ current_price_ = #{currentPrice},
|
|
|
</if>
|
|
|
<if test="sellCount != null">
|
|
|
- sell_count_ = #{sellCount},
|
|
|
+ sell_count_ = #{sellCount},
|
|
|
</if>
|
|
|
<if test="image != null">
|
|
|
- image_ = #{image},
|
|
|
+ image_ = #{image},
|
|
|
</if>
|
|
|
<if test="desc != null">
|
|
|
- desc_ = #{desc},
|
|
|
+ desc_ = #{desc},
|
|
|
+ </if>
|
|
|
+ <if test="goodsDetailUrl != null">
|
|
|
+ goods_detail_url_ = #{goodsDetailUrl},
|
|
|
</if>
|
|
|
update_time_ = NOW()
|
|
|
</set> WHERE id_ = #{id}
|
|
@@ -116,14 +78,25 @@
|
|
|
<delete id="delete" >
|
|
|
DELETE FROM live_goods WHERE id_ = #{id}
|
|
|
</delete>
|
|
|
+ <sql id="queryPageSql">
|
|
|
+ <where>
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ (name_ like '%${search}%' OR id_ = #{search})
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="LiveGoods" parameterType="map">
|
|
|
- SELECT * FROM live_goods ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ SELECT * FROM live_goods
|
|
|
+ <include refid="queryPageSql" />
|
|
|
+ ORDER BY id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
SELECT COUNT(*) FROM live_goods
|
|
|
+ <include refid="queryPageSql" />
|
|
|
</select>
|
|
|
</mapper>
|