|
|
@ -5,6 +5,7 @@ import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import com.glxp.api.dao.idc.DbDao;
|
|
|
|
import com.glxp.api.dao.idc.DbDao;
|
|
|
|
import com.glxp.api.idc.service.DeleteService;
|
|
|
|
import com.glxp.api.idc.service.DeleteService;
|
|
|
|
|
|
|
|
import com.glxp.api.idc.utils.TableUtils;
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -23,6 +25,10 @@ public class DeleteServiceImpl implements DeleteService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private DbDao dbDao;
|
|
|
|
private DbDao dbDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean syncDelete(String tableName,String uniqueValue) {
|
|
|
|
|
|
|
|
return syncDelete(tableName,"",uniqueValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean syncDelete(String tableName,String uniqueColumn,String uniqueValue) {
|
|
|
|
public boolean syncDelete(String tableName,String uniqueColumn,String uniqueValue) {
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
@ -34,7 +40,19 @@ public class DeleteServiceImpl implements DeleteService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean syncDelete(Map<String,Object> params) {
|
|
|
|
public boolean syncDelete(Map<String,Object> params) {
|
|
|
|
createTable();
|
|
|
|
createTable();
|
|
|
|
String sql = "insert into idc_delete (id,tableName,uniqueColumn,updateTime,uniqueValue) values ('"+CustomUtil.getId()+"','"+params.get("tableName").toString().toLowerCase()+"','"+params.get("uniqueColumn")+"',now(),'"+params.get("uniqueValue")+"')";
|
|
|
|
String tableName = params.get("tableName").toString();
|
|
|
|
|
|
|
|
String uniqueColumn = params.get("uniqueColumn")!=null ? params.get("uniqueColumn").toString() : "";
|
|
|
|
|
|
|
|
if(StringUtils.isEmpty(uniqueColumn)) {
|
|
|
|
|
|
|
|
String[] syncTables = TableUtils.syncTables();
|
|
|
|
|
|
|
|
for(String str:syncTables) {
|
|
|
|
|
|
|
|
String[] tnames = str.split("/");
|
|
|
|
|
|
|
|
if(tnames[3].toLowerCase().equals(tableName.toLowerCase())) {
|
|
|
|
|
|
|
|
uniqueColumn = tnames[4];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String sql = "insert into idc_delete (id,tableName,uniqueColumn,updateTime,uniqueValue) values ('"+CustomUtil.getId()+"','"+params.get("tableName").toString().toLowerCase()+"','"+uniqueColumn+"',now(),'"+params.get("uniqueValue")+"')";
|
|
|
|
|
|
|
|
|
|
|
|
if(dbDao.save(sql)>0)
|
|
|
|
if(dbDao.save(sql)>0)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|