Package app.logic

Source Code of app.logic.CrudLogic

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);
    }
}
TOP

Related Classes of app.logic.CrudLogic

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.