增加配置属性
This commit is contained in:
parent
0c4d7efde2
commit
ec5581c2ca
|
|
@ -3,6 +3,7 @@ package com.bonus.material.device.domain;
|
|||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -255,4 +256,6 @@ public class DevInfo extends BaseEntity {
|
|||
@ApiModelProperty(value = "是否上传安全证书(0:否 1:是)")
|
||||
private Integer isSafeBook;
|
||||
|
||||
@ApiModelProperty(value = "自定义属性列表")
|
||||
private List<DevInfoPropertyVo> devInfoProperties;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,4 @@ public class DevInfoVo extends DevInfo {
|
|||
@ApiModelProperty(value = "结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "自定义属性列表")
|
||||
private List<DevInfoPropertyVo> devInfoProperties;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ public interface DevInfoMapper {
|
|||
|
||||
int deleteDevInfoProperties(@Param("maId")Long maId);
|
||||
|
||||
int batchDeleteDevInfoProperties(@Param("maIds")Long[] maIds);
|
||||
|
||||
int insertDevInfoProperties(@Param("maId")Long maId, @Param("list") List<DevInfoPropertyVo> list);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import com.bonus.material.device.domain.vo.LeaseVo;
|
|||
import com.bonus.material.device.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.device.mapper.DevInfoMapper;
|
||||
import com.bonus.material.device.service.DevInfoService;
|
||||
import com.bonus.material.ma.vo.MaTypeProperty;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
|
@ -337,6 +336,10 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
if (saveSuccessNum == 0) {
|
||||
return AjaxResult.error("设备信息SQL保存失败,请修改后重试");
|
||||
}
|
||||
//保存自定义属性值
|
||||
if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) {
|
||||
devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties());
|
||||
}
|
||||
//把文件保存到附件中
|
||||
AjaxResult error = uploadFiles(devInfo, userId, i);
|
||||
if (error != null) {
|
||||
|
|
@ -370,6 +373,11 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
if (insertedDraft == 0) {
|
||||
return AjaxResult.error("装备草稿保存失败,请修改后重试");
|
||||
}
|
||||
//保存自定义属性值
|
||||
if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) {
|
||||
devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties());
|
||||
}
|
||||
//把文件保存到附件中
|
||||
AjaxResult error = uploadFiles(devInfo, userId, i);
|
||||
if (error != null) {
|
||||
return error;
|
||||
|
|
@ -453,6 +461,7 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
* @param devInfo 设备信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult updateDevInfo(DevInfo devInfo) {
|
||||
if (devInfo.getMaId() == null) {
|
||||
return AjaxResult.error("设备ID为空,请携带设备信息修改");
|
||||
|
|
@ -461,6 +470,10 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
if (deviceId != null && !deviceId.getMaId().equals(devInfo.getMaId())) {
|
||||
return AjaxResult.error("设备名称已存在,请修改后重试!");
|
||||
}*/
|
||||
devInfoMapper.deleteDevInfoProperties(devInfo.getMaId());
|
||||
if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) {
|
||||
devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties());
|
||||
}
|
||||
return devInfoMapper.updateDevInfo(devInfo) > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
|
||||
}
|
||||
|
||||
|
|
@ -471,7 +484,9 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteDevInfoByMaIds(Long[] maIds) {
|
||||
devInfoMapper.batchDeleteDevInfoProperties(maIds);
|
||||
return devInfoMapper.deleteDevInfoByMaIds(maIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -542,6 +542,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
delete from ma_dev_info_properties where ma_id = #{maId}
|
||||
</delete>
|
||||
|
||||
<delete id="batchDeleteDevInfoProperties">
|
||||
delete from ma_dev_info_properties where ma_id in
|
||||
<foreach item="maId" collection="maIds" open="(" separator="," close=")">
|
||||
#{maId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="insertDevInfoProperties">
|
||||
insert into
|
||||
ma_dev_info_properties(ma_id, property_name, property_value, create_time)
|
||||
|
|
|
|||
Loading…
Reference in New Issue