Commit 4548d93d by zhangkb

添加根据指标目录idPath获取idPath的中文路径描述接口

parent 671213ea
...@@ -6,6 +6,7 @@ import javax.persistence.GeneratedValue; ...@@ -6,6 +6,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient;
import com.keymobile.indicators.utils.DateUtils; import com.keymobile.indicators.utils.DateUtils;
...@@ -28,4 +29,6 @@ public class DriveIndCatalog { ...@@ -28,4 +29,6 @@ public class DriveIndCatalog {
private String code;//目录编码 private String code;//目录编码
private String lastUpdater; private String lastUpdater;
private String lastUpdateTime = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"); private String lastUpdateTime = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
@Transient
private String idPathDesc;
} }
...@@ -126,6 +126,32 @@ public class DriveIndCatalogService { ...@@ -126,6 +126,32 @@ public class DriveIndCatalogService {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("type", type); paramMap.put("type", type);
paramMap.put("codes", codes); paramMap.put("codes", codes);
return driveIndCatalogMapper.findByCatalogTypeAndCode(paramMap); List<DriveIndCatalog> catalogs = driveIndCatalogMapper.findByCatalogTypeAndCode(paramMap);
List<DriveIndCatalog> results = new ArrayList<>();
for(DriveIndCatalog catalog : catalogs) {
catalog.setIdPathDesc(this.getCatalogIdPathDesc(catalog.getIdPath()));
results.add(catalog);
}
return results;
}
public String getCatalogIdPathDesc(String idPath){
String idPathDesc = "";
if(StringUtils.isNotBlank(idPath)) {
//去掉idPath中的最后一个分号
idPath = idPath.substring(0, idPath.length()-1);
String[] ids = idPath.split(";");
if(ids.length>0) {
for(String id : ids) {
//根据id获取对标指标目录
DriveIndCatalog catalog = driveIndCatalogMapper
.selectByPrimaryKey(Integer.parseInt(id));
if(catalog!=null) {
idPathDesc += catalog.getCatalogName()+";";
}
}
}
}
return idPathDesc;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment