|
@@ -0,0 +1,127 @@
|
|
|
+<?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.biz.dal.dao.GoodsProcurementDao">
|
|
|
+
|
|
|
+ <resultMap type="com.ym.mec.biz.dal.entity.GoodsProcurement" id="GoodsProcurement">
|
|
|
+ <result column="id_" property="id" />
|
|
|
+ <result column="goods_id_" property="goodsId" />
|
|
|
+ <result column="goods_category_id_" property="goodsCategoryId" />
|
|
|
+ <result column="supply_channel_" property="supplyChannel" />
|
|
|
+ <result column="discount_price_" property="discountPrice" />
|
|
|
+ <result column="agree_cost_price_" property="agreeCostPrice" />
|
|
|
+ <result column="total_quantity_" property="totalQuantity" />
|
|
|
+ <result column="tax_quantity_" property="taxQuantity" />
|
|
|
+ <result column="operator_id_" property="operatorId" />
|
|
|
+ <result column="batch_no_" property="batchNo" />
|
|
|
+ <result column="create_time_" property="createTime" />
|
|
|
+ <result column="update_time_" property="updateTime" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <select id="get" resultMap="GoodsProcurement" >
|
|
|
+ SELECT * FROM goods_procurement WHERE id_ = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 全查询 -->
|
|
|
+ <select id="findAll" resultMap="GoodsProcurement">
|
|
|
+ SELECT * FROM goods_procurement ORDER BY id_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 向数据库增加一条记录 -->
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.GoodsProcurement" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ INSERT INTO goods_procurement (goods_id_,goods_category_id_,supply_channel_,discount_price_,agree_cost_price_,total_quantity_,tax_quantity_,operator_id_,batch_no_,create_time_,update_time_)
|
|
|
+ VALUES(#{goodsId},#{goodsCategoryId},#{supplyChannel},#{discountPrice},#{agreeCostPrice},#{totalQuantity},#{taxQuantity},#{operatorId},#{batchNo},NOW(),NOW())
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.GoodsProcurement" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ INSERT INTO goods_procurement (goods_id_,goods_category_id_,supply_channel_,discount_price_,agree_cost_price_,total_quantity_,tax_quantity_,operator_id_,batch_no_,create_time_,update_time_)
|
|
|
+ VALUE
|
|
|
+ <foreach collection="goodsProcurements" item="gp" separator=",">
|
|
|
+ (#{gp.goodsId},#{gp.goodsCategoryId},#{gp.supplyChannel},#{gp.discountPrice},#{gp.agreeCostPrice},#{gp.totalQuantity},#{gp.taxQuantity},#{gp.operatorId},#{gp.batchNo},NOW(),NOW())
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.GoodsProcurement">
|
|
|
+ UPDATE goods_procurement
|
|
|
+ <set>
|
|
|
+ <if test="operatorId != null">
|
|
|
+ operator_id_ = #{operatorId},
|
|
|
+ </if>
|
|
|
+ <if test="agreeCostPrice != null">
|
|
|
+ agree_cost_price_ = #{agreeCostPrice},
|
|
|
+ </if>
|
|
|
+ <if test="id != null">
|
|
|
+ id_ = #{id},
|
|
|
+ </if>
|
|
|
+ <if test="goodsCategoryId != null">
|
|
|
+ goods_category_id_ = #{goodsCategoryId},
|
|
|
+ </if>
|
|
|
+ <if test="taxQuantity != null">
|
|
|
+ tax_quantity_ = #{taxQuantity},
|
|
|
+ </if>
|
|
|
+ <if test="supplyChannel != null">
|
|
|
+ supply_channel_ = #{supplyChannel},
|
|
|
+ </if>
|
|
|
+ <if test="discountPrice != null">
|
|
|
+ discount_price_ = #{discountPrice},
|
|
|
+ </if>
|
|
|
+ <if test="totalQuantity != null">
|
|
|
+ total_quantity_ = #{totalQuantity},
|
|
|
+ </if>
|
|
|
+ <if test="goodsId != null">
|
|
|
+ goods_id_ = #{goodsId},
|
|
|
+ </if>
|
|
|
+ <if test="batchNo != null">
|
|
|
+ batch_no_ = #{batchNo},
|
|
|
+ </if>
|
|
|
+ update_time_ = NOW(),
|
|
|
+ </set> WHERE id_ = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据主键删除一条记录 -->
|
|
|
+ <delete id="delete" >
|
|
|
+ DELETE FROM goods_procurement WHERE id_ = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <sql id="queryCondition">
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <if test="goodsId!=null">
|
|
|
+ AND goods_id_ = #{goodsId}
|
|
|
+ </if>
|
|
|
+ <if test="enterStorageStartTime!=null AND enterStorageEndTime!=null">
|
|
|
+ AND DATE_FORMAT(create_time_, '%Y-%m-%d') BETWEEN #{enterStorageStartTime} AND #{enterStorageEndTime}
|
|
|
+ </if>
|
|
|
+ <if test="search!=null and search!=''">
|
|
|
+ AND supply_channel_ LIKE CONCAT('%', #{search}, '%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="queryGoodsProcurements" resultMap="GoodsProcurement" parameterType="map">
|
|
|
+ SELECT * FROM goods_procurement
|
|
|
+ <include refid="queryCondition"></include>
|
|
|
+ ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countGoodsProcurements" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM goods_procurement
|
|
|
+ <include refid="queryCondition"></include>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="GoodsProcurement" parameterType="map">
|
|
|
+ SELECT * FROM goods_procurement
|
|
|
+ ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM goods_procurement
|
|
|
+ </select>
|
|
|
+</mapper>
|