parent
a64eb808d6
commit
780c2cf369
|
@ -72,13 +72,16 @@ public class AssetsModel extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 是否字典
|
* 是否字典
|
||||||
*/
|
*/
|
||||||
private Integer isDictionary;
|
private String isDictionary;
|
||||||
/**
|
/**
|
||||||
* 映射字典
|
* 映射字典id
|
||||||
*/
|
*/
|
||||||
private String reflectionDictionary;
|
private String dictionaryId;
|
||||||
/**
|
/**
|
||||||
* 以防万一,在加一个表名
|
* 字典表名称
|
||||||
*/
|
*/
|
||||||
|
private String dictionaryName;
|
||||||
|
|
||||||
|
|
||||||
private String tableName;
|
private String tableName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
package com.etl.data.domain;
|
package com.etl.data.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典表
|
* 字典表
|
||||||
*
|
*
|
||||||
|
@ -19,22 +17,22 @@ import java.util.List;
|
||||||
* @date 21:27 2024/4/25
|
* @date 21:27 2024/4/25
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("dictionary")
|
@TableName("dictionary")
|
||||||
public class Dictionary {
|
public class Dictionary extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id", type = IdType.INPUT)
|
@TableId( type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 数据源id
|
* 数据源id
|
||||||
*/
|
*/
|
||||||
private Long dataSourceId;
|
private Long dataSourceId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典名称
|
* 字典名称
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.etl.data.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -10,21 +11,22 @@ import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典详情表
|
* 字典详情表
|
||||||
* @author YunFei.Du
|
* @author YunFei.Du
|
||||||
* @date 21:27 2024/4/25
|
* @date 21:27 2024/4/25
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("dictionary_info")
|
@TableName("dictionary_info")
|
||||||
public class DictionaryInfo {
|
public class DictionaryInfo extends BaseEntity {
|
||||||
/**
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id",type = IdType.INPUT)
|
@TableId( type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 字典表id
|
* 字典表id
|
||||||
|
@ -37,11 +39,5 @@ public class DictionaryInfo {
|
||||||
/**
|
/**
|
||||||
* 值
|
* 值
|
||||||
*/
|
*/
|
||||||
private Integer value;
|
private String value;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否编辑 (默认 0 不编辑)
|
|
||||||
*/
|
|
||||||
// private Integer isEdit;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
package com.etl.data.domain.model;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.etl.data.domain.Dictionary;
|
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典表
|
|
||||||
* @author YunFei.Du
|
|
||||||
* @date 21:27 2024/4/25
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class DictionaryModel {
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 数据源id
|
|
||||||
*/
|
|
||||||
private Long dataSourceId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典名称
|
|
||||||
*/
|
|
||||||
private String dictionaryName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典值
|
|
||||||
*/
|
|
||||||
private String dictionaryValue;
|
|
||||||
|
|
||||||
|
|
||||||
private String dictionaryNameAndValue;
|
|
||||||
private List< DictionaryInfo > dictionaryList;
|
|
||||||
|
|
||||||
|
|
||||||
public static DictionaryModel dictionaryInfoBuild(Dictionary dictionary, List< DictionaryInfo > dictionaryInfos) {
|
|
||||||
return DictionaryModel.builder ( )
|
|
||||||
.id ( dictionary.getId ( ) )
|
|
||||||
.dataSourceId ( dictionary.getDataSourceId ())
|
|
||||||
.dictionaryName ( dictionary.getDictionaryName ())
|
|
||||||
.dictionaryValue ( dictionary.getDictionaryValue ())
|
|
||||||
.dictionaryNameAndValue (dictionary.getDictionaryName ()+'('+dictionary.getDictionaryValue ()+')')
|
|
||||||
.dictionaryList (dictionaryInfos )
|
|
||||||
.build ( );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.etl.data.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.etl.data.domain.DataTable;
|
||||||
|
import com.etl.data.domain.Dictionary;
|
||||||
|
import com.etl.data.domain.DictionaryInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典响应
|
||||||
|
* @author YunFei.Du
|
||||||
|
* @date 21:33 2024/4/25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DictionaryInfoResp {
|
||||||
|
private Dictionary dictionary;
|
||||||
|
|
||||||
|
|
||||||
|
private List< DictionaryInfo > dictionaryInfoList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static DictionaryInfoResp dictionaryAndInfoBuild(Dictionary dict, List< DictionaryInfo > dictInfoList){
|
||||||
|
return DictionaryInfoResp.builder ()
|
||||||
|
.dictionary(dict)
|
||||||
|
.dictionaryInfoList(dictInfoList)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,36 +0,0 @@
|
||||||
package com.etl.data.domain.resp;
|
|
||||||
|
|
||||||
import com.etl.data.domain.AssetsModel;
|
|
||||||
import com.etl.data.domain.DataTable;
|
|
||||||
import com.etl.data.domain.Dictionary;
|
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典响应
|
|
||||||
* @author YunFei.Du
|
|
||||||
* @date 21:33 2024/4/25
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class DictionaryModelResp {
|
|
||||||
private String dictionaryName;
|
|
||||||
private List< DictionaryInfo > dictionaryList;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public static AssetsModelResp dataTableAndAssetsModelBuild(DataTable dTable, List< AssetsModel > assetsModels){
|
|
||||||
// return AssetsModelResp.builder()
|
|
||||||
// .dataTable(dTable)
|
|
||||||
// .assetsModelList(assetsModels)
|
|
||||||
// .build();
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,11 +2,8 @@ package com.etl.data.controller;
|
||||||
|
|
||||||
import com.etl.common.core.domain.Result;
|
import com.etl.common.core.domain.Result;
|
||||||
import com.etl.common.core.web.controller.BaseController;
|
import com.etl.common.core.web.controller.BaseController;
|
||||||
import com.etl.data.domain.Dictionary;
|
|
||||||
import com.etl.data.domain.model.DictionaryModel;
|
|
||||||
import com.etl.data.domain.resp.AssetsModelResp;
|
import com.etl.data.domain.resp.AssetsModelResp;
|
||||||
|
|
||||||
import com.etl.data.domain.resp.DictionaryModelResp;
|
|
||||||
import com.etl.data.service.AssetsModelService;
|
import com.etl.data.service.AssetsModelService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.etl.data.controller;
|
||||||
import com.etl.common.core.domain.Result;
|
import com.etl.common.core.domain.Result;
|
||||||
import com.etl.data.domain.Dictionary;
|
import com.etl.data.domain.Dictionary;
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
import com.etl.data.domain.DictionaryInfo;
|
||||||
import com.etl.data.mapper.DictionaryMapper;
|
import com.etl.data.domain.resp.DictionaryInfoResp;
|
||||||
import com.etl.data.service.DictionaryService;
|
import com.etl.data.service.DictionaryService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -27,11 +27,9 @@ public class DictionaryController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getDictionaryByDataSourceId")
|
@GetMapping("/getDictionaryByDataSourceId")
|
||||||
public Result getDictionaryByDataSourceId(@RequestParam Integer dataSourceId){
|
public Result<List< DictionaryInfoResp >> getDictionaryByDataSourceId(@RequestParam Integer dataSourceId){
|
||||||
return dictionaryService.getDictionaryByDataSourceId(dataSourceId);
|
return dictionaryService.getDictionaryByDataSourceId(dataSourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增字典表
|
* 新增字典表
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +37,6 @@ public class DictionaryController {
|
||||||
public Result insertDictionary(@RequestBody Dictionary dictionary){
|
public Result insertDictionary(@RequestBody Dictionary dictionary){
|
||||||
return dictionaryService.insertDictionary(dictionary);
|
return dictionaryService.insertDictionary(dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增字典选项
|
* 新增字典选项
|
||||||
*/
|
*/
|
||||||
|
@ -49,6 +46,4 @@ public class DictionaryController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.etl.data.mapper;
|
package com.etl.data.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.etl.data.domain.Dictionary;
|
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
import com.etl.data.domain.DictionaryInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,10 +3,7 @@ package com.etl.data.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.etl.common.core.domain.Result;
|
import com.etl.common.core.domain.Result;
|
||||||
import com.etl.data.domain.AssetsModel;
|
import com.etl.data.domain.AssetsModel;
|
||||||
import com.etl.data.domain.Dictionary;
|
|
||||||
import com.etl.data.domain.model.DictionaryModel;
|
|
||||||
import com.etl.data.domain.resp.AssetsModelResp;
|
import com.etl.data.domain.resp.AssetsModelResp;
|
||||||
import com.etl.data.domain.resp.DictionaryModelResp;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.etl.data.service;
|
package com.etl.data.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.etl.data.domain.Dictionary;
|
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
import com.etl.data.domain.DictionaryInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.etl.common.core.domain.Result;
|
||||||
import com.etl.data.domain.DataType;
|
import com.etl.data.domain.DataType;
|
||||||
import com.etl.data.domain.Dictionary;
|
import com.etl.data.domain.Dictionary;
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
import com.etl.data.domain.DictionaryInfo;
|
||||||
|
import com.etl.data.domain.resp.DictionaryInfoResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ import java.util.List;
|
||||||
* @Date 2024/4/20 11:48
|
* @Date 2024/4/20 11:48
|
||||||
*/
|
*/
|
||||||
public interface DictionaryService extends IService< Dictionary > {
|
public interface DictionaryService extends IService< Dictionary > {
|
||||||
Result getDictionaryByDataSourceId(Integer dataSourceId);
|
Result<List< DictionaryInfoResp >> getDictionaryByDataSourceId(Integer dataSourceId);
|
||||||
/**
|
/**
|
||||||
* 新增字典表
|
* 新增字典表
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,26 +5,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.etl.common.core.domain.Result;
|
import com.etl.common.core.domain.Result;
|
||||||
import com.etl.data.domain.AssetsModel;
|
import com.etl.data.domain.AssetsModel;
|
||||||
import com.etl.data.domain.DataTable;
|
import com.etl.data.domain.DataTable;
|
||||||
import com.etl.data.domain.Dictionary;
|
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
|
||||||
import com.etl.data.domain.model.DictionaryModel;
|
|
||||||
import com.etl.data.domain.resp.AssetsModelResp;
|
import com.etl.data.domain.resp.AssetsModelResp;
|
||||||
import com.etl.data.domain.resp.DictionaryModelResp;
|
|
||||||
import com.etl.data.mapper.AssetsModelMapper;
|
import com.etl.data.mapper.AssetsModelMapper;
|
||||||
import com.etl.data.mapper.DictionaryInfoMapper;
|
|
||||||
import com.etl.data.mapper.DictionaryMapper;
|
|
||||||
import com.etl.data.service.AssetsModelService;
|
import com.etl.data.service.AssetsModelService;
|
||||||
import com.etl.data.service.DataTableService;
|
import com.etl.data.service.DataTableService;
|
||||||
import com.etl.data.service.DictionaryInfoService;
|
;
|
||||||
import com.etl.data.service.DictionaryService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName AssetsModelServiceImpl
|
* @ClassName AssetsModelServiceImpl
|
||||||
|
@ -37,16 +28,6 @@ public class AssetsModelServiceImpl extends ServiceImpl<AssetsModelMapper, Asset
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataTableService dataTableService;
|
private DataTableService dataTableService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DictionaryService dictionaryService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DictionaryMapper dictionaryMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DictionaryInfoMapper dictionaryInfoMapper;
|
|
||||||
@Autowired
|
|
||||||
private DictionaryInfoService dictionaryInfoService;
|
|
||||||
@Override
|
@Override
|
||||||
public Result<List<AssetsModelResp>> getAssetsModelListByTableIds(List<Integer> tableId) {
|
public Result<List<AssetsModelResp>> getAssetsModelListByTableIds(List<Integer> tableId) {
|
||||||
ArrayList<AssetsModelResp> assetsModelRespArrayList = new ArrayList<>();
|
ArrayList<AssetsModelResp> assetsModelRespArrayList = new ArrayList<>();
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package com.etl.data.service.impl;
|
package com.etl.data.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.etl.data.domain.Dictionary;
|
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
import com.etl.data.domain.DictionaryInfo;
|
||||||
import com.etl.data.mapper.DictionaryInfoMapper;
|
import com.etl.data.mapper.DictionaryInfoMapper;
|
||||||
import com.etl.data.mapper.DictionaryMapper;
|
|
||||||
import com.etl.data.service.DictionaryInfoService;
|
import com.etl.data.service.DictionaryInfoService;
|
||||||
import com.etl.data.service.DictionaryService;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +13,5 @@ import org.springframework.stereotype.Service;
|
||||||
* @Date 2024/4/26 9:40
|
* @Date 2024/4/26 9:40
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DictionaryInfoServiceImpl extends ServiceImpl< DictionaryInfoMapper, DictionaryInfo > implements DictionaryInfoService {
|
public class DictionaryInfoServiceImpl extends ServiceImpl<DictionaryInfoMapper, DictionaryInfo> implements DictionaryInfoService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,9 @@ package com.etl.data.service.impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.etl.common.core.domain.Result;
|
import com.etl.common.core.domain.Result;
|
||||||
import com.etl.common.security.utils.DictUtils;
|
|
||||||
import com.etl.data.domain.Dictionary;
|
import com.etl.data.domain.Dictionary;
|
||||||
import com.etl.data.domain.DictionaryInfo;
|
import com.etl.data.domain.DictionaryInfo;
|
||||||
import com.etl.data.domain.model.DictionaryModel;
|
import com.etl.data.domain.resp.DictionaryInfoResp;
|
||||||
import com.etl.data.mapper.DictionaryInfoMapper;
|
|
||||||
import com.etl.data.mapper.DictionaryMapper;
|
import com.etl.data.mapper.DictionaryMapper;
|
||||||
import com.etl.data.service.DictionaryInfoService;
|
import com.etl.data.service.DictionaryInfoService;
|
||||||
import com.etl.data.service.DictionaryService;
|
import com.etl.data.service.DictionaryService;
|
||||||
|
@ -15,9 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName DictionaryServiceImpl
|
* @ClassName DictionaryServiceImpl
|
||||||
|
@ -26,31 +22,26 @@ import java.util.stream.Collectors;
|
||||||
* @Date 2024/4/26 9:40
|
* @Date 2024/4/26 9:40
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DictionaryServiceImpl extends ServiceImpl< DictionaryMapper, Dictionary > implements DictionaryService {
|
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements DictionaryService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DictionaryMapper dictionaryMapper;
|
|
||||||
@Autowired
|
|
||||||
private DictionaryInfoMapper dictionaryInfoMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictionaryInfoService dictionaryInfoService;
|
private DictionaryInfoService dictionaryInfoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<List< DictionaryModel >> getDictionaryByDataSourceId(Integer dataSourceId) {
|
public Result<List< DictionaryInfoResp >> getDictionaryByDataSourceId(Integer dataSourceId) {
|
||||||
|
|
||||||
List< DictionaryModel > dictionaryModels = new ArrayList<> ( );
|
List< DictionaryInfoResp > dictionaryModels = new ArrayList<> ( );
|
||||||
|
|
||||||
|
//根据数据源id查询所有适用的字典
|
||||||
List< Dictionary > dictionaryList = this.list ( new LambdaQueryWrapper< Dictionary > ( ).eq ( Dictionary::getDataSourceId, dataSourceId ) );
|
List< Dictionary > dictionaryList = this.list ( new LambdaQueryWrapper< Dictionary > ( ).eq ( Dictionary::getDataSourceId, dataSourceId ) );
|
||||||
|
|
||||||
|
//根据每一个字典查询所有字典标签,并封装为一个对象
|
||||||
for (Dictionary dictionary : dictionaryList) {
|
for (Dictionary dictionary : dictionaryList) {
|
||||||
List< DictionaryInfo > dictionaryInfoList = dictionaryInfoService.list ( new LambdaQueryWrapper< DictionaryInfo > ( ).eq (
|
LambdaQueryWrapper<DictionaryInfo> dictionaryInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
DictionaryInfo::getDictionaryId, dictionary.getId ( ) ));
|
dictionaryInfoLambdaQueryWrapper.eq(DictionaryInfo::getDictionaryId,dictionary.getId());
|
||||||
|
List<DictionaryInfo> dictionaryInfoList = dictionaryInfoService.list(dictionaryInfoLambdaQueryWrapper);
|
||||||
dictionaryModels.add ( DictionaryModel.dictionaryInfoBuild (dictionary, dictionaryInfoList ));
|
dictionaryModels.add(DictionaryInfoResp.dictionaryAndInfoBuild(dictionary,dictionaryInfoList));
|
||||||
}
|
}
|
||||||
|
return Result.success ( dictionaryModels );
|
||||||
return Result.success (dictionaryModels);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue