EmailMysql.java 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
//package web.multitask.trismegistoservices.mysql;
//
//import org.json.JSONObject;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//import java.util.Map;
//
//@Service
//public class EmailMysql {
//
//    private final JdbcTemplate jdbcTemplate;
//
//    public EmailMysql(JdbcTemplate jdbcTemplate) {
//        this.jdbcTemplate = jdbcTemplate;
//    }
//
//    public JSONObject getHTMLTemplate (JSONObject json) {
//        String id = json.optString("id",null);
//        if(id == null){
//            return new JSONObject().put("message", "Invalid Request").put("status", false);
//        }
//        String sql = "SELECT * FROM security.email_template  WHERE id = ?";
//        Object[] params = new Object[] { id };
//        try{
//            List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, params);
//            return new JSONObject().put("data", rows).put("message", "Success").put("status", true);
//        }catch (Exception e){
//            return new JSONObject().put("message", e.getMessage()).put("status", false);
//        }
//    }
//}