81 lines
4.1 KiB
XML
81 lines
4.1 KiB
XML
<?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.out.productAndStock.mapper.ViewProductAndStockMapper">
|
|
|
|
<resultMap type="ViewProductAndStock" id="ViewProductAndStockResult">
|
|
<result property="onlyIdentity" column="only_identity" />
|
|
<result property="productId" column="product_id" />
|
|
<result property="lotNo" column="lot_no" />
|
|
<result property="productName" column="product_name" />
|
|
<result property="quantity" column="quantity" />
|
|
<result property="warehouseId" column="warehouse_id" />
|
|
<result property="warehouseName" column="warehouse_name" />
|
|
</resultMap>
|
|
|
|
<sql id="selectViewProductAndStockVo">
|
|
select only_identity, product_id, lot_no, product_name, quantity, warehouse_id,warehouse_name from view_product_and_stock
|
|
</sql>
|
|
|
|
<select id="selectViewProductAndStockList" parameterType="ViewProductAndStock" resultMap="ViewProductAndStockResult">
|
|
<include refid="selectViewProductAndStockVo"/>
|
|
<where>
|
|
<if test="onlyIdentity != null "> and only_identity = #{onlyIdentity}</if>
|
|
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
|
|
<if test="lotNo != null and lotNo != ''"> and lot_no like concat('%', #{lotNo}, '%')</if>
|
|
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
|
<if test="quantity != null and quantity != ''"> and quantity = #{quantity}</if>
|
|
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectViewProductAndStockByOnlyIdentity" parameterType="Long" resultMap="ViewProductAndStockResult">
|
|
<include refid="selectViewProductAndStockVo"/>
|
|
where only_identity = #{onlyIdentity}
|
|
</select>
|
|
|
|
<insert id="insertViewProductAndStock" parameterType="ViewProductAndStock">
|
|
insert into view_product_and_stock
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="onlyIdentity != null">only_identity,</if>
|
|
<if test="productId != null">product_id,</if>
|
|
<if test="lotNo != null">lot_no,</if>
|
|
<if test="productName != null">product_name,</if>
|
|
<if test="quantity != null">quantity,</if>
|
|
<if test="warehouseId != null">warehouse_id,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="onlyIdentity != null">#{onlyIdentity},</if>
|
|
<if test="productId != null">#{productId},</if>
|
|
<if test="lotNo != null">#{lotNo},</if>
|
|
<if test="productName != null">#{productName},</if>
|
|
<if test="quantity != null">#{quantity},</if>
|
|
<if test="warehouseId != null">#{warehouseId},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateViewProductAndStock" parameterType="ViewProductAndStock">
|
|
update view_product_and_stock
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="productId != null">product_id = #{productId},</if>
|
|
<if test="lotNo != null">lot_no = #{lotNo},</if>
|
|
<if test="productName != null">product_name = #{productName},</if>
|
|
<if test="quantity != null">quantity = #{quantity},</if>
|
|
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
|
</trim>
|
|
where only_identity = #{onlyIdentity}
|
|
</update>
|
|
|
|
<delete id="deleteViewProductAndStockByOnlyIdentity" parameterType="Long">
|
|
delete from view_product_and_stock where only_identity = #{onlyIdentity}
|
|
</delete>
|
|
|
|
<delete id="deleteViewProductAndStockByOnlyIdentitys" parameterType="String">
|
|
delete from view_product_and_stock where only_identity in
|
|
<foreach item="onlyIdentity" collection="array" open="(" separator="," close=")">
|
|
#{onlyIdentity}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|