在SysUser这个model中新建了性别名称sexName属性, 数据库中执行下面的sql有值查询出来,但dao.template()查询出来值为null,是哪里需要做什么设置? 设置MixedJsonFactory、FastJsonFactory都试过
public class SysUser extends BaseSysUser<SysUser> { //性别名称 public String sexName; public String getSexName() { return sexName; } public void setSexName(String sexName) { this.sexName = sexName; } }
然后查询出来的结果sexName为空,
public Page<SysUser> page(Kv kv) { Page<SysUser> list = dao.template("admin.user.page", kv).paginate(getPage(kv), getLimit(kv)); return list; }
sql语句如下:
SELECT a.*, c.dict_data_name sex_name FROM sys_user a LEFT JOIN sys_dictionary_data c ON a.sex = c.dict_data_id
查询结果:
[{ "sexName":null, "nickname":"管理员", "email":"", "sex":1, }]
项目:JFinal
改为:getSexName() {return getStr("sex_name");}