2016-11-30 17:47
@JFinal 是的,直接用model类的find更好。我改下。 :-)
2016-11-30 13:26
是不是序列化model类不行?
model类代码:
public class Merger extends BaseMerger {
public static final Merger dao = new Merger();
public static final String tableName = TableMapping.me().getTable(Merger.class).getName();
public static List getAllMerger(Date date){
if(date == null){
return new ArrayList();
}
String sql = " select * from " + tableName + " where tm >= ? ";
return Db.query(sql,date);
}
}
2016-11-30 13:24
改成这样打印:
System.out.println(JFinalJson.getJson().toJson(list.get(0)));
System.out.println(JFinalJson.getJson().toJson(list));
结果还是一样。
结果:
["2016-10-28 01:02:28","",1,"7167","8333","2016-10-01","1","1.17",2,"足利ホールディングス","常陽銀行","東証1部","東証1部","2016/9/28 - 2016/9/30","アシカガホールディングス","ジョウヨウギンコウ","トウショウ","トウショウ"]
[["2016-10-28 01:02:28","",1,"7167","8333","2016-10-01","1","1.17",2,"足利ホールディングス","常陽銀行","東証1部","東証1部","2016/9/28 - 2016/9/30","アシカガホールディングス","ジョウヨウギンコウ","トウショウ","トウショウ"],["2016-10-28 01:02:28","",1,"3050","9855","2016-12-01","1","0.6",2,"DCMホールディングス","くろがねや","東証1部","東証2部","2016/11/28 - 2016/11/30","ディーシーエムホールディングス","クロガネヤ","トウショウ","トウショウ"]]
2016-11-30 13:18
打印这两段代码:
List list = Merger.getAllMerger(date);
System.out.println(Json.getJson().toJson(list.get(0)));
System.out.println(Json.getJson().toJson(list));
结果是:
["2016-10-28 01:02:28","",1,"7167","8333","2016-10-01","1","1.17",2,"足利ホールディングス","常陽銀行","東証1部","東証1部","2016/9/28 - 2016/9/30","アシカガホールディングス","ジョウヨウギンコウ","トウショウ","トウショウ"]
[["2016-10-28 01:02:28","",1,"7167","8333","2016-10-01","1","1.17",2,"足利ホールディングス","常陽銀行","東証1部","東証1部","2016/9/28 - 2016/9/30","アシカガホールディングス","ジョウヨウギンコウ","トウショウ","トウショウ"],["2016-10-28 01:02:28","",1,"3050","9855","2016-12-01","1","0.6",2,"DCMホールディングス","くろがねや","東証1部","東証2部","2016/11/28 - 2016/11/30","ディーシーエムホールディングス","クロガネヤ","トウショウ","トウショウ"]]
都是返回数组格式。
我的model类代码
public class Merger extends BaseMerger {
public static final Merger dao = new Merger();
public static final String tableName = TableMapping.me().getTable(Merger.class).getName();
public static List getAllMerger(Date date){
if(date == null){
return new ArrayList();
}
String sql = " select * from " + tableName + " where tm >= ? ";
return Db.query(sql,date);
}
}
父类BaseMerger代码:
public abstract class BaseMerger> extends Model implements IBean {
public void setTm(java.util.Date tm) {
set("tm", tm);
}
public java.util.Date getTm() {
return get("tm");
}
public void setMemo(java.lang.String Memo) {
set("Memo", Memo);
}
public java.lang.String getMemo() {
return get("Memo");
}
public void setMode(java.lang.Integer mode) {
set("mode", mode);
}
public java.lang.Integer getMode() {
return get("mode");
}
public void setDcode(java.lang.String dcode) {
set("dcode", dcode);
}
public java.lang.String getDcode() {
return get("dcode");
}
public void setScode(java.lang.String scode) {
set("scode", scode);
}
public java.lang.String getScode() {
return get("scode");
}
public void setDate(java.util.Date date) {
set("date", date);
}
public java.util.Date getDate() {
return get("date");
}
public void setDunit(java.lang.String dunit) {
set("dunit", dunit);
}
public java.lang.String getDunit() {
return get("dunit");
}
public void setSunit(java.lang.String sunit) {
set("sunit", sunit);
}
public java.lang.String getSunit() {
return get("sunit");
}
public void setType(java.lang.Integer type) {
set("type", type);
}
public java.lang.Integer getType() {
return get("type");
}
public void setDname(java.lang.String dname) {
set("dname", dname);
}
public java.lang.String getDname() {
return get("dname");
}
public void setSname(java.lang.String sname) {
set("sname", sname);
}
public java.lang.String getSname() {
return get("sname");
}
public void setDexchg(java.lang.String dexchg) {
set("dexchg", dexchg);
}
public java.lang.String getDexchg() {
return get("dexchg");
}
public void setSexchg(java.lang.String sexchg) {
set("sexchg", sexchg);
}
public java.lang.String getSexchg() {
return get("sexchg");
}
public void setComment(java.lang.String comment) {
set("comment", comment);
}
public java.lang.String getComment() {
return get("comment");
}
public void setDkname(java.lang.String dkname) {
set("dkname", dkname);
}
public java.lang.String getDkname() {
return get("dkname");
}
public void setSkname(java.lang.String skname) {
set("skname", skname);
}
public java.lang.String getSkname() {
return get("skname");
}
public void setDkexchg(java.lang.String dkexchg) {
set("dkexchg", dkexchg);
}
public java.lang.String getDkexchg() {
return get("dkexchg");
}
public void setSkexchg(java.lang.String skexchg) {
set("skexchg", skexchg);
}
public java.lang.String getSkexchg() {
return get("skexchg");
}
}
2016-11-30 12:47
public class Merger extends BaseMerger {
public static final Merger dao = new Merger();
public static final String tableName = TableMapping.me().getTable(Merger.class).getName();
@Override
protected Map getAttrs() {
// TODO Auto-generated method stub
return super.getAttrs();
}
public static List getAllMerger(Date date){
if(date == null){
return new ArrayList();
}
String sql = " select * from " + tableName + " where tm >= ? ";
return Db.query(sql,date);
}
}
model类代码。