解决冲突 提交本地
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
package com.nis.web.controller.specific;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.specific.SpecificServiceHostCfg;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/specific/specificServiceHostCfg")
|
||||
public class SpecificServiceHostCfgController extends BaseController {
|
||||
|
||||
|
||||
@ModelAttribute
|
||||
public SpecificServiceHostCfg get(@RequestParam(required=false) Integer hostId) {
|
||||
if (!StringUtil.isEmpty(hostId)){
|
||||
return specificServiceHostCfgService.getDictByHostId(hostId);
|
||||
}else{
|
||||
return new SpecificServiceHostCfg();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param specificServiceHostCfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:view")
|
||||
@RequestMapping(value = "list")
|
||||
public String list(SpecificServiceHostCfg specificServiceHostCfg, HttpServletRequest request, HttpServletResponse response,
|
||||
Model model) {
|
||||
|
||||
//查出分页数据
|
||||
Page<SpecificServiceHostCfg> page = specificServiceHostCfgService.findSpecHostList(new Page<SpecificServiceHostCfg>(request, response), specificServiceHostCfg);
|
||||
model.addAttribute("page", page);
|
||||
//查出所有
|
||||
List<SpecificServiceHostCfg> list = specificServiceHostCfgService.getAll();
|
||||
List<Integer> listSpecServiceId = Lists.newArrayList();
|
||||
List<String> listSrcIp = Lists.newArrayList();
|
||||
List<String> listDstIp = Lists.newArrayList();
|
||||
for(SpecificServiceHostCfg ssh:list){
|
||||
if(ssh!=null&ssh.getSpecServiceId()!=null){
|
||||
listSpecServiceId.add(ssh.getSpecServiceId());
|
||||
}
|
||||
if(ssh!=null&ssh.getSrcIp()!=null){
|
||||
listSrcIp.add(ssh.getSrcIp());
|
||||
}
|
||||
if(ssh!=null&ssh.getDstIp()!=null){
|
||||
listDstIp.add(ssh.getDstIp());
|
||||
}
|
||||
}
|
||||
model.addAttribute("listSpecServiceId", listSpecServiceId);
|
||||
model.addAttribute("listSrcIp", listSrcIp);
|
||||
model.addAttribute("listDstIp", listDstIp);
|
||||
return "/specific/specificServiceHostCfgList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入查看、修改或新增页面
|
||||
* @param specificServiceHostCfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("sys:dict:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(SpecificServiceHostCfg specificServiceHostCfg, HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
|
||||
return "/specific/specificServiceHostCfgForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
* @param specificServiceHostCfg
|
||||
* @param model
|
||||
* @param redirectAttributes
|
||||
* @param mulitId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(SpecificServiceHostCfg specificServiceHostCfg,Model model,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
specificServiceHostCfgService.saveOrUpdate(specificServiceHostCfg);
|
||||
addMessage(redirectAttributes, "保存成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "保存失败!");
|
||||
}
|
||||
return "redirect:"+adminPath+"/specific/specificServiceHostCfgList";
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
* @param specificServiceHostCfg
|
||||
* @param redirectAttributes
|
||||
* @param mulitId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="delete")
|
||||
public String delete(SpecificServiceHostCfg specificServiceHostCfg, RedirectAttributes redirectAttributes, String mulitId){
|
||||
try{
|
||||
specificServiceHostCfgService.delete(mulitId);
|
||||
addMessage(redirectAttributes,"删除成功");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"删除失败");
|
||||
}
|
||||
|
||||
return "redirect:"+adminPath+"/specific/specificServiceHostCfg/list";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user