|
|
@@ -0,0 +1,108 @@
|
|
|
+<?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.ruoyi.system.mapper.GoodsMapper">
|
|
|
+
|
|
|
+ <resultMap type="Goods" id="GoodsResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="goodsCode" column="goods_code" />
|
|
|
+ <result property="goodsName" column="goods_name" />
|
|
|
+ <result property="goodsType" column="goods_type" />
|
|
|
+ <result property="quantityStock" column="quantity_stock" />
|
|
|
+ <result property="goodsStatus" column="goods_status" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectGoodsVo">
|
|
|
+ select id, goods_code, goods_name, goods_type, quantity_stock, goods_status, create_by, create_time, update_by, update_time, remark from goods
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectGoodsList" parameterType="Goods" resultMap="GoodsResult">
|
|
|
+ <include refid="selectGoodsVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="goodsCode != null and goodsCode != ''"> and goods_code like concat('%', #{goodsCode}, '%')</if>
|
|
|
+ <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
|
|
|
+ <if test="goodsType != null and goodsType != ''"> and goods_type = #{goodsType}</if>
|
|
|
+ <if test="quantityStock != null "> and quantity_stock = #{quantityStock}</if>
|
|
|
+ <if test="goodsStatus != null "> and goods_status = #{goodsStatus}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectGoodsById" parameterType="Long" resultMap="GoodsResult">
|
|
|
+ <include refid="selectGoodsVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertGoods" parameterType="Goods">
|
|
|
+ insert into goods
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">id,</if>
|
|
|
+ <if test="goodsCode != null">goods_code,</if>
|
|
|
+ <if test="goodsName != null">goods_name,</if>
|
|
|
+ <if test="goodsType != null">goods_type,</if>
|
|
|
+ <if test="quantityStock != null">quantity_stock,</if>
|
|
|
+ <if test="goodsStatus != null">goods_status,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="goodsCode != null">#{goodsCode},</if>
|
|
|
+ <if test="goodsName != null">#{goodsName},</if>
|
|
|
+ <if test="goodsType != null">#{goodsType},</if>
|
|
|
+ <if test="quantityStock != null">#{quantityStock},</if>
|
|
|
+ <if test="goodsStatus != null">#{goodsStatus},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateGoods" parameterType="Goods">
|
|
|
+ update goods
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="goodsCode != null">goods_code = #{goodsCode},</if>
|
|
|
+ <if test="goodsName != null">goods_name = #{goodsName},</if>
|
|
|
+ <if test="goodsType != null">goods_type = #{goodsType},</if>
|
|
|
+ <if test="quantityStock != null">quantity_stock = #{quantityStock},</if>
|
|
|
+ <if test="goodsStatus != null">goods_status = #{goodsStatus},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteGoodsById" parameterType="Long">
|
|
|
+ delete from goods where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteGoodsByIds" parameterType="String">
|
|
|
+ delete from goods where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectGoodsIds" parameterType="Goods" resultMap="GoodsResult">
|
|
|
+ <include refid="selectGoodsVo"/>
|
|
|
+ where id in
|
|
|
+ <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|