package com.vci.web.service.uidataservice;
|
|
import com.alibaba.fastjson.JSON;
|
import com.vci.pagemodel.UIFormDataVO;
|
import com.vci.query.UIDataGridQuery;
|
import com.vci.query.UIFormQuery;
|
import com.vci.query.UITreeQuery;
|
import com.vci.starter.web.exception.VciBaseException;
|
import com.vci.starter.web.pagemodel.BaseResult;
|
import com.vci.starter.web.pagemodel.DataGrid;
|
import com.vci.starter.web.pagemodel.UIDataTree;
|
import com.vci.starter.web.util.Lcm.Func;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* ui数据查询基础服务(该接口定义了一些公共的数据查询方法和一些默认方法以供继承和使用)
|
* @author ludc
|
* @date 2024/12/4 11:28
|
*/
|
public interface UIDataBaseServiceI {
|
|
/**
|
* 前端请求传过来的mao的value会出现json串的情况,需要转成map对象,所以调用该方法进行转换
|
* @param sourceData 源map对象
|
*/
|
default Map<String,Object> convertMapValueJson2Map(Map<String,Object> sourceData){
|
// TODO: 2024/12/2 Ludc 界面传过来的Map的value可能是一个Map,所以尝试转换
|
Map<String, Object> convertMap = new HashMap<>();
|
sourceData.keySet().stream().forEach(key->{
|
Object obj = sourceData.get(key);
|
try {
|
if(Func.isNotEmpty(obj)){
|
convertMap.put(key, JSON.parseObject(obj.toString(), HashMap.class));
|
}
|
}catch (Exception e){
|
//不抛出异常,如果转的时候报错就代表是String:String类型,直接往Map里面放
|
convertMap.put(key,obj);
|
//e.printStackTrace();
|
}
|
});
|
return convertMap;
|
}
|
|
/**
|
* 获取表格的数据
|
* @param dataGridQuery 表格查询,必须有业务类型名称和 表格的编号
|
* @return DataGrid中data为Map<String,String>格式
|
* @throws VciBaseException 查询出错的时候会抛出异常
|
*/
|
DataGrid getDataForGrid(UIDataGridQuery dataGridQuery) throws Exception;
|
|
/**
|
* 获取表单的数据
|
* @param formQuery 表单的查询条件
|
* @return 表单的数据
|
* @throws VciBaseException 查询出错的时候会抛出异常
|
*/
|
UIFormDataVO getDataForForm(UIFormQuery formQuery) throws Exception;
|
|
/**
|
* 获取树形数据
|
* @param treeQuery 树形查询条件
|
* @return 树形数据
|
* @throws VciBaseException 查询出错的时候会抛出异常
|
*/
|
List<UIDataTree> getDataForTree(UITreeQuery treeQuery) throws Exception;
|
|
/**
|
* 获取树形数据(根据查询模板查询对象,主要用于action配置的查询模板情况下调用)
|
* @param treeQuery 树形查询条件
|
* @return 树形数据
|
* @throws VciBaseException 查询出错的时候会抛出异常
|
*/
|
BaseResult getDataByTemp(UITreeQuery treeQuery) throws Exception;
|
|
}
|