add ASMS批量删除原字典配置项
This commit is contained in:
+8
@@ -180,4 +180,12 @@ public class LawsAsmsOpenApiController extends JeroController<LawsAsmsOpenApi, I
|
|||||||
return Result.OK("操作成功");
|
return Result.OK("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "批量删除原字典配置项")
|
||||||
|
@ApiOperation(value="批量删除原字典配置项", notes="批量删除原字典配置项")
|
||||||
|
@GetMapping(value = "/removeDictItemBatch")
|
||||||
|
public Result<Object> removeDictItemBatch(@RequestParam(name="ids") String ids) {
|
||||||
|
lawsAsmsOpenApiService.removeDictItemBatch(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-3
@@ -1,10 +1,11 @@
|
|||||||
package com.jero.modules.docking.asms.api.mapper;
|
package com.jero.modules.docking.asms.api.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.jero.modules.docking.asms.api.entity.LawsAsmsOpenApi;
|
import com.jero.modules.docking.asms.api.entity.LawsAsmsOpenApi;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 汽车标准数字化平台ASMS开放API接口管理
|
* @Description: 汽车标准数字化平台ASMS开放API接口管理
|
||||||
@@ -12,6 +13,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
* @Date: 2023-10-18
|
* @Date: 2023-10-18
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface LawsAsmsOpenApiMapper extends BaseMapper<LawsAsmsOpenApi> {
|
public interface LawsAsmsOpenApiMapper extends BaseMapper<LawsAsmsOpenApi> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: liao
|
||||||
|
* @Date: 2023/10/18 16:25
|
||||||
|
* @Description: 物理删除字典配置项数据
|
||||||
|
**/
|
||||||
|
void removeDictItemBatch(@Param("dictIdList") List<String> dictIdList);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -9,4 +9,10 @@
|
|||||||
<result column="api_type" property="apiType" />
|
<result column="api_type" property="apiType" />
|
||||||
<result column="query_param_json" property="queryParamJson" />
|
<result column="query_param_json" property="queryParamJson" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<delete id="removeDictItemBatch">
|
||||||
|
DELETE FROM sys_dict_item WHERE dict_id IN
|
||||||
|
<foreach collection="dictIdList" item="item" index="index" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
+7
@@ -80,4 +80,11 @@ public interface ILawsAsmsOpenApiService extends IService<LawsAsmsOpenApi> {
|
|||||||
* @Description: 批量同步
|
* @Description: 批量同步
|
||||||
**/
|
**/
|
||||||
void syncBatch(List<String> idList);
|
void syncBatch(List<String> idList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: liao
|
||||||
|
* @Date: 2023/10/18 16:20
|
||||||
|
* @Description: 批量删除原字典配置项
|
||||||
|
**/
|
||||||
|
void removeDictItemBatch(List<String> idList);
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-2
@@ -48,6 +48,8 @@ public class LawsAsmsOpenApiServiceImpl extends ServiceImpl<LawsAsmsOpenApiMappe
|
|||||||
private AsmsPostUtil asmsPostUtil;
|
private AsmsPostUtil asmsPostUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysDictItemService sysDictItemService;
|
private ISysDictItemService sysDictItemService;
|
||||||
|
@Autowired
|
||||||
|
private LawsAsmsOpenApiMapper lawsAsmsOpenApiMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
@@ -160,6 +162,8 @@ public class LawsAsmsOpenApiServiceImpl extends ServiceImpl<LawsAsmsOpenApiMappe
|
|||||||
queryWrapper.eq(SysDictItem::getDictId, lawsAsmsOpenApi.getDictId());
|
queryWrapper.eq(SysDictItem::getDictId, lawsAsmsOpenApi.getDictId());
|
||||||
List<SysDictItem> dictItemList = sysDictItemService.list(queryWrapper);
|
List<SysDictItem> dictItemList = sysDictItemService.list(queryWrapper);
|
||||||
List<String> codeList;
|
List<String> codeList;
|
||||||
|
List<SysDictItem> insertDictItemList = new ArrayList();
|
||||||
|
List<SysDictItem> updateDictItemList = new ArrayList();
|
||||||
if (CollectionUtils.isNotEmpty(dictItemList)) {
|
if (CollectionUtils.isNotEmpty(dictItemList)) {
|
||||||
codeList = dictItemList.stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
|
codeList = dictItemList.stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
@@ -204,12 +208,21 @@ public class LawsAsmsOpenApiServiceImpl extends ServiceImpl<LawsAsmsOpenApiMappe
|
|||||||
dictItem.setId(dictItemList.stream().filter(e ->
|
dictItem.setId(dictItemList.stream().filter(e ->
|
||||||
e.getItemValue().equals(dictItem.getItemValue()))
|
e.getItemValue().equals(dictItem.getItemValue()))
|
||||||
.collect(Collectors.toList()).get(0).getId());
|
.collect(Collectors.toList()).get(0).getId());
|
||||||
sysDictItemService.updateById(dictItem);
|
updateDictItemList.add(dictItem);
|
||||||
} else {
|
} else {
|
||||||
// 如果不存在则新增
|
// 如果不存在则新增
|
||||||
sysDictItemService.save(dictItem);
|
insertDictItemList.add(dictItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 操作数据库
|
||||||
|
if (CollectionUtils.isNotEmpty(updateDictItemList)) {
|
||||||
|
// 更新
|
||||||
|
sysDictItemService.updateBatchById(updateDictItemList);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(insertDictItemList)) {
|
||||||
|
// 新增
|
||||||
|
sysDictItemService.saveBatch(insertDictItemList);
|
||||||
|
}
|
||||||
// 状态设置为已同步
|
// 状态设置为已同步
|
||||||
lawsAsmsOpenApi.setStatus("1");
|
lawsAsmsOpenApi.setStatus("1");
|
||||||
}
|
}
|
||||||
@@ -218,4 +231,20 @@ public class LawsAsmsOpenApiServiceImpl extends ServiceImpl<LawsAsmsOpenApiMappe
|
|||||||
// 同步接口的状态
|
// 同步接口的状态
|
||||||
updateBatchById(lawsAsmsOpenApiList);
|
updateBatchById(lawsAsmsOpenApiList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: liao
|
||||||
|
* @Date: 2023/10/18 16:20
|
||||||
|
* @Description: 批量删除原字典配置项
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void removeDictItemBatch(List<String> idList) {
|
||||||
|
List<LawsAsmsOpenApi> lawsAsmsOpenApiList = listByIds(idList);
|
||||||
|
List<String> dictIdList = lawsAsmsOpenApiList.stream()
|
||||||
|
.filter(e -> StringUtils.isNotBlank(e.getDictId()))
|
||||||
|
.map(LawsAsmsOpenApi::getDictId).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(dictIdList)) {
|
||||||
|
lawsAsmsOpenApiMapper.removeDictItemBatch(dictIdList);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user