万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
4.3 KiB

2 years ago
<?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.stock.mapper.StockInfoMapper">
<resultMap type="StockInfo" id="StockInfoResult">
<result property="stockId" column="stock_id" />
<result property="StockNO" column="StockNO" />
<result property="Stockname" column="Stockname" />
<result property="stockAddr" column="stockAddr" />
<result property="stockmanager" column="stockmanager" />
<result property="stockmemo" column="stockmemo" />
<result property="defaltItemclass" column="defalt_itemclass" />
<result property="firstAddTime" column="first_add_time" />
<result property="updateInfoTime" column="update_info_time" />
</resultMap>
<sql id="selectStockInfoVo">
select stock_id, StockNO, Stockname, stockAddr, stockmanager, stockmemo, defalt_itemclass, first_add_time, update_info_time from stock_info
</sql>
<select id="selectStockInfoList" parameterType="StockInfo" resultMap="StockInfoResult">
<include refid="selectStockInfoVo"/>
<where>
<if test="StockNO != null and StockNO != ''"> and StockNO like concat('%', #{StockNO}, '%')</if>
<if test="Stockname != null and Stockname != ''"> and Stockname like concat('%', #{Stockname}, '%')</if>
<if test="stockAddr != null and stockAddr != ''"> and stockAddr like concat('%', #{stockAddr}, '%')</if>
<if test="stockmanager != null and stockmanager != ''"> and stockmanager = #{stockmanager}</if>
<if test="stockmemo != null and stockmemo != ''"> and stockmemo = #{stockmemo}</if>
</where>
</select>
<select id="selectStockInfoById" parameterType="Long" resultMap="StockInfoResult">
<include refid="selectStockInfoVo"/>
where stock_id = #{stockId}
</select>
<insert id="insertStockInfo" parameterType="StockInfo">
insert into stock_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="StockNO != null and StockNO != ''">StockNO,</if>
<if test="Stockname != null and Stockname != ''">Stockname,</if>
<if test="stockAddr != null and stockAddr != ''">stockAddr,</if>
<if test="stockmanager != null">stockmanager,</if>
<if test="stockmemo != null">stockmemo,</if>
<if test="defaltItemclass != null">defalt_itemclass,</if>
first_add_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="StockNO != null and StockNO != ''">#{StockNO},</if>
<if test="Stockname != null and Stockname != ''">#{Stockname},</if>
<if test="stockAddr != null and stockAddr != ''">#{stockAddr},</if>
<if test="stockmanager != null">#{stockmanager},</if>
<if test="stockmemo != null">#{stockmemo},</if>
<if test="defaltItemclass != null">#{defaltItemclass},</if>
now(),
</trim>
</insert>
<update id="updateStockInfo" parameterType="StockInfo">
update stock_info
<trim prefix="SET" suffixOverrides=",">
<if test="StockNO != null and StockNO != ''">StockNO = #{StockNO},</if>
<if test="Stockname != null and Stockname != ''">Stockname = #{Stockname},</if>
<if test="stockAddr != null and stockAddr != ''">stockAddr = #{stockAddr},</if>
<if test="stockmanager != null">stockmanager = #{stockmanager},</if>
<if test="stockmemo != null">stockmemo = #{stockmemo},</if>
<if test="defaltItemclass != null">defalt_itemclass = #{defaltItemclass},</if>
update_info_time = CONCAT_WS(',',NOW(),update_info_time),
</trim>
where stock_id = #{stockId}
</update>
<delete id="deleteStockInfoById" parameterType="Long">
delete from stock_info where stock_id = #{stockId}
</delete>
<delete id="deleteStockInfoByIds" parameterType="Long">
delete from stock_info where stock_id in
<foreach item="stockId" collection="array" open="(" separator="," close=")">
#{stockId}
</foreach>
</delete>
</mapper>