添加序列号功能

This commit is contained in:
cjl
2019-01-23 13:58:53 +08:00
parent fd76355f3a
commit 2bd1d9982d
29 changed files with 1787 additions and 347 deletions

View File

@@ -29,6 +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" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
@@ -103,7 +104,7 @@
-->
Id, CategoryId, Name, Mfrs, Packing, SafetyStock, Model, Standard, Color, Unit, Remark,
RetailPrice, LowPrice, PresetPriceOne, PresetPriceTwo, UnitId, FirstOutUnit, FirstInUnit,
PriceStrategy, Enabled, OtherField1, OtherField2, OtherField3
PriceStrategy, Enabled, OtherField1, OtherField2, OtherField3,enableSerialNumber
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="BaseResultMap">
<!--
@@ -163,7 +164,7 @@
LowPrice, PresetPriceOne, PresetPriceTwo,
UnitId, FirstOutUnit, FirstInUnit,
PriceStrategy, Enabled, OtherField1,
OtherField2, OtherField3)
OtherField2, OtherField3,enableSerialNumber)
values (#{id,jdbcType=BIGINT}, #{categoryid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{mfrs,jdbcType=VARCHAR}, #{packing,jdbcType=DECIMAL}, #{safetystock,jdbcType=DECIMAL},
#{model,jdbcType=VARCHAR}, #{standard,jdbcType=VARCHAR}, #{color,jdbcType=VARCHAR},
@@ -171,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})
#{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR},#{enableSerialNumber,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Material">
<!--
@@ -249,6 +250,9 @@
<if test="otherfield3 != null">
OtherField3,
</if>
<if test="enableSerialNumber != null">
enableSerialNumber,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -320,6 +324,9 @@
<if test="otherfield3 != null">
#{otherfield3,jdbcType=VARCHAR},
</if>
<if test="enableSerialNumber != null">
#{enableSerialNumber,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="java.lang.Integer">
@@ -408,6 +415,9 @@
<if test="record.otherfield3 != null">
OtherField3 = #{record.otherfield3,jdbcType=VARCHAR},
</if>
<if test="record.enableSerialNumber != null">
enableSerialNumber = #{record.enableSerialNumber,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -442,6 +452,7 @@
OtherField1 = #{record.otherfield1,jdbcType=VARCHAR},
OtherField2 = #{record.otherfield2,jdbcType=VARCHAR},
OtherField3 = #{record.otherfield3,jdbcType=VARCHAR}
enableSerialNumber = #{record.enableSerialNumber,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@@ -519,6 +530,9 @@
<if test="otherfield3 != null">
OtherField3 = #{otherfield3,jdbcType=VARCHAR},
</if>
<if test="enableSerialNumber != null">
enableSerialNumber = #{enableSerialNumber,jdbcType=VARCHAR},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
@@ -550,6 +564,7 @@
OtherField1 = #{otherfield1,jdbcType=VARCHAR},
OtherField2 = #{otherfield2,jdbcType=VARCHAR},
OtherField3 = #{otherfield3,jdbcType=VARCHAR}
enableSerialNumber = #{enableSerialNumber,jdbcType=VARCHAR}
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -1,6 +1,36 @@
<?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.MaterialMapper">
<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">
<result column="unitName" jdbcType="VARCHAR" property="unitName" />
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
@@ -95,4 +125,15 @@
</if>
order by m.id asc
</select>
<select id="findByMaterialName" resultType="com.jsh.erp.datasource.entities.Material">
select m.*
FROM jsh_material m
where 1=1
<if test="name != null">
and m.name =#{name}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,116 @@
<?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">
<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
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
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
where 1=1
<if test="serialNumber != null">
<bind name="serialNumber" value="'%' + _parameter.serialNumber + '%'" />
and ser.serial_Number like #{serialNumber}
</if>
<if test="materialName != null">
<bind name="materialName" value="'%' + _parameter.materialName + '%'" />
and mat.name like #{materialName}
</if>
order by ser.id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="countSerialNumber" resultType="java.lang.Integer">
SELECT
COUNT(ser.id)
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
where 1=1
<if test="serialNumber != null">
<bind name="serialNumber" value="'%' + _parameter.serialNumber + '%'" />
and ser.serial_Number like #{serialNumber}
</if>
<if test="materialName != null">
<bind name="materialName" value="'%' + _parameter.materialName + '%'" />
and mat.name like #{materialName}
</if>
order by ser.id desc
</select>
<select id="findById" resultMap="BaseResultMap">
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
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
left join jsh_user ur on ser.updater=ur.id
where 1=1
and ser.id=#{id}
order by ser.id desc
</select>
<select id="findBySerialNumber" resultMap="BaseResultMap">
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
FROM jsh_serial_number ser
where 1=1
<if test="serialNumber != null">
and ser.serial_Number=#{serialNumber}
</if>
order by ser.id desc
</select>
<insert id="addSerialNumber" parameterType="com.jsh.erp.datasource.entities.SerialNumberEx"
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)
values
(#{materialId},#{serialNumber},#{isSell},#{remark},#{deleteFlag},
#{createTime},#{creator},#{updateTime},#{updater}
)
</insert>
<update id="updateSerialNumber" parameterType="com.jsh.erp.datasource.entities.SerialNumberEx">
update jsh_serial_number
<set>
<if test="materialId != null">
material_Id = #{materialId,jdbcType=BIGINT},
</if>
<if test="serialNumber != null">
serial_Number = #{serialNumber,jdbcType=VARCHAR},
</if>
<if test="isSell != null">
is_Sell = #{isSell,jdbcType=BIT},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=BIT},
</if>
<if test="updateTime != null">
update_Time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
updater = #{updater,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>