修正保护名单配置回车不提示、重复数据问题

This commit is contained in:
zhangwenqing
2019-04-19 17:44:12 +08:00
parent 865811b9b2
commit 99c3c8c84f
7 changed files with 93 additions and 20 deletions

View File

@@ -77,4 +77,31 @@ public class InnerProtectionListController extends BaseController{
public Map<String,List<String>> ajaxGetAllInfo(HttpServletRequest request, HttpServletResponse response){
return innerProtectionListService.ajaxGetAllInfo();
}
/**
* 校验配置是否已存在
* @param cfg
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping(value = {"/checkKeywordExist"})
public boolean checkKeywordExist(ProtectionListInfo cfg, HttpServletRequest request, HttpServletResponse response){
if(!StringUtil.isEmpty(cfg.getProId())){ // 修改操作
ProtectionListInfo info = innerProtectionListService.getById(cfg.getProId());
if(info != null && info.getKeyword().equals(cfg.getKeyword()) && info.getTargetType().equals(cfg.getTargetType())){
return true;
}
}
Map<String, List<String>> map = innerProtectionListService.ajaxGetAllInfo();
List<String> list = map.get(cfg.getTargetType());
if(list != null) {
if(list.contains(cfg.getKeyword())) {
return false;
}
}
return true;
}
}