车型项目库法规清单关联平台件表-批量添加

This commit is contained in:
zhn
2023-09-19 16:45:00 +08:00
parent b11e2622aa
commit a81500beb2
4 changed files with 61 additions and 10 deletions
@@ -93,6 +93,19 @@ public class LawsInventoryPlatformEOController extends JeroController<LawsInvent
lawsInventoryPlatformEOService.add(lawsInventoryPlatformEO);
return Result.OK("添加成功!");
}
/**
* 批量添加
*
* @param lawsInventoryPlatformEOList
* @return
*/
@AutoLog(value = "车型项目库法规清单关联平台件表-批量添加")
@ApiOperation(value="车型项目库法规清单关联平台件表-批量添加", notes="车型项目库法规清单关联平台件表-批量添加")
@PostMapping(value = "/addBatch")
public Result<?> addBatch(@Validated @RequestBody List<LawsInventoryPlatformEO> lawsInventoryPlatformEOList) {
lawsInventoryPlatformEOService.addBatch(lawsInventoryPlatformEOList);
return Result.OK("添加成功!");
}
/**
* 编辑
@@ -1,21 +1,19 @@
package com.jero.modules.project.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
@@ -71,4 +69,8 @@ public class LawsInventoryPlatformEO implements Serializable {
@ApiModelProperty(value = "平台件项目库法规清单id")
private java.lang.String platformLawsInventoryId;
@TableField(exist = false)
@ApiModelProperty(value = "平台件项目库法规清单ids")
private java.lang.String platformLawsInventoryIds;
}
@@ -20,6 +20,12 @@ public interface ILawsInventoryPlatformEOService extends IService<LawsInventoryP
*/
void add(LawsInventoryPlatformEO lawsInventoryPlatformEO);
/**
* 批量保存
* @param lawsInventoryPlatformEOList
*/
void addBatch(List<LawsInventoryPlatformEO> lawsInventoryPlatformEOList);
/**
* 更新
*
@@ -1,12 +1,15 @@
package com.jero.modules.project.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.project.entity.LawsInventoryPlatformEO;
import com.jero.modules.project.mapper.LawsInventoryPlatformEOMapper;
import com.jero.modules.project.service.ILawsInventoryPlatformEOService;
import com.jero.modules.system.util.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/**
* @Description: 车型项目库法规清单关联平台件表
@@ -30,6 +33,33 @@ public class LawsInventoryPlatformEOServiceImpl extends ServiceImpl<LawsInventor
lawsInventoryPlatformEO.setUpdateTime(now);
save(lawsInventoryPlatformEO);
}
/**
* 批量保存
*
* @param lawsInventoryPlatformEOList
* @return
*/
@Override
public void addBatch(List<LawsInventoryPlatformEO> lawsInventoryPlatformEOList) {
if(!lawsInventoryPlatformEOList.isEmpty()){
List<LawsInventoryPlatformEO> lawsInventoryPlatformEOS = new ArrayList<>();
for (LawsInventoryPlatformEO lawsInventoryPlatformEO : lawsInventoryPlatformEOList) {
if(StringUtils.isNotBlank(lawsInventoryPlatformEO.getPlatformLawsInventoryIds())){
for (String platformLawsInventoryId : lawsInventoryPlatformEO.getPlatformLawsInventoryIds().split(",")) {
LawsInventoryPlatformEO inventoryPlatformEO = new LawsInventoryPlatformEO();
inventoryPlatformEO.setCreateTime(new Date());
inventoryPlatformEO.setUpdateTime(new Date());
inventoryPlatformEO.setLawsInventoryId(lawsInventoryPlatformEO.getLawsInventoryId());
inventoryPlatformEO.setPlatformLawsInventoryId(platformLawsInventoryId);
lawsInventoryPlatformEOS.add(inventoryPlatformEO);
}
}
}
if(!lawsInventoryPlatformEOS.isEmpty()){
this.saveBatch(lawsInventoryPlatformEOS);
}
}
}
/**
* 更新