|
|
|
@ -153,8 +153,7 @@ |
|
|
|
</sql> |
|
|
|
<!-- 查询所有数据的条数 --> |
|
|
|
<select id="findCount" resultType="integer"> |
|
|
|
SELECT |
|
|
|
count(*) |
|
|
|
SELECT count(*) |
|
|
|
FROM material m |
|
|
|
where m.depository_id is null |
|
|
|
</select> |
|
|
|
@ -793,8 +792,7 @@ |
|
|
|
|
|
|
|
<!-- 根据仓库查询物料总数--> |
|
|
|
<select id="findMaterialByDepositoryCount" resultType="int" parameterType="map"> |
|
|
|
SELECT |
|
|
|
COUNT(*) |
|
|
|
SELECT COUNT(*) |
|
|
|
from findInventory |
|
|
|
where depositoryId = #{depositoryId} |
|
|
|
</select> |
|
|
|
@ -863,8 +861,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
<select id="findMaxMaterialCodeForMt" resultType="string" parameterType="long"> |
|
|
|
select |
|
|
|
max(code) |
|
|
|
select max(code) |
|
|
|
from material m |
|
|
|
where m.type_id = #{oldId} |
|
|
|
</select> |
|
|
|
@ -916,7 +913,7 @@ |
|
|
|
<insert id="insertMaterial" useGeneratedKeys="true" keyProperty="id"> |
|
|
|
INSERT INTO material ( |
|
|
|
id, depository_id, mname, quantity, price, |
|
|
|
type_id,code,unit,version,texture,amounts,depositoryCode,producedDate,shelfLife,brand,productionPlace,remark,uid |
|
|
|
type_id,code,unit,version,texture,amounts,depositoryCode,producedDate,shelfLife,brand,productionPlace,remark,uid,createTime |
|
|
|
) VALUES ( |
|
|
|
#{id}, |
|
|
|
<if test="depositoryId != null"> |
|
|
|
@ -960,26 +957,25 @@ |
|
|
|
#{brand}, |
|
|
|
#{productionPlace}, |
|
|
|
#{remark}, |
|
|
|
#{uid} |
|
|
|
#{uid}, |
|
|
|
#{createTime} |
|
|
|
) |
|
|
|
</insert> |
|
|
|
<!-- 插入数据 --> |
|
|
|
<insert id="insertInventory" useGeneratedKeys="true" keyProperty="id"> |
|
|
|
insert into inventory(id,mid,remark,quantity,producedDate,depository_id) |
|
|
|
values ( |
|
|
|
#{id}, |
|
|
|
insert into inventory(id, mid, remark, quantity, producedDate, depository_id) |
|
|
|
values (#{id}, |
|
|
|
#{mid}, |
|
|
|
#{remark}, |
|
|
|
#{quantity}, |
|
|
|
#{producedDate}, |
|
|
|
#{depositoryId} |
|
|
|
) |
|
|
|
#{depositoryId}) |
|
|
|
</insert> |
|
|
|
<!-- 添加当前批次物料与生产日期对应--> |
|
|
|
<insert id="addMaterialAndProducedDate" useGeneratedKeys="true" keyProperty="id"> |
|
|
|
insert into materialandproduceddate(id,inid,mid,quantity,expendnum,inventory,producedDate,barCode,qrCode) |
|
|
|
values ( |
|
|
|
#{id}, |
|
|
|
insert into materialandproduceddate(id, inid, mid, quantity, expendnum, inventory, producedDate, barCode, |
|
|
|
qrCode) |
|
|
|
values (#{id}, |
|
|
|
#{inid}, |
|
|
|
#{mid}, |
|
|
|
#{quantity}, |
|
|
|
@ -987,18 +983,15 @@ |
|
|
|
#{inventory}, |
|
|
|
#{producedDate}, |
|
|
|
#{barCode}, |
|
|
|
#{qrCode} |
|
|
|
) |
|
|
|
#{qrCode}) |
|
|
|
</insert> |
|
|
|
|
|
|
|
<insert id="addBarCodeAndMcode" parameterType="map"> |
|
|
|
insert into qrcodeandmaterial(id,barCode,mcode,flag) |
|
|
|
values ( |
|
|
|
#{id}, |
|
|
|
insert into qrcodeandmaterial(id, barCode, mcode, flag) |
|
|
|
values (#{id}, |
|
|
|
#{barCode}, |
|
|
|
#{code}, |
|
|
|
1 |
|
|
|
) |
|
|
|
1) |
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
@ -1119,12 +1112,16 @@ |
|
|
|
<if test="version != null and version != ''"> |
|
|
|
version = #{version}, |
|
|
|
</if> |
|
|
|
<if test="updateTime != '' and updateTime != null"> |
|
|
|
updateTime = #{updateTime}, |
|
|
|
</if> |
|
|
|
<if test="code != null and code != ''"> |
|
|
|
code = #{code}, |
|
|
|
</if> |
|
|
|
<if test="unit != null and unit != ''"> |
|
|
|
unit = #{unit}, |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="depositoryCode != null and depositoryCode !=''"> |
|
|
|
depositoryCode = #{depositoryCode}, |
|
|
|
</if> |
|
|
|
@ -1149,6 +1146,7 @@ |
|
|
|
<if test="remark != '' and remark != null"> |
|
|
|
remark = #{remark} |
|
|
|
</if> |
|
|
|
|
|
|
|
</set> |
|
|
|
WHERE id = #{id} |
|
|
|
</update> |
|
|
|
@ -1209,7 +1207,9 @@ |
|
|
|
|
|
|
|
<!-- 根据主键删除数据 --> |
|
|
|
<delete id="deleteMaterialById" parameterType="int"> |
|
|
|
DELETE FROM material WHERE id = #{id} |
|
|
|
DELETE |
|
|
|
FROM material |
|
|
|
WHERE id = #{id} |
|
|
|
</delete> |
|
|
|
|
|
|
|
<!-- 根据主键批量删除数据 |
|
|
|
@ -1220,17 +1220,20 @@ |
|
|
|
</foreach> |
|
|
|
</delete>--> |
|
|
|
<!-- 根据主键将状态改为删除--> |
|
|
|
<update id="changeStateToDeletedById" parameterType="int"> |
|
|
|
<update id="changeStateToDeletedById" parameterType="map"> |
|
|
|
UPDATE material |
|
|
|
<set> |
|
|
|
updateTime = #{updateTime}, |
|
|
|
state = 3 |
|
|
|
</set> |
|
|
|
|
|
|
|
WHERE id = #{id} |
|
|
|
</update> |
|
|
|
|
|
|
|
<update id="updateStateByParam" parameterType="map"> |
|
|
|
UPDATE material |
|
|
|
<set> |
|
|
|
updateTime = #{updateTime}, |
|
|
|
state = #{state} |
|
|
|
</set> |
|
|
|
where id = #{id} |
|
|
|
@ -1244,15 +1247,17 @@ |
|
|
|
<update id="updateStateByTypeId" parameterType="map"> |
|
|
|
UPDATE material |
|
|
|
<set> |
|
|
|
updateTime = #{updateTime}, |
|
|
|
state = #{state} |
|
|
|
</set> |
|
|
|
where type_id = #{typeId} |
|
|
|
</update> |
|
|
|
|
|
|
|
<!-- 根据主键批量将状态改为删除--> |
|
|
|
<update id="changeStateToDeletedByIds" parameterType="list"> |
|
|
|
<update id="changeStateToDeletedByIds" parameterType="map"> |
|
|
|
update material |
|
|
|
<set> |
|
|
|
updateTime = #{updateTime}, |
|
|
|
state = 3 |
|
|
|
</set> |
|
|
|
where id in |
|
|
|
|