|
|
@@ -225,16 +225,12 @@ public class DataConnectorService {
|
|
|
删除数据源
|
|
|
*/
|
|
|
@CacheEvict(value = "singleDataConnector")
|
|
|
- public RepEntity delDataConnector(List<Integer> idList) {
|
|
|
- Iterator isList = idList.iterator();
|
|
|
-// while (isList.hasNext()){
|
|
|
-// int id = (int) isList.next();
|
|
|
-// List<String> chartName = dataConnectorMapper.getChartsName(id);
|
|
|
-// if (chartName.size() != 0){
|
|
|
-// return new RepEntity(RepCode.hasChartsUsing, chartName);
|
|
|
-// }
|
|
|
-// }
|
|
|
- dataConnectorMapper.deleteData(idList);
|
|
|
+ public RepEntity delDataConnector(Long id) {
|
|
|
+ int count = dataConnectorMapper.countChartsById(id);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new MyException(RepCode.CHARTS_USED_DATACONNECTOR);
|
|
|
+ }
|
|
|
+ dataConnectorMapper.deleteData(id);
|
|
|
return new RepEntity(RepCode.success);
|
|
|
}
|
|
|
|
|
|
@@ -278,21 +274,16 @@ public class DataConnectorService {
|
|
|
删除数据源分组
|
|
|
*/
|
|
|
@CacheEvict(value = "singleDataConnector")
|
|
|
- public RepEntity delDataConnectorGroup(List<Integer> idList) {
|
|
|
- List<Integer> integerList = idList;
|
|
|
- Iterator isList = integerList.iterator();
|
|
|
- while (isList.hasNext()) {
|
|
|
- int id = (int) isList.next();
|
|
|
- List<String> groupName = dataConnectorMapper.getFatherId(id);
|
|
|
- if (groupName.size() != 0) {
|
|
|
- return new RepEntity(RepCode.hasGroupUsing);
|
|
|
- }
|
|
|
- List<String> chartName = dataConnectorMapper.getConName(id);
|
|
|
- if (chartName.size() != 0) {
|
|
|
- return new RepEntity(RepCode.hasConUsing);
|
|
|
- }
|
|
|
+ public RepEntity delDataConnectorGroup(Long id) {
|
|
|
+ List<String> groupName = dataConnectorMapper.getFatherId(id.intValue());
|
|
|
+ if (groupName.size() != 0) {
|
|
|
+ return new RepEntity(RepCode.hasGroupUsing);
|
|
|
+ }
|
|
|
+ List<String> chartName = dataConnectorMapper.getConName(id.intValue());
|
|
|
+ if (chartName.size() != 0) {
|
|
|
+ return new RepEntity(RepCode.hasConUsing);
|
|
|
}
|
|
|
- dataConnectorMapper.delConnectorGroup(idList);
|
|
|
+ dataConnectorMapper.delConnectorGroup(id);
|
|
|
return new RepEntity(RepCode.success);
|
|
|
}
|
|
|
|