|
@@ -12,12 +12,12 @@ public class MagicApiService {
|
|
|
|
|
|
private final String deleteById = "delete from magic_api_info where id = ?";
|
|
|
private final String selectList = "select id,api_name name,api_path path,api_method method from magic_api_info order by api_update_time desc";
|
|
|
- private final String selectListWithScript = "select id,api_name name,api_path path,api_method method,api_script script from magic_api_info";
|
|
|
- private final String selectOne = "select api_method method,api_script script,api_path path,api_name name from magic_api_info where id = ?";
|
|
|
+ private final String selectListWithScript = "select id,api_name name,api_path path,api_method method,api_script script,api_parameter parameter,api_option `option` from magic_api_info";
|
|
|
+ private final String selectOne = "select api_method method,api_script script,api_path path,api_name name,api_parameter parameter,api_option `option` from magic_api_info where id = ?";
|
|
|
private final String exists = "select count(*) from magic_api_info where api_method = ? and api_path = ?";
|
|
|
private final String existsWithoutId = "select count(*) from magic_api_info where api_method = ? and api_path = ? and id !=?";
|
|
|
- private final String insert = "insert into magic_api_info(id,api_method,api_path,api_script,api_name,api_create_time,api_update_time) values(?,?,?,?,?,?,?)";
|
|
|
- private final String update = "update magic_api_info set api_method = ?,api_path = ?,api_script = ?,api_name = ?,api_update_time = ? where id = ?";
|
|
|
+ private final String insert = "insert into magic_api_info(id,api_method,api_path,api_script,api_name,api_parameter,api_option,api_create_time,api_update_time) values(?,?,?,?,?,?,?,?,?)";
|
|
|
+ private final String update = "update magic_api_info set api_method = ?,api_path = ?,api_script = ?,api_name = ?,api_parameter = ?,api_option = ?,api_update_time = ? where id = ?";
|
|
|
private RowMapper<ApiInfo> rowMapper = new BeanPropertyRowMapper<>(ApiInfo.class);
|
|
|
private JdbcTemplate template;
|
|
|
|
|
@@ -56,11 +56,10 @@ public class MagicApiService {
|
|
|
protected boolean insert(ApiInfo info) {
|
|
|
info.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
long time = System.currentTimeMillis();
|
|
|
- return template.update(insert, info.getId(), info.getMethod(), info.getPath(), info.getScript(), info.getName(), time, time) > 0;
|
|
|
+ return template.update(insert, info.getId(), info.getMethod(), info.getPath(), info.getScript(), info.getName(), info.getParameter(), info.getOption(), time, time) > 0;
|
|
|
}
|
|
|
|
|
|
protected boolean update(ApiInfo info) {
|
|
|
- long time = System.currentTimeMillis();
|
|
|
- return template.update(update, info.getMethod(), info.getPath(), info.getScript(), info.getName(), System.currentTimeMillis(), info.getId()) > 0;
|
|
|
+ return template.update(update, info.getMethod(), info.getPath(), info.getScript(), info.getName(), info.getParameter(), info.getOption(), System.currentTimeMillis(), info.getId()) > 0;
|
|
|
}
|
|
|
}
|