package app.logic;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.blogger.tcuri.appserver.db.DbUtils;
import com.blogger.tcuri.appserver.db.MapHandler;
import com.blogger.tcuri.appserver.db.SqlBuilder;
import com.blogger.tcuri.appserver.koi.JsonResolution;
import com.blogger.tcuri.appserver.resolution.Resolution;
public class CrudLogic {
public static Resolution read() throws SQLException {
SqlBuilder sql = new SqlBuilder(
"select id,content,formatdatetime(updatetime, 'yyyy-MM-dd HH:mm:ss') as updatetime from messages order by id desc");
List<Map<String, Object>> messageList = DbUtils.selectList(sql,
MapHandler.INSTANCE);
return new JsonResolution(messageList);
}
}