领用管理

This commit is contained in:
cwchen 2024-08-06 10:36:00 +08:00
parent 545381cf94
commit c1dac23723
4 changed files with 32 additions and 11 deletions

View File

@ -77,4 +77,9 @@ public class EquipmentReqDataVo {
* 领用时间
*/
private Date lyTime = new Date();
/**
* 领用人类型 0正常 1临时人员
*/
private Integer userType = 0;
}

View File

@ -58,7 +58,7 @@ public interface EquipmentReqMapper {
* @author cwchen
* @date 2024/8/5 17:02
*/
void updateShBoxData(@Param("vo") EquipmentReqDataVo vo, @Param("equipment") EquipmentReqDataVo.Equipment equipment);
void updateDeviceData(@Param("vo") EquipmentReqDataVo vo, @Param("equipment") EquipmentReqDataVo.Equipment equipment,@Param("type")int type);
/**
* 判断设备是否已经归还
@ -87,7 +87,7 @@ public interface EquipmentReqMapper {
* @author cwchen
* @date 2024/8/6 9:16
*/
void updateshBoxData(BraceletParamsDto dto);
void updateReturnDeviceData(@Param("params") BraceletParamsDto dto,@Param("type") int type);
/**
* 更新设备归还状态

View File

@ -70,9 +70,12 @@ public class EquipmentReqServiceImpl implements IEquipmentReqService {
mapper.addDevUseData(vo);
mapper.addDevUseDetailData(vo);
for (EquipmentReqDataVo.Equipment equipment : vo.getList()) {
// 更新手环箱状态
if(Objects.equals(equipment.getDevType(), BusinessConstants.SHX)){
mapper.updateShBoxData(vo,equipment);
// 更新手环箱状态
mapper.updateDeviceData(vo,equipment,1);
}else{
// 更新其他设备状态
mapper.updateDeviceData(vo,equipment,2);
}
}
return AjaxResult.success();
@ -100,7 +103,10 @@ public class EquipmentReqServiceImpl implements IEquipmentReqService {
try {
if(Objects.equals(dto.getDevType(), BusinessConstants.SHX)){
// 设备类型为手环箱更新手环箱状态
mapper.updateshBoxData(dto);
mapper.updateReturnDeviceData(dto,1);
}else{
// 设备类型为其他设备更新设备状态
mapper.updateReturnDeviceData(dto,2);
}
mapper.returnDevice(dto);
return AjaxResult.success();

View File

@ -40,13 +40,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</foreach>
</insert>
<!--更新手环箱状态-->
<update id="updateShBoxData">
UPDATE tb_sh_box SET team_id = #{vo.teamId},pro_id = #{vo.proId},gt_id = #{vo.powerId} WHERE id = #{equipment.devId}
<!--更新设备状态-->
<update id="updateDeviceData">
<if test="type == 1">
UPDATE tb_sh_box SET team_id = #{vo.teamId},pro_id = #{vo.proId},gt_id = #{vo.powerId} WHERE id = #{equipment.devId}
</if>
<if test="type == 2">
UPDATE tb_dev_ly SET pro_id = #{vo.proId},team_id = #{vo.teamId},ly_user = #{vo.createUser},ly_status = 0,ly_time = #{vo.lyTime},user_type = #{vo.userType},gt_id = #{vo.powerId} WHERE dev_id = #{equipment.devId}
</if>
</update>
<!--更新手环箱状态-->
<update id="updateshBoxData">
UPDATE tb_sh_box SET team_id = null,pro_id = null,gt_id = null WHERE id = #{devId}
<!--更新1.手环箱/2.其他设备状态-->
<update id="updateReturnDeviceData">
<if test="type == 1">
UPDATE tb_sh_box SET team_id = null,pro_id = null,gt_id = null WHERE id = #{params.devId}
</if>
<if test="type == 2">
UPDATE tb_dev_ly SET pro_id = null,team_id = null,ly_user = null,ly_status = null,ly_time = null,user_type = null,gt_id = null WHERE dev_id = #{params.devId}
</if>
</update>
<!--更新设备归还状态-->
<update id="returnDevice">