List 返回json值不区分大小写 这个算不算是BUG
13 回复
@wendal 是的
@wendal
酱紫 莫非改成
Sql sql = dao.sqls().create("shopping.list");
sql.params().set("uid", uid);
List<Record> shoppingCart = appShoppingCartService.list(sql);
Sql sql = dao.sqls().create("shopping.list");
sql.params().set("uid", uid);
List<maps> shoppingCart = appShoppingCartService.list(sql);
@tonyyule 不知道什么是回调?sql.setCallback
@wendal 噢
@wendal 噢
@wendal
为何加了这句话 返回值还是不区分大小写呢
@At
@Ok("json")
@SLog(tag = "购物车列表", msg = "")
@Filters(@By(type=AccessTokenFilter.class))
public Object list(@Param("id") String uid) {
try {
Sql sql = dao.sqls().create("shopping.list");
//区分大小写
sql.setCallback(Sqls.callback.maps());
sql.params().set("uid", uid);
List<Record> shoppingCart = appShoppingCartService.list(sql);
return ResultApp.success("system.success",shoppingCart);
} catch (Exception e) {
return ResultApp.error("system.error");
}
}
sql
/* shopping.list */
SELECT s.id , s.userId AS userId, s.prodId, s.size, s.color, s.prodCount, s.prodImg ,s.invenId,
i.prodNum, i.prodUrls, p.name, p.price, p.promPrice
FROM app_shopping_cart s
inner join app_inventory i on i.prodId = s.prodId
inner join app_product p on p.id=s.prodId
WHERE s.userId=@uid and s.size=i.size and s.color=i.color and s.delFlag=0
sql取了别名 还是不行
返回值
{
"result": 1,
"msg": "操作成功",
"data": [
{
"id": 41,
"userid": 5,
"prodid": "0487ee781caf4151b621d0601409ce0b",
"size": "M",
"color": "绿色",
"prodcount": 10,
"invenid": "3abc852fe4d740c7b74c86397e75ce82",
"prodnum": 99,
"produrls": "/upload/image/20161012/7qgu124gicg3epgc9g1uht7olu.png;/upload/image/20161012/1573alr6dohlhqnppfvap3b4qc.png",
"name": "绿帽 男 2017款 0300002698",
"price": 139,
"promprice": 110
}
]
}
nutMap还是不区分大小写
@At
@Ok("json")
public Object dictDo() {
try {
Sql sql = categoryService.dao().sqls().create("dict.list");
//区分大小写
sql.setCallback(Sqls.callback.maps());
List<NutMap> re =categoryService.listM(sql);
return re;
} catch (Exception e) {
return Result.error("system.error");
}
}
public <T> List<NutMap> listM(Sql sql) {
sql.setCallback(Sqls.callback.records());
this.dao().execute(sql);
return sql.getList(NutMap.class);
}
添加回复
请先登陆