kgdxpr 1 year ago
commit 6e417331de

@ -16,7 +16,9 @@ import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.SqlPara;
import java.text.ParseException;
import java.util.*;
import java.text.SimpleDateFormat;
public class ZbdcModel {
/**
@ -521,7 +523,25 @@ public class ZbdcModel {
public List<Record> getXxzbdcList(String bureau_id, int dcb_id, int year) {
String table_name = getXxzbdcTableName(dcb_id);
String sql = "select t1.*,t2.lb_name,t2.lb_sb_name from " + table_name + " as t1 inner join t_zbdc_table_lbsb as t2 on t1.lb_sb_id=t2.lb_sb_id where t1.school_id=? and t1.year=? order by t1.id";
return Db.find(sql, bureau_id, year);
List<Record> records = Db.find(sql, bureau_id, year);
// 遍历列表
for (Record record : records) {
Map<String, Object> attrs = record.getColumns();
for (Map.Entry<String, Object> entry : attrs.entrySet()) {
String fieldName = entry.getKey(); // 获取字段名
Object fieldValue = entry.getValue(); // 获取字段值
// 这里可以检查字段值是否是日期类型,并进行处理
if (fieldValue instanceof java.sql.Date) {
java.sql.Date date = (java.sql.Date) fieldValue;
if (date != null) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
record.set(fieldName, dateFormat.format(date));
}
}
}
}
return records;
}
/**

Loading…
Cancel
Save