代码:
@At
@Ok("raw")
public Object test(){
List<Department> list = dao.query(Department.class, null);
System.out.println(list.get(0));
return list.get(0);
}
日志:
[DEBUG] 14:54:43.752 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/department/test : DepartmentModule.test(DepartmentModule.java:41)
Department{Department_id='null', department_name='国家海洋局北海分局', Sea_area='null', department_level='北海分局'}
[DEBUG] 14:54:45.607 com.infogather.mvc.LogTimeProcessor.process(LogTimeProcessor.java:30) - [ GET]URI=/infogather/department/test 1854ms
pojo:
package com.infogather.entity;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
/**
* 对应数据表Department
*/
@Table("department")
public class Department {
@Name
private String department_id;
@Column
private String department_name;
@Column
private String sea_area;
@Column
private String department_level;
public static final String DEPARTMENT_ID = "department_id";
public static final String DEPARTMENT_NAME = "department_name";
public static final String SEA_AREA = "sea_area";
public static final String DEPARTMENT_LEVEL = "department_level";
@Override
public String toString() {
return "Department{" +
"Department_id='" + department_id + '\'' +
", department_name='" + department_name + '\'' +
", Sea_area='" + sea_area + '\'' +
", department_level='" + department_level + '\'' +
'}';
}
public String getDepartment_id() {
return department_id;
}
public void setDepartment_id(String department_id) {
department_id = department_id;
}
public String getDepartment_name() {
return department_name;
}
public void setDepartment_name(String department_name) {
this.department_name = department_name;
}
public String getSea_area() {
return sea_area;
}
public void setSea_area(String sea_area) {
sea_area = sea_area;
}
public String getDepartment_level() {
return department_level;
}
public void setDepartment_level(String department_level) {
this.department_level = department_level;
}
}