This commit is contained in:
caozehui
2024-12-02 13:13:49 +08:00
parent 7335ffe445
commit 37aba2181b
6 changed files with 20 additions and 4 deletions

View File

@@ -50,6 +50,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
public boolean addPqSource(PqSourceParam param) {
PqSource pqSource = new PqSource();
BeanUtil.copyProperties(param, pqSource);
pqSource.setParameter(StrUtil.isBlank(pqSource.getParameter()) ? null : pqSource.getParameter());
pqSource.setState(DataStateEnum.ENABLE.getCode());
return this.save(pqSource);
}

View File

@@ -80,4 +80,11 @@ public interface IDictDataService extends IService<DictData> {
* @param queryParam 查询参数
*/
void exportDictData(DictDataParam.QueryParam queryParam);
/**
* 根据字典类型id删除字典数据
* @param ids 字典类型id集合
* @return 成功返回true失败返回false
*/
boolean deleteDictDataByDictTypeId(List<String> ids);
}

View File

@@ -166,6 +166,14 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
ExcelUtil.exportExcel("字典数据导出数据.xlsx", "字典数据", DictDataExcel.class, dictDataExcels);
}
@Override
public boolean deleteDictDataByDictTypeId(List<String> ids) {
QueryWrapper<DictData> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("sys_dict_data.type_id", ids)
.ne("sys_dict_data.state", DataStateEnum.DELETED.getCode());
return this.remove(queryWrapper);
}
/**
* 校验参数,检查是否存在相同名称的字典类型

View File

@@ -14,6 +14,7 @@ import com.njcn.gather.system.dictionary.mapper.DictTypeMapper;
import com.njcn.gather.system.dictionary.pojo.param.DictTypeParam;
import com.njcn.gather.system.dictionary.pojo.po.DictType;
import com.njcn.gather.system.dictionary.pojo.vo.DictTypeExcel;
import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.gather.system.dictionary.service.IDictTypeService;
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
import com.njcn.web.factory.PageFactory;
@@ -30,6 +31,7 @@ import java.util.List;
@Service
@RequiredArgsConstructor
public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> implements IDictTypeService {
private final IDictDataService dictDataService;
@Override
public Page<DictType> listDictTypes(DictTypeParam.QueryParam queryParam) {
@@ -71,6 +73,7 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
@Override
public boolean deleteDictType(List<String> ids) {
dictDataService.deleteDictDataByDictTypeId(ids);
return this.lambdaUpdate()
.set(DictType::getState, DataStateEnum.DELETED.getCode())
.in(DictType::getId, ids)

View File

@@ -29,7 +29,7 @@ public interface SystemValidMessage {
String CODE_NOT_BLANK = "编码不能为空请检查code参数";
String CODE_FORMAT_ERROR = "格式错误请检查code参数";
String CODE_FORMAT_ERROR = "格式错误请检查code参数";
String SORT_NOT_NULL = "排序不能为空请检查sort参数";

View File

@@ -158,9 +158,6 @@ public class SysFunctionServiceImpl extends ServiceImpl<SysFunctionMapper, SysFu
}
/**
* 根据当前分类找出子类,递归找出子类的子类
*/
private <T extends SysFunction> List<SysFunction> getChildrenList(T currMenu, List<? extends SysFunction> categories) {
return categories.stream().filter(o -> Objects.equals(o.getPid(), currMenu.getId())).peek(o -> o.setChildren(getChildrenList(o, categories))).sorted(Comparator.comparingInt(SysFunction::getSort)).collect(Collectors.toList());
}