SELECT addtime FROM attend_sign
where DATE_FORMAT(FROM_UNIXTIME(addtime),'%Y%m')= DATE_FORMAT(20180507,'%Y%m')
AND uid = 34 AND state =1 OR state =2;
一列时间戳
接触Nutz没几天 求大佬帮忙
7 回复
StringBuilder sql = new StringBuilder("SELECT addtime FROM attend_sign where DATE_FORMAT(FROM_UNIXTIME(addtime),'%Y%m')= DATE_FORMAT(@date,'%Y%m') AND uid = @id AND state =1 OR state =2");
Sql sqls = Sqls.create(sql.toString());
sqls.params().set("date", date);
sqls.params().set("id", user.getId());
sqls.setCallback(new SqlCallback(){
@Override
public Object invoke(Connection conn, ResultSet rs, Sql sql)
throws SQLException {
List list1 = new ArrayList();
while (rs.next()){
list1.add(rs.getString("addtime"));
}
return list1;
}
});
dao().execute(sqls);
List list1 = sqls.getList(Map.class);
写出来了
添加回复
请先登陆