优化序列号模块
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.DepotHeadMapperEx">
|
||||
|
||||
<resultMap extends="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.vo.DepotHeadVo4List">
|
||||
<result column="depotHeadType" jdbcType="VARCHAR" property="depotHeadType" />
|
||||
<result column="OrganName" jdbcType="VARCHAR" property="organName" />
|
||||
<result column="userName" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="AccountName" jdbcType="VARCHAR" property="accountName" />
|
||||
@@ -432,7 +433,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
|
||||
select dh.*, s.supplier OrganName, a.name AccountName
|
||||
select dh.*, concat(dh.sub_type,dh.type) as depotHeadType, s.supplier OrganName, a.name AccountName
|
||||
from jsh_depot_head dh
|
||||
left join jsh_supplier s on dh.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
|
||||
left join jsh_account a on dh.account_id=a.id and ifnull(a.delete_Flag,'0') !='1'
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
<result column="creator" jdbcType="BIGINT" property="creator" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="updater" jdbcType="BIGINT" property="updater" />
|
||||
<result column="depot_head_id" jdbcType="BIGINT" property="depotHeadId" />
|
||||
<result column="in_bill_no" jdbcType="VARCHAR" property="inBillNo" />
|
||||
<result column="out_bill_no" jdbcType="VARCHAR" property="outBillNo" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
@@ -76,7 +77,7 @@
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, material_id, depot_id, serial_number, is_sell, remark, delete_flag, create_time,
|
||||
creator, update_time, updater, depot_head_id, tenant_id
|
||||
creator, update_time, updater, in_bill_no, out_bill_no, tenant_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.SerialNumberExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -112,13 +113,13 @@
|
||||
insert into jsh_serial_number (id, material_id, depot_id,
|
||||
serial_number, is_sell, remark,
|
||||
delete_flag, create_time, creator,
|
||||
update_time, updater, depot_head_id,
|
||||
tenant_id)
|
||||
update_time, updater, in_bill_no,
|
||||
out_bill_no, tenant_id)
|
||||
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{depotId,jdbcType=BIGINT},
|
||||
#{serialNumber,jdbcType=VARCHAR}, #{isSell,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
#{deleteFlag,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=BIGINT}, #{depotHeadId,jdbcType=BIGINT},
|
||||
#{tenantId,jdbcType=BIGINT})
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=BIGINT}, #{inBillNo,jdbcType=VARCHAR},
|
||||
#{outBillNo,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
|
||||
insert into jsh_serial_number
|
||||
@@ -156,8 +157,11 @@
|
||||
<if test="updater != null">
|
||||
updater,
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
depot_head_id,
|
||||
<if test="inBillNo != null">
|
||||
in_bill_no,
|
||||
</if>
|
||||
<if test="outBillNo != null">
|
||||
out_bill_no,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
@@ -197,8 +201,11 @@
|
||||
<if test="updater != null">
|
||||
#{updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
#{depotHeadId,jdbcType=BIGINT},
|
||||
<if test="inBillNo != null">
|
||||
#{inBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="outBillNo != null">
|
||||
#{outBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
@@ -247,8 +254,11 @@
|
||||
<if test="record.updater != null">
|
||||
updater = #{record.updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.depotHeadId != null">
|
||||
depot_head_id = #{record.depotHeadId,jdbcType=BIGINT},
|
||||
<if test="record.inBillNo != null">
|
||||
in_bill_no = #{record.inBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.outBillNo != null">
|
||||
out_bill_no = #{record.outBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.tenantId != null">
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
@@ -271,7 +281,8 @@
|
||||
creator = #{record.creator,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
updater = #{record.updater,jdbcType=BIGINT},
|
||||
depot_head_id = #{record.depotHeadId,jdbcType=BIGINT},
|
||||
in_bill_no = #{record.inBillNo,jdbcType=VARCHAR},
|
||||
out_bill_no = #{record.outBillNo,jdbcType=VARCHAR},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@@ -310,8 +321,11 @@
|
||||
<if test="updater != null">
|
||||
updater = #{updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
depot_head_id = #{depotHeadId,jdbcType=BIGINT},
|
||||
<if test="inBillNo != null">
|
||||
in_bill_no = #{inBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="outBillNo != null">
|
||||
out_bill_no = #{outBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
@@ -331,7 +345,8 @@
|
||||
creator = #{creator,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
updater = #{updater,jdbcType=BIGINT},
|
||||
depot_head_id = #{depotHeadId,jdbcType=BIGINT},
|
||||
in_bill_no = #{inBillNo,jdbcType=VARCHAR},
|
||||
out_bill_no = #{outBillNo,jdbcType=VARCHAR},
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
@@ -11,82 +11,14 @@
|
||||
<result column="depotHeadType" jdbcType="VARCHAR" property="depotHeadType" />
|
||||
<result column="depotName" jdbcType="VARCHAR" property="depotName" />
|
||||
</resultMap>
|
||||
<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,me.bar_code as materialCode,mat.name as materialName,null as creator,null as updater,null as creatorName,
|
||||
null as updaterName,ser.depot_head_id, dh.number as depotHeadNumber,concat(dh.sub_type,dh.type) as depotHeadType, depot_id, d.name depotName
|
||||
FROM jsh_serial_number ser
|
||||
left join jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_flag,'0') !='1'
|
||||
left join jsh_material_extend me on mat.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_head dh on dh.id= ser.depot_head_id and ifnull(dh.delete_flag,'0') !='1'
|
||||
left join jsh_depot d on ser.depot_id=d.id and ifnull(d.delete_flag,'0') !='1'
|
||||
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>
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
order by ser.id desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
<select id="countSerialNumber" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(ser.id)
|
||||
FROM jsh_serial_number ser
|
||||
left JOIN jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_flag,'0') !='1'
|
||||
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>
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
order by ser.id desc
|
||||
</select>
|
||||
<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,ser.depot_head_id
|
||||
FROM jsh_serial_number ser
|
||||
left JOIN jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_Flag,'0') !='1'
|
||||
left join jsh_user cr on ser.creator=cr.id and ifnull(cr.status,'0') not in('1','2')
|
||||
left join jsh_user ur on ser.updater=ur.id and ifnull(ur.status,'0') not in('1','2')
|
||||
where 1=1
|
||||
and ser.id=#{id}
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
order by ser.id desc
|
||||
</select>
|
||||
<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.depot_head_id
|
||||
FROM jsh_serial_number ser
|
||||
where 1=1
|
||||
<if test="serialNumber != null">
|
||||
and ser.serial_number=#{serialNumber}
|
||||
</if>
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
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,depot_head_id)
|
||||
create_time, creator,update_time, updater,in_bill_no, out_bill_no)
|
||||
values
|
||||
(#{materialId},#{serialNumber},#{isSell},#{remark},#{deleteFlag},
|
||||
#{createTime},#{creator},#{updateTime},#{updater},#{depotHeadId}
|
||||
#{createTime},#{creator},#{updateTime},#{updater},#{inBillNo},#{outBillNo}
|
||||
)
|
||||
</insert>
|
||||
<update id="updateSerialNumber" parameterType="com.jsh.erp.datasource.entities.SerialNumberEx">
|
||||
@@ -113,8 +45,11 @@
|
||||
<if test="updater != null">
|
||||
updater = #{updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
depot_head_id = #{depotHeadId,jdbcType=BIGINT},
|
||||
<if test="inBillNo != null">
|
||||
in_bill_no = #{inBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="outBillNo != null">
|
||||
out_bill_no = #{outBillNo,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
@@ -131,26 +66,12 @@
|
||||
and ifnull(ser.delete_flag,'0') !='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.depot_head_id=#{depotHeadId}
|
||||
</if>
|
||||
and ser.is_sell =#{isSell,jdbcType=VARCHAR}
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
</select>
|
||||
<update id="sellSerialNumber">
|
||||
update jsh_serial_number
|
||||
<set>
|
||||
is_sell = '1',
|
||||
<if test="depotHeadId !=null ">
|
||||
depot_head_id = #{depotHeadId},
|
||||
<if test="outBillNo !=null ">
|
||||
out_bill_no = #{outBillNo},
|
||||
</if>
|
||||
<if test="updateTime !=null ">
|
||||
update_time = #{updateTime},
|
||||
@@ -179,7 +100,7 @@
|
||||
<update id="cancelSerialNumber">
|
||||
update jsh_serial_number
|
||||
<set>
|
||||
is_sell = '0', depot_head_id=null,
|
||||
is_sell = '0', out_bill_no=null,
|
||||
<if test="updateTime !=null ">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
@@ -191,8 +112,8 @@
|
||||
<if test="materialId != null">
|
||||
and material_id = #{materialId}
|
||||
</if>
|
||||
<if test="depotHeadId !=null ">
|
||||
and depot_head_id = #{depotHeadId,jdbcType=BIGINT}
|
||||
<if test="outBillNo !=null ">
|
||||
and out_bill_no = #{outBillNo,jdbcType=VARCHAR}
|
||||
</if>
|
||||
and is_sell != '0'
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
@@ -204,8 +125,8 @@
|
||||
<if test="materialId != null">
|
||||
and selFrom.material_id = #{materialId}
|
||||
</if>
|
||||
<if test="depotHeadId !=null ">
|
||||
and selFrom.depot_head_id = #{depotHeadId,jdbcType=BIGINT}
|
||||
<if test="outBillNo !=null ">
|
||||
and selFrom.out_bill_no = #{outBillNo,jdbcType=VARCHAR}
|
||||
</if>
|
||||
and selFrom.is_sell !='0'
|
||||
and ifnull(selFrom.delete_flag,'0') !='1'
|
||||
|
||||
Reference in New Issue
Block a user