添加出库时开启序列号的商品强制附加使用序列号

This commit is contained in:
cjl
2019-01-29 10:33:22 +08:00
parent b55e9d1597
commit b08d349b45
31 changed files with 1521 additions and 567 deletions

View File

@@ -1,8 +1,8 @@
<?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.jsh.erp.datasource.mappers.DepotHeadMapper">
<mapper namespace="com.jsh.erp.datasource.mappers.DepotHeadMapperEx">
<resultMap extends="BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.vo.DepotHeadVo4List">
<resultMap extends="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.vo.DepotHeadVo4List">
<result column="ProjectName" jdbcType="VARCHAR" property="projectName" />
<result column="OrganName" jdbcType="VARCHAR" property="organName" />
<result column="HandsPersonName" jdbcType="VARCHAR" property="handsPersonName" />
@@ -282,4 +282,112 @@
</if>
</select>
<insert id="adddepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHead"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_depothead (Type, SubType,
ProjectId, DefaultNumber, Number,
OperPersonName, CreateTime, OperTime,
OrganId, HandsPersonId, AccountId,
ChangeAmount, AllocationProjectId, TotalPrice,
PayType, Remark, Salesman,
AccountIdList, AccountMoneyList, Discount,
DiscountMoney, DiscountLastMoney, OtherMoney,
OtherMoneyList, OtherMoneyItem, AccountDay,
Status)
values (#{type,jdbcType=VARCHAR}, #{subtype,jdbcType=VARCHAR},
#{projectid,jdbcType=BIGINT}, #{defaultnumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR},
#{operpersonname,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP}, #{opertime,jdbcType=TIMESTAMP},
#{organid,jdbcType=BIGINT}, #{handspersonid,jdbcType=BIGINT}, #{accountid,jdbcType=BIGINT},
#{changeamount,jdbcType=DECIMAL}, #{allocationprojectid,jdbcType=BIGINT}, #{totalprice,jdbcType=DECIMAL},
#{paytype,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{salesman,jdbcType=VARCHAR},
#{accountidlist,jdbcType=VARCHAR}, #{accountmoneylist,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL},
#{discountmoney,jdbcType=DECIMAL}, #{discountlastmoney,jdbcType=DECIMAL}, #{othermoney,jdbcType=DECIMAL},
#{othermoneylist,jdbcType=VARCHAR}, #{othermoneyitem,jdbcType=VARCHAR}, #{accountday,jdbcType=INTEGER},
#{status,jdbcType=BIT})
</insert>
<update id="updatedepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHead">
update jsh_depothead
<set>
<if test="type != null">
Type = #{type,jdbcType=VARCHAR},
</if>
<if test="subtype != null">
SubType = #{subtype,jdbcType=VARCHAR},
</if>
<if test="projectid != null">
ProjectId = #{projectid,jdbcType=BIGINT},
</if>
<if test="defaultnumber != null">
DefaultNumber = #{defaultnumber,jdbcType=VARCHAR},
</if>
<if test="number != null">
Number = #{number,jdbcType=VARCHAR},
</if>
<if test="operpersonname != null">
OperPersonName = #{operpersonname,jdbcType=VARCHAR},
</if>
<if test="opertime != null">
OperTime = #{opertime,jdbcType=TIMESTAMP},
</if>
<if test="organid != null">
OrganId = #{organid,jdbcType=BIGINT},
</if>
<if test="handspersonid != null">
HandsPersonId = #{handspersonid,jdbcType=BIGINT},
</if>
<if test="accountid != null">
AccountId = #{accountid,jdbcType=BIGINT},
</if>
<if test="changeamount != null">
ChangeAmount = #{changeamount,jdbcType=DECIMAL},
</if>
<if test="allocationprojectid != null">
AllocationProjectId = #{allocationprojectid,jdbcType=BIGINT},
</if>
<if test="totalprice != null">
TotalPrice = #{totalprice,jdbcType=DECIMAL},
</if>
<if test="paytype != null">
PayType = #{paytype,jdbcType=VARCHAR},
</if>
<if test="remark != null">
Remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="salesman != null">
Salesman = #{salesman,jdbcType=VARCHAR},
</if>
<if test="accountidlist != null">
AccountIdList = #{accountidlist,jdbcType=VARCHAR},
</if>
<if test="accountmoneylist != null">
AccountMoneyList = #{accountmoneylist,jdbcType=VARCHAR},
</if>
<if test="discount != null">
Discount = #{discount,jdbcType=DECIMAL},
</if>
<if test="discountmoney != null">
DiscountMoney = #{discountmoney,jdbcType=DECIMAL},
</if>
<if test="discountlastmoney != null">
DiscountLastMoney = #{discountlastmoney,jdbcType=DECIMAL},
</if>
<if test="othermoney != null">
OtherMoney = #{othermoney,jdbcType=DECIMAL},
</if>
<if test="othermoneylist != null">
OtherMoneyList = #{othermoneylist,jdbcType=VARCHAR},
</if>
<if test="othermoneyitem != null">
OtherMoneyItem = #{othermoneyitem,jdbcType=VARCHAR},
</if>
<if test="accountday != null">
AccountDay = #{accountday,jdbcType=INTEGER},
</if>
<if test="status != null">
Status = #{status,jdbcType=BIT},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -1,6 +1,7 @@
<?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.jsh.erp.datasource.mappers.DepotItemMapper">
<mapper namespace="com.jsh.erp.datasource.mappers.DepotItemMapperEx">
<resultMap id="HeaderIdResultMap" type="com.jsh.erp.datasource.entities.DepotItemVo4HeaderId">
<result column="HeaderId" jdbcType="BIGINT" property="headerid" />
</resultMap>
@@ -12,12 +13,12 @@
<result column="oTime" jdbcType="TIMESTAMP" property="otime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultAndMaterialMap" type="com.jsh.erp.datasource.entities.DepotItemVo4Material">
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultAndMaterialMap" type="com.jsh.erp.datasource.entities.DepotItemVo4Material">
<result column="mName" jdbcType="VARCHAR" property="mname" />
<result column="mModel" jdbcType="VARCHAR" property="mmodel" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultWithInfoExMap" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultWithInfoExMap" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
<result column="MName" jdbcType="VARCHAR" property="MName" />
<result column="MModel" jdbcType="VARCHAR" property="MModel" />
<result column="MaterialUnit" jdbcType="VARCHAR" property="MaterialUnit" />
@@ -33,7 +34,7 @@
<result column="UName" jdbcType="VARCHAR" property="UName" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultByMaterial" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultByMaterial" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
<result column="MId" jdbcType="VARCHAR" property="MId" />
<result column="MName" jdbcType="VARCHAR" property="MName" />
<result column="MModel" jdbcType="VARCHAR" property="MModel" />
@@ -41,7 +42,7 @@
<result column="MColor" jdbcType="VARCHAR" property="MColor" />
</resultMap>
<select id="selectByConditionDepotItem" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
<select id="selectByConditionDepotItem" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap">
select *
FROM jsh_depotitem
where 1=1
@@ -274,4 +275,35 @@
and jsh_depotitem.MaterialId =${MId}
</select>
<select id="findDepotItemListBydepotheadId" resultType="com.jsh.erp.datasource.entities.DepotItem">
select
dep.id,dep.headerId,dep.materialid,dep.munit,dep.opernumber,
dep.basicnumber,dep.unitprice,dep.taxunitprice,dep.allprice,dep.remark,
dep.img,dep.incidentals,dep.depotid,dep.anotherdepotid,dep.taxrate,
dep.taxmoney,dep.taxlastmoney,dep.otherfield1,dep.otherfield2,dep.otherfield3,
dep.otherfield4,dep.otherfield5,dep.mtype
from jsh_depotitem dep,jsh_material mat
where 1=1
<if test="depotheadId != null">
and HeaderId = #{depotheadId}
</if>
and dep.materialid=mat.id
<if test="enableSerialNumber != null">
and mat.enableSerialNumber = #{enableSerialNumber}
</if>
</select>
<delete id="deleteDepotItemByDepotHeadIds">
delete from jsh_depotitem
where 1=1
and HeaderId in
(
<foreach collection="depotheadIds" item="depotheadId" separator=",">
#{depotheadId}
</foreach>
)
</delete>
</mapper>

View File

@@ -29,7 +29,7 @@
<result column="OtherField1" jdbcType="VARCHAR" property="otherfield1" />
<result column="OtherField2" jdbcType="VARCHAR" property="otherfield2" />
<result column="OtherField3" jdbcType="VARCHAR" property="otherfield3" />
<result column="enableSerialNumber" jdbcType="BIT" property="enableSerialNumber" />
<result column="enableSerialNumber" jdbcType="VARCHAR" property="enableSerialNumber" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
@@ -172,7 +172,7 @@
#{lowprice,jdbcType=DECIMAL}, #{presetpriceone,jdbcType=DECIMAL}, #{presetpricetwo,jdbcType=DECIMAL},
#{unitid,jdbcType=BIGINT}, #{firstoutunit,jdbcType=VARCHAR}, #{firstinunit,jdbcType=VARCHAR},
#{pricestrategy,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT}, #{otherfield1,jdbcType=VARCHAR},
#{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR},#{enableSerialNumber,jdbcType=BIT})
#{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR},#{enableSerialNumber,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Material">
<!--
@@ -325,7 +325,7 @@
#{otherfield3,jdbcType=VARCHAR},
</if>
<if test="enableSerialNumber != null">
#{enableSerialNumber,jdbcType=BIT},
#{enableSerialNumber,jdbcType=VARCHAR},
</if>
</trim>
</insert>
@@ -452,7 +452,7 @@
OtherField1 = #{record.otherfield1,jdbcType=VARCHAR},
OtherField2 = #{record.otherfield2,jdbcType=VARCHAR},
OtherField3 = #{record.otherfield3,jdbcType=VARCHAR}
enableSerialNumber = #{record.enableSerialNumber,jdbcType=BIT}
enableSerialNumber = #{record.enableSerialNumber,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>

View File

@@ -1,42 +1,12 @@
<?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.jsh.erp.datasource.mappers.MaterialMapperEx">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Material">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="Id" jdbcType="BIGINT" property="id" />
<result column="CategoryId" jdbcType="BIGINT" property="categoryid" />
<result column="Name" jdbcType="VARCHAR" property="name" />
<result column="Mfrs" jdbcType="VARCHAR" property="mfrs" />
<result column="Packing" jdbcType="DECIMAL" property="packing" />
<result column="SafetyStock" jdbcType="DECIMAL" property="safetystock" />
<result column="Model" jdbcType="VARCHAR" property="model" />
<result column="Standard" jdbcType="VARCHAR" property="standard" />
<result column="Color" jdbcType="VARCHAR" property="color" />
<result column="Unit" jdbcType="VARCHAR" property="unit" />
<result column="Remark" jdbcType="VARCHAR" property="remark" />
<result column="RetailPrice" jdbcType="DECIMAL" property="retailprice" />
<result column="LowPrice" jdbcType="DECIMAL" property="lowprice" />
<result column="PresetPriceOne" jdbcType="DECIMAL" property="presetpriceone" />
<result column="PresetPriceTwo" jdbcType="DECIMAL" property="presetpricetwo" />
<result column="UnitId" jdbcType="BIGINT" property="unitid" />
<result column="FirstOutUnit" jdbcType="VARCHAR" property="firstoutunit" />
<result column="FirstInUnit" jdbcType="VARCHAR" property="firstinunit" />
<result column="PriceStrategy" jdbcType="VARCHAR" property="pricestrategy" />
<result column="Enabled" jdbcType="BIT" property="enabled" />
<result column="OtherField1" jdbcType="VARCHAR" property="otherfield1" />
<result column="OtherField2" jdbcType="VARCHAR" property="otherfield2" />
<result column="OtherField3" jdbcType="VARCHAR" property="otherfield3" />
<result column="enableSerialNumber" jdbcType="BIT" property="enableSerialNumber" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
<result column="unitName" jdbcType="VARCHAR" property="unitName" />
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
<result column="UName" jdbcType="VARCHAR" property="unitName" />
</resultMap>

View File

@@ -9,13 +9,14 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="material_Id" jdbcType="BIGINT" property="materialId" />
<result column="serial_Number" jdbcType="VARCHAR" property="serialNumber" />
<result column="is_Sell" jdbcType="BIT" property="isSell" />
<result column="is_Sell" jdbcType="VARCHAR" property="isSell" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="delete_Flag" jdbcType="BIT" property="deleteFlag" />
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
<result column="create_Time" jdbcType="TIMESTAMP" property="createTime" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="update_Time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="updater" jdbcType="BIGINT" property="updater" />
<result column="depothead_Id" jdbcType="BIGINT" property="depotheadId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
@@ -89,7 +90,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, material_Id, serial_Number, is_Sell, remark, delete_Flag, create_Time, creator,
update_Time, updater
update_Time, updater,depothead_Id
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.SerialNumberExample" resultMap="BaseResultMap">
<!--
@@ -145,11 +146,11 @@
insert into jsh_serial_number (id, material_Id, serial_Number,
is_Sell, remark, delete_Flag,
create_Time, creator, update_Time,
updater)
updater,depothead_Id)
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{serialNumber,jdbcType=VARCHAR},
#{isSell,jdbcType=BIT}, #{remark,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=BIT},
#{isSell,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
#{updater,jdbcType=BIGINT})
#{updater,jdbcType=BIGINT},#{depotheadId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
<!--
@@ -188,6 +189,9 @@
<if test="updater != null">
updater,
</if>
<if test="depotheadId != null">
depothead_Id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -200,13 +204,13 @@
#{serialNumber,jdbcType=VARCHAR},
</if>
<if test="isSell != null">
#{isSell,jdbcType=BIT},
#{isSell,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=BIT},
#{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
@@ -220,6 +224,9 @@
<if test="updater != null">
#{updater,jdbcType=BIGINT},
</if>
<if test="depotheadId != null">
#{depotheadId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.SerialNumberExample" resultType="java.lang.Integer">
@@ -249,13 +256,13 @@
serial_Number = #{record.serialNumber,jdbcType=VARCHAR},
</if>
<if test="record.isSell != null">
is_Sell = #{record.isSell,jdbcType=BIT},
is_Sell = #{record.isSell,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.deleteFlag != null">
delete_Flag = #{record.deleteFlag,jdbcType=BIT},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_Time = #{record.createTime,jdbcType=TIMESTAMP},
@@ -269,6 +276,9 @@
<if test="record.updater != null">
updater = #{record.updater,jdbcType=BIGINT},
</if>
<if test="record.depotheadId != null">
depothead_Id = #{record.depotheadId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -283,13 +293,14 @@
set id = #{record.id,jdbcType=BIGINT},
material_Id = #{record.materialId,jdbcType=BIGINT},
serial_Number = #{record.serialNumber,jdbcType=VARCHAR},
is_Sell = #{record.isSell,jdbcType=BIT},
is_Sell = #{record.isSell,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
delete_Flag = #{record.deleteFlag,jdbcType=BIT},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
create_Time = #{record.createTime,jdbcType=TIMESTAMP},
creator = #{record.creator,jdbcType=BIGINT},
update_Time = #{record.updateTime,jdbcType=TIMESTAMP},
updater = #{record.updater,jdbcType=BIGINT}
updater = #{record.updater,jdbcType=BIGINT},
depothead_Id = #{record.depotheadId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@@ -308,13 +319,13 @@
serial_Number = #{serialNumber,jdbcType=VARCHAR},
</if>
<if test="isSell != null">
is_Sell = #{isSell,jdbcType=BIT},
is_Sell = #{isSell,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=BIT},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_Time = #{createTime,jdbcType=TIMESTAMP},
@@ -328,6 +339,9 @@
<if test="updater != null">
updater = #{updater,jdbcType=BIGINT},
</if>
<if test="depotheadId != null">
depothead_Id = #{depotheadId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@@ -339,13 +353,14 @@
update jsh_serial_number
set material_Id = #{materialId,jdbcType=BIGINT},
serial_Number = #{serialNumber,jdbcType=VARCHAR},
is_Sell = #{isSell,jdbcType=BIT},
is_Sell = #{isSell,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
delete_Flag = #{deleteFlag,jdbcType=BIT},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
create_Time = #{createTime,jdbcType=TIMESTAMP},
creator = #{creator,jdbcType=BIGINT},
update_Time = #{updateTime,jdbcType=TIMESTAMP},
updater = #{updater,jdbcType=BIGINT}
updater = #{updater,jdbcType=BIGINT},
depothead_Id = #{depotheadId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -1,25 +1,17 @@
<?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.jsh.erp.datasource.mappers.SerialNumberMapperEx">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.SerialNumberEx">
<resultMap extends="com.jsh.erp.datasource.mappers.SerialNumberMapper.BaseResultMap" id="SerialNumberExBaseResultMap" type="com.jsh.erp.datasource.entities.SerialNumberEx">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="material_Id" jdbcType="BIGINT" property="materialId" />
<result column="materialName" jdbcType="VARCHAR" property="materialName" />
<result column="serial_Number" jdbcType="VARCHAR" property="serialNumber" />
<result column="is_Sell" jdbcType="BIT" property="isSell" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="delete_Flag" jdbcType="BIT" property="deleteFlag" />
<result column="create_Time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_Time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="updater" jdbcType="BIGINT" property="updater" />
<result column="creatorName" jdbcType="VARCHAR" property="creatorName" />
<result column="updaterName" jdbcType="VARCHAR" property="updaterName" />
</resultMap>
<select id="selectByConditionSerialNumber" resultMap="BaseResultMap">
<select id="selectByConditionSerialNumber" resultMap="SerialNumberExBaseResultMap">
select
ser.id, ser.material_Id, ser.serial_Number, ser.is_Sell, ser.remark, ser.delete_Flag, ser.create_Time,
ser.update_Time,mat.name as materialName,null as creator,null as updater,null as creatorName, null as updaterName
ser.update_Time,mat.name as materialName,null as creator,null as updater,null as creatorName,
null as updaterName,ser.depothead_Id
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
where 1=1
@@ -52,11 +44,11 @@
</if>
order by ser.id desc
</select>
<select id="findById" resultMap="BaseResultMap">
<select id="findById" resultMap="SerialNumberExBaseResultMap">
SELECT
ser.id, ser.material_Id, ser.serial_Number, ser.is_Sell, ser.remark, ser.delete_Flag, ser.create_Time,
ser.update_Time,ser.creator,ser.updater,mat.name as materialName,cr.username as creatorName,
ur.username as updaterName
ur.username as updaterName,ser.depothead_Id
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
left join jsh_user cr on ser.creator=cr.id
@@ -65,10 +57,10 @@
and ser.id=#{id}
order by ser.id desc
</select>
<select id="findBySerialNumber" resultMap="BaseResultMap">
<select id="findBySerialNumber" resultMap="SerialNumberExBaseResultMap">
SELECT
ser.id, ser.material_Id, ser.serial_Number, ser.is_Sell, ser.remark, ser.delete_Flag, ser.create_Time,
ser.update_Time,ser.creator,ser.updater
ser.update_Time,ser.creator,ser.updater,ser.depothead_Id
FROM jsh_serial_number ser
where 1=1
<if test="serialNumber != null">
@@ -80,10 +72,10 @@
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_serial_number
(material_Id, serial_Number, is_Sell, remark,delete_Flag,
create_Time, creator,update_Time, updater)
create_Time, creator,update_Time, updater,depothead_Id)
values
(#{materialId},#{serialNumber},#{isSell},#{remark},#{deleteFlag},
#{createTime},#{creator},#{updateTime},#{updater}
#{createTime},#{creator},#{updateTime},#{updater},#{depotheadId}
)
</insert>
<update id="updateSerialNumber" parameterType="com.jsh.erp.datasource.entities.SerialNumberEx">
@@ -96,13 +88,13 @@
serial_Number = #{serialNumber,jdbcType=VARCHAR},
</if>
<if test="isSell != null">
is_Sell = #{isSell,jdbcType=BIT},
is_Sell = #{isSell,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=BIT},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_Time = #{updateTime,jdbcType=TIMESTAMP},
@@ -110,9 +102,13 @@
<if test="updater != null">
updater = #{updater,jdbcType=BIGINT},
</if>
<if test="depotheadId != null">
depothead_Id = #{depotheadId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findSerialNumberByMaterialId" resultType="java.lang.Integer">
SELECT
count(ser.id)
@@ -124,5 +120,93 @@
and ser.delete_Flag !='1'
and ser.is_Sell !='1'
</select>
<select id="countSerialNumberByMaterialIdAndDepotheadId" resultType="java.lang.Integer">
SELECT
count(ser.id)
FROM jsh_serial_number ser
where 1=1
<if test="materialId != null">
and ser.material_Id=#{materialId}
</if>
<if test="depotheadId != null">
and ser.depothead_Id=#{depotheadId}
</if>
and ser.is_Sell =#{isSell,jdbcType=VARCHAR}
and ser.delete_Flag !='1'
</select>
<update id="sellSerialNumber">
update jsh_serial_number
<set>
is_Sell = '1',
<if test="depotheadId !=null ">
depothead_Id = #{depotheadId},
</if>
<if test="updateTime !=null ">
update_Time = #{updateTime},
</if>
<if test="updater != null">
updater = #{updater},
</if>
</set>
where 1=1
<if test="materialId != null">
and material_Id = #{materialId}
</if>
and is_Sell != '1'
<if test="count != null">
and id in
( select batchSN.id from
( select selFrom.id from jsh_serial_number selFrom
where 1=1
<if test="materialId != null">
and selFrom.material_Id = #{materialId}
</if>
and selFrom.is_Sell != '1'
limit 0,#{count}
) batchSN
)
</if>
</update>
<update id="cancelSerialNumber">
update jsh_serial_number
<set>
is_Sell = '0',
<if test="updateTime !=null ">
update_Time = #{updateTime},
</if>
<if test="updater != null">
updater = #{updater},
</if>
</set>
where 1=1
<if test="materialId != null">
and material_Id = #{materialId}
</if>
<if test="depotheadId !=null ">
and depothead_Id = #{depotheadId,jdbcType=BIGINT}
</if>
and is_Sell != '0'
<if test="count != null">
and id in
( select batchSN.id from
( select selFrom.id from jsh_serial_number selFrom
where 1=1
<if test="materialId != null">
and selFrom.material_Id = #{materialId}
</if>
<if test="depotheadId !=null ">
and selFrom.depothead_Id = #{depotheadId,jdbcType=BIGINT}
</if>
and selFrom.is_Sell !='0'
limit 0,#{count}
) batchSN
)
</if>
</update>
</mapper>