增加批次商品选择
This commit is contained in:
@@ -81,6 +81,17 @@
|
||||
<result column="disAssemOutTotal" jdbcType="DECIMAL" property="disAssemOutTotal" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="batchNumberListMap" type="com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList">
|
||||
<result column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="bar_code" jdbcType="VARCHAR" property="barCode" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="standard" jdbcType="VARCHAR" property="standard" />
|
||||
<result column="model" jdbcType="VARCHAR" property="model" />
|
||||
<result column="batch_number" jdbcType="VARCHAR" property="batchNumber" />
|
||||
<result column="expiration_date" jdbcType="TIMESTAMP" property="expirationDate" />
|
||||
<result column="total_num" jdbcType="VARCHAR" property="totalNum" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByConditionDepotItem" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap">
|
||||
select *
|
||||
FROM jsh_depot_item
|
||||
@@ -473,4 +484,30 @@
|
||||
</if>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getBatchNumberList" resultMap="batchNumberListMap">
|
||||
select id, bar_code, name, standard, model, batch_number, expiration_date, sum(oper_number) total_num from
|
||||
(select di.batch_number id, me.bar_code, m.name, m.standard, m.model,di.batch_number,di.expiration_date,
|
||||
di.oper_number*(case dh.type when '入库' then 1 when '出库' then -1 end) as oper_number
|
||||
from
|
||||
jsh_depot_head dh
|
||||
left join jsh_depot_item di on dh.id=di.header_id
|
||||
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag, '0') != '1'
|
||||
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_flag,'0') !='1'
|
||||
where me.bar_code= #{barCode} and me.default_flag=1
|
||||
<if test="name != null">
|
||||
<bind name="bindName" value="'%'+name+'%'"/>
|
||||
and di.batch_number like #{bindName}
|
||||
</if>
|
||||
<if test="depotId != null">
|
||||
and di.depot_id= #{depotId}
|
||||
</if>
|
||||
<if test="batchNumber != null">
|
||||
and di.batch_number= #{batchNumber}
|
||||
</if>
|
||||
and m.enable_batch_number =1
|
||||
and di.delete_flag!=1) tb
|
||||
group by batch_number
|
||||
order by expiration_date asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.SerialNumber">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="material_id" jdbcType="BIGINT" property="materialId" />
|
||||
<result column="depot_id" jdbcType="BIGINT" property="depotId" />
|
||||
<result column="serial_number" jdbcType="VARCHAR" property="serialNumber" />
|
||||
<result column="is_sell" jdbcType="VARCHAR" property="isSell" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
@@ -74,8 +75,8 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, material_id, serial_number, is_sell, remark, delete_flag, create_time, creator,
|
||||
update_time, updater, depot_head_id, tenant_id
|
||||
id, material_id, depot_id, serial_number, is_sell, remark, delete_flag, create_time,
|
||||
creator, update_time, updater, depot_head_id, tenant_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.SerialNumberExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -108,16 +109,16 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
|
||||
insert into jsh_serial_number (id, material_id, serial_number,
|
||||
is_sell, remark, delete_flag,
|
||||
create_time, creator, update_time,
|
||||
updater, depot_head_id, tenant_id
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{materialId,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}
|
||||
)
|
||||
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)
|
||||
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})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
|
||||
insert into jsh_serial_number
|
||||
@@ -128,6 +129,9 @@
|
||||
<if test="materialId != null">
|
||||
material_id,
|
||||
</if>
|
||||
<if test="depotId != null">
|
||||
depot_id,
|
||||
</if>
|
||||
<if test="serialNumber != null">
|
||||
serial_number,
|
||||
</if>
|
||||
@@ -166,6 +170,9 @@
|
||||
<if test="materialId != null">
|
||||
#{materialId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="depotId != null">
|
||||
#{depotId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="serialNumber != null">
|
||||
#{serialNumber,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -213,6 +220,9 @@
|
||||
<if test="record.materialId != null">
|
||||
material_id = #{record.materialId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.depotId != null">
|
||||
depot_id = #{record.depotId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.serialNumber != null">
|
||||
serial_number = #{record.serialNumber,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -252,6 +262,7 @@
|
||||
update jsh_serial_number
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
material_id = #{record.materialId,jdbcType=BIGINT},
|
||||
depot_id = #{record.depotId,jdbcType=BIGINT},
|
||||
serial_number = #{record.serialNumber,jdbcType=VARCHAR},
|
||||
is_sell = #{record.isSell,jdbcType=VARCHAR},
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
@@ -272,6 +283,9 @@
|
||||
<if test="materialId != null">
|
||||
material_id = #{materialId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="depotId != null">
|
||||
depot_id = #{depotId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="serialNumber != null">
|
||||
serial_number = #{serialNumber,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -308,6 +322,7 @@
|
||||
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
|
||||
update jsh_serial_number
|
||||
set material_id = #{materialId,jdbcType=BIGINT},
|
||||
depot_id = #{depotId,jdbcType=BIGINT},
|
||||
serial_number = #{serialNumber,jdbcType=VARCHAR},
|
||||
is_sell = #{isSell,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
|
||||
@@ -9,16 +9,18 @@
|
||||
<result column="updaterName" jdbcType="VARCHAR" property="updaterName" />
|
||||
<result column="depotHeadNumber" jdbcType="VARCHAR" property="depotHeadNumber" />
|
||||
<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
|
||||
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 + '%'" />
|
||||
@@ -240,8 +242,44 @@
|
||||
)
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getEnableSerialNumberList" resultMap="com.jsh.erp.datasource.mappers.SerialNumberMapper.BaseResultMap">
|
||||
select
|
||||
ser.id, ser.serial_number
|
||||
FROM jsh_serial_number ser
|
||||
where 1=1
|
||||
<if test="name != null">
|
||||
<bind name="bindName" value="'%'+name+'%'"/>
|
||||
and ser.serial_number like #{bindName}
|
||||
</if>
|
||||
<if test="depotId != null">
|
||||
and ser.depot_id =#{depotId}
|
||||
</if>
|
||||
<if test="materialId != null">
|
||||
and ser.material_id =#{materialId}
|
||||
</if>
|
||||
and ser.is_sell = '0'
|
||||
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="getEnableSerialNumberCount" resultType="java.lang.Long">
|
||||
select
|
||||
count(1)
|
||||
FROM jsh_serial_number ser
|
||||
where 1=1
|
||||
<if test="name != null">
|
||||
<bind name="bindName" value="'%'+name+'%'"/>
|
||||
and ser.serial_number like #{bindName}
|
||||
</if>
|
||||
<if test="depotId != null">
|
||||
and ser.depot_id =#{depotId}
|
||||
</if>
|
||||
<if test="materialId != null">
|
||||
and ser.material_id =#{materialId}
|
||||
</if>
|
||||
and ser.is_sell = '0'
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user