设备上下架功能

This commit is contained in:
liang.chao 2024-11-23 17:43:19 +08:00
parent 16c608f99e
commit baf144e412
6 changed files with 55 additions and 1 deletions

View File

@ -93,6 +93,17 @@ public class DevInfoController extends BaseController {
return success(devInfoService.selectDevInfoByMaId(maId));
}
/**
* 上下架批量
*/
// @RequiresPermissions("equip:info:edit")
@ApiOperation(value = "上下架(批量)")
@PostMapping("updateUpDown")
public AjaxResult updateUp(@RequestBody DevInfo devInfo) {
return toAjax(devInfoService.updateUpDown(devInfo));
}
/**
* 修改设备信息
*/

View File

@ -29,6 +29,9 @@ public class DevInfo extends BaseEntity {
@Excel(name = "设备id")
@ApiModelProperty(value = "设备id")
private Long maId;
/** 设备id */
@ApiModelProperty(value = "设备id")
private List<Long> maIds;
/** 系统编码 */
@Excel(name = "系统编码")

View File

@ -5,6 +5,7 @@ import com.bonus.common.biz.domain.*;
import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.dto.InfoMotionDto;
import com.bonus.material.device.domain.vo.DevInfoVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -105,5 +106,7 @@ public interface DevInfoMapper {
* @return
*/
List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj);
int updateUpDown(@Param("maIds") List<Long> maIds, @Param("maStatus")String maStatus);
}

View File

@ -88,4 +88,6 @@ public interface DevInfoService {
* @return
*/
List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj);
int updateUpDown(DevInfo devInfo);
}

View File

@ -156,7 +156,9 @@ public class DevInfoServiceImpl implements DevInfoService {
List<BaseAddress> addressList = devInfoMapper.getBaseAddress();
for (DevInfoVo devInfoVo : list) {
for (BaseAddress address : addressList) {
if (devInfoVo.getCityId() == null || address.getCode() == null) { continue; }
if (devInfoVo.getCityId() == null || address.getCode() == null) {
continue;
}
if (devInfoVo.getCityId().equals(Integer.valueOf(address.getCode()))) {
devInfoVo.setCityStr(address.getName());
break;
@ -277,6 +279,7 @@ public class DevInfoServiceImpl implements DevInfoService {
/**
* 查询公司列表
*
* @param obj
* @return
*/
@ -285,6 +288,17 @@ public class DevInfoServiceImpl implements DevInfoService {
return devInfoMapper.selectCompanyList(obj);
}
@Override
public int updateUpDown(DevInfo devInfo) {
List<Long> maIds = devInfo.getMaIds();
String maStatus = devInfo.getMaStatus();
int i = 0;
if (CollectionUtil.isNotEmpty(maIds)) {
i = devInfoMapper.updateUpDown(maIds, maStatus);
}
return i;
}
@Override
public void insertOutType(String devInfo) {
ObjectMapper objectMapper = new ObjectMapper();

View File

@ -417,6 +417,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set search_num = search_num + 1
where ma_id = #{maId}
</update>
<update id="updateUpDown">
<if test="maIds != null and maIds.size() > 0">
<choose>
<when test="maIds.size() == 1">
<!-- 单个ID更新 -->
update ma_dev_info
set ma_status = #{maStatus}
where ma_id = #{maIds[0]}
</when>
<otherwise>
<!-- 批量更新 -->
update ma_dev_info
set ma_status = #{maStatus}
where ma_id in
<foreach collection="maIds" item="maId" open="(" separator="," close=")">
#{maId}
</foreach>
</otherwise>
</choose>
</if>
</update>
<select id="getSysDic" resultType="com.bonus.common.biz.domain.SysDic">
select