Commit f62318ab authored by Quxl's avatar Quxl

x

parent 506517b5
...@@ -95,7 +95,7 @@ public class HttpController { ...@@ -95,7 +95,7 @@ public class HttpController {
@ResponseBody @ResponseBody
@PostMapping("remove") @PostMapping("remove")
public Object remove(Integer id) { public Object remove(Integer id) {
common.delete(id, THttpItem.class); common.deleteById(id, THttpItem.class);
this.deleteSchedule(id); this.deleteSchedule(id);
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
......
...@@ -13,7 +13,7 @@ public interface CommonService { ...@@ -13,7 +13,7 @@ public interface CommonService {
void update(Object obj); void update(Object obj);
void delete(Object id, Class<?> type); void deleteById(Object id, Class<?> type);
<T> T queryById(Object id, Class<T> type); <T> T queryById(Object id, Class<T> type);
......
...@@ -32,8 +32,14 @@ public class CommonServiceImpl implements CommonService { ...@@ -32,8 +32,14 @@ public class CommonServiceImpl implements CommonService {
} }
@Override @Override
public void delete(Object id, Class<?> type) { public void deleteById(Object id, Class<?> type) {
this.jdbcTemplate.delete(id, type); Desc desc = new Desc(type);
String[] pks = desc.getColumnPkNames();
if(pks != null && pks.length == 1) {
String sql = "delete from " + desc.getName() + " where " + pks[0] + " = ?";
this.jdbcTemplate.executeUpdate(sql, id);
}
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment