工具类调整
This commit is contained in:
parent
8a6b127eed
commit
293768081c
|
@ -4,12 +4,15 @@ import nc.bs.dao.BaseDAO;
|
||||||
import nc.bs.logging.Logger;
|
import nc.bs.logging.Logger;
|
||||||
import nc.itf.arap.goldentax.SysParaInitQuery;
|
import nc.itf.arap.goldentax.SysParaInitQuery;
|
||||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||||
|
import nc.jdbc.framework.processor.MapProcessor;
|
||||||
import nc.vo.cmp.util.StringUtils;
|
import nc.vo.cmp.util.StringUtils;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工具类
|
* 工具类
|
||||||
|
@ -21,7 +24,7 @@ public class MyHelper {
|
||||||
private static final BaseDAO dao = new BaseDAO();
|
private static final BaseDAO dao = new BaseDAO();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键查询编码
|
* 单个字段值翻译
|
||||||
*/
|
*/
|
||||||
public static String transferField(String tableName, String selectField, String pkField, String pk) throws BusinessException {
|
public static String transferField(String tableName, String selectField, String pkField, String pk) throws BusinessException {
|
||||||
if (StringUtils.isEmpty(pk)) {
|
if (StringUtils.isEmpty(pk)) {
|
||||||
|
@ -39,6 +42,29 @@ public class MyHelper {
|
||||||
return o.toString();
|
return o.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多个字段值翻译
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> transferFields(String tableName, String selectFields, String pkField, String pk) throws BusinessException {
|
||||||
|
if (StringUtils.isEmpty(pk)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
SqlBuilder sqlBuilder = new SqlBuilder();
|
||||||
|
sqlBuilder.append(" select " + selectFields);
|
||||||
|
sqlBuilder.append(" from " + tableName);
|
||||||
|
sqlBuilder.append(" where ");
|
||||||
|
sqlBuilder.append(pkField, pk);
|
||||||
|
|
||||||
|
Map<String, Object> result = (Map<String, Object>) dao.executeQuery(sqlBuilder.toString(), new MapProcessor());
|
||||||
|
|
||||||
|
if (result == null || result.isEmpty()) {
|
||||||
|
result = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查当前组织是否为电力电子
|
* 检查当前组织是否为电力电子
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue