修改库存
This commit is contained in:
187
src/main/resources/mapper/TbConsInfoMapper.xml
Normal file
187
src/main/resources/mapper/TbConsInfoMapper.xml
Normal file
@@ -0,0 +1,187 @@
|
||||
<?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.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<result column="con_type_id" jdbcType="INTEGER" property="conTypeId" />
|
||||
<result column="con_type_name" jdbcType="VARCHAR" property="conTypeName" />
|
||||
<result column="con_code" jdbcType="VARCHAR" property="conCode" />
|
||||
<result column="con_name" jdbcType="VARCHAR" property="conName" />
|
||||
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
|
||||
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
|
||||
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
|
||||
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number, con_unit,
|
||||
surplus_stock, laster_in_stock, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_cons_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_cons_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
insert into tb_cons_info (id, shop_id, con_type_id,
|
||||
con_type_name, con_code, con_name,
|
||||
stock_number, con_unit, surplus_stock,
|
||||
laster_in_stock, create_time, update_time
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{conTypeId,jdbcType=INTEGER},
|
||||
#{conTypeName,jdbcType=VARCHAR}, #{conCode,jdbcType=VARCHAR}, #{conName,jdbcType=VARCHAR},
|
||||
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{surplusStock,jdbcType=DECIMAL},
|
||||
#{lasterInStock,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
insert into tb_cons_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
<if test="conTypeId != null">
|
||||
con_type_id,
|
||||
</if>
|
||||
<if test="conTypeName != null">
|
||||
con_type_name,
|
||||
</if>
|
||||
<if test="conCode != null">
|
||||
con_code,
|
||||
</if>
|
||||
<if test="conName != null">
|
||||
con_name,
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
stock_number,
|
||||
</if>
|
||||
<if test="conUnit != null">
|
||||
con_unit,
|
||||
</if>
|
||||
<if test="surplusStock != null">
|
||||
surplus_stock,
|
||||
</if>
|
||||
<if test="lasterInStock != null">
|
||||
laster_in_stock,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conTypeId != null">
|
||||
#{conTypeId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conTypeName != null">
|
||||
#{conTypeName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="conCode != null">
|
||||
#{conCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="conName != null">
|
||||
#{conName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
#{stockNumber,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="conUnit != null">
|
||||
#{conUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="surplusStock != null">
|
||||
#{surplusStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lasterInStock != null">
|
||||
#{lasterInStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
update tb_cons_info
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conTypeId != null">
|
||||
con_type_id = #{conTypeId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conTypeName != null">
|
||||
con_type_name = #{conTypeName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="conCode != null">
|
||||
con_code = #{conCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="conName != null">
|
||||
con_name = #{conName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
stock_number = #{stockNumber,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="conUnit != null">
|
||||
con_unit = #{conUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="surplusStock != null">
|
||||
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lasterInStock != null">
|
||||
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
update tb_cons_info
|
||||
set shop_id = #{shopId,jdbcType=INTEGER},
|
||||
con_type_id = #{conTypeId,jdbcType=INTEGER},
|
||||
con_type_name = #{conTypeName,jdbcType=VARCHAR},
|
||||
con_code = #{conCode,jdbcType=VARCHAR},
|
||||
con_name = #{conName,jdbcType=VARCHAR},
|
||||
stock_number = #{stockNumber,jdbcType=DECIMAL},
|
||||
con_unit = #{conUnit,jdbcType=VARCHAR},
|
||||
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
||||
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="batchStock">
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
update tb_cons_info
|
||||
set stock_number= stock_number- #{item.amount},
|
||||
update_time = now()
|
||||
where id = #{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user