Skip to content

Commit ede544d

Browse files
author
Parvatam
committed
Test
1 parent 1937e6a commit ede544d

2 files changed

Lines changed: 35 additions & 6 deletions

File tree

src/main/java/com/example/Main.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.example;
1818

19+
import com.example.response.Result;
1920
import com.zaxxer.hikari.HikariConfig;
2021
import com.zaxxer.hikari.HikariDataSource;
2122
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,7 @@
3233
import java.sql.SQLException;
3334
import java.sql.Statement;
3435
import java.util.ArrayList;
36+
import java.util.List;
3537
import java.util.Map;
3638

3739
@Controller
@@ -75,18 +77,22 @@ String db(Map<String, Object> model) {
7577
}
7678

7779
//Save a account to the postgres DB
78-
@RequestMapping(value = "/save-account")
80+
@RequestMapping(value = "/account")
7981
public @ResponseBody
80-
boolean saveSfContact(@RequestParam(name = "name") String name, @RequestParam(name = "id")String id) {
82+
Result saveSfContact(@RequestParam(name = "name") String name, @RequestParam(name = "id")String id) {
83+
Result result = new Result();
8184
try (Connection connection = dataSource.getConnection()) {
8285
Statement stmt = connection.createStatement();
83-
stmt.executeUpdate("update salesforcecgoconnect.account set salesforcecgoconnect.account.name= '"+ name +"' where recordtypeid = '" + id + "'");
84-
return true;
86+
ResultSet rs = stmt.executeQuery("select * from salesforcecgoconnect.account where salesforcecgoconnect.account.name= '"+ name +"' and salesforcecgoconnect.account.recordtypeid = '" + id + "'");
87+
//stmt.executeUpdate("select * from salesforcecgoconnect.account where salesforcecgoconnect.account.name= '"+ name +"' and recordtypeid = '" + id + "'");
88+
while (rs.next()){
89+
result.setId(rs.getString("recordtypeid"));
90+
result.setName(rs.getString("name"));
91+
}
8592
} catch (Exception e) {
8693
e.printStackTrace();
87-
return false;
8894
}
89-
95+
return result;
9096
}
9197

9298
@Bean
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.example.response;
2+
3+
public class Result {
4+
5+
private String id;
6+
private String name;
7+
8+
public String getId() {
9+
return id;
10+
}
11+
12+
public void setId(String id) {
13+
this.id = id;
14+
}
15+
16+
public String getName() {
17+
return name;
18+
}
19+
20+
public void setName(String name) {
21+
this.name = name;
22+
}
23+
}

0 commit comments

Comments
 (0)