|
@@ -0,0 +1,136 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<!--
|
|
|
+这个文件是自动生成的。
|
|
|
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
|
|
|
+-->
|
|
|
+<mapper namespace="com.ym.mec.web.dal.dao.GoodsDao">
|
|
|
+
|
|
|
+ <resultMap type="com.ym.mec.web.dal.entity.Goods" id="Goods">
|
|
|
+ <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="market_price_" property="marketPrice" />
|
|
|
+ <result column="discount_price_" property="discountPrice" />
|
|
|
+ <result column="group_purchase_price_" property="groupPurchasePrice" />
|
|
|
+ <result column="brief_" property="brief" />
|
|
|
+ <result column="desc_" property="desc" />
|
|
|
+ <result column="is_new_" property="isNew" />
|
|
|
+ <result column="is_top_" property="isTop" />
|
|
|
+ <result column="status_" property="status" />
|
|
|
+ <result column="memo_" property="memo" />
|
|
|
+ <result column="publish_time_" property="publishTime" />
|
|
|
+ <result column="create_time_" property="createTime" />
|
|
|
+ <result column="update_time_" property="updateTime" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <select id="get" resultMap="Goods" >
|
|
|
+ SELECT * FROM goods WHERE id_ = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 全查询 -->
|
|
|
+ <select id="findAll" resultMap="Goods">
|
|
|
+ SELECT * FROM goods ORDER BY id_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 向数据库增加一条记录 -->
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.web.dal.entity.Goods" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ <!--
|
|
|
+ <selectKey resultClass="int" keyProperty="id" >
|
|
|
+ SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
+ </selectKey>
|
|
|
+ -->
|
|
|
+ INSERT INTO goods (id_,goods_category_id_,sn_,name_,brand_,specification_,image_,stock_count_,sell_count_,market_price_,discount_price_,group_purchase_price_,brief_,desc_,is_new_,is_top_,status_,memo_,publish_time_,create_time_,update_time_) VALUES(#{id},#{goodsCategoryId},#{sn},#{name},#{brand},#{specification},#{image},#{stockCount},#{sellCount},#{marketPrice},#{discountPrice},#{groupPurchasePrice},#{brief},#{desc},#{isNew},#{isTop},#{status},#{memo},#{publishTime},#{createTime},#{updateTime})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <update id="update" parameterType="com.ym.mec.web.dal.entity.Goods">
|
|
|
+ UPDATE goods <set>
|
|
|
+<if test="specification != null">
|
|
|
+specification_ = #{specification},
|
|
|
+</if>
|
|
|
+<if test="status != null">
|
|
|
+status_ = #{status},
|
|
|
+</if>
|
|
|
+<if test="isTop != null">
|
|
|
+is_top_ = #{isTop},
|
|
|
+</if>
|
|
|
+<if test="id != null">
|
|
|
+id_ = #{id},
|
|
|
+</if>
|
|
|
+<if test="sn != null">
|
|
|
+sn_ = #{sn},
|
|
|
+</if>
|
|
|
+<if test="marketPrice != null">
|
|
|
+market_price_ = #{marketPrice},
|
|
|
+</if>
|
|
|
+<if test="memo != null">
|
|
|
+memo_ = #{memo},
|
|
|
+</if>
|
|
|
+<if test="isNew != null">
|
|
|
+is_new_ = #{isNew},
|
|
|
+</if>
|
|
|
+<if test="groupPurchasePrice != null">
|
|
|
+group_purchase_price_ = #{groupPurchasePrice},
|
|
|
+</if>
|
|
|
+<if test="name != null">
|
|
|
+name_ = #{name},
|
|
|
+</if>
|
|
|
+<if test="createTime != null">
|
|
|
+create_time_ = #{createTime},
|
|
|
+</if>
|
|
|
+<if test="stockCount != null">
|
|
|
+stock_count_ = #{stockCount},
|
|
|
+</if>
|
|
|
+<if test="goodsCategoryId != null">
|
|
|
+goods_category_id_ = #{goodsCategoryId},
|
|
|
+</if>
|
|
|
+<if test="brand != null">
|
|
|
+brand_ = #{brand},
|
|
|
+</if>
|
|
|
+<if test="brief != null">
|
|
|
+brief_ = #{brief},
|
|
|
+</if>
|
|
|
+<if test="updateTime != null">
|
|
|
+update_time_ = #{updateTime},
|
|
|
+</if>
|
|
|
+<if test="discountPrice != null">
|
|
|
+discount_price_ = #{discountPrice},
|
|
|
+</if>
|
|
|
+<if test="sellCount != null">
|
|
|
+sell_count_ = #{sellCount},
|
|
|
+</if>
|
|
|
+<if test="image != null">
|
|
|
+image_ = #{image},
|
|
|
+</if>
|
|
|
+<if test="desc != null">
|
|
|
+desc_ = #{desc},
|
|
|
+</if>
|
|
|
+<if test="publishTime != null">
|
|
|
+publish_time_ = #{publishTime},
|
|
|
+</if>
|
|
|
+</set> WHERE id_ = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据主键删除一条记录 -->
|
|
|
+ <delete id="delete" >
|
|
|
+ DELETE FROM goods WHERE id_ = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="Goods" parameterType="map">
|
|
|
+ SELECT * FROM goods ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM goods
|
|
|
+ </select>
|
|
|
+</mapper>
|