项目初始导入

This commit is contained in:
dell
2017-12-29 16:18:40 +08:00
commit 0788f42ae7
3221 changed files with 500217 additions and 0 deletions

View File

@@ -0,0 +1,167 @@
package com.nis.web.controller;
import java.beans.PropertyEditorSupport;
import java.io.IOException;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.util.DateUtils;
import com.nis.util.JsonMapper;
import com.nis.web.service.ArchiveServcie;
import com.nis.web.service.AreaService;
import com.nis.web.service.DictService;
import com.nis.web.service.LogService;
import com.nis.web.service.MenuService;
import com.nis.web.service.OfficeService;
import com.nis.web.service.RoleService;
import com.nis.web.service.SystemService;
import com.nis.web.service.UserService;
public class BaseController {
@Autowired
protected UserService userService;
@Autowired
protected SystemService systemService;
@Autowired
protected OfficeService officeService;
@Autowired
protected AreaService areaService;
@Autowired
protected RoleService roleService;
@Autowired
protected MenuService menuService;
@Autowired
protected LogService logService;
@Autowired
protected ArchiveServcie archiveServcie;
@Autowired
protected DictService dictService;
protected final Logger logger = Logger.getLogger(this.getClass());
/**
* 管理基础路径
*/
@Value("${adminPath}")
protected String adminPath;
/**
* 前端基础路径
*/
@Value("${frontPath}")
protected String frontPath;
/**
* 前端URL后缀
*/
@Value("${urlSuffix}")
protected String urlSuffix;
/**
* 客户端返回JSON字符串
* @param response
* @param object
* @return
*/
protected String renderString(HttpServletResponse response, Object object) {
return renderString(response, JsonMapper.toJsonString(object), "application/json");
}
/**
* 客户端返回字符串
* @param response
* @param string
* @return
*/
protected String renderString(HttpServletResponse response, String string, String type) {
try {
response.reset();
response.setContentType(type);
response.setCharacterEncoding("utf-8");
response.getWriter().print(string);
return null;
} catch (IOException e) {
return null;
}
}
/**
* 添加Model消息
* @param message
*/
protected void addMessage(Model model, String... messages) {
StringBuilder sb = new StringBuilder();
for (String message : messages){
sb.append(message).append(messages.length>1?"<br/>":"");
}
model.addAttribute("message", sb.toString());
}
/**
* 添加Flash消息
* @param message
*/
protected void addMessage(RedirectAttributes redirectAttributes, String... messages) {
StringBuilder sb = new StringBuilder();
for (String message : messages){
sb.append(message).append(messages.length>1?"<br/>":"");
}
redirectAttributes.addFlashAttribute("message", sb.toString());
}
/**
* 初始化数据绑定
* 1. 将所有传递进来的String进行HTML编码防止XSS攻击
* 2. 将字段中Date类型转换为String类型
*/
@InitBinder
protected void initBinder(WebDataBinder binder) {
// String类型转换将所有传递进来的String进行HTML编码防止XSS攻击
binder.registerCustomEditor(String.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
setValue(text == null ? null : StringEscapeUtils.escapeHtml4(text.trim()));
}
@Override
public String getAsText() {
Object value = getValue();
return value != null ? value.toString() : "";
}
});
// Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
setValue(DateUtils.parseDate(text));
}
});
}
}

View File

@@ -0,0 +1,72 @@
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.nis.web.controller;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;
import com.ckfinder.connector.configuration.Configuration;
import com.ckfinder.connector.data.AccessControlLevel;
import com.ckfinder.connector.utils.AccessControlUtil;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.StringUtils;
import com.nis.web.security.Servlets;
import com.nis.web.security.SystemAuthorizingRealm.Principal;
import com.nis.web.security.UserUtils;
/**
* CKFinder配置
* @author ThinkGem
* @version 2014-06-25
*/
public class CKFinderConfig extends Configuration {
public CKFinderConfig(ServletConfig servletConfig) {
super(servletConfig);
}
@Override
protected Configuration createConfigurationInstance() {
Principal principal = (Principal) UserUtils.getPrincipal();
if (principal == null){
return new CKFinderConfig(this.servletConf);
}
boolean isView = true;//UserUtils.getSubject().isPermitted("cms:ckfinder:view");
boolean isUpload = true;//UserUtils.getSubject().isPermitted("cms:ckfinder:upload");
boolean isEdit = true;//UserUtils.getSubject().isPermitted("cms:ckfinder:edit");
AccessControlLevel alc = this.getAccessConrolLevels().get(0);
alc.setFolderView(isView);
alc.setFolderCreate(isEdit);
alc.setFolderRename(isEdit);
alc.setFolderDelete(isEdit);
alc.setFileView(isView);
alc.setFileUpload(isUpload);
alc.setFileRename(isEdit);
alc.setFileDelete(isEdit);
// for (AccessControlLevel a : this.getAccessConrolLevels()){
// System.out.println(a.getRole()+", "+a.getResourceType()+", "+a.getFolder()
// +", "+a.isFolderView()+", "+a.isFolderCreate()+", "+a.isFolderRename()+", "+a.isFolderDelete()
// +", "+a.isFileView()+", "+a.isFileUpload()+", "+a.isFileRename()+", "+a.isFileDelete());
// }
AccessControlUtil.getInstance(this).loadACLConfig();
try {
// Principal principal = (Principal)SecurityUtils.getSubject().getPrincipal();
// this.baseURL = ServletContextFactory.getServletContext().getContextPath()+"/userfiles/"+principal+"/";
this.baseURL = FileUtils.path(Servlets.getRequest().getContextPath() + "/" + Configurations.getStringProperty("userfiles.basedir","") + Constants.USERFILES_BASE_URL + principal + "/");
this.baseDir = FileUtils.path(StringUtils.getUserfilesBaseDir() + Constants.USERFILES_BASE_URL + principal + "/");
} catch (Exception e) {
throw new RuntimeException(e);
}
return new CKFinderConfig(this.servletConf);
}
@Override
public boolean checkAuthentication(final HttpServletRequest request) {
return UserUtils.getPrincipal()!=null;
}
}

View File

@@ -0,0 +1,75 @@
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.nis.web.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ckfinder.connector.ConnectorServlet;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.StringUtils;
import com.nis.web.security.SystemAuthorizingRealm.Principal;
import com.nis.web.security.UserUtils;
/**
* CKFinderConnectorServlet
* @author ThinkGem
* @version 2014-06-25
*/
public class CKFinderConnectorServlet extends ConnectorServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
prepareGetResponse(request, response, false);
response.setContentType("text/html;charset=UTF-8");
super.doGet(request, response);
}
@Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
prepareGetResponse(request, response, true);
response.setContentType("text/html;charset=UTF-8");
super.doPost(request, response);
}
private void prepareGetResponse(final HttpServletRequest request,
final HttpServletResponse response, final boolean post) throws ServletException {
Principal principal = (Principal) UserUtils.getPrincipal();
if (principal == null){
return;
}
String command = request.getParameter("command");
String type = request.getParameter("type");
// 初始化时如果startupPath文件夹不存在则自动创建startupPath文件夹
if ("Init".equals(command)){
String startupPath = request.getParameter("startupPath");// 当前文件夹可指定为模块名
if (startupPath!=null){
String[] ss = startupPath.split(":");
if (ss.length==2){
String realPath = StringUtils.getUserfilesBaseDir() + Constants.USERFILES_BASE_URL
+ principal + "/" + ss[0] + ss[1];
FileUtils.createDirectory(FileUtils.path(realPath));
}
}
}
// 快捷上传,自动创建当前文件夹,并上传到该路径
else if ("QuickUpload".equals(command) && type!=null){
String currentFolder = request.getParameter("currentFolder");// 当前文件夹可指定为模块名
String realPath = StringUtils.getUserfilesBaseDir() + Constants.USERFILES_BASE_URL
+ principal + "/" + type + (currentFolder != null ? currentFolder : "");
FileUtils.createDirectory(FileUtils.path(realPath));
}
}
}

View File

@@ -0,0 +1,66 @@
package com.nis.web.controller;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
@Controller
public class CaptchaProducerController {
@Autowired
private Producer captchaProducer;
@RequestMapping("captcha-image")
public ModelAndView handleRequest(HttpServletRequest request,HttpServletResponse response) throws IOException{
// Set to expire far in the past.
response.setDateHeader("Expires", 0);
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
// return a jpeg
response.setContentType("image/jpeg");
// create the text for the image
String capText = captchaProducer.createText();
// store the text in the session
request.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY, capText.toUpperCase());
// create the image with the text
BufferedImage bi = captchaProducer.createImage(capText);
ServletOutputStream out = response.getOutputStream();
// write the data out
ImageIO.write(bi, "jpg", out);
try
{
out.flush();
}
finally
{
out.close();
}
return null;
}
}

View File

@@ -0,0 +1,210 @@
package com.nis.web.controller;
import java.io.UnsupportedEncodingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.UnauthorizedException;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.CookieUtil;
import com.nis.util.StringUtils;
import com.nis.web.security.IdGen;
import com.nis.web.security.SystemAuthorizingRealm.Principal;
import com.nis.web.security.UserUtils;
import com.nis.web.service.SystemService;
@Controller
public class LoginController extends BaseController {
@Autowired
private SystemService systemService;
/**
* 默认进入系统动作,即跳转登录操作
* @return
*/
@RequestMapping(value="login",method=RequestMethod.GET)
public String login(HttpServletRequest request, HttpServletResponse response, Model model){
Principal principal = UserUtils.getPrincipal();
logger.debug("login, active session size: {}"+systemService.getActiveSessions(false).size());
if (Constants.TRUE.equals(Configurations.getStringProperty("notAllowRefreshIndex", "false"))) {
try {
CookieUtil.addCookie(response, "LOGINED", "false");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
// 如果已经登录,则跳转到管理首页
if(principal != null && !principal.isMobileLogin()){
return "redirect:" + adminPath + "/index";
}
return "login";
}
/**
* 登录失败时调用的方法真正登录方法在shiro filter时实现。
* @return
*/
@RequestMapping(value="login",method=RequestMethod.POST)
public String loginFail(HttpServletRequest request, HttpServletResponse response, Model model){
Principal principal = UserUtils.getPrincipal();
// 如果已经登录,则跳转到管理首页
if(principal != null){
return "redirect:" + adminPath + "/index";
}
String username = WebUtils.getCleanParam(request, FormAuthenticationFilter.DEFAULT_USERNAME_PARAM);
boolean rememberMe = WebUtils.isTrue(request, FormAuthenticationFilter.DEFAULT_REMEMBER_ME_PARAM);
boolean mobile = WebUtils.isTrue(request, Constants.DEFAULT_MOBILE_PARAM);
String exception = (String)request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
String message = (String)request.getAttribute(Constants.DEFAULT_MESSAGE_PARAM);
if (StringUtils.isBlank(message) || StringUtils.equals(message, "null")){
message = "用户或密码错误, 请重试!";
}
model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, username);
model.addAttribute(FormAuthenticationFilter.DEFAULT_REMEMBER_ME_PARAM, rememberMe);
model.addAttribute(Constants.DEFAULT_MOBILE_PARAM, mobile);
model.addAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME, exception);
model.addAttribute(Constants.DEFAULT_MESSAGE_PARAM, message);
if (logger.isDebugEnabled()){
logger.debug("login fail, active session size: "+systemService.getActiveSessions(false).size()+", message: "+message+", exception: "+exception);
}
// 非授权异常登录失败验证码加1。
if (!UnauthorizedException.class.getName().equals(exception)){
model.addAttribute("isValidateCodeLogin", UserUtils.isValidateCodeLogin(username, true, false));
}
// 验证失败清空验证码
request.getSession().setAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY, IdGen.uuid());
// 如果是手机登录则返回JSON字符串
if (mobile){
return renderString(response, model);
}
return "login";
}
@RequiresPermissions("user")
@RequestMapping("/nis/index")
public String index(HttpServletRequest request, HttpServletResponse response,ModelMap model){
Principal principal = UserUtils.getPrincipal();
// 登录成功后,验证码计算器清零
UserUtils.isValidateCodeLogin(principal.getLoginName(), false, true);
if (logger.isDebugEnabled()){
logger.debug("show index, active session size: {}"+ systemService.getActiveSessions(false).size());
}
// 如果已登录,再次访问主页,则退出原账号。
if (Constants.TRUE.equals(Configurations.getStringProperty("notAllowRefreshIndex","false"))){
String logined;
try {
logined = CookieUtil.getValue(request, "LOGINED");
if (StringUtils.isBlank(logined) || "false".equals(logined)){
CookieUtil.addCookie(response, "LOGINED", "true");
}else if (StringUtils.equals(logined, "true")){
UserUtils.getSubject().logout();
return "redirect:" + "/login";
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
// 如果是手机登录则返回JSON字符串
if (principal.isMobileLogin()){
if (request.getParameter("login") != null){
return renderString(response, principal);
}
if (request.getParameter("index") != null){
return "home";
}
return "redirect:" + "/login";
}
model.addAttribute("adminPath", adminPath);
return "/home";
}
/**
* 获取主题方案
*/
@RequestMapping(value = "/theme/{theme}")
public String getThemeInCookie(@PathVariable String theme, HttpServletRequest request, HttpServletResponse response){
try {
if (StringUtils.isNotBlank(theme)){
CookieUtil.addCookie(response, "theme", theme);
}else{
theme = CookieUtil.getValue(request, "theme");
}
} catch (Exception e) {
e.printStackTrace();
}
return "redirect:"+request.getParameter("url");
}
/**
* 修改权限组
*/
@RequestMapping(value = "/permission/{roleId}")
public String switchPermissionGroup(@PathVariable String roleId, HttpServletRequest request, HttpServletResponse response){
try {
if (StringUtils.isNotBlank(roleId)){
System.out.println("*****************");
}
} catch (Exception e) {
e.printStackTrace();
}
return "redirect:"+request.getParameter("url");
}
@RequestMapping(value="/validateCode")
public void validateCode(HttpServletRequest request, HttpServletResponse response,String captcha) {
renderString(response, UserUtils.validateCodeIsValid(captcha));
}
}

View File

@@ -0,0 +1,20 @@
package com.nis.web.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
@RequestMapping("${adminPath}/sys/")
public class SystemController extends BaseController{
@RequestMapping("index")
public String index(HttpServletRequest request, HttpServletResponse response,ModelMap model){
return "/sys/sysIndex";
}
}

View File

@@ -0,0 +1,41 @@
package com.nis.web.controller;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("${adminPath}/tag")
public class TagController extends BaseController {
/**
* 树结构选择标签treeselect.tag
*/
@RequiresPermissions("user")
@RequestMapping(value = "treeselect")
public String treeselect(HttpServletRequest request, Model model) {
model.addAttribute("url", request.getParameter("url")); // 树结构数据URL
model.addAttribute("extId", request.getParameter("extId")); // 排除的编号ID
model.addAttribute("checked", request.getParameter("checked")); // 是否可复选
model.addAttribute("selectIds", request.getParameter("selectIds")); // 指定默认选中的ID
model.addAttribute("isAll", request.getParameter("isAll")); // 是否读取全部数据,不进行权限过滤
model.addAttribute("module", request.getParameter("module")); // 过滤栏目模型仅针对CMS的Category树
return "/sys/tagTreeselect";
}
/**
* 图标选择标签iconselect.tag
*/
@RequiresPermissions("user")
@RequestMapping(value = "iconselect")
public String iconselect(HttpServletRequest request, Model model) {
model.addAttribute("value", request.getParameter("value"));
return "/sys/tagIconselect";
}
}

View File

@@ -0,0 +1,115 @@
package com.nis.web.controller.sys;
import java.util.List;
import java.util.Map;
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.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.SysArea;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/sys/area")
public class AreaController extends BaseController {
@ModelAttribute
public SysArea get(@RequestParam(required=false) Long id) {
if (!StringUtil.isEmpty(id)){
return areaService.get(id);
}else{
return new SysArea();
}
}
@RequiresPermissions("sys:area:view")
@RequestMapping("index")
public String index(SysArea area, Model model) {
return "/sys/areaIndex";
}
@RequiresPermissions("sys:area:view")
@RequestMapping(value = {"list"})
public String list(SysArea sysArea, Model model) {
model.addAttribute("list", areaService.findAllAreaList(sysArea));
return "/sys/areaList";
}
@RequiresPermissions("sys:area:view")
@RequestMapping(value = "form")
public String form(SysArea area, Model model) {
if (!StringUtil.isEmpty(area.getParent().getId())) {
area.setParent(areaService.get(area.getParent().getId()));
}
model.addAttribute("area", area);
return "/sys/areaForm";
}
@RequiresPermissions("sys:area:edit")
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(SysArea sysArea, Model model, RedirectAttributes redirectAttributes) {
areaService.saveOrUpdate(sysArea);
addMessage(redirectAttributes, "保存区域'" + sysArea.getName() + "'成功");
String id = sysArea.getParentId().equals(0l) ? "" : String.valueOf(sysArea.getParentId());
return "redirect:" + adminPath + "/sys/area/list?id="+id+"&parentIds="+sysArea.getParent().getParentIds();
}
@RequiresPermissions("sys:area:edit")
@RequestMapping(value = "delete")
public String delete(SysArea area, RedirectAttributes redirectAttributes) {
areaService.delete(area);
addMessage(redirectAttributes, "删除区域成功");
return "redirect:" + adminPath + "/sys/area/list?id="+area.getParentId()+"&parentIds="+area.getParent().getParentIds();
}
@RequiresPermissions("user")
@ResponseBody
@RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId, HttpServletResponse response) {
List<Map<String, Object>> mapList = Lists.newArrayList();
List<SysArea> list = areaService.findAll();
for (int i=0; i<list.size(); i++){
SysArea e = list.get(i);
if (StringUtils.isBlank(extId) || (extId!=null && !extId.equals(e.getId()) && e.getParentIds().indexOf(","+extId+",")==-1)){
Map<String, Object> map = Maps.newHashMap();
map.put("id", e.getId());
map.put("pId", e.getParentId());
map.put("pIds", e.getParentIds());
map.put("name", e.getName());
mapList.add(map);
}
}
return mapList;
}
}

View File

@@ -0,0 +1,101 @@
package com.nis.web.controller.sys;
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.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.SysDataDictionaryName;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping(value = "${adminPath}/sys/dict")
public class DictController extends BaseController {
@ModelAttribute
public SysDataDictionaryName get(@RequestParam(required=false) Integer id) {
if (!StringUtil.isEmpty(id)){
return dictService.getDictByIdWithRelation(id);
}else{
return new SysDataDictionaryName();
}
}
@RequiresPermissions("sys:dict:view")
@RequestMapping(value = {"list", ""})
public String list(SysDataDictionaryName sysDictName,HttpServletRequest request, HttpServletResponse response, Model model) {
Page<SysDataDictionaryName> page = dictService.findDictList(new Page<SysDataDictionaryName>(request, response), sysDictName);
model.addAttribute("page", page);
return "/sys/dictList";
}
/**
* 进入字典添加或修改页面
* @param sysDictName
* @param model
* @return
*/
@RequestMapping(value={"form"})
public String form(SysDataDictionaryName sysDictName, Model model) {
return "/sys/dictForm";
}
@RequiresPermissions("sys:dict:edit")
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(SysDataDictionaryName sysDictName,Model model, RedirectAttributes redirectAttributes) {
try {
dictService.saveOrUpdate(sysDictName);
addMessage(redirectAttributes, "保存字典成功");
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes, "保存字典失败!");
}
return "redirect:" + adminPath + "/sys/dict/list";
}
@RequiresPermissions("sys:dict:edit")
@RequestMapping(value = "delete")
public String delete(Integer id,Model model, RedirectAttributes redirectAttributes) {
try {
dictService.deleteDict(id);
addMessage(redirectAttributes, "删除字典成功");
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes, "删除字典失败!");
}
return "redirect:" + adminPath + "/sys/dict/list";
}
@ResponseBody
@RequestMapping(value = "loadDataDict")
public SysDataDictionaryName loadDataDict(@RequestParam(required=false) Integer id,HttpServletRequest request, HttpServletResponse response, Model model){
return dictService.getDictByIdWithRelation(id);
}
}

View File

@@ -0,0 +1,42 @@
package com.nis.web.controller.sys;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.nis.domain.SrcIp;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/sys/ipLocation")
public class IpLocationController extends BaseController{
/**
* 进入首页IP定位
* @param office
* @param model
* @return
*/
@RequestMapping("index")
public String index(Model model) {
return "/sys/ipLocation";
}
/**
* 检索获取当前位置信息
* @param srcIp
* @param model
* @return
*/
@RequestMapping("search")
public String search(SrcIp srcIp, Model model) {
systemService.ipLookUp(srcIp.getSearchIp()).get(0);
return "/sys/iplocationResult";
}
}

View File

@@ -0,0 +1,143 @@
package com.nis.web.controller.sys;
import java.util.List;
import java.util.Map;
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.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.SysMenu;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/sys/menu")
public class MenuController extends BaseController {
@ModelAttribute("sysMenu")
public SysMenu get(@RequestParam(required=false) Long id) {
if (!StringUtil.isEmpty(id)){
return menuService.getMenu(id);
}else{
return new SysMenu();
}
}
@RequiresPermissions("sys:menu:view")
@RequestMapping(value = {"list", ""})
public String list(Model model) {
List<SysMenu> list = Lists.newArrayList();
List<SysMenu> sourcelist = menuService.findAllMenu();
SysMenu.sortList(list, sourcelist, SysMenu.getRootId(), true);
model.addAttribute("list", list);
return "/sys/menuList";
}
@RequiresPermissions("sys:menu:view")
@RequestMapping(value = "form")
public String form(SysMenu menu, Model model) {
if (menu.getParent() == null || menu.getParent().getId() == null) {
menu.setParent(new SysMenu(SysMenu.getRootId()));
}
menu.setParent(menuService.getMenu(menu.getParent().getId()));
// 获取排序号,最末节点排序号+30
if (StringUtil.isEmpty(menu.getId())) {
List<SysMenu> list = Lists.newArrayList();
List<SysMenu> sourcelist = menuService.findAllMenu();
SysMenu.sortList(list, sourcelist, menu.getParentId(), false);
if (list.size() > 0){
menu.setSort(list.get(list.size()-1).getSort() + 30);
}
}
model.addAttribute("menu", menu);
return "/sys/menuForm";
}
@RequiresPermissions("sys:menu:edit")
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(SysMenu menu, Model model, RedirectAttributes redirectAttributes) {
if(!UserUtils.getUser().isAdmin()){
addMessage(redirectAttributes, "越权操作,只有超级管理员才能添加或修改数据!");
return "redirect:" + adminPath + "/sys/role/?repage";
}
menuService.saveOrUpdateMenu(menu);
addMessage(redirectAttributes, "保存菜单'" + menu.getName() + "'成功");
return "redirect:" + adminPath + "/sys/menu/";
}
@RequiresPermissions("sys:menu:edit")
@RequestMapping(value = "delete")
public String delete(SysMenu menu, RedirectAttributes redirectAttributes) {
// if (Menu.isRoot(id)){
// addMessage(redirectAttributes, "删除菜单失败, 不允许删除顶级菜单或编号为空");
// }else{
menuService.deleteMenu(menu);
addMessage(redirectAttributes, "删除菜单成功");
// }
return "redirect:" + adminPath + "/sys/menu/";
}
/**
* 批量修改菜单排序
*/
@RequiresPermissions("sys:menu:edit")
@RequestMapping(value = "updateSort")
public String updateSort(Long[] ids, Integer[] sorts, RedirectAttributes redirectAttributes) {
for (int i = 0; i < ids.length; i++) {
SysMenu menu = new SysMenu(ids[i]);
menu.setSort(sorts[i]);
menuService.updateMenuSort(menu);
}
addMessage(redirectAttributes, "保存菜单排序成功!");
return "redirect:" + adminPath + "/sys/menu/";
}
/**
* isShowHide是否显示隐藏菜单
* @param extId
* @param isShowHidden
* @param response
* @return
*/
@RequiresPermissions("user")
@ResponseBody
@RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide, HttpServletResponse response) {
List<Map<String, Object>> mapList = Lists.newArrayList();
List<SysMenu> list = menuService.findAllMenu();
for (int i=0; i<list.size(); i++){
SysMenu menu = list.get(i);
if (StringUtils.isBlank(extId) || (extId !=null && !extId.equals(menu.getId()) && menu.getParentIds().indexOf(","+extId+",") == -1)) {
if(isShowHide != null && isShowHide.equals("0") && menu.getIsShow().equals(0)){
continue;
}
Map<String, Object> map = Maps.newHashMap();
map.put("id", menu.getId());
map.put("pId", menu.getParentId());
map.put("name",menu.getName());
mapList.add(map);
}
}
return mapList;
}
}

View File

@@ -0,0 +1,163 @@
package com.nis.web.controller.sys;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import java.util.Map;
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.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.SysOffice;
import com.nis.domain.SysUser;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/sys/office")
public class OfficeController extends BaseController {
@ModelAttribute
public SysOffice get(@RequestParam(required=false) Long id) {
if (!StringUtil.isEmpty(id)){
return officeService.get(id);
}else{
return new SysOffice();
}
}
/**
* 进入机构首页
* @param office
* @param model
* @return
*/
@RequiresPermissions("sys:office:view")
@RequestMapping("")
public String index(SysOffice office,Model model) {
return "/sys/officeIndex";
}
@RequiresPermissions("sys:office:view")
@RequestMapping("list")
public String list(SysOffice sysOffice, Model model) {
model.addAttribute("list", officeService.findAllOfficeList(sysOffice));
return "/sys/officeList";
}
@RequiresPermissions("sys:office:view")
@RequestMapping(value = "form")
public String form(SysOffice office, Model model) {
SysUser user = UserUtils.getUser();
if (office.getParent() == null || office.getParent().getId() == null){
office.setParent(user.getOffice());
} else {
office.setParent(officeService.get(office.getParent().getId()));
}
if (office.getArea() == null) {
office.setArea(user.getOffice().getArea());
}
// 自动获取排序号
if (StringUtil.isEmpty(office.getId()) && office.getParent() != null) {
int size = 0;
List<SysOffice> list = officeService.findAll();
for (int i=0; i<list.size(); i++){
SysOffice e = list.get(i);
if (e.getParent() != null && e.getParent().getId() !=null
&& e.getParent().getId().equals(office.getParent().getId())){
size++;
}
}
office.setCode(office.getParent().getCode() + StringUtils.leftPad(String.valueOf(size > 0 ? size+1 : 1), 3, "0"));
}
model.addAttribute("office", office);
return "/sys/officeForm";
}
@RequiresPermissions("sys:office:edit")
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(SysOffice office, Model model, RedirectAttributes redirectAttributes) {
officeService.saveOrUpdate(office);
addMessage(redirectAttributes, "保存机构'" + office.getName() + "'成功");
String id = office.getParentId().equals(0l) ? "" : String.valueOf(office.getParentId());
return "redirect:" + adminPath + "/sys/office/list?id="+id+"&parentIds="+office.getParentIds();
}
@RequiresPermissions("sys:office:edit")
@RequestMapping(value = "delete")
public String delete(SysOffice office, RedirectAttributes redirectAttributes) {
// if (Office.isRoot(id)){
// addMessage(redirectAttributes, "删除机构失败, 不允许删除顶级机构或编号空");
// }else{
officeService.delete(office);
addMessage(redirectAttributes, "删除机构成功");
// }
String id = office.getParentId().equals(0l) ? "" : String.valueOf(office.getParentId());
return "redirect:" + adminPath + "/sys/office/list?id="+id+"&parentIds="+office.getParentIds();
}
/**
* 获取机构JSON数据。
* @param extId 排除的ID
* @param type 类型1公司2 单位3部门4信访办5其它6携带用户
* @param grade 显示级别
* @param response
* @return
*/
@RequiresPermissions("user")
@ResponseBody
@RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId, @RequestParam(required=false) String type,
@RequestParam(required=false) Long grade, @RequestParam(required=false) Boolean isAll, HttpServletResponse response) {
List<Map<String, Object>> mapList = Lists.newArrayList();
List<SysOffice> list = officeService.findList(isAll);
for (int i=0; i<list.size(); i++){
SysOffice e = list.get(i);
if ((StringUtils.isBlank(extId) || (extId != null && !extId.equals(e.getId()) && e.getParentIds().indexOf(","+extId+",") == -1))
&& (type == null || (type != null && e.getType() <= Integer.valueOf(type)))
&& (grade == null || (grade != null && e.getGrade() <= grade.intValue()))){
Map<String, Object> map = Maps.newHashMap();
map.put("id", e.getId());
map.put("pId", e.getParentId());
map.put("pIds", e.getParentIds());
map.put("name", e.getName());
if (type != null && "6".equals(type)){
map.put("isParent", true);
}
mapList.add(map);
}
}
return mapList;
}
}

View File

@@ -0,0 +1,212 @@
package com.nis.web.controller.sys;
import java.util.List;
import java.util.Map;
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.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
import com.nis.util.Collections3;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping(value = "${adminPath}/sys/role")
public class RoleController extends BaseController {
@ModelAttribute("sysRole")
public SysRole get(@RequestParam(required=false) Long id) {
if (!StringUtil.isEmpty(id)){
return roleService.getRole(id);
}else{
return new SysRole();
}
}
@RequiresPermissions("sys:role:view")
@RequestMapping(value = {"list", ""})
public String list(SysRole role, Model model) {
List<SysRole> list = roleService.findAllRole();
model.addAttribute("list", list);
return "/sys/roleList";
}
@RequiresPermissions("sys:role:view")
@RequestMapping(value = "form")
public String form(SysRole role, Model model) {
model.addAttribute("role", role);
model.addAttribute("menuList", menuService.findAllMenu());
return "/sys/roleForm";
}
/**
* 角色分配页面
* @param role
* @param model
* @return
*/
@RequiresPermissions("sys:role:edit")
@RequestMapping(value = "assign")
public String assign(SysRole role, Model model) {
List<SysUser> userList = userService.findUserByRoleId(role.getId());
model.addAttribute("userList", userList);
return "/sys/roleAssign";
}
/**
* 角色分配 -- 打开角色分配对话框
* @param role
* @param model
* @return
*/
@RequiresPermissions("sys:role:view")
@RequestMapping(value = "usertorole")
public String selectUserToRole(SysRole role, Model model) {
List<SysUser> userList = userService.findUserByRoleId(role.getId());
model.addAttribute("role", role);
model.addAttribute("userList", userList);
model.addAttribute("selectIds", Collections3.extractToString(userList, "id", ","));
model.addAttribute("officeList", officeService.findAll());
return "/sys/selectUserToRole";
}
/**
* 角色分配 -- 根据部门编号获取用户列表
* @param officeId
* @param response
* @return
*/
@RequiresPermissions("sys:role:view")
@ResponseBody
@RequestMapping(value = "users")
public List<Map<String, Object>> users(Long officeId, HttpServletResponse response) {
List<Map<String, Object>> mapList = Lists.newArrayList();
List<SysUser> userList = userService.findUserByOfficeId(officeId);
for (SysUser e : userList) {
Map<String, Object> map = Maps.newHashMap();
map.put("id", e.getId());
map.put("pId", 0);
map.put("name", e.getName());
mapList.add(map);
}
return mapList;
}
/**
* 角色分配
* @param role
* @param idsArr
* @param redirectAttributes
* @return
*/
@RequiresPermissions("sys:role:edit")
@RequestMapping(value = "assignrole")
public String assignRole(SysRole role, String[] idsArr, RedirectAttributes redirectAttributes) {
StringBuilder msg = new StringBuilder();
int newNum = 0;
for (int i = 0; i < idsArr.length; i++) {
SysUser user = systemService.assignUserToRole(role, userService.getUser(idsArr[i]));
if (null != user) {
msg.append("<br/>新增用户【" + user.getName() + "】到角色【" + role.getName() + "】!");
newNum++;
}
}
addMessage(redirectAttributes, "已成功分配 "+newNum+" 个用户"+msg);
return "redirect:" + adminPath + "/sys/role/assign?id="+role.getId();
}
@RequiresPermissions("sys:role:edit")
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(SysRole role, Model model, RedirectAttributes redirectAttributes) {
if (!"true".equals(checkName(role.getOldName(), role.getName()))){
addMessage(model, "保存角色'" + role.getName() + "'失败, 角色名已存在");
return form(role, model);
}
roleService.saveOrUpdate(role);
addMessage(redirectAttributes, "保存角色'" + role.getName() + "'成功");
return "redirect:" + adminPath + "/sys/role/?repage";
}
@RequiresPermissions("sys:role:edit")
@RequestMapping(value = "delete")
public String delete(SysRole role, RedirectAttributes redirectAttributes) {
roleService.deleteRole(role);
addMessage(redirectAttributes, "删除角色成功");
return "redirect:" + adminPath + "/sys/role/?repage";
}
/**
* 验证角色名是否有效
* @param oldName
* @param name
* @return
*/
@RequiresPermissions("user")
@ResponseBody
@RequestMapping(value = "checkName")
public String checkName(String oldName, String name) {
if (name!=null && name.equals(oldName)) {
return "true";
} else if (name!=null && roleService.getRoleByName(name) == null) {
return "true";
}
return "false";
}
/**
* 角色分配 -- 从角色中移除用户
* @param userId
* @param roleId
* @param redirectAttributes
* @return
*/
@RequiresPermissions("sys:role:edit")
@RequestMapping(value = "outrole")
public String outrole(Long userId, Long roleId, RedirectAttributes redirectAttributes) {
SysRole role = roleService.getRole(roleId);
SysUser user = userService.getUser(userId.toString());
if (UserUtils.getUser().getId().equals(userId)) {
addMessage(redirectAttributes, "无法从角色【" + role.getName() + "】中移除用户【" + user.getName() + "】自己!");
}else {
if (user.getUserRoleList().size() <= 1){
addMessage(redirectAttributes, "用户【" + user.getName() + "】从角色【" + role.getName() + "】中移除失败!这已经是该用户的唯一角色,不能移除。");
}else{
Boolean flag = systemService.outUserInRole(role, user);
if (!flag) {
addMessage(redirectAttributes, "用户【" + user.getName() + "】从角色【" + role.getName() + "】中移除失败!");
}else {
addMessage(redirectAttributes, "用户【" + user.getName() + "】从角色【" + role.getName() + "】中移除成功!");
}
}
}
return "redirect:" + adminPath + "/sys/role/assign?id="+role.getId();
}
}

View File

@@ -0,0 +1,27 @@
package com.nis.web.controller.sys;
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.RequestMapping;
import com.nis.domain.Page;
import com.nis.domain.SysLog;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/sys/log")
public class SysLogController extends BaseController {
@RequiresPermissions("sys:log:view")
@RequestMapping(value = {"list", ""})
public String list(SysLog sysLog, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<SysLog> page = logService.findPage(new Page<SysLog>(request, response), sysLog);
model.addAttribute("page", page);
return "/sys/logList";
}
}

View File

@@ -0,0 +1,289 @@
package com.nis.web.controller.sys;
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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
import com.nis.util.DateUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.util.excel.ExportExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/sys/user")
public class UserController extends BaseController{
@ModelAttribute
public SysUser get(@RequestParam(required=false) Long id) {
if (!StringUtil.isEmpty(id)){
return userService.getUserByIdWithRelation(id);
}else{
return new SysUser();
}
}
@RequiresPermissions("sys:user:view")
@RequestMapping(value = {"index"})
public String index(SysUser user, Model model) {
return "/sys/userIndex";
}
/**
* 进入用户添加或修改页面
* @param user
* @param model
* @return
*/
@RequestMapping(value={"form"})
public String form(SysUser user, Model model) {
if (user.getCompany()==null || user.getCompany().getId()==null){
user.setCompany(UserUtils.getUser().getCompany());
}
if (user.getEntity() == null || user.getEntity().getId() == null) {
user.setEntity(UserUtils.getUser().getEntity());
} else {
user.setEntity(user.getEntity());
}
if (user.getOffice() == null || user.getOffice().getId() == null) {
user.setOffice(UserUtils.getUser().getOffice());
} else {
user.setOffice(user.getOffice());
}
model.addAttribute("user", user);
model.addAttribute("allRoles", roleService.findAllRole());
return "/sys/userForm";
}
@RequiresPermissions("sys:user:edit")
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(SysUser user, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
// 如果新密码为空,则不更换密码
if (StringUtils.isNotBlank(user.getNewPassword())) {
user.setPassword(StringUtils.entryptPassword(user.getNewPassword()));
}
/*if (!beanValidator(model, user)){
return form(user, model);
}*/
if (!"true".equals(checkLoginName(user.getOldLoginId(), user.getLoginId()))){
addMessage(model, "保存用户'" + user.getLoginId() + "'失败,登录名已存在");
return form(user, model);
}
// 角色数据有效性验证,过滤不在授权内的角色
List<SysRole> roleList = Lists.newArrayList();
List<Long> roleIdList = user.getRoleIdList();
for (SysRole r : roleService.findAllRole()) {
if (roleIdList.contains(r.getId())){
roleList.add(r);
}
}
user.setUserRoleList(roleList);
// 保存用户信息
userService.saveOrUpdate(user);
// 清除当前用户缓存
if (user.getLoginId().equals(UserUtils.getUser().getLoginId())){
UserUtils.clearCache();
}
addMessage(redirectAttributes, "保存用户'" + user.getLoginId() + "'成功");
return "redirect:" + adminPath + "/sys/user/list?repage";
}
@RequiresPermissions("sys:user:edit")
@RequestMapping(value = "delete")
public String delete(SysUser user, RedirectAttributes redirectAttributes) {
if (UserUtils.getUser().getId().equals(user.getId())){
addMessage(redirectAttributes, "删除用户失败, 不允许删除当前用户");
}else if (user.isAdmin()){
addMessage(redirectAttributes, "删除用户失败, 不允许删除超级管理员用户");
}else{
userService.deleteUser(user);
addMessage(redirectAttributes, "删除用户成功");
}
return "redirect:" + adminPath + "/sys/user/list?repage";
}
/**
* 验证登录名是否有效
* @param oldLoginName
* @param loginName
* @return
*/
@ResponseBody
@RequiresPermissions("sys:user:edit")
@RequestMapping(value = "checkLoginName")
public String checkLoginName(String oldLoginId, String loginId) {
if (loginId !=null && loginId.equals(oldLoginId)) {
return "true";
} else if (loginId !=null && systemService.getUserByLoginName(loginId) == null) {
return "true";
}
return "false";
}
@ResponseBody
@RequiresPermissions("sys:user:edit")
@RequestMapping(value = "checkOffice")
public String checkOffice(Long officeId, Long companyId) {
boolean isValid = !StringUtil.isEmpty(officeId) && !StringUtil.isEmpty(companyId);
if (isValid) {
isValid = systemService.officeIsValid(officeId, companyId);
}
return String.valueOf(isValid);
}
@RequiresPermissions("sys:user:view")
@RequestMapping(value = {"list"})
public String list(SysUser user, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<SysUser> page = userService.findUser(new Page<SysUser>(request, response), user);
model.addAttribute("page", page);
return "/sys/userList";
}
/**
* 导出用户数据
* @param user
* @param request
* @param response
* @param redirectAttributes
* @return
*/
@RequiresPermissions("sys:user:view")
@RequestMapping(value = "export", method=RequestMethod.POST)
public String exportFile(SysUser user, HttpServletRequest request, HttpServletResponse response,
RedirectAttributes redirectAttributes) {
try {
String fileName = "用户数据-"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
Page<SysUser> page = userService.findUser(new Page<SysUser>(request, response, -1), user);
new ExportExcel("用户数据", SysUser.class).setDataList(page.getList()).write(response, fileName).dispose();
return null;
} catch (Exception e) {
addMessage(redirectAttributes, "导出用户失败!失败信息:"+e.getMessage());
}
return "redirect:" + adminPath + "/sys/user/list?repage";
}
@RequiresPermissions("user")
@ResponseBody
@RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) Long officeId, HttpServletResponse response) {
List<Map<String, Object>> mapList = Lists.newArrayList();
List<SysUser> list = userService.findUserByOfficeId(officeId);
for (int i=0; i<list.size() ; i++){
SysUser e = list.get(i);
Map<String, Object> map = Maps.newHashMap();
map.put("id", "u_"+e.getId());
map.put("pId", officeId);
map.put("name", StringUtils.replace(e.getName(), " ", ""));
mapList.add(map);
}
return mapList;
}
/**
* 用户信息显示及保存
* @param user
* @param model
* @return
*/
@RequiresPermissions("user")
@RequestMapping(value = "info")
public String info(SysUser user, HttpServletResponse response, Model model) {
SysUser currentUser = UserUtils.getUser();
if (StringUtils.isNotBlank(user.getName())){
currentUser.setEmail(user.getEmail());
currentUser.setPhoto(user.getPhoto());
userService.updateUserInfo(currentUser);
model.addAttribute("message", "保存用户信息成功");
}
model.addAttribute("user", currentUser);
return "/sys/userInfo";
}
/**
* 返回用户信息
* @return
*/
@RequiresPermissions("user")
@ResponseBody
@RequestMapping(value = "infoData")
public SysUser infoData() {
return UserUtils.getUser();
}
/**
* 修改个人用户密码
* @param oldPassword
* @param newPassword
* @param model
* @return
*/
@RequiresPermissions("user")
@RequestMapping(value = "modifyPwd")
public String modifyPwd(String oldPassword, String newPassword, Model model) {
SysUser user = UserUtils.getUser();
if (StringUtils.isNotBlank(oldPassword) && StringUtils.isNotBlank(newPassword)){
if (StringUtils.validatePassword(oldPassword, user.getPassword())){
userService.updatePasswordById(user.getId(), user.getLoginId(), newPassword);
model.addAttribute("message", "修改密码成功");
}else{
model.addAttribute("message", "修改密码失败,旧密码错误");
}
}
model.addAttribute("user", user);
return "/sys/userModifyPwd";
}
}

View File

@@ -0,0 +1,338 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.ConfigCompileDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.ConfigCompileTest">
<id column="COMPILE_ID" jdbcType="BIGINT" property="compileId" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
<result column="ACTION" jdbcType="INTEGER" property="action" />
<result column="CONT_TYPE" jdbcType="INTEGER" property="contType" />
<result column="ATTR_TYPE" jdbcType="INTEGER" property="attrType" />
<result column="CONT_LABEL" jdbcType="VARCHAR" property="contLabel" />
<result column="Task_id" jdbcType="INTEGER" property="taskId" />
<result column="Guarantee_ID" jdbcType="INTEGER" property="guaranteeId" />
<result column="AFFAIR_ID" jdbcType="INTEGER" property="affAirId" />
<result column="TOPIC_ID" jdbcType="INTEGER" property="topIcId" />
<result column="DO_BLACKLIST" jdbcType="BIGINT" property="doBlackList" />
<result column="DO_LOG" jdbcType="INTEGER" property="doLog" />
<result column="EFFECTIVE_RANGE" jdbcType="VARCHAR" property="effectiveRange" />
<result column="ACTIVE_SYS" jdbcType="INTEGER" property="activeSys" />
<result column="CONFIG_PERCENT" jdbcType="DOUBLE" property="configPercent" />
<result column="CONFIG_OPTION" jdbcType="DOUBLE" property="configOption" />
<result column="START_TIME" jdbcType="TIMESTAMP" property="startTime" />
<result column="END_TIME" jdbcType="TIMESTAMP" property="endTime" />
<result column="USER_REGION" jdbcType="VARCHAR" property="userRegion" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="GROUP_NUM" jdbcType="INTEGER" property="groupNum" />
<result column="FATHER_CFG_ID" jdbcType="BIGINT" property="fatherCfgId" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="LAST_UPDATE" jdbcType="TIMESTAMP" property="lastUpdate" />
<result column="PROC_SEQ" jdbcType="BIGINT" property="procSeq" />
</resultMap>
<sql id="configCompileSql">
COMPILE_ID,SERVICE,ACTION,CONT_TYPE,ATTR_TYPE,CONT_LABEL,Task_id,Guarantee_ID,
AFFAIR_ID,TOPIC_ID,DO_BLACKLIST,DO_LOG,EFFECTIVE_RANGE,ACTIVE_SYS,
CONFIG_PERCENT,CONFIG_OPTION,START_TIME,END_TIME,USER_REGION,
IS_VALID,GROUP_NUM,FATHER_CFG_ID,OP_TIME,LAST_UPDATE,PROC_SEQ
</sql>
<select id="queryConfigCompileById" parameterType="java.lang.Long"
resultMap="BaseResultMap">
select
<include refid="configCompileSql" />
from CONFIG_COMPILE where COMPILE_ID = #{compileId ,jdbcType=BIGINT }
</select>
<select id="queryConfigCompileByIdArr" parameterType="java.lang.String"
resultMap="BaseResultMap">
select
<include refid="configCompileSql" />
from CONFIG_COMPILE where COMPILE_ID in (${compileIdArr})
</select>
<select id="queryAllCompile" resultMap="BaseResultMap"
parameterType="com.nis.domain.restful.ConfigCompileTest">
select
<include refid="configCompileSql" />
from CONFIG_COMPILE
<where>
<if test="searchEndTime != null and searchEndTime!=''">
<![CDATA[AND OP_TIME < to_date(#{searchEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStartTime != null and searchStartTime!=''">
<![CDATA[AND OP_TIME >= to_date(#{searchStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="service != null">
AND SERVICE = #{service}
</if>
<if test="compileId != null ">
AND COMPILE_ID = #{compileId}
</if>
</where>
order by OP_TIME
</select>
<select id="getCompileSeq" resultType="java.lang.Long">
select
SEQ_COMPILEID.NEXTVAL from dual;
</select>
<select id="getGroupSeq" resultType="java.lang.Long">
select SEQ_GROUPID.NEXTVAL
from dual;
</select>
<select id="getRegionSeq" resultType="java.lang.Long">
select SEQ_REGIONID.NEXTVAL
from dual;
</select>
<insert id="saveCompileBatch" parameterType="java.util.List">
<!-- insert /*+append*/ into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION
, -->
insert into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION ,
CONT_TYPE,
ATTR_TYPE,
CONT_LABEL,
Task_id,
Guarantee_ID,
AFFAIR_ID,
TOPIC_ID,
DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE ,
ACTIVE_SYS,
CONFIG_PERCENT
,CONFIG_OPTION
,START_TIME ,END_TIME ,
USER_REGION,
IS_VALID,GROUP_NUM,FATHER_CFG_ID
,OP_TIME,LAST_UPDATE
<!-- ,PROC_SEQ -->
)
<foreach collection="list" item="item" index="index" open="("
close=")" separator="union">
select
#{item.compileId,jdbcType=BIGINT},
#{item.service,jdbcType=BIGINT},
#{item.action,jdbcType=INTEGER},
#{item.contType,jdbcType=INTEGER},
#{item.attrType,jdbcType=INTEGER},
#{item.contLabel,jdbcType=INTEGER},
#{item.taskId,jdbcType=INTEGER},
#{item.guaranteeId,jdbcType=INTEGER},
#{item.affAirId,jdbcType=INTEGER},
#{item.topIcId,jdbcType=INTEGER},
#{item.doBlackList,jdbcType=BIGINT},
#{item.doLog,jdbcType=INTEGER},
#{item.effectiveRange,jdbcType=VARCHAR},
#{item.activeSys,jdbcType=INTEGER},
#{item.configPercent,jdbcType=DOUBLE},
#{item.configOption,jdbcType=DOUBLE},
#{item.startTime,jdbcType=TIMESTAMP},
#{item.endTime,jdbcType=TIMESTAMP},
#{item.userRegion,jdbcType=VARCHAR},
#{item.isValid,jdbcType=INTEGER},
#{item.groupNum,jdbcType=INTEGER },
#{item.fatherCfgId,jdbcType=BIGINT},
#{item.opTime,jdbcType=TIMESTAMP},
sysdate
<!-- ,#{item.procSeq,jdbcType=BIGINT} -->
from dual
</foreach>
</insert>
<insert id="saveConfigCompile" parameterType="com.nis.domain.restful.ConfigCompile">
<!-- <selectKey keyProperty="compileId" resultType="java.lang.Long" -->
<!-- order="BEFORE"> 取消使用序列,界面会将id传过来 -->
<!-- select seq_compileId.nextval from dual -->
<!-- </selectKey> -->
insert into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION ,
<if test="contType !=null">
CONT_TYPE,
</if>
<if test="attrType !=null">
ATTR_TYPE,
</if>
<if test="contLabel !=null and contLabel !=''">
CONT_LABEL,
</if>
<if test="taskId !=null">
Task_id,
</if>
<if test="guaranteeId !=null">
Guarantee_ID,
</if>
<if test="affAirId !=null">
AFFAIR_ID,
</if>
<if test="topIcId !=null">
TOPIC_ID,
</if>
<if test="lastUpdate !=null">
LAST_UPDATE,
</if>
DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE ,ACTIVE_SYS,
CONFIG_PERCENT
,CONFIG_OPTION
,START_TIME ,END_TIME ,
<if test="userRegion != null and userRegion !=''">
USER_REGION,
</if>
IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME) VALUES(
#{compileId,jdbcType=BIGINT},
#{service, jdbcType=BIGINT},
#{action,jdbcType=INTEGER},
<if test="contType !=null">
#{contType,jdbcType=INTEGER },
</if>
<if test="attrType !=null">
#{attrType,jdbcType=INTEGER },
</if>
<if test="contLabel !=null and contLabel !=''">
#{contLabel,jdbcType=INTEGER},
</if>
<if test="taskId !=null">
#{taskId,jdbcType=INTEGER},
</if>
<if test="guaranteeId !=null">
#{guaranteeId,jdbcType=INTEGER},
</if>
<if test="affAirId !=null">
#{affAirId,jdbcType=INTEGER},
</if>
<if test="topIcId !=null">
#{topIcId,jdbcType=INTEGER},
</if>
<if test="lastUpdate !=null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
#{doBlackList,jdbcType=BIGINT},
#{doLog,jdbcType=INTEGER},
#{effectiveRange,jdbcType=VARCHAR},
#{activeSys,jdbcType=INTEGER},
#{configPercent,jdbcType=DOUBLE},
#{configOption,jdbcType=DOUBLE},
#{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP},
<if test="userRegion != null and userRegion !=''">
#{userRegion,jdbcType=VARCHAR},
</if>
#{isValid,jdbcType=INTEGER},
#{groupNum,jdbcType=INTEGER },
#{fatherCfgId,jdbcType=BIGINT},
#{opTime,jdbcType=TIMESTAMP})
</insert>
<update id="updateConfigCompile" parameterType="com.nis.domain.restful.ConfigCompile">
update CONFIG_COMPILE
<set>
LAST_UPDATE =sysdate,
<if test="contType != null">
CONT_TYPE = #{contType,jdbcType=INTEGER},
</if>
<if test="attrType != null">
ATTR_TYPE = #{attrType,jdbcType=INTEGER},
</if>
<if test="contLabel != null and contLabel!=''">
CONT_LABEL = #{contLabel,jdbcType=VARCHAR},
</if>
<if test="taskId != null">
Task_id = #{taskId,jdbcType=INTEGER},
</if>
<if test="guaranteeId != null">
Guarantee_ID = #{guaranteeId,jdbcType=INTEGER},
</if>
<if test="affAirId != null">
AFFAIR_ID = #{affAirId,jdbcType=INTEGER},
</if>
<if test="topIcId != null">
TOPIC_ID = #{topIcId,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="activeSys != null">
ACTIVE_SYS = #{activeSys,jdbcType=INTEGER},
</if>
<if test="effectiveRange != null and effectiveRange!=''">
EFFECTIVE_RANGE = #{effectiveRange,jdbcType=VARCHAR},
</if>
</set>
where COMPILE_ID = #{compileId ,jdbcType=BIGINT }
</update>
<update id="setCompileInvalid" >
update CONFIG_COMPILE set is_valid=#{valid,jdbcType=INTEGER } where COMPILE_ID = #{compileId ,jdbcType=BIGINT }
</update>
<!-- <update id="updateConfigCompile" parameterType="com.nis.domain.restful.ConfigCompile">
update CONFIG_COMPILE <set> <if test="service != null"> SERVICE = #{service,jdbcType=BIGINT},
</if> <if test="action != null"> ACTION = #{action,jdbcType=BIGINT}, </if>
<if test="contType != null"> CONT_TYPE =#{contType,jdbcType=INTEGER }, </if>
<if test="attrType != null"> ATTR_TYPE =#{attrType,jdbcType=INTEGER }, </if>
<if test="contLabel != null"> CONT_LABEL = #{contLabel,jdbcType=INTEGER },
</if> <if test="taskId != null"> Task_id = #{taskId,jdbcType=INTEGER }, </if>
<if test="guaranteeId != null"> Guarantee_ID=#{guaranteeId,jdbcType=INTEGER
}, </if> <if test="affAirId != null"> AFFAIR_ID = #{ affAirId , jdbcType=INTEGER
}, </if> <if test="topIcId != null"> TOPIC_ID = #{ topIcId , jdbcType=INTEGER
}, </if> <if test="doBlackList != null"> DO_BLACKLIST = #{doBlackList,jdbcType=BIGINT},
</if> <if test="doLog != null"> DO_LOG = #{doLog,jdbcType=INTEGER}, </if>
<if test="effectiveRange != null"> EFFECTIVE_RANGE = #{effectiveRange,jdbcType=VARCHAR},
</if> <if test="configPercent != null"> CONFIG_PERCENT = #{configPercent,jdbcType=DOUBLE},
</if> <if test="configOption != null"> CONFIG_OPTION = #{configOption,jdbcType=DOUBLE},
</if> <if test="startTime != null"> START_TIME = #{startTime,jdbcType=TIMESTAMP},
</if> <if test="endTime != null"> END_TIME = #{endTime,jdbcType=TIMESTAMP},
</if> <if test="userRegion != null and userRegion !=''"> USER_REGION = #{userRegion,jdbcType=VARCHAR},
</if> <if test="isValid != null"> IS_VALID = #{isValid,jdbcType=INTEGER},
</if> <if test="groupNum != null"> GROUP_NUM = #{groupNum,jdbcType=INTEGER},
</if> <if test="fatherCfgId != null"> FATHER_CFG_ID = #{fatherCfgId,jdbcType=BIGINT},
</if> <if test="opTime != null"> OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if> </set> where COMPILE_ID = #{compileId ,jdbcType=BIGINT } </update> -->
<resultMap id="ConfigStateResultMap" type="com.nis.domain.restful.ConfigState">
<result column="TABLE_NAME" jdbcType="VARCHAR" property="tableName" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
</resultMap>
<sql id="configStateSql">
TABLE_NAME,OP_TIME
</sql>
<select id="queryConfigStateByTN" parameterType="java.lang.String"
resultMap="ConfigStateResultMap">
select
<include refid="configStateSql" />
from CONFIG_STATE where TABLE_NAME = #{tableName ,jdbcType=VARCHAR}
</select>
<update id="updateConfigState" parameterType="map">
update CONFIG_STATE
<set>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where TABLE_NAME = #{tableName ,jdbcType=VARCHAR }
</update>
<insert id="saveConfigState" parameterType="map">
insert into
CONFIG_STATE(TABLE_NAME,OP_TIME)
values(#{tableName,jdbcType=VARCHAR},#{opTime,jdbcType=TIMESTAMP})
</insert>
</mapper>

View File

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.ConfigGroupRelationDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.ConfigGroupRelation">
<result column="ID" jdbcType="BIGINT" property="id" />
<result column="GROUP_ID" jdbcType="BIGINT" property="groupId" />
<result column="COMPILE_ID" jdbcType="BIGINT" property="compileId" />
<result column="IS_VALID" jdbcType="BIGINT" property="isValid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="LAST_UPDATE" jdbcType="TIMESTAMP" property="lastUpdate" />
<result column="PROC_SEQ" jdbcType="BIGINT" property="procSeq" />
</resultMap>
<sql id="compileGroupSql">
ID,GROUP_ID,COMPILE_ID,IS_VALID,OP_TIME,LAST_UPDATE,PROC_SEQ
</sql>
<select id="queryCompileGroupByPID" parameterType="com.nis.domain.restful.ConfigGroupRelation"
resultMap="BaseResultMap">
select
<include refid="compileGroupSql" />
from CONFIG_GROUP where COMPILE_ID = #{compileId ,jdbcType=BIGINT }
</select>
<select id="queryCompileGroupByGID" parameterType="com.nis.domain.restful.ConfigGroupRelation"
resultMap="BaseResultMap">
select
<include refid="compileGroupSql" />
from CONFIG_GROUP where IS_VALID=1 GROUP_ID = #{groupId
,jdbcType=BIGINT }
</select>
<insert id="saveGroupBatch" parameterType="java.util.List">
<!-- insert /*+append*/ into CONFIG_GROUP -->
insert into CONFIG_GROUP
(ID,GROUP_ID, COMPILE_ID, IS_VALID,
OP_TIME,LAST_UPDATE
<!-- ,PROC_SEQ -->
)
<foreach collection="list" item="item" index="index" open="("
close=")" separator="union">
select
<!-- seq_groupId.nextval, -->
#{item.id,jdbcType=BIGINT},
#{item.groupId,jdbcType=BIGINT},
#{item.compileId,jdbcType=BIGINT},
#{item.isValid,jdbcType=BIGINT},
#{item.opTime,jdbcType=TIMESTAMP},
sysdate
<!-- ,#{item.procSeq,jdbcType=BIGINT} -->
from dual
</foreach>
</insert>
<insert id="saveConfigGroupRelation" parameterType="com.nis.domain.restful.ConfigGroupRelation">
<!-- <selectKey keyProperty="groupId" resultType="java.lang.Long" -->
<!-- order="BEFORE"> 取消使用序列,界面会将id传过来 -->
<!-- select seq_groupId.nextval from dual -->
<!-- </selectKey> -->
insert into CONFIG_GROUP
(ID,GROUP_ID, COMPILE_ID, IS_VALID,
LAST_UPDATE,
OP_TIME )
values
(
<!-- #{id,jdbcType=BIGINT}, -->
seq_config_group.nextval,
#{groupId,jdbcType=BIGINT},
#{compileId,jdbcType=BIGINT},
#{isValid,jdbcType=BIGINT},
sysdate,
#{opTime,jdbcType=TIMESTAMP}
)
</insert>
<update id="updateConfigGroupRelation" parameterType="com.nis.domain.restful.ConfigGroupRelation">
UPDATE
CONFIG_GROUP
<set>
<if test="isValid != null">
IS_VALID=#{isValid , jdbcType=BIGINT},
</if>
<if test="opTime != null">
OP_TIME=#{opTime , jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
LAST_UPDATE=#{lastUpdate , jdbcType=TIMESTAMP},
</if>
</set>
where GROUP_ID=#{groupId}
</update>
<!-- <update id="updateConfigGroupRelation" parameterType="com.nis.domain.restful.ConfigGroupRelation">
UPDATE CONFIG_GROUP <set> <if test="compileId != null"> COMPILE_ID=#{compileId
, jdbcType=BIGINT}, </if> <if test="isValid != null"> IS_VALID=#{isValid
, jdbcType=BIGINT}, </if> <if test="opTime != null"> OP_TIME=#{opTime , jdbcType=TIMESTAMP},
</if> </set> where GROUP_ID=#{groupId} </update> -->
</mapper>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.ConfigPzIdDao">
<select id="getConfigPzIdList" parameterType="com.nis.domain.restful.ConfigPzIdSource" resultType="java.lang.Long" useCache="false" flushCache="true">
SELECT
<if test="sourceName != null and sourceName =='CONFIG_COMPILE'">
SEQ_COMPILEID.nextval
</if>
<if test="sourceName != null and sourceName =='CONFIG_GROUP_ID'">
SEQ_CONFIG_GROUP.nextval
</if>
<if test="sourceName != null and sourceName =='CONFIG_GROUP'">
SEQ_GROUPID.nextval
</if>
<if test="sourceName != null and sourceName =='CONFIG_REGION'">
SEQ_REGIONID.nextval
</if>
FROM dual
</select>
</mapper>

View File

@@ -0,0 +1,31 @@
/**
* @Title: ControlLogDao.java
* @Package com.nis.web.dao
* @Description: TODO(用一句话描述该文件做什么)
* @author darnell
* @date 2016年8月15日 下午4:13:49
* @version V1.0
*/
package com.nis.web.dao;
import java.util.List;
import com.nis.domain.ControlLog;
/**
* @ClassName: ControlLogDao
* @Description: TODO(这里用一句话描述这个类的作用)
* @author (darnell)
* @date 2016年8月15日 下午4:13:49
* @version V1.0
*/
@MyBatisDao
public interface ControlLogDao extends CrudDao<ControlLog> {
List<ControlLog> getLogInfo(ControlLog controlLog);
void saveControlLog(ControlLog controlLog);
void removeControlLog(long id);
}

View File

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.ControlLogDao" >
<select id="getLogInfo" resultType="controlLog">
SELECT
l.*
FROM log_info l
</select>
<resultMap type="controlLog" id="controlLogMap">
<id property="id" column="id"/>
<result property="domain" column="domain"/>
<result property="title" column="title"/>
<result property="srcIp" column="source_ip"/>
<result property="resIp" column="res_ip"/>
<result property="optTime" column="opt_time"/>
<result property="status" column="status"/>
</resultMap>
<sql id="controlLogColumns">
id,
domain,
title,
source_ip,
res_ip,
status,
opt_time
</sql>
<select id="get" resultMap="controlLogMap">
select
<include refid="controlLogColumns"/>
from log_info
WHERE id=#{id}
</select>
<select id="findList" resultMap="controlLogMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="controlLogColumns"/>
</otherwise>
</choose>
from log_info
WHERE 1=1
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY id desc
</otherwise>
</choose>
</select>
<insert id="saveControlLog" parameterType="controlLog" >
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_LOG_INFO.Nextval as ID from DUAL
</selectKey>
insert into LOG_INFO(ID,DOMAIN,TITLE,SOURCE_IP,RES_IP,STATUS,OPT_TIME)
values (#{id},#{domain},#{title},#{srcIp},#{resIp},#{status},#{optTime})
</insert>
<update id="removeControlLog">
UPDATE LOG_INFO SET
status = 0
WHERE id = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,65 @@
package com.nis.web.dao;
import java.util.List;
/**
* DAO支持类实现
* @author
* @version
* @param <T>
*/
public interface CrudDao<T> {
/**
* 获取单条数据
* @param id
* @return
*/
public T get(Long id);
/**
* 获取单条数据
* @param entity
* @return
*/
public T get(T entity);
/**
* 查询数据列表如果需要分页请设置分页对象entity.setPage(new Page<T>());
* @param entity
* @return
*/
public List<T> findList(T entity);
/**
* 查询所有数据列表
* @param entity
* @return
*/
public List<T> findAllList(T entity);
/**
* 插入数据
* @param entity
* @return
*/
public int insert(T entity);
/**
* 更新数据
* @param entity
* @return
*/
public int update(T entity);
public int updateValid(T entity);
/**
* 删除数据一般为逻辑删除更新del_flag字段为1
* @param entity
* @return
*/
public int delete(T entity);
}

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DataDictionaryDao">
<resultMap id="DataDictionaryMap" type="com.nis.domain.restful.DataDictionaryName">
<id column="dictnameid" jdbcType="BIGINT" property="dictNameId" />
<result column="datadictname" jdbcType="BIGINT" property="dataDictName" />
<collection property="dictValueList"
ofType="com.nis.domain.restful.DataDictionaryValue">
<id column="dictvalueid" jdbcType="BIGINT" property="dictValueId" />
<result column="dataDictValue" jdbcType="BIGINT" property="dataDictValue" />
</collection>
</resultMap>
<resultMap id="DataDictValMap" type="com.nis.domain.restful.DataDictionaryValue">
<id column="dictvalueid" jdbcType="BIGINT" property="dictValueId" />
<result column="dictNameId" jdbcType="BIGINT" property="dictNameId" />
<result column="datadictname" jdbcType="BIGINT" property="dataDictName" />
<result column="dataDictValue" jdbcType="BIGINT" property="dataDictValue" />
</resultMap>
<sql id="dataDictSql">
n.id dictnameid,
n.datadictname datadictname,
v.id
dictvalueid,
v.datadictvalue datadictvalue
</sql>
<select id="getAllDictName" resultMap="DataDictValMap">
select
<include refid="dataDictSql" />
from datadictionaryname n left join datadictionaryvalue v on n.id =
v.datadictid
<where>
n.isvalid = 1 and v.isvalid=1
<if test="dictValueId != null">
and v.id = #{dictValueId}
</if>
<if test="dictNameId != null">
and n.id = #{dictNameId}
</if>
<if test="dataDictValue != null and dataDictValue!=''">
and v.dataDictValue = #{dataDictValue}
</if>
<if test="dataDictName != null and dataDictName!=''">
and n.datadictname= #{dataDictName}
</if>
</where>
</select>
<select id="selAllDictName" resultMap="DataDictionaryMap">
select n.id dictnameid,
n.datadictname datadictname from datadictionaryname n where
n.isvalid=1
</select>
<insert id="addDictName" parameterType="com.nis.domain.restful.DataDictionaryName">
<selectKey keyProperty="dictNameId" resultType="java.lang.Long"
order="BEFORE">
select seq_datadict.nextval from dual
</selectKey>
insert into datadictionaryname (id ,datadictname,isValid) values(
#{dictNameId,jdbcType=BIGINT},
#{dataDictName, jdbcType=VARCHAR},1)
</insert>
<insert id="addDictValue" parameterType="com.nis.domain.restful.DataDictionaryValue">
<selectKey keyProperty="dictValueId" resultType="java.lang.Long"
order="BEFORE">
select seq_datadict.nextval from dual
</selectKey>
insert into datadictionaryvalue (id ,datadictid,datadictvalue,isValid)
values(
#{dictValueId,jdbcType=BIGINT},#{dictNameId, jdbcType=BIGINT},
#{dataDictValue,jdbcType=VARCHAR},1)
</insert>
<update id="updateDictName" parameterType="com.nis.domain.restful.DataDictionaryName">
update datadictionaryname
<set>
<if test="isValid != null">
isValid = #{isValid,jdbcType=BIGINT},
</if>
<if test="dataDictName != null">
dataDictName = #{dataDictName,jdbcType=VARCHAR},
</if>
</set>
where id = #{dictNameId ,jdbcType=BIGINT }
</update>
<update id="updateDictValue" parameterType="com.nis.domain.restful.DataDictionaryValue">
update datadictionaryvalue
<set>
<if test="dataDictValue != null and dataDictValue!=''">
dataDictValue = #{dataDictValue,jdbcType=VARCHAR},
</if>
<if test="isValid != null">
isValid = #{isValid,jdbcType=BIGINT},
</if>
</set>
where id = #{dictValueId ,jdbcType=BIGINT }
</update>
</mapper>

View File

@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfDjLogStatDao">
<!-- DfDjLogStatistics -->
<sql id="DfDjLogStatPorperty">SUM</sql>
<resultMap id="DfDjLogStatisticsMap" type="com.nis.domain.restful.DfDjLogStatistics">
<result column="sum" jdbcType="BIGINT" property="sum" />
</resultMap>
<select id="findDfLogStatistics" parameterType="com.nis.domain.restful.DfDjLogStatistics"
resultMap="DfDjLogStatisticsMap">
SELECT
<include refid="DfDjLogStatPorperty"/>
FROM (SELECT nvl(sum(SUM), 0) SUM
FROM DF_STAT_LOG_DAILY t
<where>
<if test="searchStatActiveSys != null and searchStatActiveSys !=''">
AND active_sys=#{searchStatActiveSys}
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
<if test="searchConfigId != null and searchConfigId !=''">
AND config_id in (${searchConfigId})
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
) DF_STAT_LOG_DAILY
</select>
<select id="findDjLogStatistics" parameterType="com.nis.domain.restful.DfDjLogStatistics"
resultMap="DfDjLogStatisticsMap">
SELECT
<include refid="DfDjLogStatPorperty"/>
FROM (SELECT nvl(sum(SUM), 0) SUM
FROM DJ_STAT_LOG_DAILY t
<where>
<if test="searchStatActiveSys != null and searchStatActiveSys !=''">
AND active_sys=#{searchStatActiveSys}
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
<if test="searchConfigId != null and searchConfigId !=''">
AND config_id in (${searchConfigId})
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
) DJ_STAT_LOG_DAILY
</select>
<!-- DfDjPzLogStatistics -->
<sql id="DfDjPzLogStatPorperty">CONFIG_ID, SERVICE, STAT_TIME, SUM</sql>
<resultMap id="DfDjPzLogStatisticsMap" type="com.nis.domain.restful.DfDjPzLogStatistics">
<result column="config_id" jdbcType="BIGINT" property="configId" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="sum" jdbcType="BIGINT" property="sum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="findDfPzLogStatistics" parameterType="com.nis.domain.restful.DfDjPzLogStatistics"
resultMap="DfDjPzLogStatisticsMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfDjPzLogStatPorperty"/>
</otherwise>
</choose>
FROM (SELECT CONFIG_ID, SERVICE, STAT_TIME, sum(SUM) SUM
FROM DF_STAT_LOG_DAILY t
<where>
<if test="searchStatActiveSys != null and searchStatActiveSys !=''">
AND active_sys=#{searchStatActiveSys}
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
<if test="searchConfigId != null and searchConfigId !=''">
AND config_id in(${searchConfigId})
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY CONFIG_ID, SERVICE, STAT_TIME) DF_STAT_LOG_DAILY
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDjPzLogStatistics" parameterType="com.nis.domain.restful.DfDjPzLogStatistics"
resultMap="DfDjPzLogStatisticsMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfDjPzLogStatPorperty"/>
</otherwise>
</choose>
FROM (SELECT CONFIG_ID, SERVICE, STAT_TIME, sum(SUM) SUM
FROM DJ_STAT_LOG_DAILY t
<where>
<if test="searchStatActiveSys != null and searchStatActiveSys !=''">
AND active_sys=#{searchStatActiveSys}
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
<if test="searchConfigId != null and searchConfigId !=''">
AND config_id in(${searchConfigId})
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY CONFIG_ID, SERVICE, STAT_TIME) DJ_STAT_LOG_DAILY
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfDjNestLogDao">
<!-- OVER_INFO_LOG -->
<sql id="dfDjNestLogProperty">
LAYER_ID,FOUND_TIME,RECV_TIME,LAYER_CNT,NEST_PROTOCOL,NEST_SERVER_IP,
NEST_CLIENT_IP,NEST_SERVER_PORT,NEST_CLIENT_PORT,OVER_ID
</sql>
<resultMap id="DfDjNestLogMap" type="com.nis.domain.restful.DfDjNestLog">
<result column="layer_id" jdbcType="VARCHAR" property="layerId" />
<result column="found_time" jdbcType="TIMESTAMP" property="foundTime" />
<result column="recv_time" jdbcType="TIMESTAMP" property="recvTime" />
<result column="layer_cnt" jdbcType="INTEGER" property="layerCnt" />
<result column="nest_protocol" jdbcType="VARCHAR" property="nestProtocol" />
<result column="nest_server_ip" jdbcType="VARCHAR" property="nestServerIp" />
<result column="nest_client_ip" jdbcType="VARCHAR" property="nestClientIp" />
<result column="nest_server_port" jdbcType="INTEGER" property="nestServerPort" />
<result column="nest_client_port" jdbcType="INTEGER" property="nestClientPort" />
<result column="over_id" jdbcType="VARCHAR" property="overId" />
</resultMap>
<select id="findDfDjNestLogPage" parameterType="com.nis.domain.restful.DfDjNestLog"
resultMap="DfDjNestLogMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="dfDjNestLogProperty"/>
</otherwise>
</choose>
FROM OVER_INFO_LOG t
CONNECT BY t.layer_id = prior t.over_id
START WITH t.layer_id = #{searchLayerId}
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfIpPortUdpDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.DfIpPortUdp">
<id column="CFG_ID" jdbcType="BIGINT" property="cfgId" />
<result column="ADDR_TYPE" jdbcType="INTEGER" property="addrType" />
<result column="SRC_IP" jdbcType="VARCHAR" property="srcIp" />
<result column="MASK_SRC_IP" jdbcType="VARCHAR" property="maskSrcIp" />
<result column="SRC_PORT" jdbcType="VARCHAR" property="srcPort" />
<result column="MASK_SRC_PORT" jdbcType="VARCHAR" property="maskSrcPort" />
<result column="DST_IP" jdbcType="VARCHAR" property="dstIp" />
<result column="MASK_DST_IP" jdbcType="VARCHAR" property="maskDstIp" />
<result column="DST_PORT" jdbcType="VARCHAR" property="dstPort" />
<result column="MASK_DST_PORT" jdbcType="VARCHAR" property="maskDstPort" />
<result column="PROTOCOL" jdbcType="INTEGER" property="protocol" />
<result column="DIRECTION" jdbcType="INTEGER" property="direction" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result property="lastUpdate" column="LAST_UPDATE"/>
<result property="effectiveRange" column="EFFECTIVE_RANGE"/>
<result property="activeSys" column="ACTIVE_SYS"/>
</resultMap>
<sql id="Base_Column_List">
CFG_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT, DST_IP, MASK_DST_IP,
DST_PORT, MASK_DST_PORT, PROTOCOL, DIRECTION, IS_VALID, OP_TIME,lastUpdate,effectiveRange,activeSys
</sql>
<!--
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from DF_IP_PORT_UDP
where CFG_ID = #{cfgId,jdbcType=BIGINT}
</select>
-->
<delete id="delete" parameterType="java.lang.Long">
delete from DF_IP_PORT_UDP
where CFG_ID = #{cfgId,jdbcType=BIGINT}
</delete>
<!--
<insert id="insert" parameterType="com.nis.domain.restful.DfIpPortUdp">
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DF_IP_PORT_UDP.Nextval as ID from DUAL
</selectKey>
insert into DF_IP_PORT_UDP (CFG_ID, ADDR_TYPE, SRC_IP,
MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT,
DST_IP, MASK_DST_IP, DST_PORT,
MASK_DST_PORT, PROTOCOL, DIRECTION,
IS_VALID, OP_TIME)
values (#{id,jdbcType=BIGINT}, #{addrType,jdbcType=INTEGER}, #{srcIp,jdbcType=VARCHAR},
#{maskSrcIp,jdbcType=VARCHAR}, #{srcPort,jdbcType=VARCHAR}, #{maskSrcPort,jdbcType=VARCHAR},
#{dstIp,jdbcType=VARCHAR}, #{maskDstIp,jdbcType=VARCHAR}, #{dstPort,jdbcType=VARCHAR},
#{maskDstPort,jdbcType=VARCHAR}, #{protocol,jdbcType=INTEGER}, #{direction,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER}, #{opTime,jdbcType=TIMESTAMP})
</insert>
-->
<insert id="insert" parameterType="com.nis.domain.restful.DfIpPortUdp">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="cfgId">
SELECT SEQ_DF_IP_PORT_UDP.Nextval as ID from DUAL
</selectKey>
-->
insert into DF_IP_PORT_UDP
<trim prefix="(" suffix=")" suffixOverrides=",">
CFG_ID,
<if test="addrType != null">
ADDR_TYPE,
</if>
<if test="srcIp != null">
SRC_IP,
</if>
<if test="maskSrcIp != null">
MASK_SRC_IP,
</if>
<if test="srcPort != null">
SRC_PORT,
</if>
<if test="maskSrcPort != null">
MASK_SRC_PORT,
</if>
<if test="dstIp != null">
DST_IP,
</if>
<if test="maskDstIp != null">
MASK_DST_IP,
</if>
<if test="dstPort != null">
DST_PORT,
</if>
<if test="maskDstPort != null">
MASK_DST_PORT,
</if>
<if test="protocol != null">
PROTOCOL,
</if>
<if test="direction != null">
DIRECTION,
</if>
<if test="isValid != null">
IS_VALID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
<if test="opTime != null">
LAST_UPDATE,
</if>
<if test="effectiveRange != null">
EFFECTIVE_RANGE,
</if>
<if test="activeSys != null">
ACTIVE_SYS,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{cfgId,jdbcType=BIGINT},
<if test="addrType != null">
#{addrType,jdbcType=INTEGER},
</if>
<if test="srcIp != null">
#{srcIp,jdbcType=VARCHAR},
</if>
<if test="maskSrcIp != null">
#{maskSrcIp,jdbcType=VARCHAR},
</if>
<if test="srcPort != null">
#{srcPort,jdbcType=VARCHAR},
</if>
<if test="maskSrcPort != null">
#{maskSrcPort,jdbcType=VARCHAR},
</if>
<if test="dstIp != null">
#{dstIp,jdbcType=VARCHAR},
</if>
<if test="maskDstIp != null">
#{maskDstIp,jdbcType=VARCHAR},
</if>
<if test="dstPort != null">
#{dstPort,jdbcType=VARCHAR},
</if>
<if test="maskDstPort != null">
#{maskDstPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
#{protocol,jdbcType=INTEGER},
</if>
<if test="direction != null">
#{direction,jdbcType=INTEGER},
</if>
<if test="isValid != null">
#{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
<if test="effectiveRange != null">
#{effectiveRange,jdbcType=VARCHAR},
</if>
<if test="activeSys != null">
#{activeSys,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="update" parameterType="com.nis.domain.restful.DfIpPortUdp">
update DF_IP_PORT_UDP
<set>
<if test="addrType != null">
ADDR_TYPE = #{addrType,jdbcType=INTEGER},
</if>
<if test="srcIp != null">
SRC_IP = #{srcIp,jdbcType=VARCHAR},
</if>
<if test="maskSrcIp != null">
MASK_SRC_IP = #{maskSrcIp,jdbcType=VARCHAR},
</if>
<if test="srcPort != null">
SRC_PORT = #{srcPort,jdbcType=VARCHAR},
</if>
<if test="maskSrcPort != null">
MASK_SRC_PORT = #{maskSrcPort,jdbcType=VARCHAR},
</if>
<if test="dstIp != null">
DST_IP = #{dstIp,jdbcType=VARCHAR},
</if>
<if test="maskDstIp != null">
MASK_DST_IP = #{maskDstIp,jdbcType=VARCHAR},
</if>
<if test="dstPort != null">
DST_PORT = #{dstPort,jdbcType=VARCHAR},
</if>
<if test="maskDstPort != null">
MASK_DST_PORT = #{maskDstPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
PROTOCOL = #{protocol,jdbcType=INTEGER},
</if>
<if test="direction != null">
DIRECTION = #{direction,jdbcType=INTEGER},
</if>
<if test="isValid != null">
IS_VALID = #{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
<if test="effectiveRange != null">
EFFECTIVE_RANGE=#{effectiveRange,jdbcType=VARCHAR},
</if>
<if test="activeSys != null">
ACTIVE_SYS=#{activeSys,jdbcType=INTEGER},
</if>
</set>
where CFG_ID = #{cfgId,jdbcType=BIGINT}
</update>
<!--
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.DfIpPortUdp">
update DF_IP_PORT_UDP
set ADDR_TYPE = #{addrType,jdbcType=INTEGER},
SRC_IP = #{srcIp,jdbcType=VARCHAR},
MASK_SRC_IP = #{maskSrcIp,jdbcType=VARCHAR},
SRC_PORT = #{srcPort,jdbcType=VARCHAR},
MASK_SRC_PORT = #{maskSrcPort,jdbcType=VARCHAR},
DST_IP = #{dstIp,jdbcType=VARCHAR},
MASK_DST_IP = #{maskDstIp,jdbcType=VARCHAR},
DST_PORT = #{dstPort,jdbcType=VARCHAR},
MASK_DST_PORT = #{maskDstPort,jdbcType=VARCHAR},
PROTOCOL = #{protocol,jdbcType=INTEGER},
DIRECTION = #{direction,jdbcType=INTEGER},
IS_VALID = #{isValid,jdbcType=INTEGER},
OP_TIME = #{opTime,jdbcType=TIMESTAMP}
where CFG_ID = #{cfgId,jdbcType=BIGINT}
</update>
-->
</mapper>

View File

@@ -0,0 +1,692 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfJitLogSearchDao">
<resultMap id="DfJitFlSrcReportMap" type="com.nis.domain.restful.DfJitFlSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="FL" jdbcType="INTEGER" property="fl" />
<result column="XZ" jdbcType="INTEGER" property="xz" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitFlSrcReport_Column_List">
STAT_ID, FL, XZ, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitFlSrcReport" parameterType="com.nis.domain.restful.DfJitFlSrcReport"
resultMap="DfJitFlSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitFlSrcReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_FL_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchFl != null and searchFl !=''">
AND FL = #{searchFl}
</if>
<if test="searchXz != null and searchXz !=''">
AND XZ = #{searchXz}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitFlDestReportMap" type="com.nis.domain.restful.DfJitFlDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="FL" jdbcType="INTEGER" property="fl" />
<result column="XZ" jdbcType="INTEGER" property="xz" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitFlDestReport_Column_List">
STAT_ID, FL, XZ, REPORT_TIME, DEST_COUNTRY, DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitFlDestReport" parameterType="com.nis.domain.restful.DfJitFlDestReport"
resultMap="DfJitFlDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitFlDestReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_FL_Dest_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchFl != null and searchFl !=''">
AND FL = #{searchFl}
</if>
<if test="searchXz != null and searchXz !=''">
AND XZ = #{searchXz}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitAffairSrcReportMap" type="com.nis.domain.restful.DfJitAffairSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="Affair" jdbcType="INTEGER" property="affair" />
<result column="topic" jdbcType="INTEGER" property="topic" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitAffairSrcReport_Column_List">
STAT_ID, Affair,topic, REPORT_TIME, SRC_COUNTRY,
SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitAffairSrcReport" parameterType="com.nis.domain.restful.DfJitAffairSrcReport"
resultMap="DfJitAffairSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitAffairSrcReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_AFFAIR_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchAffair != null and searchAffair !=''">
AND Affair = #{searchAffair}
</if>
<if test="searchTopic != null and searchTopic !=''">
AND topic = #{searchTopic}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitAffairDestReportMap" type="com.nis.domain.restful.DfJitAffairDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="Affair" jdbcType="INTEGER" property="affair" />
<result column="topic" jdbcType="INTEGER" property="topic" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitAffairDestReport_Column_List">
STAT_ID, Affair,topic, REPORT_TIME, DEST_COUNTRY,
DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitAffairDestReport" parameterType="com.nis.domain.restful.DfJitAffairDestReport"
resultMap="DfJitAffairDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitAffairDestReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_AFFAIR_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchAffair != null and searchAffair !=''">
AND Affair = #{searchAffair}
</if>
<if test="searchTopic != null and searchTopic !=''">
AND topic = #{searchTopic}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitMissionSrcReportMap" type="com.nis.domain.restful.DfJitMissionSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="mission" jdbcType="INTEGER" property="mission" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitMissionSrcReport_Column_List">
STAT_ID, mission, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitMissionSrcReport" parameterType="com.nis.domain.restful.DfJitMissionSrcReport"
resultMap="DfJitMissionSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitMissionSrcReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_MISSION_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchMission != null and searchMission !=''">
AND mission = #{searchMission}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitMissionDestReportMap" type="com.nis.domain.restful.DfJitMissionDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="mission" jdbcType="INTEGER" property="mission" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitMissionDestReport_Column_List">
STAT_ID, mission, REPORT_TIME, DEST_COUNTRY, DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitMissionDestReport" parameterType="com.nis.domain.restful.DfJitMissionDestReport"
resultMap="DfJitMissionDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitMissionDestReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_MISSION_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchMission != null and searchMission !=''">
AND mission = #{searchMission}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitGuaranteeSrcReportMap"
type="com.nis.domain.restful.DfJitGuaranteeSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="guarantee" jdbcType="INTEGER" property="guarantee" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitGuaranteeSrcReport_Column_List">
STAT_ID, guarantee, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitGuaranteeSrcReport" parameterType="com.nis.domain.restful.DfJitGuaranteeSrcReport"
resultMap="DfJitGuaranteeSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitGuaranteeSrcReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_GUARANTEE_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchGuarantee != null and searchGuarantee !=''">
AND guarantee = #{searchGuarantee}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitGuaranteeDestReportMap"
type="com.nis.domain.restful.DfJitGuaranteeDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="guarantee" jdbcType="INTEGER" property="guarantee" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitGuaranteeDestReport_Column_List">
STAT_ID, guarantee, REPORT_TIME, DEST_COUNTRY,
DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitGuaranteeDestReport" parameterType="com.nis.domain.restful.DfJitGuaranteeDestReport"
resultMap="DfJitGuaranteeDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitGuaranteeDestReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_GUARANTEE_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchGuarantee != null and searchGuarantee !=''">
AND guarantee = #{searchGuarantee}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitTagSrcReportMap" type="com.nis.domain.restful.DfJitTagSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="tag" jdbcType="INTEGER" property="tag" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitTagSrcReport_Column_List">
STAT_ID, tag, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitTagSrcReport" parameterType="com.nis.domain.restful.DfJitTagSrcReport"
resultMap="DfJitTagSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitTagSrcReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_TAG_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND tag in(${searchTag})
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitTagDestReportMap" type="com.nis.domain.restful.DfJitTagDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="tag" jdbcType="INTEGER" property="tag" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitTagDestReport_Column_List">
STAT_ID, tag, REPORT_TIME, DEST_COUNTRY,
DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitTagDestReport" parameterType="com.nis.domain.restful.DfJitTagDestReport"
resultMap="DfJitTagDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitTagDestReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_TAG_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND tag in(${searchTag})
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitIdSrcReportMap" type="com.nis.domain.restful.DfJitIdSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="id" jdbcType="BIGINT" property="id" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitIdSrcReport_Column_List">
STAT_ID, id, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitIdSrcReport" parameterType="com.nis.domain.restful.DfJitIdSrcReport"
resultMap="DfJitIdSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitIdSrcReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_ID_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchId != null and searchId !=''">
AND id = #{searchId}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfJitIdDestReportMap" type="com.nis.domain.restful.DfJitIdDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="id" jdbcType="BIGINT" property="id" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DfJitIdDestReport_Column_List">
STAT_ID, id, REPORT_TIME, DEST_COUNTRY,
DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDfJitIdDestReport" parameterType="com.nis.domain.restful.DfJitIdDestReport"
resultMap="DfJitIdDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DfJitIdDestReport_Column_List" />
</otherwise>
</choose>
from DF_JIT_ID_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchId != null and searchId !=''">
AND id = #{searchId}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfKeyConvertUrlDao">
<!-- DJ_FLOWCONTROL_STOP -->
<sql id="dfKeyConvertUrlProperty">
ID,KEY_ID,URL,OP_TIME
</sql>
<resultMap id="DfKeyConvertUrlMap" type="com.nis.domain.restful.DfKeyConvertUrl">
<result column="id" jdbcType="INTEGER" property="id" />
<result column="key_id" jdbcType="INTEGER" property="keyId" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="op_time" jdbcType="TIMESTAMP" property="opTime" />
</resultMap>
<select id="findDfKeyConvertUrlPage" parameterType="com.nis.domain.restful.DfKeyConvertUrl" resultMap="DfKeyConvertUrlMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="dfKeyConvertUrlProperty"/>
</otherwise>
</choose>
FROM DF_KEY_CONVERT_URL
<where>
<if test="optStartTime != null and optStartTime !=''">
<![CDATA[AND OP_TIME >= to_date(#{optStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="optEndTime != null and optEndTime !=''">
<![CDATA[AND OP_TIME < to_date(#{optEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchId != null and searchId !=''">
AND id > ${searchId}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfKeyMailAddDao">
<!-- DF_KEY_MAIL_ADDR -->
<sql id="dfKeyMailAddProperty">
ID,KEY_ID,MAIL_ADDR,OP_TIME
</sql>
<resultMap id="DfKeyMailAddMap" type="com.nis.domain.restful.DfKeyMailAdd">
<result column="id" jdbcType="INTEGER" property="id" />
<result column="key_id" jdbcType="INTEGER" property="keyId" />
<result column="mail_addr" jdbcType="VARCHAR" property="mailAddr" />
<result column="op_time" jdbcType="TIMESTAMP" property="opTime" />
</resultMap>
<select id="findDfKeyMailAddPage" parameterType="com.nis.domain.restful.DfKeyMailAdd"
resultMap="DfKeyMailAddMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="dfKeyMailAddProperty"/>
</otherwise>
</choose>
FROM DF_KEY_MAIL_ADDR
<where>
<if test="optStartTime != null and optStartTime !=''">
<![CDATA[AND OP_TIME >= to_date(#{optStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="optEndTime != null and optEndTime !=''">
<![CDATA[AND OP_TIME < to_date(#{optEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchId != null and searchId !=''">
AND id > ${searchId}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfMultiDimensionalReportDao">
<!-- 所有实时统计report表的公共属性 -->
<sql id="commonPorperty">
ASUM,BSUM,REPORT_TIME,SERVICE
</sql>
<resultMap id="DfLwhhAttrReportMap" type="com.nis.domain.restful.DfLwhhAttrReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="LWHH" jdbcType="BIGINT" property="lwhh" />
<result column="ATTR_TYPE" jdbcType="BIGINT" property="attrType" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
</resultMap>
<select id="findDfLwhhAttrReport" parameterType="com.nis.domain.restful.DfLwhhAttrReport"
resultMap="DfLwhhAttrReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />,LWHH,ATTR_TYPE
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.LWHH,
pz.ATTR_TYPE
FROM DF_LWHH_TYPE_REPORT PZ
GROUP BY PZ.LWHH,PZ.ATTR_TYPE, PZ.SERVICE, PZ.REPORT_TIME
) DF_LWHH_TYPE_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfLwhhTagReportMap" type="com.nis.domain.restful.DfLwhhTagReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="LWHH" jdbcType="BIGINT" property="lwhh" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
</resultMap>
<select id="findDfLwhhTagReportPage" parameterType="com.nis.domain.restful.DfLwhhTagReport"
resultMap="DfLwhhTagReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />,LWHH,TAG
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.LWHH,
pz.TAG
FROM DF_LWHH_TAG_REPORT PZ
GROUP BY PZ.LWHH,PZ.TAG, PZ.SERVICE, PZ.REPORT_TIME
) DF_LWHH_TAG_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG in (${searchTag})
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfSrcIpTagReportMap" type="com.nis.domain.restful.DfSrcIpTagReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
</resultMap>
<select id="findDfSrcIpTagReportPage" parameterType="com.nis.domain.restful.DfSrcIpTagReport"
resultMap="DfSrcIpTagReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />,SRC_PROVINCE,TAG
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.SRC_PROVINCE,
pz.TAG
FROM DF_SRCIP_DOMESTIC_TAG_REPORT PZ
GROUP BY PZ.SRC_PROVINCE,PZ.TAG, PZ.SERVICE, PZ.REPORT_TIME
) DF_SRCIP_DOMESTIC_TAG_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG in (${searchTag})
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfSrcIpAttrReportMap" type="com.nis.domain.restful.DfSrcIpAttrReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="ATTR_TYPE" jdbcType="BIGINT" property="attrType" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
</resultMap>
<select id="findDfSrcIpAttrReportPage" parameterType="com.nis.domain.restful.DfSrcIpAttrReport"
resultMap="DfSrcIpAttrReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />,SRC_PROVINCE,ATTR_TYPE
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.SRC_PROVINCE,
pz.ATTR_TYPE
FROM DF_SRCIP_DOMESTIC_TYPE_REPORT PZ
GROUP BY PZ.SRC_PROVINCE,PZ.ATTR_TYPE, PZ.SERVICE, PZ.REPORT_TIME
) DF_SRCIP_DOMESTIC_TYPE_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,475 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfMultiDimensionalStatLogDao">
<!-- 配置报表的公共属性 -->
<sql id="commonPorperty">
ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DfLwhhAttrDailyMap" type="com.nis.domain.restful.DfLwhhAttrDaily">
<result column="lwhh" jdbcType="BIGINT" property="lwhh" />
<result column="attr_type" jdbcType="BIGINT" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="dfLwhhAttrDaily" parameterType="com.nis.domain.restful.DfLwhhAttrDaily" resultMap="DfLwhhAttrDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,LWHH,ATTR_TYPE
</otherwise>
</choose>
FROM
(
select LWHH,ATTR_TYPE,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select LWHH,ATTR_TYPE,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_LWHH_TYPE_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by LWHH,ATTR_TYPE,service,stat_time
) DF_LWHH_TYPE_STAT_LOG_DAILY
GROUP BY LWHH,ATTR_TYPE,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfLwhhAttrMonthMap" type="com.nis.domain.restful.DfLwhhAttrMonth">
<result column="lwhh" jdbcType="BIGINT" property="lwhh" />
<result column="attr_type" jdbcType="BIGINT" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="dfLwhhAttrMonth" parameterType="com.nis.domain.restful.DfLwhhAttrMonth" resultMap="DfLwhhAttrMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,LWHH,ATTR_TYPE
</otherwise>
</choose>
FROM
(
select LWHH,ATTR_TYPE,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select LWHH,ATTR_TYPE,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_LWHH_TYPE_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by LWHH,ATTR_TYPE,service,stat_time
) DF_LWHH_TYPE_STAT_LOG_MONTH
GROUP BY LWHH,ATTR_TYPE,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfLwhhTagDailyMap" type="com.nis.domain.restful.DfLwhhTagDaily">
<result column="lwhh" jdbcType="BIGINT" property="lwhh" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="dfLwhhTagDaily" parameterType="com.nis.domain.restful.DfLwhhTagDaily" resultMap="DfLwhhTagDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,LWHH,TAG
</otherwise>
</choose>
FROM
(
select LWHH,TAG,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select LWHH,TAG,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_LWHH_TAG_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG IN (${searchTag})
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by LWHH,TAG,service,stat_time
) DF_LWHH_TAG_STAT_LOG_DAILY
GROUP BY LWHH,TAG,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfLwhhTagMonthMap" type="com.nis.domain.restful.DfLwhhTagMonth">
<result column="lwhh" jdbcType="BIGINT" property="lwhh" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="dfLwhhTagMonth" parameterType="com.nis.domain.restful.DfLwhhTagMonth" resultMap="DfLwhhTagMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,LWHH,TAG
</otherwise>
</choose>
FROM
(
select LWHH,TAG,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select LWHH,TAG,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_LWHH_TAG_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG IN (${searchTag})
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by LWHH,TAG,service,stat_time
) DF_LWHH_TAG_STAT_LOG_MONTH
GROUP BY LWHH,TAG,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfSrcIpAttrDailyMap" type="com.nis.domain.restful.DfSrcIpAttrDaily">
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="attr_type" jdbcType="BIGINT" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="dfSrcIpAttrDaily" parameterType="com.nis.domain.restful.DfSrcIpAttrDaily" resultMap="DfSrcIpAttrDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,SRC_PROVINCE,ATTR_TYPE
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,ATTR_TYPE,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,ATTR_TYPE,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_SRCIP_TYPE_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,ATTR_TYPE,service,stat_time
) DF_SRCIP_TYPE_STAT_LOG_DAILY
GROUP BY SRC_PROVINCE,ATTR_TYPE,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfSrcIpAttrMonthMap" type="com.nis.domain.restful.DfSrcIpAttrMonth">
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="attr_type" jdbcType="BIGINT" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="dfSrcIpAttrMonth" parameterType="com.nis.domain.restful.DfSrcIpAttrMonth" resultMap="DfSrcIpAttrMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,SRC_PROVINCE,ATTR_TYPE
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,ATTR_TYPE,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,ATTR_TYPE,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_SRCIP_TYPE_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,ATTR_TYPE,service,stat_time
) DF_SRCIP_TYPE_STAT_LOG_MONTH
GROUP BY SRC_PROVINCE,ATTR_TYPE,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfSrcIpTagDailyMap" type="com.nis.domain.restful.DfSrcIpTagDaily">
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="dfSrcIpTagDaily" parameterType="com.nis.domain.restful.DfSrcIpTagDaily" resultMap="DfSrcIpTagDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,SRC_PROVINCE,TAG
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,TAG,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,TAG,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_SRCIP_TAG_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG IN (${searchTag})
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,TAG,service,stat_time
) DF_SRCIP_TAG_STAT_LOG_DAILY
GROUP BY SRC_PROVINCE,TAG,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfSrcIpTagMonthMap" type="com.nis.domain.restful.DfSrcIpTagMonth">
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="dfSrcIpTagMonth" parameterType="com.nis.domain.restful.DfSrcIpTagMonth" resultMap="DfSrcIpTagMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,SRC_PROVINCE,TAG
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,TAG,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,TAG,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_SRCIP_TAG_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG IN (${searchTag})
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,TAG,service,stat_time
) DF_SRCIP_TAG_STAT_LOG_MONTH
GROUP BY SRC_PROVINCE,TAG,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,824 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfReportDao">
<!-- 所有实时统计report表的公共属性 -->
<sql id="commonPorperty">
ASUM,BSUM,REPORT_TIME
</sql>
<sql id="commonABPorperty">
ASUM,BSUM,ABSUM,REPORT_TIME
</sql>
<resultMap id="DfPzReportMap" type="com.nis.domain.restful.DfPzReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="ABSUM" jdbcType="BIGINT" property="absum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="CFG_ID" jdbcType="BIGINT" property="cfgId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<resultMap id="DfPzReportStatMap" type="com.nis.domain.restful.DfPzReportStat">
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="CFG_ID" jdbcType="BIGINT" property="configId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<resultMap id="DfAttrTypeReportMap" type="com.nis.domain.restful.DfAttrTypeReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="ABSUM" jdbcType="BIGINT" property="absum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="ATTR_TYPE" jdbcType="INTEGER" property="attrType" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<resultMap id="DfSrcIpDomeSticReportMap" type="com.nis.domain.restful.DfSrcIpDomeSticReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
</resultMap>
<resultMap id="DfDestIpCountryReportMap" type="com.nis.domain.restful.DfDestIpCountryReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="destCountry" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<!-- DfPzReport日志查询 -->
<sql id="dfPzReportPorperty">
,CFG_ID,SERVICE
</sql>
<select id="findDfPzReport" parameterType="com.nis.domain.restful.DfPzReport"
resultMap="DfPzReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />
<include refid="dfPzReportPorperty" />
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.CFG_ID,
PZ.SERVICE
FROM DF_PZ_REPORT PZ
GROUP BY
PZ.CFG_ID,
PZ.SERVICE, PZ.REPORT_TIME
) DF_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchCfgId != null and searchCfgId !=''">
AND CFG_ID =#{searchCfgId}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findAttrTypeReport" parameterType="com.nis.domain.restful.DfAttrTypeReport"
resultMap="DfAttrTypeReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,absum,REPORT_TIME,ATTR_TYPE,SERVICE
</otherwise>
</choose>
FROM (
SELECT attr_type,REPORT_TIME, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select attr_type, asum, bsum, absum, REPORT_TIME,service
from (select attr_type,
REPORT_TIME,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.REPORT_TIME,
pz.cfg_id,
pz.attr_type,pz.service
FROM df_pz_attr_report PZ
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
GROUP BY pz.cfg_id, pz.attr_type, PZ.REPORT_TIME,pz.service)) a)
group by attr_type, REPORT_TIME,service
) df_pz_attr_report
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findSrcIpDomeSticReport" parameterType="com.nis.domain.restful.DfSrcIpDomeSticReport"
resultMap="DfSrcIpDomeSticReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,SERVICE,SRC_PROVINCE,SRC_CITY
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.SRC_PROVINCE,pz.SRC_CITY
FROM
DF_SRCIP_DOMESTIC_REPORT PZ
GROUP BY PZ.SRC_PROVINCE,pz.SRC_CITY,
PZ.SERVICE, PZ.REPORT_TIME
) DF_SRCIP_DOMESTIC_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchSrcCity != null and searchSrcCity !=''">
AND SRC_CITY =#{searchSrcCity}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDestIpCountryReport" parameterType="com.nis.domain.restful.DfDestIpCountryReport"
resultMap="DfDestIpCountryReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,DEST_COUNTRY,SERVICE
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.DEST_COUNTRY
FROM DF_DESTIP_COUNTRY_REPORT
PZ
GROUP BY PZ.DEST_COUNTRY, PZ.SERVICE, PZ.REPORT_TIME
)
DF_DESTIP_COUNTRY_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchDestCountry != null and searchDestCountry !=''">
AND DEST_COUNTRY =#{searchDestCountry}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDfPriTagReport" parameterType="com.nis.domain.restful.DfPzReport"
resultMap="DfPzReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,ABSUM,SERVICE
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 OR PZ.CFG_ID IN (SELECT DISTINCT CFG_ID
FROM
DF_PZ_REPORT T WHERE T.ACTIVE_SYS = 2 AND T.CFG_ID NOT IN
(SELECT
CFG_ID FROM DF_PZ_REPORT B WHERE B.ACTIVE_SYS = 4)) THEN
SUM ELSE 0
END) ABSUM,
PZ.SERVICE
FROM DF_PZ_REPORT PZ
GROUP BY PZ.SERVICE
)
DF_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDfPzReportStat" parameterType="com.nis.domain.restful.DfPzReportStat"
resultMap="DfPzReportStatMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
CFG_ID,SERVICE,SUM
</otherwise>
</choose>
FROM (
<choose>
<when test="searchStatActiveSys == 6 ">
SELECT CFG_ID,SERVICE, DECODE(ASUM,0,BSUM,ASUM) SUM FROM (
SELECT config_id CFG_ID, SERVICE,
SUM(CASE WHEN ACTIVE_SYS=4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN ACTIVE_SYS=2 THEN SUM ELSE 0 END) BSUM
FROM df_stat_log_hour
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND stat_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND stat_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
</where>
GROUP BY config_id,SERVICE
) REPORT
</when>
<otherwise>
SELECT
config_id cfg_id,SERVICE,SUM(sum) SUM
FROM df_stat_log_hour
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND stat_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND stat_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
AND active_sys=#{searchStatActiveSys}
</where>
GROUP BY config_id,SERVICE
</otherwise>
</choose>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDfPzReportStatMinutes" parameterType="com.nis.domain.restful.DfPzReportStat"
resultMap="DfPzReportStatMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
CFG_ID,SERVICE,SUM
</otherwise>
</choose>
FROM (
<choose>
<when test="searchStatActiveSys == 6 ">
SELECT CFG_ID,SERVICE, DECODE(ASUM,0,BSUM,ASUM) SUM FROM (
SELECT CFG_ID, SERVICE,
SUM(CASE WHEN ACTIVE_SYS=4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN ACTIVE_SYS=2 THEN SUM ELSE 0 END) BSUM
FROM DF_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
</where>
GROUP BY CFG_ID,SERVICE
) REPORT
</when>
<otherwise>
SELECT
CFG_ID,SERVICE,SUM(sum) SUM
FROM DF_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
AND active_sys=#{searchStatActiveSys}
</where>
GROUP BY CFG_ID,SERVICE
</otherwise>
</choose>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDfPzReportSum" parameterType="com.nis.domain.restful.DfPzReportStat"
resultType="java.lang.Long">
SELECT
SUM(sum) SUM
FROM DF_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
AND active_sys=#{searchStatActiveSys}
</where>
</select>
<resultMap id="DfServiceReportMap" type="com.nis.domain.restful.DfServiceReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="CSUM" jdbcType="BIGINT" property="csum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SERVICE" jdbcType="INTEGER" property="serviceType" />
</resultMap>
<!-- DfServiceReport日志查询 -->
<sql id="dfServiceReportPorperty">
,service
</sql>
<select id="findDfServiceReport" parameterType="com.nis.domain.restful.DfServiceReport"
resultMap="DfServiceReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />
<include refid="dfServiceReportPorperty" />
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 1 THEN SUM ELSE 0 END) CSUM,
PZ.REPORT_TIME,
PZ.SERVICE
FROM DF_SERVICE_REPORT PZ
GROUP BY PZ.SERVICE, PZ.REPORT_TIME
) DF_SERVICE_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfTagReportMap" type="com.nis.domain.restful.DfTagReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="ABSUM" jdbcType="BIGINT" property="absum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="TAG" jdbcType="INTEGER" property="tag" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<!-- DfTagReport日志查询 -->
<sql id="dfTagReportPorperty">
,tag
</sql>
<select id="findDfTagReportPage" parameterType="com.nis.domain.restful.DfTagReport"
resultMap="DfTagReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
tag,REPORT_TIME, asum, bsum,absum,service
</otherwise>
</choose>
FROM (
SELECT tag,REPORT_TIME, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select tag, asum, bsum, absum, REPORT_TIME,service
from (select tag,
REPORT_TIME,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.REPORT_TIME,
pz.cfg_id,
pz.tag,pz.service
FROM df_pz_tag_report PZ
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchTag != null and searchTag !=''">
AND tag in(${searchTag})
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
</where>
GROUP BY pz.cfg_id, pz.tag, PZ.REPORT_TIME,pz.service)) a)
group by tag, REPORT_TIME,service
)
DF_TAG_REPORT
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDfTagReport" parameterType="com.nis.domain.restful.DfTagReport"
resultMap="DfTagReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
tag,REPORT_TIME, asum, bsum,absum,service
</otherwise>
</choose>
FROM (
SELECT tag,REPORT_TIME, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select tag, asum, bsum, absum, REPORT_TIME,service
from (select tag,
REPORT_TIME,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.REPORT_TIME,
pz.cfg_id,
pz.tag,pz.service
FROM df_pz_tag_report PZ
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchTag != null and searchTag !=''">
AND tag in(${searchTag})
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
</where>
GROUP BY pz.cfg_id, pz.tag, PZ.REPORT_TIME,pz.service)) a)
group by tag, REPORT_TIME,service
)
DF_TAG_REPORT
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfLwhhReportMap" type="com.nis.domain.restful.DfLwhhReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="lwhh" jdbcType="INTEGER" property="lwhh" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<select id="findDfLwhhReport" parameterType="com.nis.domain.restful.DfLwhhReport"
resultMap="DfLwhhReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,SERVICE,LWHH
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.lwhh,pz.service
FROM DF_LWHH_REPORT PZ
GROUP BY
PZ.lwhh,pz.service, PZ.REPORT_TIME
)
DF_LWHH_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND lwhh=#{searchLwhh}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfEntranceReportMap" type="com.nis.domain.restful.DfEntranceReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="ENTRANCE_ID" jdbcType="INTEGER" property="entraceId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<select id="findDfEntranceReport" parameterType="com.nis.domain.restful.DfEntranceReport"
resultMap="DfEntranceReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,SERVICE,ENTRANCE_ID
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.ENTRANCE_ID,pz.service
FROM DF_ENTRANCE_REPORT PZ
GROUP BY
PZ.ENTRANCE_ID,pz.service, PZ.REPORT_TIME
)
DF_LWHH_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
<if test="searchEntraceId != null and searchEntraceId !=''">
AND ENTRANCE_ID=#{searchEntraceId}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- DF_SRCIP_DOMESTIC_REPORT -->
<sql id="dfSrcIpPorperty">
,SRC_PROVINCE,SRC_CITY
</sql>
<resultMap id="DfSrcIpReportMap" type="com.nis.domain.restful.DfSrcIpReport">
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="csum" jdbcType="BIGINT" property="csum" />
<result column="report_time" jdbcType="TIMESTAMP" property="reportTime" />
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="src_city" jdbcType="VARCHAR" property="srcCity" />
</resultMap>
<select id="findDfSrcIpReport" parameterType="com.nis.domain.restful.DfSrcIpReport"
resultMap="DfSrcIpReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />
<include refid="dfSrcIpPorperty" />
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN t.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN t.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
SUM(CASE WHEN
t.ACTIVE_SYS = 1 THEN SUM ELSE 0 END) CSUM,
t.SRC_PROVINCE,
t.SRC_CITY
,
t.REPORT_TIME
FROM DF_SRCIP_DOMESTIC_REPORT t
GROUP BY t.SRC_PROVINCE,
t.SRC_CITY, t.REPORT_TIME
) DF_SRCIP_DOMESTIC_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- DF_DESTIP_COUNTRY_REPORT -->
<sql id="dfDestIpPorperty">
,DEST_COUNTRY
</sql>
<resultMap id="DfDestIpReportMap" type="com.nis.domain.restful.DfDestIpReport">
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="csum" jdbcType="BIGINT" property="csum" />
<result column="report_time" jdbcType="TIMESTAMP" property="reportTime" />
<result column="dest_country" jdbcType="VARCHAR" property="destCountry" />
</resultMap>
<select id="findDfDestIpReport" parameterType="com.nis.domain.restful.DfDestIpReport"
resultMap="DfDestIpReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />
<include refid="dfDestIpPorperty" />
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN t.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN t.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
SUM(CASE WHEN
t.ACTIVE_SYS = 1 THEN SUM ELSE 0 END) CSUM,
t.DEST_COUNTRY
,
t.REPORT_TIME
FROM DF_DESTIP_COUNTRY_REPORT t
GROUP BY t.DEST_COUNTRY,
t.REPORT_TIME
) DF_DESTIP_COUNTRY_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,857 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DfStatLogDao">
<!-- 配置报表的公共属性 -->
<sql id="commonPorperty">
CONFIG_ID,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DfStatLogDailyMap" type="com.nis.domain.restful.DfStatLogDaily">
<result column="config_id" jdbcType="BIGINT" property="configId" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_StatLog_Daily日志查询 -->
<select id="dfStatLogDaily" parameterType="com.nis.domain.restful.DfStatLogDaily" resultMap="DfStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>
</otherwise>
</choose>
FROM
(
select config_id,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select config_id,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchConfigId != null and searchConfigId !=''">
and config_id=#{searchConfigId}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by config_id,service,stat_time
) A
GROUP BY config_id,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfStatLogMonthMap" type="com.nis.domain.restful.DfStatLogMonth">
<result column="config_id" jdbcType="BIGINT" property="configId" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_Stat_Log_Month日志查询 -->
<select id="dfStatLogMonth" parameterType="com.nis.domain.restful.DfStatLogMonth" resultMap="DfStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>
</otherwise>
</choose>
FROM
(
select config_id,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select config_id,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchConfigId != null and searchConfigId !=''">
and config_id=#{searchConfigId}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by config_id,service,stat_time
) A
GROUP BY config_id,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 标签报表的公共属性 -->
<sql id="tagCommonPorperty">
TAG,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DfTagStatLogDailyMap" type="com.nis.domain.restful.DfTagStatLogDaily">
<result column="tag" jdbcType="INTEGER" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_TAG_Stat_Log_Daily日志查询 -->
<select id="dfTagStatLogDaily" parameterType="com.nis.domain.restful.DfTagStatLogDaily" resultMap="DfTagStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="tagCommonPorperty"/>
</otherwise>
</choose>
FROM
(
SELECT tag,'7' as active_sys,stat_time, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select tag, asum, bsum, absum, stat_time,service
from (select tag,
stat_time,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.stat_time,
pz.config_id,
pz.tag,pz.service
FROM df_cfg_tag_stat_log_daily PZ
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
and tag=#{searchTag}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY pz.config_id, pz.tag, PZ.stat_time,pz.service)) a)
group by tag, stat_time,service
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfTagStatLogMonthMap" type="com.nis.domain.restful.DfTagStatLogMonth">
<result column="tag" jdbcType="INTEGER" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_Tag_Stat_Log_Month日志查询 -->
<select id="dfTagStatLogMonth" parameterType="com.nis.domain.restful.DfTagStatLogMonth" resultMap="DfTagStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="tagCommonPorperty"/>
</otherwise>
</choose>
FROM
(
SELECT tag,'7' as active_sys,stat_time, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select tag, asum, bsum, absum, stat_time,service
from (select tag,
stat_time,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.stat_time,
pz.config_id,
pz.tag,pz.service
FROM df_cfg_tag_stat_log_month PZ
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
and tag=#{searchTag}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY pz.config_id, pz.tag, PZ.stat_time,pz.service)) a)
group by tag, stat_time,service
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 性质报表的公共属性 -->
<sql id="attrCommonPorperty">
attr_type,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DfAttrStatLogDailyMap" type="com.nis.domain.restful.DfAttrStatLogDaily">
<result column="attr_type" jdbcType="INTEGER" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_ATTR_Stat_Log_Daily日志查询 -->
<select id="dfAttrStatLogDaily" parameterType="com.nis.domain.restful.DfAttrStatLogDaily" resultMap="DfAttrStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="attrCommonPorperty"/>
</otherwise>
</choose>
FROM
(
SELECT attr_type,'7' as active_sys,stat_time, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select attr_type, asum, bsum, absum, stat_time,service
from (select attr_type,
stat_time,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.stat_time,
pz.config_id,
pz.attr_type,pz.service
FROM df_cfg_attr_stat_log_daily PZ
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
and attr_type=#{searchAttrType}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY pz.config_id, pz.attr_type, PZ.stat_time,pz.service)) a)
group by attr_type, stat_time,service
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfAttrStatLogMonthMap" type="com.nis.domain.restful.DfAttrStatLogMonth">
<result column="attr_type" jdbcType="INTEGER" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_Attr_Stat_Log_Month日志查询 -->
<select id="dfAttrStatLogMonth" parameterType="com.nis.domain.restful.DfAttrStatLogMonth" resultMap="DfAttrStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="attrCommonPorperty"/>
</otherwise>
</choose>
FROM
(
SELECT attr_type,'7' as active_sys,stat_time, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select attr_type, asum, bsum, absum, stat_time,service
from (select attr_type,
stat_time,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.stat_time,
pz.config_id,
pz.attr_type,pz.service
FROM df_cfg_attr_stat_log_month PZ
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
and attr_type=#{searchAttrType}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY pz.config_id, pz.attr_type, PZ.stat_time,pz.service)) a)
group by attr_type, stat_time,service
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 局点报表的公共属性 -->
<sql id="entrCommonPorperty">
ENTRANCE_ID,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DfEntrStatLogDailyMap" type="com.nis.domain.restful.DfEntrStatLogDaily">
<result column="ENTRANCE_ID" jdbcType="INTEGER" property="entranceId" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_ATTR_Stat_Log_Daily日志查询 -->
<select id="dfEntrStatLogDaily" parameterType="com.nis.domain.restful.DfEntrStatLogDaily" resultMap="DfEntrStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="entrCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select ENTRANCE_ID,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select ENTRANCE_ID,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_entr_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchEntranceId != null and searchEntranceId !=''">
and ENTRANCE_ID=#{searchEntranceId}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by ENTRANCE_ID,service,stat_time
) A
GROUP BY ENTRANCE_ID,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfEntrStatLogMonthMap" type="com.nis.domain.restful.DfEntrStatLogMonth">
<result column="ENTRANCE_ID" jdbcType="INTEGER" property="entranceId" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_Entr_Stat_Log_Month日志查询 -->
<select id="dfEntrStatLogMonth" parameterType="com.nis.domain.restful.DfEntrStatLogMonth" resultMap="DfEntrStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="entrCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select ENTRANCE_ID,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select ENTRANCE_ID,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_entr_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchEntranceId != null and searchEntranceId !=''">
and ENTRANCE_ID=#{searchEntranceId}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by ENTRANCE_ID,service,stat_time
) A
GROUP BY ENTRANCE_ID,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 来文函号报表的公共属性 -->
<sql id="lwhhCommonPorperty">
lwhh,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DfLwhhStatLogDailyMap" type="com.nis.domain.restful.DfLwhhStatLogDaily">
<result column="lwhh" jdbcType="INTEGER" property="lwhh" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_ATTR_Stat_Log_Daily日志查询 -->
<select id="dfLwhhStatLogDaily" parameterType="com.nis.domain.restful.DfLwhhStatLogDaily" resultMap="DfLwhhStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="lwhhCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select lwhh,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select lwhh,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_lwhh_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
and lwhh=#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by lwhh,service,stat_time
) A
GROUP BY lwhh,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfLwhhStatLogMonthMap" type="com.nis.domain.restful.DfLwhhStatLogMonth">
<result column="lwhh" jdbcType="INTEGER" property="lwhh" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_Lwhh_Stat_Log_Month日志查询 -->
<select id="dfLwhhStatLogMonth" parameterType="com.nis.domain.restful.DfLwhhStatLogMonth" resultMap="DfLwhhStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="lwhhCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select lwhh,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select lwhh,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DF_lwhh_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
and lwhh=#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by lwhh,service,stat_time
) A
GROUP BY lwhh,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 境内源ip报表的公共属性 -->
<sql id="srcIpCommonPorperty">
SRC_PROVINCE,SRC_CITY,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DfSrcIpDomesticStatLogDailyMap" type="com.nis.domain.restful.DfSrcIpDomesticStatLogDaily">
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_SrcIp_Stat_Log_Daily日志查询 -->
<select id="dfSrcIpDomesticStatLogDaily" parameterType="com.nis.domain.restful.DfSrcIpDomesticStatLogDaily" resultMap="DfSrcIpDomesticStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="srcIpCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,SRC_CITY,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,SRC_CITY,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from df_SRCIP_stat_log_daily
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,SRC_CITY,service,stat_time
) A
GROUP BY SRC_PROVINCE,SRC_CITY,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfSrcIpDomesticStatLogMonthMap" type="com.nis.domain.restful.DfSrcIpDomesticStatLogMonth">
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_SrcIpDomestic_Stat_Log_Month日志查询 -->
<select id="dfSrcIpDomesticStatLogMonth" parameterType="com.nis.domain.restful.DfSrcIpDomesticStatLogMonth" resultMap="DfSrcIpDomesticStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="srcIpCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,SRC_CITY,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,SRC_CITY,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from df_SRCIP_stat_log_month
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,SRC_CITY,service,stat_time
) A
GROUP BY SRC_PROVINCE,SRC_CITY,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 国家目的ip报表的公共属性 -->
<sql id="destIpCommonPorperty">
DEST_COUNTRY,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DfDestIpCounrtyStatLogDailyMap" type="com.nis.domain.restful.DfDestIpCounrtyStatLogDaily">
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="destCountry" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_DestIp_Stat_Log_Daily日志查询 -->
<select id="dfDestIpCounrtyStatLogDaily" parameterType="com.nis.domain.restful.DfDestIpCounrtyStatLogDaily" resultMap="DfDestIpCounrtyStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="destIpCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select DEST_COUNTRY,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select DEST_COUNTRY,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from df_DESTIP_stat_log_daily
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by DEST_COUNTRY,service,stat_time
) A
GROUP BY DEST_COUNTRY,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DfDestIpCounrtyStatLogMonthMap" type="com.nis.domain.restful.DfDestIpCounrtyStatLogMonth">
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="destCountry" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Df_DestIp_Stat_Log_Month日志查询 -->
<select id="dfDestIpCounrtyStatLogMonth" parameterType="com.nis.domain.restful.DfDestIpCounrtyStatLogMonth" resultMap="DfDestIpCounrtyStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="destIpCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select DEST_COUNTRY,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select DEST_COUNTRY,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from df_DESTIP_stat_log_Month
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by DEST_COUNTRY,service,stat_time
) A
GROUP BY DEST_COUNTRY,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,776 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DjJitLogSearchDao">
<resultMap id="DjJitFlSrcReportMap" type="com.nis.domain.restful.DjJitFlSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="FL" jdbcType="INTEGER" property="fl" />
<result column="XZ" jdbcType="INTEGER" property="xz" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitFlSrcReport_Column_List">
STAT_ID, FL, XZ, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitFlSrcReport" parameterType="com.nis.domain.restful.DjJitFlSrcReport"
resultMap="DjJitFlSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitFlSrcReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_FL_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchFl != null and searchFl !=''">
AND FL = #{searchFl}
</if>
<if test="searchXz != null and searchXz !=''">
AND XZ = #{searchXz}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitFlDestReportMap" type="com.nis.domain.restful.DjJitFlDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="FL" jdbcType="INTEGER" property="fl" />
<result column="XZ" jdbcType="INTEGER" property="xz" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitFlDestReport_Column_List">
STAT_ID, FL, XZ, REPORT_TIME, DEST_COUNTRY, DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitFlDestReport" parameterType="com.nis.domain.restful.DjJitFlDestReport"
resultMap="DjJitFlDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitFlDestReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_FL_Dest_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchFl != null and searchFl !=''">
AND FL = #{searchFl}
</if>
<if test="searchXz != null and searchXz !=''">
AND XZ = #{searchXz}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitAffairSrcReportMap" type="com.nis.domain.restful.DjJitAffairSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="Affair" jdbcType="INTEGER" property="affair" />
<result column="topic" jdbcType="INTEGER" property="topic" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitAffairSrcReport_Column_List">
STAT_ID, Affair,topic, REPORT_TIME, SRC_COUNTRY,
SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitAffairSrcReport" parameterType="com.nis.domain.restful.DjJitAffairSrcReport"
resultMap="DjJitAffairSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitAffairSrcReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_AFFAIR_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchAffair != null and searchAffair !=''">
AND Affair = #{searchAffair}
</if>
<if test="searchTopic != null and searchTopic !=''">
AND topic = #{searchTopic}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitAffairDestReportMap" type="com.nis.domain.restful.DjJitAffairDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="Affair" jdbcType="INTEGER" property="affair" />
<result column="topic" jdbcType="INTEGER" property="topic" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitAffairDestReport_Column_List">
STAT_ID, Affair,topic, REPORT_TIME, DEST_COUNTRY,
DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitAffairDestReport" parameterType="com.nis.domain.restful.DjJitAffairDestReport"
resultMap="DjJitAffairDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitAffairDestReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_AFFAIR_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchAffair != null and searchAffair !=''">
AND Affair = #{searchAffair}
</if>
<if test="searchTopic != null and searchTopic !=''">
AND topic = #{searchTopic}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitMissionSrcReportMap" type="com.nis.domain.restful.DjJitMissionSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="mission" jdbcType="INTEGER" property="mission" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitMissionSrcReport_Column_List">
STAT_ID, mission, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitMissionSrcReport" parameterType="com.nis.domain.restful.DjJitMissionSrcReport"
resultMap="DjJitMissionSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitMissionSrcReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_MISSION_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchMission != null and searchMission !=''">
AND mission = #{searchMission}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitMissionDestReportMap" type="com.nis.domain.restful.DjJitMissionDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="mission" jdbcType="INTEGER" property="mission" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitMissionDestReport_Column_List">
STAT_ID, mission, REPORT_TIME, DEST_COUNTRY, DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitMissionDestReport" parameterType="com.nis.domain.restful.DjJitMissionDestReport"
resultMap="DjJitMissionDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitMissionDestReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_MISSION_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchMission != null and searchMission !=''">
AND mission = #{searchMission}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitGuaranteeSrcReportMap"
type="com.nis.domain.restful.DjJitGuaranteeSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="guarantee" jdbcType="INTEGER" property="guarantee" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitGuaranteeSrcReport_Column_List">
STAT_ID, guarantee, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitGuaranteeSrcReport" parameterType="com.nis.domain.restful.DjJitGuaranteeSrcReport"
resultMap="DjJitGuaranteeSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitGuaranteeSrcReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_GUARANTEE_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchGuarantee != null and searchGuarantee !=''">
AND guarantee = #{searchGuarantee}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitGuaranteeDestReportMap"
type="com.nis.domain.restful.DjJitGuaranteeDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="guarantee" jdbcType="INTEGER" property="guarantee" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitGuaranteeDestReport_Column_List">
STAT_ID, guarantee, REPORT_TIME, DEST_COUNTRY,
DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitGuaranteeDestReport" parameterType="com.nis.domain.restful.DjJitGuaranteeDestReport"
resultMap="DjJitGuaranteeDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitGuaranteeDestReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_GUARANTEE_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchGuarantee != null and searchGuarantee !=''">
AND guarantee = #{searchGuarantee}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitTagSrcReportMap" type="com.nis.domain.restful.DjJitTagSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="tag" jdbcType="INTEGER" property="tag" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitTagSrcReport_Column_List">
STAT_ID, tag, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitTagSrcReport" parameterType="com.nis.domain.restful.DjJitTagSrcReport"
resultMap="DjJitTagSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitTagSrcReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_TAG_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND tag in (${searchTag})
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitTagDestReportMap" type="com.nis.domain.restful.DjJitTagDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="tag" jdbcType="INTEGER" property="tag" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitTagDestReport_Column_List">
STAT_ID, tag, REPORT_TIME, DEST_COUNTRY,
DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitTagDestReport" parameterType="com.nis.domain.restful.DjJitTagDestReport"
resultMap="DjJitTagDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitTagDestReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_TAG_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND tag in (${searchTag})
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitIdSrcReportMap" type="com.nis.domain.restful.DjJitIdSrcReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="id" jdbcType="BIGINT" property="id" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitIdSrcReport_Column_List">
STAT_ID, id, REPORT_TIME, SRC_COUNTRY, SRC_PROVINCE,
SRC_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitIdSrcReport" parameterType="com.nis.domain.restful.DjJitIdSrcReport"
resultMap="DjJitIdSrcReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitIdSrcReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_ID_SRC_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchId != null and searchId !=''">
AND id = #{searchId}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjJitIdDestReportMap" type="com.nis.domain.restful.DjJitIdDestReport">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="id" jdbcType="BIGINT" property="id" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="nation" />
<result column="DEST_PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="DEST_CITY" jdbcType="VARCHAR" property="city" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="DjJitIdDestReport_Column_List">
STAT_ID, id, REPORT_TIME, DEST_COUNTRY,
DEST_PROVINCE,
DEST_CITY, SUM,
SERVICE
</sql>
<select id="findDjJitIdDestReport" parameterType="com.nis.domain.restful.DjJitIdDestReport"
resultMap="DjJitIdDestReportMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjJitIdDestReport_Column_List" />
</otherwise>
</choose>
from DJ_JIT_ID_DEST_REPORT
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchId != null and searchId !=''">
AND id = #{searchId}
</if>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjCkStatLogMap" type="com.nis.domain.restful.DjCkStatLog">
<id column="STAT_ID" jdbcType="BIGINT" property="statId" />
<result column="CONFIG_ID" jdbcType="BIGINT" property="configId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="GJ_CK_ID" jdbcType="BIGINT" property="gjCkId" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="CAP_TIME" jdbcType="TIMESTAMP" property="capTime" />
</resultMap>
<sql id="DjCkStatLog_Column_List">
STAT_ID, CONFIG_ID, SERVICE, GJ_CK_ID,SUM,CAP_TIME,active_sys
</sql>
<select id="findDjCkStatLog" parameterType="com.nis.domain.restful.DjCkStatLog"
resultMap="DjCkStatLogMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="DjCkStatLog_Column_List" />
</otherwise>
</choose>
from DJ_CK_STAT_LOG
<where>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
<if test="searchGjCkId != null and searchGjCkId !=''">
AND GJ_CK_ID = #{searchGjCkId}
</if>
<if test="searchCfgId != null and searchCfgId !=''">
AND CONFIG_ID = #{searchCfgId}
</if>
<if test="searchActiveSys != null and searchActiveSys !=''">
AND active_sys = #{searchActiveSys}
</if>
<if test="searchCapStartTime != null and searchCapStartTime !=''">
<![CDATA[AND CAP_TIME >= to_date(#{searchCapStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchCapEndTime != null and searchCapEndTime !=''">
<![CDATA[AND CAP_TIME < to_date(#{searchCapEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DjMultiDimensionalReportDao">
<!-- 所有实时统计report表的公共属性 -->
<sql id="commonPorperty">
ASUM,BSUM,REPORT_TIME,SERVICE
</sql>
<resultMap id="DjLwhhAttrReportMap" type="com.nis.domain.restful.DjLwhhAttrReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="LWHH" jdbcType="BIGINT" property="lwhh" />
<result column="ATTR_TYPE" jdbcType="BIGINT" property="attrType" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
</resultMap>
<select id="findDjLwhhAttrReport" parameterType="com.nis.domain.restful.DjLwhhAttrReport"
resultMap="DjLwhhAttrReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />,LWHH,ATTR_TYPE
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.LWHH,
pz.ATTR_TYPE
FROM DJ_LWHH_TYPE_REPORT PZ
GROUP BY PZ.LWHH,PZ.ATTR_TYPE, PZ.SERVICE, PZ.REPORT_TIME
) DJ_LWHH_TYPE_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjLwhhTagReportMap" type="com.nis.domain.restful.DjLwhhTagReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="LWHH" jdbcType="BIGINT" property="lwhh" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
</resultMap>
<select id="findDjLwhhTagReportPage" parameterType="com.nis.domain.restful.DjLwhhTagReport"
resultMap="DjLwhhTagReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />,LWHH,TAG
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.LWHH,
pz.TAG
FROM DJ_LWHH_TAG_REPORT PZ
GROUP BY PZ.LWHH,PZ.TAG, PZ.SERVICE, PZ.REPORT_TIME
) DJ_LWHH_TAG_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG in (${searchTag})
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjSrcIpTagReportMap" type="com.nis.domain.restful.DjSrcIpTagReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
</resultMap>
<select id="findDjSrcIpTagReportPage" parameterType="com.nis.domain.restful.DjSrcIpTagReport"
resultMap="DjSrcIpTagReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />,SRC_PROVINCE,TAG
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.SRC_PROVINCE,
pz.TAG
FROM DJ_SRCIP_DOMESTIC_TAG_REPORT PZ
GROUP BY PZ.SRC_PROVINCE,PZ.TAG, PZ.SERVICE, PZ.REPORT_TIME
) DJ_SRCIP_DOMESTIC_TAG_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG in (${searchTag})
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjSrcIpAttrReportMap" type="com.nis.domain.restful.DjSrcIpAttrReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="ATTR_TYPE" jdbcType="BIGINT" property="attrType" />
<result column="SERVICE" jdbcType="BIGINT" property="service" />
</resultMap>
<select id="findDjSrcIpAttrReportPage" parameterType="com.nis.domain.restful.DjSrcIpAttrReport"
resultMap="DjSrcIpAttrReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />,SRC_PROVINCE,ATTR_TYPE
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.SRC_PROVINCE,
pz.ATTR_TYPE
FROM DJ_SRCIP_DOMESTIC_TYPE_REPORT PZ
GROUP BY PZ.SRC_PROVINCE,PZ.ATTR_TYPE, PZ.SERVICE, PZ.REPORT_TIME
) DJ_SRCIP_DOMESTIC_TYPE_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,475 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DjMultiDimensionalStatLogDao">
<!-- 配置报表的公共属性 -->
<sql id="commonPorperty">
ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DjLwhhAttrDailyMap" type="com.nis.domain.restful.DjLwhhAttrDaily">
<result column="lwhh" jdbcType="BIGINT" property="lwhh" />
<result column="attr_type" jdbcType="BIGINT" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="djLwhhAttrDaily" parameterType="com.nis.domain.restful.DjLwhhAttrDaily" resultMap="DjLwhhAttrDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,LWHH,ATTR_TYPE
</otherwise>
</choose>
FROM
(
select LWHH,ATTR_TYPE,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select LWHH,ATTR_TYPE,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_LWHH_TYPE_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by LWHH,ATTR_TYPE,service,stat_time
) DJ_LWHH_TYPE_STAT_LOG_DAILY
GROUP BY LWHH,ATTR_TYPE,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjLwhhAttrMonthMap" type="com.nis.domain.restful.DjLwhhAttrMonth">
<result column="lwhh" jdbcType="BIGINT" property="lwhh" />
<result column="attr_type" jdbcType="BIGINT" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="djLwhhAttrMonth" parameterType="com.nis.domain.restful.DjLwhhAttrMonth" resultMap="DjLwhhAttrMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,LWHH,ATTR_TYPE
</otherwise>
</choose>
FROM
(
select LWHH,ATTR_TYPE,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select LWHH,ATTR_TYPE,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_LWHH_TYPE_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by LWHH,ATTR_TYPE,service,stat_time
) DJ_LWHH_TYPE_STAT_LOG_MONTH
GROUP BY LWHH,ATTR_TYPE,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjLwhhTagDailyMap" type="com.nis.domain.restful.DjLwhhTagDaily">
<result column="lwhh" jdbcType="BIGINT" property="lwhh" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="djLwhhTagDaily" parameterType="com.nis.domain.restful.DjLwhhTagDaily" resultMap="DjLwhhTagDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,LWHH,TAG
</otherwise>
</choose>
FROM
(
select LWHH,TAG,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select LWHH,TAG,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_LWHH_TAG_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG IN (${searchTag})
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by LWHH,TAG,service,stat_time
) DJ_LWHH_TAG_STAT_LOG_DAILY
GROUP BY LWHH,TAG,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjLwhhTagMonthMap" type="com.nis.domain.restful.DjLwhhTagMonth">
<result column="lwhh" jdbcType="BIGINT" property="lwhh" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="djLwhhTagMonth" parameterType="com.nis.domain.restful.DjLwhhTagMonth" resultMap="DjLwhhTagMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,LWHH,TAG
</otherwise>
</choose>
FROM
(
select LWHH,TAG,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select LWHH,TAG,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_LWHH_TAG_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG IN (${searchTag})
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND LWHH =#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by LWHH,TAG,service,stat_time
) DJ_LWHH_TAG_STAT_LOG_MONTH
GROUP BY LWHH,TAG,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjSrcIpAttrDailyMap" type="com.nis.domain.restful.DjSrcIpAttrDaily">
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="attr_type" jdbcType="BIGINT" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="djSrcIpAttrDaily" parameterType="com.nis.domain.restful.DjSrcIpAttrDaily" resultMap="DjSrcIpAttrDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,SRC_PROVINCE,ATTR_TYPE
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,ATTR_TYPE,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,ATTR_TYPE,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_SRCIP_TYPE_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,ATTR_TYPE,service,stat_time
) DJ_SRCIP_TYPE_STAT_LOG_DAILY
GROUP BY SRC_PROVINCE,ATTR_TYPE,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjSrcIpAttrMonthMap" type="com.nis.domain.restful.DjSrcIpAttrMonth">
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="attr_type" jdbcType="BIGINT" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="djSrcIpAttrMonth" parameterType="com.nis.domain.restful.DjSrcIpAttrMonth" resultMap="DjSrcIpAttrMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,SRC_PROVINCE,ATTR_TYPE
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,ATTR_TYPE,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,ATTR_TYPE,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_SRCIP_TYPE_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,ATTR_TYPE,service,stat_time
) DJ_SRCIP_TYPE_STAT_LOG_MONTH
GROUP BY SRC_PROVINCE,ATTR_TYPE,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjSrcIpTagDailyMap" type="com.nis.domain.restful.DjSrcIpTagDaily">
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="djSrcIpTagDaily" parameterType="com.nis.domain.restful.DjSrcIpTagDaily" resultMap="DjSrcIpTagDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,SRC_PROVINCE,TAG
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,TAG,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,TAG,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_SRCIP_TAG_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG IN (${searchTag})
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,TAG,service,stat_time
) DJ_SRCIP_TAG_STAT_LOG_DAILY
GROUP BY SRC_PROVINCE,TAG,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjSrcIpTagMonthMap" type="com.nis.domain.restful.DjSrcIpTagMonth">
<result column="src_province" jdbcType="VARCHAR" property="srcProvince" />
<result column="TAG" jdbcType="BIGINT" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<select id="djSrcIpTagMonth" parameterType="com.nis.domain.restful.DjSrcIpTagMonth" resultMap="DjSrcIpTagMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>,SRC_PROVINCE,TAG
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,TAG,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,TAG,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_SRCIP_TAG_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
AND TAG IN (${searchTag})
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,TAG,service,stat_time
) DJ_SRCIP_TAG_STAT_LOG_MONTH
GROUP BY SRC_PROVINCE,TAG,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,617 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DjReportDao">
<!-- 所有实时统计report表的公共属性 -->
<sql id="commonPorperty">
ASUM,BSUM,CSUM,REPORT_TIME
</sql>
<!-- DjPzReport日志查询 -->
<resultMap id="DjPzReportMap" type="com.nis.domain.restful.DjPzReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="CFG_ID" jdbcType="BIGINT" property="cfgId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<resultMap id="DjPzReportStatMap" type="com.nis.domain.restful.DjPzReportStat">
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="CFG_ID" jdbcType="BIGINT" property="configId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<!-- DJ_PZ_REPORT -->
<sql id="djPzReportPorperty">
,CFG_ID,SERVICE
</sql>
<select id="findDjPzReport" parameterType="com.nis.domain.restful.DjPzReport"
resultMap="DjPzReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,CSUM,REPORT_TIME,SERVICE,CFG_ID
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 1 THEN SUM ELSE 0 END) CSUM,
PZ.REPORT_TIME,
PZ.CFG_ID,
PZ.SERVICE
FROM DJ_PZ_REPORT PZ
GROUP BY PZ.CFG_ID,
PZ.SERVICE, PZ.REPORT_TIME
) DJ_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchCfgId != null and searchCfgId !=''">
AND CFG_ID =#{searchCfgId}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDjPzPrivPage" parameterType="com.nis.domain.restful.DjPzReport"
resultMap="DjPzReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,SERVICE,CFG_ID
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.CFG_ID,
PZ.SERVICE
FROM DJ_PZ_REPORT PZ
GROUP BY
PZ.CFG_ID, PZ.SERVICE, PZ.REPORT_TIME
) DJ_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchCfgId != null and searchCfgId !=''">
AND CFG_ID =#{searchCfgId}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDjPzReportStat" parameterType="com.nis.domain.restful.DjPzReportStat"
resultMap="DjPzReportStatMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
CFG_ID,SERVICE,SUM
</otherwise>
</choose>
FROM (
<choose>
<when test="searchStatActiveSys == 6 ">
SELECT CFG_ID,SERVICE, DECODE(ASUM,0,BSUM,ASUM) SUM FROM (
SELECT
config_id CFG_ID, SERVICE,
SUM(CASE WHEN ACTIVE_SYS=4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN ACTIVE_SYS=2 THEN SUM ELSE 0 END) BSUM
FROM dj_stat_log_hour
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND stat_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND stat_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
</where>
GROUP BY config_id,SERVICE
) REPORT
</when>
<otherwise>
SELECT
config_id CFG_ID,SERVICE,SUM(sum) SUM
FROM dj_stat_log_hour
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND stat_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND stat_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
AND active_sys=#{searchStatActiveSys}
</where>
GROUP BY config_id,SERVICE
</otherwise>
</choose>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDjPzReportStatMinutes" parameterType="com.nis.domain.restful.DjPzReportStat"
resultMap="DjPzReportStatMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
CFG_ID,SERVICE,SUM
</otherwise>
</choose>
FROM (
<choose>
<when test="searchStatActiveSys == 6 ">
SELECT CFG_ID,SERVICE, DECODE(ASUM,0,BSUM,ASUM) SUM FROM (
SELECT
CFG_ID, SERVICE,
SUM(CASE WHEN ACTIVE_SYS=4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN ACTIVE_SYS=2 THEN SUM ELSE 0 END) BSUM
FROM DJ_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
</where>
GROUP BY CFG_ID,SERVICE
) REPORT
</when>
<otherwise>
SELECT
CFG_ID,SERVICE,SUM(sum) SUM
FROM DJ_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
AND active_sys=#{searchStatActiveSys}
</where>
GROUP BY CFG_ID,SERVICE
</otherwise>
</choose>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findDjPzReportSum" parameterType="com.nis.domain.restful.DjPzReportStat"
resultType="java.lang.Long">
SELECT
SUM(sum) SUM
FROM DJ_PZ_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null ">
AND SERVICE =#{searchService}
</if>
AND active_sys=#{searchStatActiveSys}
</where>
</select>
<resultMap id="DjAttrTypeReportMap" type="com.nis.domain.restful.DjAttrTypeReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="ABSUM" jdbcType="BIGINT" property="absum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="ATTR_TYPE" jdbcType="INTEGER" property="attrType" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<select id="findAttrTypeReport" parameterType="com.nis.domain.restful.DjAttrTypeReport"
resultMap="DjAttrTypeReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,absum,REPORT_TIME,ATTR_TYPE,SERVICE
</otherwise>
</choose>
FROM (
SELECT attr_type,REPORT_TIME, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select attr_type, asum, bsum, absum, REPORT_TIME,service
from (select attr_type,
REPORT_TIME,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.REPORT_TIME,
pz.cfg_id,
pz.attr_type,pz.service
FROM dj_pz_attr_report PZ
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchAttrType != null and searchAttrType !=''">
AND ATTR_TYPE =#{searchAttrType}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
GROUP BY pz.cfg_id, pz.attr_type, PZ.REPORT_TIME,pz.service)) a)
group by attr_type, REPORT_TIME,service
) DJ_CFG_ATTR_STAT_LOG_HOUR
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjSrcIpDomeSticReportMap" type="com.nis.domain.restful.DjSrcIpDomeSticReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
</resultMap>
<select id="findSrcIpDomeSticReport" parameterType="com.nis.domain.restful.DjSrcIpDomeSticReport"
resultMap="DjSrcIpDomeSticReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,SERVICE,SRC_PROVINCE,SRC_CITY
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.SRC_PROVINCE,pz.SRC_CITY
FROM
DJ_SRCIP_DOMESTIC_REPORT PZ
GROUP BY PZ.SRC_PROVINCE,pz.SRC_CITY,
PZ.SERVICE, PZ.REPORT_TIME
) DJ_SRCIP_DOMESTIC_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchSrcProvince != null and searchSrcProvince !=''">
AND SRC_PROVINCE =#{searchSrcProvince}
</if>
<if test="searchSrcCity != null and searchSrcCity !=''">
AND SRC_CITY =#{searchSrcCity}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjDestIpCountryReportMap" type="com.nis.domain.restful.DjDestIpCountryReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="destCountry" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<select id="findDestIpCountryReport" parameterType="com.nis.domain.restful.DjDestIpCountryReport"
resultMap="DjDestIpCountryReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,DEST_COUNTRY,SERVICE
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.SERVICE,
pz.DEST_COUNTRY
FROM DJ_DESTIP_COUNTRY_REPORT
PZ
GROUP BY PZ.DEST_COUNTRY, PZ.SERVICE, PZ.REPORT_TIME
)
DJ_DESTIP_COUNTRY_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchDestCountry != null and searchDestCountry !=''">
AND DEST_COUNTRY =#{searchDestCountry}
</if>
<if test="searchService != null and searchService !=''">
AND SERVICE =#{searchService}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjLwhhReportMap" type="com.nis.domain.restful.DjLwhhReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="lwhh" jdbcType="INTEGER" property="lwhh" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<select id="findDjLwhhReport" parameterType="com.nis.domain.restful.DjLwhhReport"
resultMap="DjLwhhReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,SERVICE,LWHH
</otherwise>
</choose>
FROM (SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME,
PZ.lwhh,pz.service
FROM DJ_LWHH_REPORT PZ
GROUP BY
PZ.lwhh,pz.service, PZ.REPORT_TIME
)
DJ_LWHH_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
AND lwhh=#{searchLwhh}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- DjTagReport日志查询 -->
<resultMap id="DjTagReportMap" type="com.nis.domain.restful.DjTagReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="ABSUM" jdbcType="BIGINT" property="absum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="TAG" jdbcType="INTEGER" property="tag" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<sql id="djTagReportPorperty">
,tag
</sql>
<select id="findDjTagReportPage" parameterType="com.nis.domain.restful.DjTagReport"
resultMap="DjTagReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,absum,REPORT_TIME,SERVICE,TAG
</otherwise>
</choose>
FROM (
SELECT tag,REPORT_TIME, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select tag, asum, bsum, absum, REPORT_TIME,service
from (select tag,
REPORT_TIME,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.REPORT_TIME,
pz.cfg_id,
pz.tag,pz.service
FROM dj_pz_tag_report PZ
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchTag != null and searchTag !=''">
AND tag in(${searchTag})
</if>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
</where>
GROUP BY pz.cfg_id, pz.tag, PZ.REPORT_TIME,pz.service)) a)
group by tag, REPORT_TIME,service
)
DJ_CFG_TAG_STAT_LOG_HOUR
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjEntranceReportMap" type="com.nis.domain.restful.DjEntranceReport">
<result column="ASUM" jdbcType="BIGINT" property="asum" />
<result column="BSUM" jdbcType="BIGINT" property="bsum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP" property="reportTime" />
<result column="ENTRANCE_ID" jdbcType="INTEGER" property="entraceId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
</resultMap>
<select id="findDjEntranceReport" parameterType="com.nis.domain.restful.DjEntranceReport"
resultMap="DjEntranceReportMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ASUM,BSUM,REPORT_TIME,SERVICE,ENTRANCE_ID
</otherwise>
</choose>
FROM ( SELECT
SUM(CASE WHEN PZ.ACTIVE_SYS = 4 THEN SUM ELSE 0 END) ASUM,
SUM(CASE WHEN PZ.ACTIVE_SYS = 2 THEN SUM ELSE 0 END) BSUM,
PZ.REPORT_TIME REPORT_TIME,
PZ.ENTRANCE_ID ENTRANCE_ID,
pz.service
FROM DJ_ENTRANCE_REPORT PZ
GROUP BY
PZ.REPORT_TIME,pz.service, PZ.ENTRANCE_ID
)
DJ_ENTRANCE_REPORT
<where>
<if test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= to_date(#{searchReportStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME < to_date(#{searchReportEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchService != null and searchService !=''">
AND service=#{searchService}
</if>
<if test="searchEntraceId != null and searchEntraceId !=''">
AND ENTRANCE_ID=#{searchEntraceId}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,858 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DjStatLogDao">
<!-- 配置报表的公共属性 -->
<sql id="commonPorperty">
CONFIG_ID,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DjStatLogDailyMap" type="com.nis.domain.restful.DjStatLogDaily">
<result column="config_id" jdbcType="BIGINT" property="configId" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_StatLog_Daily日志查询 -->
<select id="djStatLogDaily" parameterType="com.nis.domain.restful.DjStatLogDaily" resultMap="DjStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>
</otherwise>
</choose>
FROM
(
select config_id,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select config_id,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchConfigId != null and searchConfigId !=''">
and config_id=#{searchConfigId}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by config_id,service,stat_time
) A
GROUP BY config_id,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjStatLogMonthMap" type="com.nis.domain.restful.DjStatLogMonth">
<result column="config_id" jdbcType="BIGINT" property="configId" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_Stat_Log_Month日志查询 -->
<select id="djStatLogMonth" parameterType="com.nis.domain.restful.DjStatLogMonth" resultMap="DjStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty"/>
</otherwise>
</choose>
FROM
(
select config_id,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select config_id,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchConfigId != null and searchConfigId !=''">
and config_id=#{searchConfigId}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by config_id,service,stat_time
) A
GROUP BY config_id,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 标签报表的公共属性 -->
<sql id="tagCommonPorperty">
TAG,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DjTagStatLogDailyMap" type="com.nis.domain.restful.DjTagStatLogDaily">
<result column="tag" jdbcType="INTEGER" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_TAG_Stat_Log_Daily日志查询 -->
<select id="djTagStatLogDaily" parameterType="com.nis.domain.restful.DjTagStatLogDaily" resultMap="DjTagStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="tagCommonPorperty"/>
</otherwise>
</choose>
FROM
(
SELECT tag,'7' as active_sys,stat_time, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select tag, asum, bsum, absum, stat_time,service
from (select tag,
stat_time,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.stat_time,
pz.config_id,
pz.tag,pz.service
FROM dj_cfg_tag_stat_log_daily PZ
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
and tag=#{searchTag}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY pz.config_id, pz.tag, PZ.stat_time,pz.service)) a)
group by tag, stat_time,service
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjTagStatLogMonthMap" type="com.nis.domain.restful.DjTagStatLogMonth">
<result column="tag" jdbcType="INTEGER" property="tag" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_Tag_Stat_Log_Month日志查询 -->
<select id="djTagStatLogMonth" parameterType="com.nis.domain.restful.DjTagStatLogMonth" resultMap="DjTagStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="tagCommonPorperty"/>
</otherwise>
</choose>
FROM
(
SELECT tag,'7' as active_sys,stat_time, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select tag, asum, bsum, absum, stat_time,service
from (select tag,
stat_time,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.stat_time,
pz.config_id,
pz.tag,pz.service
FROM dj_cfg_tag_stat_log_month PZ
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchTag != null and searchTag !=''">
and tag=#{searchTag}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY pz.config_id, pz.tag, PZ.stat_time,pz.service)) a)
group by tag, stat_time,service
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 性质报表的公共属性 -->
<sql id="attrCommonPorperty">
attr_type,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DjAttrStatLogDailyMap" type="com.nis.domain.restful.DjAttrStatLogDaily">
<result column="attr_type" jdbcType="INTEGER" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_ATTR_Stat_Log_Daily日志查询 -->
<select id="djAttrStatLogDaily" parameterType="com.nis.domain.restful.DjAttrStatLogDaily" resultMap="DjAttrStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="attrCommonPorperty"/>
</otherwise>
</choose>
FROM
(
SELECT attr_type,'7' as active_sys,stat_time, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select attr_type, asum, bsum, absum, stat_time,service
from (select attr_type,
stat_time,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.stat_time,
pz.config_id,
pz.attr_type,pz.service
FROM dj_cfg_attr_stat_log_daily PZ
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
and attr_type=#{searchAttrType}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY pz.config_id, pz.attr_type, PZ.stat_time,pz.service)) a)
group by attr_type, stat_time,service
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjAttrStatLogMonthMap" type="com.nis.domain.restful.DjAttrStatLogMonth">
<result column="attr_type" jdbcType="INTEGER" property="attrType" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_Attr_Stat_Log_Month日志查询 -->
<select id="djAttrStatLogMonth" parameterType="com.nis.domain.restful.DjAttrStatLogMonth" resultMap="DjAttrStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="attrCommonPorperty"/>
</otherwise>
</choose>
FROM
(
SELECT attr_type,'7' as active_sys,stat_time, sum(asum) asum, sum(bsum) bsum, SUM(absum) absum,service
FROM (select attr_type, asum, bsum, absum, stat_time,service
from (select attr_type,
stat_time,service,
asum,
bsum,
decode(asum, 0, bsum, asum) absum
from (SELECT SUM(CASE
WHEN PZ.ACTIVE_SYS = 4 THEN
SUM
ELSE
0
END) ASUM,
SUM(CASE
WHEN PZ.ACTIVE_SYS = 2 THEN
SUM
ELSE
0
END) BSUM,
PZ.stat_time,
pz.config_id,
pz.attr_type,pz.service
FROM dj_cfg_attr_stat_log_month PZ
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchAttrType != null and searchAttrType !=''">
and attr_type=#{searchAttrType}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
GROUP BY pz.config_id, pz.attr_type, PZ.stat_time,pz.service)) a)
group by attr_type, stat_time,service
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 局点报表的公共属性 -->
<sql id="entrCommonPorperty">
ENTRANCE_ID,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DjEntrStatLogDailyMap" type="com.nis.domain.restful.DjEntrStatLogDaily">
<result column="ENTRANCE_ID" jdbcType="INTEGER" property="entranceId" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_ATTR_Stat_Log_Daily日志查询 -->
<select id="djEntrStatLogDaily" parameterType="com.nis.domain.restful.DjEntrStatLogDaily" resultMap="DjEntrStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="entrCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select ENTRANCE_ID,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select ENTRANCE_ID,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_entr_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchEntranceId != null and searchEntranceId !=''">
and ENTRANCE_ID=#{searchEntranceId}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by ENTRANCE_ID,service,stat_time
) A
GROUP BY ENTRANCE_ID,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjEntrStatLogMonthMap" type="com.nis.domain.restful.DjEntrStatLogMonth">
<result column="ENTRANCE_ID" jdbcType="INTEGER" property="entranceId" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_Entr_Stat_Log_Month日志查询 -->
<select id="djEntrStatLogMonth" parameterType="com.nis.domain.restful.DjEntrStatLogMonth" resultMap="DjEntrStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="entrCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select ENTRANCE_ID,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select ENTRANCE_ID,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_entr_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchEntranceId != null and searchEntranceId !=''">
and ENTRANCE_ID=#{searchEntranceId}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by ENTRANCE_ID,service,stat_time
) A
GROUP BY ENTRANCE_ID,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 来问函号报表的公共属性 -->
<sql id="lwhhCommonPorperty">
lwhh,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DjLwhhStatLogDailyMap" type="com.nis.domain.restful.DjLwhhStatLogDaily">
<result column="lwhh" jdbcType="INTEGER" property="lwhh" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_ATTR_Stat_Log_Daily日志查询 -->
<select id="djLwhhStatLogDaily" parameterType="com.nis.domain.restful.DjLwhhStatLogDaily" resultMap="DjLwhhStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="lwhhCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select lwhh,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select lwhh,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_lwhh_STAT_LOG_DAILY
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
and lwhh=#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by lwhh,service,stat_time
) A
GROUP BY lwhh,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjLwhhStatLogMonthMap" type="com.nis.domain.restful.DjLwhhStatLogMonth">
<result column="lwhh" jdbcType="INTEGER" property="lwhh" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_Lwhh_Stat_Log_Month日志查询 -->
<select id="djLwhhStatLogMonth" parameterType="com.nis.domain.restful.DjLwhhStatLogMonth" resultMap="DjLwhhStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="lwhhCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select lwhh,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select lwhh,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from DJ_lwhh_STAT_LOG_MONTH
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchLwhh != null and searchLwhh !=''">
and lwhh=#{searchLwhh}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by lwhh,service,stat_time
) A
GROUP BY lwhh,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 境内源ip报表的公共属性 -->
<sql id="srcIpCommonPorperty">
SRC_PROVINCE,SRC_CITY,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DjSrcIpDomesticStatLogDailyMap" type="com.nis.domain.restful.DjSrcIpDomesticStatLogDaily">
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_SrcIp_Stat_Log_Daily日志查询 -->
<select id="djSrcIpDomesticStatLogDaily" parameterType="com.nis.domain.restful.DjSrcIpDomesticStatLogDaily" resultMap="DjSrcIpDomesticStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="srcIpCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,SRC_CITY,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,SRC_CITY,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from dj_SRCIP_stat_log_daily
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,SRC_CITY,service,stat_time
) A
GROUP BY SRC_PROVINCE,SRC_CITY,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjSrcIpDomesticStatLogMonthMap" type="com.nis.domain.restful.DjSrcIpDomesticStatLogMonth">
<result column="SRC_PROVINCE" jdbcType="VARCHAR" property="srcProvince" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_SrcIpDomestic_Stat_Log_Month日志查询 -->
<select id="djSrcIpDomesticStatLogMonth" parameterType="com.nis.domain.restful.DjSrcIpDomesticStatLogMonth" resultMap="DjSrcIpDomesticStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="srcIpCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select SRC_PROVINCE,SRC_CITY,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select SRC_PROVINCE,SRC_CITY,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from dj_SRCIP_stat_log_month
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by SRC_PROVINCE,SRC_CITY,service,stat_time
) A
GROUP BY SRC_PROVINCE,SRC_CITY,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<!-- 国家目的ip报表的公共属性 -->
<sql id="destIpCommonPorperty">
DEST_COUNTRY,ACTIVE_SYS,SERVICE,ASUM,BSUM,ABSUM,STAT_TIME
</sql>
<resultMap id="DjDestIpCounrtyStatLogDailyMap" type="com.nis.domain.restful.DjDestIpCounrtyStatLogDaily">
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="destCountry" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_DestIp_Stat_Log_Daily日志查询 -->
<select id="djDestIpCounrtyStatLogDaily" parameterType="com.nis.domain.restful.DjDestIpCounrtyStatLogDaily" resultMap="DjDestIpCounrtyStatLogDailyMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="destIpCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select DEST_COUNTRY,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select DEST_COUNTRY,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from dj_DESTIP_stat_log_daily
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by DEST_COUNTRY,service,stat_time
) A
GROUP BY DEST_COUNTRY,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<resultMap id="DjDestIpCounrtyStatLogMonthMap" type="com.nis.domain.restful.DjDestIpCounrtyStatLogMonth">
<result column="DEST_COUNTRY" jdbcType="VARCHAR" property="destCountry" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="asum" jdbcType="BIGINT" property="asum" />
<result column="bsum" jdbcType="BIGINT" property="bsum" />
<result column="absum" jdbcType="BIGINT" property="absum" />
<result column="stat_time" jdbcType="DATE" property="statTime" />
</resultMap>
<!-- Dj_DestIp_Stat_Log_Month日志查询 -->
<select id="djDestIpCounrtyStatLogMonth" parameterType="com.nis.domain.restful.DjDestIpCounrtyStatLogMonth" resultMap="DjDestIpCounrtyStatLogMonthMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="destIpCommonPorperty"/>
</otherwise>
</choose>
FROM
(
select DEST_COUNTRY,active_sys,service,stat_time,asum,bsum,decode(asum,0,bsum,asum) as absum
from (select DEST_COUNTRY,'7' as active_sys,service,stat_time
,sum(case when active_sys=4 then sum else 0 end) asum
,sum(case when active_sys=2 then sum else 0 end) bsum
from dj_DESTIP_stat_log_Month
<where>
<if test="searchService != null and searchService !=''">
and service=#{searchService}
</if>
<if test="searchStatStartTime != null and searchStatStartTime !=''">
<![CDATA[AND stat_time >= to_date(#{searchStatStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="searchStatEndTime != null and searchStatEndTime !=''">
<![CDATA[AND stat_time < to_date(#{searchStatEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
</where>
group by DEST_COUNTRY,service,stat_time
) A
GROUP BY DEST_COUNTRY,active_sys ,service,stat_time,asum,bsum
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DmbCkDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.DmbCk">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="POSITION" jdbcType="VARCHAR" property="position" />
<result column="COM_OPTION" jdbcType="VARCHAR" property="comOption" />
<result column="CZYID" jdbcType="BIGINT" property="czyid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result property="lastUpdate" jdbcType="TIMESTAMP" column="LAST_UPDATE"/>
</resultMap>
<sql id="Base_Column_List">
ID, NAME, POSITION, COM_OPTION, CZYID, OP_TIME,LAST_UPDATE
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from DMB_CK
where ID = #{id,jdbcType=BIGINT}
</select>
<delete id="delete" parameterType="java.lang.Long">
delete from DMB_CK
where ID = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.nis.domain.restful.DmbCk">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DMB_CK.Nextval as ID from DUAL
</selectKey> -->
insert into DMB_CK (ID, NAME, POSITION,
COM_OPTION, CZYID, OP_TIME,LAST_UPDATE
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
#{comOption,jdbcType=VARCHAR}, #{czyid,jdbcType=BIGINT}, #{opTime,jdbcType=TIMESTAMP},
#{lastUpdate,jdbcType=TIMESTAMP}
)
</insert>
<!--
<insert id="insertSelective" parameterType="com.nis.domain.restful.DmbCk">
insert into DMB_CK
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="name != null">
NAME,
</if>
<if test="position != null">
POSITION,
</if>
<if test="comOption != null">
COM_OPTION,
</if>
<if test="czyid != null">
CZYID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="position != null">
#{position,jdbcType=VARCHAR},
</if>
<if test="comOption != null">
#{comOption,jdbcType=VARCHAR},
</if>
<if test="czyid != null">
#{czyid,jdbcType=BIGINT},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
-->
<update id="update" parameterType="com.nis.domain.restful.DmbCk">
update DMB_CK
<set>
<if test="name != null">
NAME = #{name,jdbcType=VARCHAR},
</if>
<if test="position != null">
POSITION = #{position,jdbcType=VARCHAR},
</if>
<if test="comOption != null">
COM_OPTION = #{comOption,jdbcType=VARCHAR},
</if>
<if test="czyid != null">
CZYID = #{czyid,jdbcType=BIGINT},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<!--
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.DmbCk">
update DMB_CK
set NAME = #{name,jdbcType=VARCHAR},
POSITION = #{position,jdbcType=VARCHAR},
COM_OPTION = #{comOption,jdbcType=VARCHAR},
CZYID = #{czyid,jdbcType=BIGINT},
OP_TIME = #{opTime,jdbcType=TIMESTAMP}
where ID = #{id,jdbcType=BIGINT}
</update>
-->
</mapper>

View File

@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DmbPortDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.DmbPort">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="ENTRANCE_ID" jdbcType="BIGINT" property="entranceId" />
<result column="PORT_NAME" jdbcType="VARCHAR" property="portName" />
<result column="IS_USED" jdbcType="INTEGER" property="isUsed" />
<result column="IP_DZ" jdbcType="VARCHAR" property="ipDz" />
<result column="PORT_EQUIPMENT" jdbcType="VARCHAR" property="portEquipment" />
<result column="ODF_PORT" jdbcType="VARCHAR" property="odfPort" />
<result column="ADDR" jdbcType="VARCHAR" property="addr" />
<result column="CK_PORT" jdbcType="VARCHAR" property="ckPort" />
<result column="CZYID" jdbcType="BIGINT" property="czyid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result property="lastUpdate" jdbcType="TIMESTAMP" column="LAST_UPDATE"/>
</resultMap>
<sql id="Base_Column_List">
ID, ENTRANCE_ID, PORT_NAME, IS_USED, IP_DZ, PORT_EQUIPMENT, ODF_PORT, ADDR, CK_PORT,
CZYID, OP_TIME,LAST_UPDATE
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from DMB_PORT
where ID = #{id,jdbcType=BIGINT}
</select>
<delete id="delete" parameterType="java.lang.Long">
delete from DMB_PORT
where ID = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.nis.domain.restful.DmbPort">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DMB_PORT.Nextval as ID from DUAL
</selectKey> -->
insert into DMB_PORT (ID, ENTRANCE_ID, PORT_NAME,
IS_USED, IP_DZ, PORT_EQUIPMENT,
ODF_PORT, ADDR, CK_PORT,
CZYID, OP_TIME,LAST_UPDATE)
values (#{id,jdbcType=BIGINT}, #{entranceId,jdbcType=BIGINT}, #{portName,jdbcType=VARCHAR},
#{isUsed,jdbcType=INTEGER}, #{ipDz,jdbcType=VARCHAR}, #{portEquipment,jdbcType=VARCHAR},
#{odfPort,jdbcType=VARCHAR}, #{addr,jdbcType=VARCHAR}, #{ckPort,jdbcType=VARCHAR},
#{czyid,jdbcType=BIGINT}, #{opTime,jdbcType=TIMESTAMP}, #{lastUpdate,jdbcType=TIMESTAMP})
</insert>
<!--
<insert id="insertSelective" parameterType="com.nis.domain.restful.DmbPort">
insert into DMB_PORT
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="entranceId != null">
ENTRANCE_ID,
</if>
<if test="portName != null">
PORT_NAME,
</if>
<if test="isUsed != null">
IS_USED,
</if>
<if test="ipDz != null">
IP_DZ,
</if>
<if test="portEquipment != null">
PORT_EQUIPMENT,
</if>
<if test="odfPort != null">
ODF_PORT,
</if>
<if test="addr != null">
ADDR,
</if>
<if test="ckPort != null">
CK_PORT,
</if>
<if test="czyid != null">
CZYID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="entranceId != null">
#{entranceId,jdbcType=BIGINT},
</if>
<if test="portName != null">
#{portName,jdbcType=VARCHAR},
</if>
<if test="isUsed != null">
#{isUsed,jdbcType=INTGER},
</if>
<if test="ipDz != null">
#{ipDz,jdbcType=VARCHAR},
</if>
<if test="portEquipment != null">
#{portEquipment,jdbcType=VARCHAR},
</if>
<if test="odfPort != null">
#{odfPort,jdbcType=VARCHAR},
</if>
<if test="addr != null">
#{addr,jdbcType=VARCHAR},
</if>
<if test="ckPort != null">
#{ckPort,jdbcType=VARCHAR},
</if>
<if test="czyid != null">
#{czyid,jdbcType=BIGINT},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
-->
<update id="update" parameterType="com.nis.domain.restful.DmbPort">
update DMB_PORT
<set>
<if test="entranceId != null">
ENTRANCE_ID = #{entranceId,jdbcType=BIGINT},
</if>
<if test="portName != null">
PORT_NAME = #{portName,jdbcType=VARCHAR},
</if>
<if test="isUsed != null">
IS_USED = #{isUsed,jdbcType=INTEGER},
</if>
<if test="ipDz != null">
IP_DZ = #{ipDz,jdbcType=VARCHAR},
</if>
<if test="portEquipment != null">
PORT_EQUIPMENT = #{portEquipment,jdbcType=VARCHAR},
</if>
<if test="odfPort != null">
ODF_PORT = #{odfPort,jdbcType=VARCHAR},
</if>
<if test="addr != null">
ADDR = #{addr,jdbcType=VARCHAR},
</if>
<if test="ckPort != null">
CK_PORT = #{ckPort,jdbcType=VARCHAR},
</if>
<if test="czyid != null">
CZYID = #{czyid,jdbcType=BIGINT},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<!--
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.DmbPort">
update DMB_PORT
set ENTRANCE_ID = #{entranceId,jdbcType=BIGINT},
PORT_NAME = #{portName,jdbcType=VARCHAR},
IS_USED = #{isUsed,jdbcType=INTEGER},
IP_DZ = #{ipDz,jdbcType=VARCHAR},
PORT_EQUIPMENT = #{portEquipment,jdbcType=VARCHAR},
ODF_PORT = #{odfPort,jdbcType=VARCHAR},
ADDR = #{addr,jdbcType=VARCHAR},
CK_PORT = #{ckPort,jdbcType=VARCHAR},
CZYID = #{czyid,jdbcType=BIGINT},
OP_TIME = #{opTime,jdbcType=TIMESTAMP}
where ID = #{id,jdbcType=BIGINT}
</update>
-->
</mapper>

View File

@@ -0,0 +1,182 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.DnsFakeInfoDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.DnsFakeInfo">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="GROUP_ID" jdbcType="INTEGER" property="groupId" />
<result column="INFO" jdbcType="VARCHAR" property="info" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="YL1" jdbcType="INTEGER" property="yl1" />
<result column="YL2" jdbcType="INTEGER" property="yl2" />
<result column="YL3" jdbcType="VARCHAR" property="yl3" />
<result column="YL4" jdbcType="VARCHAR" property="yl4" />
<result column="YL5" jdbcType="VARCHAR" property="yl5" />
<result property="lastUpdate" jdbcType="TIMESTAMP" column="LAST_UPDATE"/>
</resultMap>
<sql id="Base_Column_List">
ID, GROUP_ID, INFO, IS_VALID, OP_TIME, YL1, YL2, YL3, YL4, YL5,LAST_UPDATE
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from DNS_FAKE_INFO
where ID = #{id,jdbcType=BIGINT}
</select>
<delete id="delete" parameterType="java.lang.Long">
delete from DNS_FAKE_INFO
where ID = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.nis.domain.restful.DnsFakeInfo">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DNS_FAKE_INFO.Nextval as ID from DUAL
</selectKey>
-->
insert into DNS_FAKE_INFO (ID, GROUP_ID, INFO,
IS_VALID, OP_TIME, YL1,
YL2, YL3, YL4, YL5,LAST_UPDATE
)
values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=INTEGER}, #{info,jdbcType=VARCHAR},
#{isValid,jdbcType=INTEGER}, #{opTime,jdbcType=TIMESTAMP}, #{yl1,jdbcType=INTEGER},
#{yl2,jdbcType=INTEGER}, #{yl3,jdbcType=VARCHAR}, #{yl4,jdbcType=VARCHAR}, #{yl5,jdbcType=VARCHAR}
, #{lastUpdate,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.nis.domain.restful.DnsFakeInfo">
insert into DNS_FAKE_INFO
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="groupId != null">
GROUP_ID,
</if>
<if test="info != null">
INFO,
</if>
<if test="isValid != null">
IS_VALID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
<if test="yl1 != null">
YL1,
</if>
<if test="yl2 != null">
YL2,
</if>
<if test="yl3 != null">
YL3,
</if>
<if test="yl4 != null">
YL4,
</if>
<if test="yl5 != null">
YL5,
</if>
<if test="lastUpdate != null">
LAST_UPDATE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="groupId != null">
#{groupId,jdbcType=INTEGER},
</if>
<if test="info != null">
#{info,jdbcType=VARCHAR},
</if>
<if test="isValid != null">
#{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="yl1 != null">
#{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null">
#{yl2,jdbcType=INTEGER},
</if>
<if test="yl3 != null">
#{yl3,jdbcType=VARCHAR},
</if>
<if test="yl4 != null">
#{yl4,jdbcType=VARCHAR},
</if>
<if test="yl5 != null">
#{yl5,jdbcType=VARCHAR},
</if>
<if test="lastUpdate != null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="update" parameterType="com.nis.domain.restful.DnsFakeInfo">
update DNS_FAKE_INFO
<set>
<if test="groupId != null">
GROUP_ID = #{groupId,jdbcType=INTEGER},
</if>
<if test="info != null">
INFO = #{info,jdbcType=VARCHAR},
</if>
<if test="isValid != null">
IS_VALID = #{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="yl1 != null">
YL1 = #{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null">
YL2 = #{yl2,jdbcType=INTEGER},
</if>
<if test="yl3 != null">
YL3 = #{yl3,jdbcType=VARCHAR},
</if>
<if test="yl4 != null">
YL4 = #{yl4,jdbcType=VARCHAR},
</if>
<if test="yl5 != null">
YL5 = #{yl5,jdbcType=VARCHAR},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<select id="isValid" parameterType="long" resultType="java.lang.Integer">
select IS_VALID FROM DNS_FAKE_INFO
WHERE ID = #{id,jdbcType=BIGINT}
</select>
<select id="isValidBatch" resultType="java.lang.Integer">
select count(ID) FROM DNS_FAKE_INFO
WHERE ID in(
<foreach collection="idsList" item="ids" separator=",">
#{ids}
</foreach>
) and IS_VALID=#{isValid}
</select>
<!--
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.DnsFakeInfo">
update DNS_FAKE_INFO
set GROUP_ID = #{groupId,jdbcType=DECIMAL},
INFO = #{info,jdbcType=VARCHAR},
IS_VALID = #{isValid,jdbcType=DECIMAL},
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
YL1 = #{yl1,jdbcType=DECIMAL},
YL2 = #{yl2,jdbcType=DECIMAL},
YL3 = #{yl3,jdbcType=VARCHAR},
YL4 = #{yl4,jdbcType=VARCHAR},
YL5 = #{yl5,jdbcType=VARCHAR}
where ID = #{id,jdbcType=DECIMAL}
</update>
-->
</mapper>

View File

@@ -0,0 +1,284 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.DnsFakeIpDao" >
<resultMap type="dnsFakeIp" id="dnsFakeIpMap">
<id property="id" column="ID"/>
<result property="groupId" column="GROUP_ID"/>
<result property="addrType" column="ADDR_TYPE"/>
<result property="srcIp" column="SRC_IP"/>
<result property="maskSrcIp" column="MASK_SRC_IP"/>
<result property="srcPort" column="SRC_PORT"/>
<result property="maskSrcPort" column="MASK_SRC_PORT"/>
<result property="dstIp" column="DST_IP"/>
<result property="maskDstIp" column="MASK_DST_IP"/>
<result property="dstPort" column="DST_PORT"/>
<result property="maskDstPort" column="MASK_DST_PORT"/>
<result property="protocol" column="PROTOCOL"/>
<result property="direction" column="DIRECTION"/>
<result property="opTime" column="OP_TIME"/>
<result property="isValid" column="IS_VALID"/>
<result property="yl1" column="YL1"/>
<result property="yl2" column="YL2"/>
<result property="yl3" column="YL3"/>
<result property="yl4" column="YL4"/>
<result property="yl5" column="YL5"/>
<result property="lastUpdate" jdbcType="TIMESTAMP" column="LAST_UPDATE"/>
</resultMap>
<sql id="dnsFakeIpColumns">
id,
groupId,
addrType,
srcIp,
maskSrcIp,
srcPort,
maskSrcPort,
dstIp,
maskDstIp,
dstPort,
maskDstPort,
protocol,
direction,
opTime,
isValid,
yl1,
yl2,
yl3,
yl4,
yl5,
lastUpdate
</sql>
<!--
<insert id="insert" parameterType="dnsFakeIp" >
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DNS_FAKE_IP.Nextval as ID from DUAL
</selectKey>
insert into DNS_FAKE_IP(ID,GROUP_ID,ADDR_TYPE,SRC_IP,MASK_SRC_IP,SRC_PORT,MASK_SRC_PORT,
DST_IP,MASK_DST_IP,DST_PORT,MASK_DST_PORT,PROTOCOL,DIRECTION,OP_TIME,IS_VALID,YL1,YL2,YL3,YL4,YL5)
values (#{id},#{groupId},#{addrType},#{srcIp},#{maskSrcIp},#{srcPort},#{maskSrcPort},#{dstIp}
,#{maskDstIp},#{dstPort},#{maskDstPort},#{protocol},#{direction},#{opTime},#{isValid}
,#{yl1},#{yl2},#{yl3},#{yl4},#{yl5})
</insert>
-->
<insert id="insert" parameterType="com.nis.domain.restful.DnsFakeIp">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DNS_FAKE_IP.Nextval as ID from DUAL
</selectKey>
-->
insert into DNS_FAKE_IP
<trim prefix="(" suffix=")" suffixOverrides=",">
ID,
<if test="groupId != null">
GROUP_ID,
</if>
<if test="addrType != null">
ADDR_TYPE,
</if>
<if test="srcIp != null">
SRC_IP,
</if>
<if test="maskSrcIp != null">
MASK_SRC_IP,
</if>
<if test="srcPort != null">
SRC_PORT,
</if>
<if test="maskSrcPort != null">
MASK_SRC_PORT,
</if>
<if test="dstIp != null">
DST_IP,
</if>
<if test="maskDstIp != null">
MASK_DST_IP,
</if>
<if test="dstPort != null">
DST_PORT,
</if>
<if test="maskDstPort != null">
MASK_DST_PORT,
</if>
<if test="protocol != null">
PROTOCOL,
</if>
<if test="direction != null">
DIRECTION,
</if>
<if test="isValid != null">
IS_VALID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
<if test="yl1 != null">
YL1,
</if>
<if test="yl2 != null">
YL2,
</if>
<if test="yl3 != null">
YL3,
</if>
<if test="yl4 != null">
YL4,
</if>
<if test="yl5 != null">
YL5,
</if>
<if test="lastUpdate != null">
LAST_UPDATE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="groupId != null">
#{groupId,jdbcType=INTEGER},
</if>
<if test="addrType != null">
#{addrType,jdbcType=INTEGER},
</if>
<if test="srcIp != null">
#{srcIp,jdbcType=VARCHAR},
</if>
<if test="maskSrcIp != null">
#{maskSrcIp,jdbcType=VARCHAR},
</if>
<if test="srcPort != null">
#{srcPort,jdbcType=VARCHAR},
</if>
<if test="maskSrcPort != null">
#{maskSrcPort,jdbcType=VARCHAR},
</if>
<if test="dstIp != null">
#{dstIp,jdbcType=VARCHAR},
</if>
<if test="maskDstIp != null">
#{maskDstIp,jdbcType=VARCHAR},
</if>
<if test="dstPort != null">
#{dstPort,jdbcType=VARCHAR},
</if>
<if test="maskDstPort != null">
#{maskDstPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
#{protocol,jdbcType=INTEGER},
</if>
<if test="direction != null">
#{direction,jdbcType=INTEGER},
</if>
<if test="isValid != null">
#{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="yl1 != null">
#{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null">
#{yl2,jdbcType=INTEGER},
</if>
<if test="yl3 != null">
#{yl3,jdbcType=VARCHAR},
</if>
<if test="yl4 != null">
#{yl4,jdbcType=VARCHAR},
</if>
<if test="yl5 != null">
#{yl5,jdbcType=VARCHAR},
</if>
<if test="lastUpdate != null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="update" parameterType="dnsFakeIp">
UPDATE DNS_FAKE_IP
<set>
<if test="groupId != null">
GROUP_ID=#{groupId,jdbcType=INTEGER},
</if>
<if test="addrType != null">
ADDR_TYPE=#{addrType,jdbcType=INTEGER},
</if>
<if test="srcIp != null">
SRC_IP=#{srcIp,jdbcType=VARCHAR},
</if>
<if test="maskSrcIp != null">
MASK_SRC_IP=#{maskSrcIp,jdbcType=VARCHAR},
</if>
<if test="srcPort != null">
SRC_PORT=#{srcPort,jdbcType=VARCHAR},
</if>
<if test="maskSrcPort != null">
MASK_SRC_PORT=#{maskSrcPort,jdbcType=VARCHAR},
</if>
<if test="dstIp != null">
DST_IP=#{dstIp,jdbcType=VARCHAR},
</if>
<if test="maskDstIp != null">
MASK_DST_IP=#{maskDstIp,jdbcType=VARCHAR},
</if>
<if test="dstPort != null">
DST_PORT=#{dstPort,jdbcType=VARCHAR},
</if>
<if test="maskDstPort != null">
MASK_DST_PORT=#{maskDstPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
PROTOCOL=#{protocol,jdbcType=INTEGER},
</if>
<if test="direction != null">
DIRECTION=#{direction,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME=#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="isValid != null">
IS_VALID=#{isValid,jdbcType=INTEGER},
</if>
<if test="yl1 != null">
YL1=#{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null">
YL2=#{yl2,jdbcType=INTEGER},
</if>
<if test="yl3 != null">
YL3=#{yl3,jdbcType=VARCHAR},
</if>
<if test="yl4 != null">
YL4=#{yl4,jdbcType=VARCHAR},
</if>
<if test="yl5 != null">
YL5=#{yl5,jdbcType=VARCHAR},
</if>
<if test="lastUpdate != null">
LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where ID = #{id ,jdbcType=BIGINT }
</update>
<delete id="delete" parameterType="long">
DELETE FROM DNS_FAKE_IP
WHERE ID = #{id,jdbcType=BIGINT}
</delete>
<select id="isValid" parameterType="long" resultType="java.lang.Integer">
select IS_VALID FROM DNS_FAKE_IP
WHERE ID = #{id,jdbcType=BIGINT}
</select>
<select id="isValidBatch" resultType="java.lang.Integer">
select count(ID) FROM DNS_FAKE_IP
WHERE ID in(
<foreach collection="idsList" item="ids" separator=",">
#{ids}
</foreach>
) and IS_VALID=#{isValid}
</select>
</mapper>

View File

@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.DnsGroupTypeDao" >
<resultMap type="dnsGroupType" id="dnsGroupTypeMap">
<id property="id" column="ID"/>
<result property="groupId" column="GROUP_ID"/>
<result property="groupName" column="GROUP_NAME"/>
<result property="resTypeId" column="RES_TYPE_ID"/>
<result property="opTime" column="OP_TIME"/>
<result property="isValid" column="IS_VALID"/>
<result property="yl1" column="YL1"/>
<result property="yl2" column="YL2"/>
<result property="yl3" column="YL3"/>
<result property="yl4" column="YL4"/>
<result property="yl5" column="YL5"/>
<result property="lastUpdate" column="LAST_UPDATE"/>
</resultMap>
<sql id="dnsGroupTypeColumns">
id,
groupId,
groupName,
resTypeId,
opTime,
isValid,
yl1,
yl2,
yl3,
yl4,
yl5,
lastUpdate
</sql>
<!--
<select id="get" resultMap="dnsGroupTypeMap">
select
<include refid="dnsGroupTypeColumns"/>
from DNS_GROUP_TYPE
WHERE id=#{id}
</select>
<select id="findList" resultMap="dnsGroupTypeMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="dnsGroupTypeColumns"/>
</otherwise>
</choose>
from DNS_GROUP_TYPE
WHERE 1=1
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY id desc
</otherwise>
</choose>
</select>
-->
<insert id="insert" parameterType="dnsGroupType" >
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DNS_GROUP_TYPE.Nextval as ID from DUAL
</selectKey>
-->
insert into DNS_GROUP_TYPE(ID,GROUP_ID,GROUP_NAME,RES_TYPE_ID,OP_TIME,IS_VALID,YL1,YL2,YL3,YL4,YL5,LAST_UPDATE)
values (#{id},#{groupId},#{groupName},#{resTypeId},#{opTime},#{isValid},#{yl1},#{yl2},#{yl3},#{yl4},#{yl5},#{lastUpdate})
</insert>
<update id="update" parameterType="dnsGroupType">
UPDATE DNS_GROUP_TYPE
<set>
<if test="groupId != null">
GROUP_ID=#{groupId,jdbcType=INTEGER},
</if>
<if test="groupName != null">
GROUP_NAME=#{groupName,jdbcType=VARCHAR},
</if>
<if test="resTypeId != null">
RES_TYPE_ID=#{resTypeId,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME=#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="isValid != null">
IS_VALID=#{isValid,jdbcType=INTEGER},
</if>
<if test="yl1 != null">
YL1=#{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null">
YL2=#{yl2,jdbcType=INTEGER},
</if>
<if test="yl3 != null">
YL3=#{yl3,jdbcType=VARCHAR},
</if>
<if test="yl4 != null">
YL4=#{yl4,jdbcType=VARCHAR},
</if>
<if test="yl5 != null">
YL5=#{yl5,jdbcType=VARCHAR},
</if>
<if test="lastUpdate != null">
LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where ID = #{id ,jdbcType=BIGINT }
</update>
<delete id="delete" parameterType="long">
DELETE FROM DNS_GROUP_TYPE
WHERE ID = #{id,jdbcType=BIGINT}
</delete>
<select id="isValid" parameterType="long" resultType="java.lang.Integer">
select IS_VALID FROM DNS_GROUP_TYPE
WHERE ID = #{id,jdbcType=BIGINT}
</select>
<select id="isValidBatch" resultType="java.lang.Integer">
select count(ID) FROM DNS_GROUP_TYPE
WHERE ID in(
<foreach collection="idsList" item="ids" separator=",">
#{ids}
</foreach>
) and IS_VALID=#{isValid}
</select>
<select id="isGroupIdUnique" resultType="java.lang.Integer">
select COUNT(ID) FROM DNS_GROUP_TYPE
WHERE GROUP_ID in(
<foreach collection="idsList" item="ids" separator=",">
#{ids,jdbcType=INTEGER}
</foreach>
)
</select>
</mapper>

View File

@@ -0,0 +1,377 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.DnsResponseStrategyDao" >
<resultMap type="dnsResponseStrategy" id="dnsResponseStrategyMap">
<id property="id" column="ID"/>
<result property="reqStrateId" column="REQ_STRATE_ID"/>
<result property="strateName" column="STRATE_NAME"/>
<result property="resGroupOneId" column="RES_GROUP_1_ID"/>
<result property="resGroupOneNum" column="RES_GROUP_1_NUM"/>
<result property="resGroupTwoId" column="RES_GROUP_2_ID"/>
<result property="resGroupTwoNum" column="RES_GROUP_2_NUM"/>
<result property="resGroupThreeId" column="RES_GROUP_3_ID"/>
<result property="resGroupThreeNum" column="RES_GROUP_3_NUM"/>
<result property="resGroupFourId" column="RES_GROUP_4_ID"/>
<result property="resGroupFourNum" column="RES_GROUP_4_NUM"/>
<result property="resGroupFiveId" column="RES_GROUP_5_ID"/>
<result property="resGroupFiveNum" column="RES_GROUP_5_NUM"/>
<result property="authGroup" column="AUTH_GROUP"/>
<result property="addGroup" column="ADD_GROUP"/>
<result property="opTime" column="OP_TIME"/>
<result property="isValid" column="IS_VALID"/>
<result property="yl1" column="YL1"/>
<result property="yl2" column="YL2"/>
<result property="yl3" column="YL3"/>
<result property="yl4" column="YL4"/>
<result property="yl5" column="YL5"/>
<result property="lastUpdate" column="LAST_UPDATE"/>
<result property="minTtl" column="MIN_TTL"/>
<result property="maxTtl" column="MAX_TTL"/>
</resultMap>
<sql id="dnsResponseStrategyColumns">
id,
reqStrateId,
strateName,
resGroupOneId,
resGroupOneNum,
resGroupTwoId,
resGroupTwoNum,
resGroupThreeId,
resGroupThreeNum,
resGroupFourId,
resGroupFourNum,
resGroupFiveId,
resGroupFiveNum,
authGroup,
addGroup,
opTime,
isValid,
yl1,
yl2,
yl3,
yl4,
yl5,
lastUpdate,
minTtl,
maxTtl
</sql>
<!--
<select id="get" resultMap="dnsResponseStrategyMap">
select
<include refid="dnsResponseStrategyColumns"/>
from DNS_RESPONSE_STRATEGY
WHERE id=#{id}
</select>
<select id="findList" resultMap="dnsResponseStrategyMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="dnsResponseStrategyColumns"/>
</otherwise>
</choose>
from DNS_RESPONSE_STRATEGY
WHERE 1=1
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY id desc
</otherwise>
</choose>
</select>
-->
<!--
<insert id="insert" parameterType="dnsResponseStrategy" >
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DNS_RESPONSE_STRATEGY.Nextval as ID from DUAL
</selectKey>
insert into DNS_RESPONSE_STRATEGY(ID,REQ_STRATE_ID,STRATE_NAME,RES_GROUP_1_ID,RES_GROUP_1_NUM
,RES_GROUP_2_ID,RES_GROUP_2_NUM,AUTH_GROUP,ADD_GROUP,OP_TIME,IS_VALID,YL1,YL2,YL3,YL4,YL5)
values (#{id},#{reqStrateId},#{strateName},#{resGroupOneId},#{resGroupOneNum},#{resGroupTwoId},#{resGroupTwoNum},
#{authGroup},#{addGroup},#{opTime},#{isValid},#{yl1},#{yl2},#{yl3},#{yl4},#{yl5})
</insert>
-->
<insert id="insert" parameterType="com.nis.domain.restful.DnsResponseStrategy">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_DNS_RESPONSE_STRATEGY.Nextval as ID from DUAL
</selectKey>
-->
insert into DNS_RESPONSE_STRATEGY
<trim prefix="(" suffix=")" suffixOverrides=",">
ID,
<if test="reqStrateId != null">
REQ_STRATE_ID,
</if>
<if test="strateName != null">
STRATE_NAME,
</if>
<if test="resGroupOneId != null">
RES_GROUP_1_ID,
</if>
<if test="resGroupOneNum != null">
RES_GROUP_1_NUM,
</if>
<if test="resGroupTwoId != null">
RES_GROUP_2_ID,
</if>
<if test="resGroupTwoNum != null">
RES_GROUP_2_NUM,
</if>
<if test="resGroupThreeId != null">
RES_GROUP_3_ID,
</if>
<if test="resGroupThreeNum != null">
RES_GROUP_3_NUM,
</if>
<if test="resGroupFourId != null">
RES_GROUP_4_ID,
</if>
<if test="resGroupFourNum != null">
RES_GROUP_4_NUM,
</if>
<if test="resGroupFiveId != null">
RES_GROUP_5_ID,
</if>
<if test="resGroupFiveNum != null">
RES_GROUP_5_NUM,
</if>
<if test="authGroup != null">
AUTH_GROUP,
</if>
<if test="addGroup != null">
ADD_GROUP,
</if>
<if test="opTime != null">
OP_TIME,
</if>
<if test="isValid != null">
IS_VALID,
</if>
<if test="yl1 != null">
YL1,
</if>
<if test="yl2 != null">
YL2,
</if>
<if test="yl3 != null">
YL3,
</if>
<if test="yl4 != null">
YL4,
</if>
<if test="yl5 != null">
YL5,
</if>
<if test="lastUpdate != null">
LAST_UPDATE,
</if>
<if test="minTtl != null">
MIN_TTL,
</if>
<if test="maxTtl != null">
MAX_TTL,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="reqStrateId != null">
#{reqStrateId,jdbcType=INTEGER},
</if>
<if test="strateName != null">
#{strateName,jdbcType=VARCHAR},
</if>
<if test="resGroupOneId != null">
#{resGroupOneId,jdbcType=INTEGER},
</if>
<if test="resGroupOneNum != null">
#{resGroupOneNum,jdbcType=INTEGER},
</if>
<if test="resGroupTwoId != null">
#{resGroupTwoId,jdbcType=INTEGER},
</if>
<if test="resGroupTwoNum != null">
#{resGroupTwoNum,jdbcType=INTEGER},
</if>
<if test="resGroupThreeId != null">
#{resGroupThreeId,jdbcType=INTEGER},
</if>
<if test="resGroupThreeNum != null">
#{resGroupThreeNum,jdbcType=INTEGER},
</if>
<if test="resGroupFourId != null">
#{resGroupFourId,jdbcType=INTEGER},
</if>
<if test="resGroupFourNum != null">
#{resGroupFourNum,jdbcType=INTEGER},
</if>
<if test="resGroupFiveId != null">
#{resGroupFiveId,jdbcType=INTEGER},
</if>
<if test="resGroupFiveNum != null">
#{resGroupFiveNum,jdbcType=INTEGER},
</if>
<if test="authGroup != null">
#{authGroup,jdbcType=INTEGER},
</if>
<if test="addGroup != null">
#{addGroup,jdbcType=INTEGER},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="isValid != null">
#{isValid,jdbcType=INTEGER},
</if>
<if test="yl1 != null">
#{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null">
#{yl2,jdbcType=INTEGER},
</if>
<if test="yl3 != null">
#{yl3,jdbcType=VARCHAR},
</if>
<if test="yl4 != null">
#{yl4,jdbcType=VARCHAR},
</if>
<if test="yl5 != null">
#{yl5,jdbcType=VARCHAR},
</if>
<if test="lastUpdate != null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
<if test="minTtl != null">
#{minTtl,jdbcType=INTEGER},
</if>
<if test="maxTtl != null">
#{maxTtl,jdbcType=INTEGER},
</if>
</trim>
</insert>
<!--
<insert id="saveBatch" parameterType="java.util.List">
insert into DNS_RESPONSE_STRATEGY(ID,REQ_STRATE_ID,STRATE_NAME,RES_GROUP_1_ID,RES_GROUP_1_NUM
,RES_GROUP_2_ID,RES_GROUP_2_NUM,AUTH_GROUP,ADD_GROUP,OP_TIME,IS_VALID,YL1,YL2,YL3,YL4,YL5)
<foreach collection="list" item="item" index="index" separator="union all">
(select SEQ_DNS_RESPONSE_STRATEGY.Nextval,#{item.reqStrateId,jdbcType=NUMBER },#{item.strateName,jdbcType=VARCHAR2},#{item.resGroupOneId,jdbcType=NUMBER},#{item.resGroupOneNum,jdbcType=NUMBER},#{item.resGroupTwoId,jdbcType=NUMBER},#{item.resGroupTwoNum,jdbcType=NUMBER},
#{item.authGroup,jdbcType=NUMBER},#{item.addGroup,jdbcType=NUMBER},#{item.opTime,jdbcType=DATE},#{item.isValid,jdbcType=NUMBER},#{item.yl1,jdbcType=NUMBER},#{item.yl2,jdbcType=NUMBER},#{item.yl3,jdbcType=VARCHAR2},#{item.yl4,jdbcType=VARCHAR2},#{item.yl5,jdbcType=VARCHAR2} from dual)
</foreach>
</insert>
-->
<update id="update" parameterType="dnsResponseStrategy">
UPDATE DNS_RESPONSE_STRATEGY
<set>
<if test="reqStrateId != null">
REQ_STRATE_ID=#{reqStrateId,jdbcType=INTEGER},
</if>
<if test="strateName != null">
STRATE_NAME=#{strateName,jdbcType=VARCHAR},
</if>
<if test="resGroupOneId != null">
RES_GROUP_1_ID=#{resGroupOneId,jdbcType=INTEGER},
</if>
<if test="resGroupOneNum != null">
RES_GROUP_1_NUM=#{resGroupOneNum,jdbcType=INTEGER},
</if>
<if test="resGroupTwoId != null">
RES_GROUP_2_ID=#{resGroupTwoId,jdbcType=INTEGER},
</if>
<if test="resGroupTwoNum != null">
RES_GROUP_2_NUM=#{resGroupTwoNum,jdbcType=INTEGER},
</if>
<if test="resGroupThreeId != null">
RES_GROUP_3_ID=#{resGroupThreeId,jdbcType=INTEGER},
</if>
<if test="resGroupThreeNum != null">
RES_GROUP_3_NUM=#{resGroupThreeNum,jdbcType=INTEGER},
</if>
<if test="resGroupFourId != null">
RES_GROUP_4_ID=#{resGroupFourId,jdbcType=INTEGER},
</if>
<if test="resGroupFourNum != null">
RES_GROUP_4_NUM=#{resGroupFourNum,jdbcType=INTEGER},
</if>
<if test="resGroupFiveId != null">
RES_GROUP_5_ID=#{resGroupFiveId,jdbcType=INTEGER},
</if>
<if test="resGroupFiveNum != null">
RES_GROUP_5_NUM=#{resGroupFiveNum,jdbcType=INTEGER},
</if>
<if test="authGroup != null">
AUTH_GROUP=#{authGroup,jdbcType=INTEGER},
</if>
<if test="addGroup != null">
ADD_GROUP=#{addGroup,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME=#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="isValid != null">
IS_VALID=#{isValid,jdbcType=INTEGER},
</if>
<if test="yl1 != null">
YL1=#{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null">
YL2=#{yl2,jdbcType=INTEGER},
</if>
<if test="yl3 != null">
YL3=#{yl3,jdbcType=VARCHAR},
</if>
<if test="yl4 != null">
YL4=#{yl4,jdbcType=VARCHAR},
</if>
<if test="yl5 != null">
YL5=#{yl5,jdbcType=VARCHAR},
</if>
<if test="lastUpdate != null">
LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP},
</if>
<if test="minTtl != null">
MIN_TTL=#{minTtl,jdbcType=INTEGER},
</if>
<if test="maxTtl != null">
MAX_TTL=#{maxTtl,jdbcType=INTEGER},
</if>
</set>
where ID = #{id ,jdbcType=BIGINT }
</update>
<delete id="delete" parameterType="long">
DELETE FROM DNS_RESPONSE_STRATEGY
WHERE ID = #{id,jdbcType=BIGINT}
</delete>
<select id="isValid" parameterType="long" resultType="java.lang.Integer">
select IS_VALID FROM DNS_RESPONSE_STRATEGY
WHERE ID = #{id,jdbcType=BIGINT}
</select>
<select id="isReqStrateIdUnique" resultType="java.lang.Integer">
select COUNT(ID) FROM DNS_RESPONSE_STRATEGY
WHERE REQ_STRATE_ID in(
<foreach collection="idsList" item="ids" separator=",">
#{ids,jdbcType=INTEGER}
</foreach>
)
</select>
<select id="isValidBatch" resultType="java.lang.Integer">
select count(ID) FROM DNS_RESPONSE_STRATEGY
WHERE ID in(
<foreach collection="idsList" item="ids" separator=",">
#{ids}
</foreach>
) and IS_VALID=#{isValid}
</select>
</mapper>

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.EncryptProtoRandomDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.EncryptProtoRandom">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="RANDOM_VALUE" jdbcType="INTEGER" property="randomValue" />
<result column="PROTO" jdbcType="INTEGER" property="proto" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="PROC_SEQ" jdbcType="INTEGER" property="procSeq" />
<result column="LAST_UPDATE" jdbcType="TIMESTAMP" property="lastUpdate" />
</resultMap>
<sql id="Base_Column_List">
ID, RANDOM_VALUE, PROTO, OP_TIME, IS_VALID, PROC_SEQ, LAST_UPDATE
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ENCRYPT_PROTO_RANDOM
where ID = #{id,jdbcType=BIGINT}
</select>
<delete id="delete" parameterType="java.lang.Long">
delete from ENCRYPT_PROTO_RANDOM
where ID = #{id,jdbcType=BIGINT}
</delete>
<!--
<insert id="insert" parameterType="com.nis.domain.restful.EncryptProtoRandom">
insert into ENCRYPT_PROTO_RANDOM (ID, RANDOM_VALUE, PROTO,
OP_TIME, IS_VALID, PROC_SEQ,
LAST_UPDATE)
values (#{id,jdbcType=INTEGER}, #{randomValue,jdbcType=INTEGER}, #{proto,jdbcType=INTEGER},
#{opTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=INTEGER}, #{procSeq,jdbcType=INTEGER},
#{lastUpdate,jdbcType=TIMESTAMP})
</insert>
-->
<insert id="insert" parameterType="com.nis.domain.restful.EncryptProtoRandom">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_ENCRYPT_PROTO_RANDOM.Nextval as ID from DUAL
</selectKey>
-->
insert into ENCRYPT_PROTO_RANDOM
<trim prefix="(" suffix=")" suffixOverrides=",">
ID,
<if test="randomValue != null">
RANDOM_VALUE,
</if>
<if test="proto != null">
PROTO,
</if>
<if test="opTime != null">
OP_TIME,
</if>
<if test="isValid != null">
IS_VALID,
</if>
<if test="lastUpdate != null">
LAST_UPDATE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="randomValue != null">
#{randomValue,jdbcType=INTEGER},
</if>
<if test="proto != null">
#{proto,jdbcType=INTEGER},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="isValid != null">
#{isValid,jdbcType=INTEGER},
</if>
<if test="lastUpdate != null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="update" parameterType="com.nis.domain.restful.EncryptProtoRandom">
update ENCRYPT_PROTO_RANDOM
<set>
<if test="randomValue != null">
RANDOM_VALUE = #{randomValue,jdbcType=INTEGER},
</if>
<if test="proto != null">
PROTO = #{proto,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="isValid != null">
IS_VALID = #{isValid,jdbcType=INTEGER},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<!--
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.EncryptProtoRandom">
update ENCRYPT_PROTO_RANDOM
set RANDOM_VALUE = #{randomValue,jdbcType=INTEGER},
PROTO = #{proto,jdbcType=INTEGER},
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
IS_VALID = #{isValid,jdbcType=INTEGER},
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP}
where ID = #{id,jdbcType=INTEGER}
</update>
-->
</mapper>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.FakeIpConfigCompileDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.FakeIpConfigCompile">
<id column="COMPILE_ID" jdbcType="BIGINT" property="compileId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="ACTION" jdbcType="INTEGER" property="action" />
<result column="DO_BLACKLIST" jdbcType="INTEGER" property="doBlacklist" />
<result column="DO_LOG" jdbcType="INTEGER" property="doLog" />
<result column="EFFECTIVE_RANGE" jdbcType="VARCHAR" property="effectiveRange" />
<result column="USER_REGION" jdbcType="VARCHAR" property="userRegion" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="GROUP_NUM" jdbcType="INTEGER" property="groupNum" />
<result property="lastUpdate" jdbcType="TIMESTAMP" column="LAST_UPDATE"/>
<result property="activeSys" jdbcType="INTEGER" column="ACTIVE_SYS"/>
</resultMap>
<sql id="Base_Column_List">
COMPILE_ID, SERVICE, ACTION, DO_BLACKLIST, DO_LOG, EFFECTIVE_RANGE, USER_REGION,
IS_VALID, OP_TIME, GROUP_NUM,LAST_UPDATE,ACTIVE_SYS
</sql>
<!--
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from FAKE_IP_CONFIG_COMPILE
where COMPILE_ID = #{compileId,jdbcType=BIGINT}
</select>
-->
<delete id="delete" parameterType="java.lang.Long">
delete from FAKE_IP_CONFIG_COMPILE
where COMPILE_ID = #{compileId,jdbcType=BIGINT}
</delete>
<select resultType="java.lang.Long" id="getCompileId" flushCache="true" useCache="false">
select SEQ_FAKE_IP_CONFIG_COMPILE.Nextval as ID from DUAL
</select>
<insert id="insert" parameterType="com.nis.domain.restful.FakeIpConfigCompile">
insert into FAKE_IP_CONFIG_COMPILE (COMPILE_ID, SERVICE, ACTION,
DO_BLACKLIST, DO_LOG, EFFECTIVE_RANGE,
USER_REGION, IS_VALID, OP_TIME,
GROUP_NUM,LAST_UPDATE,ACTIVE_SYS)
values (#{compileId,jdbcType=BIGINT}, #{service,jdbcType=INTEGER}, #{action,jdbcType=INTEGER},
#{doBlacklist,jdbcType=INTEGER}, #{doLog,jdbcType=INTEGER}, #{effectiveRange,jdbcType=VARCHAR},
#{userRegion,jdbcType=VARCHAR}, #{isValid,jdbcType=INTEGER}, #{opTime,jdbcType=TIMESTAMP},
#{groupNum,jdbcType=INTEGER}, #{lastUpdate,jdbcType=TIMESTAMP},#{activeSys,jdbcType=INTEGER})
</insert>
<!--
<insert id="insertSelective" parameterType="com.nis.domain.restful.FakeIpConfigCompile">
insert into FAKE_IP_CONFIG_COMPILE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="compileId != null">
COMPILE_ID,
</if>
<if test="service != null">
SERVICE,
</if>
<if test="action != null">
ACTION,
</if>
<if test="doBlacklist != null">
DO_BLACKLIST,
</if>
<if test="doLog != null">
DO_LOG,
</if>
<if test="effectiveRange != null">
EFFECTIVE_RANGE,
</if>
<if test="userRegion != null">
USER_REGION,
</if>
<if test="isValid != null">
IS_VALID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
<if test="groupNum != null">
GROUP_NUM,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="compileId != null">
#{compileId,jdbcType=BIGINT},
</if>
<if test="service != null">
#{service,jdbcType=INTEGER},
</if>
<if test="action != null">
#{action,jdbcType=INTEGER},
</if>
<if test="doBlacklist != null">
#{doBlacklist,jdbcType=INTEGER},
</if>
<if test="doLog != null">
#{doLog,jdbcType=INTEGER},
</if>
<if test="effectiveRange != null">
#{effectiveRange,jdbcType=BIGINT},
</if>
<if test="userRegion != null">
#{userRegion,jdbcType=VARCHAR},
</if>
<if test="isValid != null">
#{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="groupNum != null">
#{groupNum,jdbcType=INTEGER},
</if>
</trim>
</insert>
-->
<update id="update" parameterType="com.nis.domain.restful.FakeIpConfigCompile">
update FAKE_IP_CONFIG_COMPILE
<set>
<if test="service != null">
SERVICE = #{service,jdbcType=INTEGER},
</if>
<if test="action != null">
ACTION = #{action,jdbcType=INTEGER},
</if>
<if test="doBlacklist != null">
DO_BLACKLIST = #{doBlacklist,jdbcType=INTEGER},
</if>
<if test="doLog != null">
DO_LOG = #{doLog,jdbcType=INTEGER},
</if>
<if test="effectiveRange != null">
EFFECTIVE_RANGE = #{effectiveRange,jdbcType=VARCHAR},
</if>
<if test="userRegion != null">
USER_REGION = #{userRegion,jdbcType=VARCHAR},
</if>
<if test="isValid != null">
IS_VALID = #{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="groupNum != null">
GROUP_NUM = #{groupNum,jdbcType=INTEGER},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
<if test="activeSys != null">
ACTIVE_SYS = #{activeSys,jdbcType=INTEGER},
</if>
</set>
where COMPILE_ID = #{compileId,jdbcType=BIGINT}
</update>
<!--
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.FakeIpConfigCompile">
update FAKE_IP_CONFIG_COMPILE
set SERVICE = #{service,jdbcType=DECIMAL},
ACTION = #{action,jdbcType=DECIMAL},
DO_BLACKLIST = #{doBlacklist,jdbcType=DECIMAL},
DO_LOG = #{doLog,jdbcType=DECIMAL},
EFFECTIVE_RANGE = #{effectiveRange,jdbcType=VARCHAR},
USER_REGION = #{userRegion,jdbcType=VARCHAR},
IS_VALID = #{isValid,jdbcType=DECIMAL},
OP_TIME = #{opTime,jdbcType=DATE},
GROUP_NUM = #{groupNum,jdbcType=DECIMAL}
where COMPILE_ID = #{compileId,jdbcType=DECIMAL}
</update>
-->
</mapper>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.FakeIpConfigGroupDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.FakeIpConfigGroup">
<result column="GROUP_ID" jdbcType="BIGINT" property="groupId" />
<result column="COMPILE_ID" jdbcType="BIGINT" property="compileId" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result property="lastUpdate" jdbcType="TIMESTAMP" column="LAST_UPDATE"/>
<result property="id" jdbcType="BIGINT" column="ID"/>
</resultMap>
<insert id="insert" parameterType="com.nis.domain.restful.FakeIpConfigGroup">
insert into FAKE_IP_CONFIG_GROUP (GROUP_ID, COMPILE_ID, IS_VALID,
OP_TIME,LAST_UPDATE,ID)
values (#{groupId,jdbcType=BIGINT}, #{compileId,jdbcType=BIGINT}, #{isValid,jdbcType=INTEGER},
#{opTime,jdbcType=TIMESTAMP},#{lastUpdate,jdbcType=TIMESTAMP},SEQ_CONFIG_GROUP.Nextval)
</insert>
<!--
<insert id="insertSelective" parameterType="com.nis.domain.restful.FakeIpConfigGroup">
insert into FAKE_IP_CONFIG_GROUP
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupId != null">
GROUP_ID,
</if>
<if test="compileId != null">
COMPILE_ID,
</if>
<if test="isValid != null">
IS_VALID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupId != null">
#{groupId,jdbcType=BIGINT},
</if>
<if test="compileId != null">
#{compileId,jdbcType=BIGINT},
</if>
<if test="isValid != null">
#{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
#{opTime,jdbcType=DATE},
</if>
</trim>
</insert>
-->
</mapper>

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.FwqInfoDao">
<resultMap id="fwqInfoResultMap" type="com.nis.domain.restful.FwqInfo">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="ENTRANCE_ID" jdbcType="BIGINT" property="entranceId" />
<result column="CZYID" jdbcType="BIGINT" property="czyid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result property="lastUpdate" jdbcType="TIMESTAMP" column="LAST_UPDATE"/>
</resultMap>
<sql id="Base_Column_List">
ID, NAME, ENTRANCE_ID, CZYID, OP_TIME,LAST_UPDATE
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="fwqInfoResultMap">
select
<include refid="Base_Column_List" />
from FWQ_INFO
where ID = #{id,jdbcType=BIGINT}
</select>
<delete id="delete" parameterType="java.lang.Long">
delete from FWQ_INFO
where ID = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.nis.domain.restful.FwqInfo">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_FWQ_INFO.Nextval as ID from DUAL
</selectKey>
-->
insert into FWQ_INFO (ID, NAME, ENTRANCE_ID,
CZYID, OP_TIME,LAST_UPDATE)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{entranceId,jdbcType=BIGINT},
#{czyid,jdbcType=BIGINT}, #{opTime,jdbcType=TIMESTAMP},#{lastUpdate,jdbcType=TIMESTAMP})
</insert>
<!--
<insert id="insertSelective" parameterType="com.nis.domain.restful.FwqInfo">
insert into FWQ_INFO
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="name != null">
NAME,
</if>
<if test="entranceId != null">
ENTRANCE_ID,
</if>
<if test="czyid != null">
CZYID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="entranceId != null">
#{entranceId,jdbcType=BIGINT},
</if>
<if test="czyid != null">
#{czyid,jdbcType=BIGINT},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
-->
<update id="update" parameterType="com.nis.domain.restful.FwqInfo">
update FWQ_INFO
<set>
<if test="name != null">
NAME = #{name,jdbcType=VARCHAR},
</if>
<if test="entranceId != null">
ENTRANCE_ID = #{entranceId,jdbcType=BIGINT},
</if>
<if test="czyid != null">
CZYID = #{czyid,jdbcType=BIGINT},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<!--
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.FwqInfo">
update FWQ_INFO
set NAME = #{name,jdbcType=VARCHAR},
ENTRANCE_ID = #{entranceId,jdbcType=BIGINT},
CZYID = #{czyid,jdbcType=BIGINT},
OP_TIME = #{opTime,jdbcType=TIMESTAMP}
where ID = #{id,jdbcType=BIGINT}
</update>
-->
</mapper>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.IntervalTimeSearchDao">
<!-- DJ_FLOWCONTROL_STOP -->
<sql id="flowControlStopProperty">
CFG_ID,SERVICE,ACTION,OP_TIME
</sql>
<resultMap id="DjFlowControlStopMap" type="com.nis.domain.restful.DjFlowControlStop">
<result column="CFG_ID" jdbcType="BIGINT" property="cfgId" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="action" jdbcType="INTEGER" property="action" />
<result column="op_time" jdbcType="TIMESTAMP" property="opTime" />
</resultMap>
<select id="findFlowControlStopPage" parameterType="com.nis.domain.restful.DjFlowControlStop" resultMap="DjFlowControlStopMap">
SELECT
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="flowControlStopProperty"/>
</otherwise>
</choose>
FROM DJ_FLOWCONTROL_STOP
<where>
<if test="optStartTime != null and optStartTime !=''">
<![CDATA[AND OP_TIME >= to_date(#{optStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="optEndTime != null and optEndTime !=''">
<![CDATA[AND OP_TIME < to_date(#{optEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<!-- <if test="searchCfgId != null and searchCfgId !=''">
AND cfg_id =${searchCfgId}
</if> -->
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
</mapper>

View File

@@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.IpLocationPublicDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.IpLocationPublic">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="IP_START" jdbcType="VARCHAR" property="ipStart" />
<result column="IP_END" jdbcType="VARCHAR" property="ipEnd" />
<result column="IP_START_NUM" jdbcType="BIGINT" property="ipStartNum" />
<result column="IP_END_NUM" jdbcType="BIGINT" property="ipEndNum" />
<result column="CONTINENT" jdbcType="VARCHAR" property="continent" />
<result column="COUNTRY" jdbcType="VARCHAR" property="country" />
<result column="PROVINCE" jdbcType="VARCHAR" property="province" />
<result column="CITY" jdbcType="VARCHAR" property="city" />
<result column="DISTRICT" jdbcType="VARCHAR" property="district" />
<result column="DESCRIPTION" jdbcType="VARCHAR" property="description" />
<result column="ISP" jdbcType="VARCHAR" property="isp" />
<result column="AREA_CODE" jdbcType="VARCHAR" property="areaCode" />
<result column="COUNTRY_ENGLISH" jdbcType="VARCHAR" property="countryEnglish" />
<result column="COUNTRY_CODE" jdbcType="VARCHAR" property="countryCode" />
<result column="LONGITUDE" jdbcType="VARCHAR" property="longitude" />
<result column="LATITUDE" jdbcType="VARCHAR" property="latitude" />
</resultMap>
<sql id="Base_Column_List">
ID, IP_START, IP_END, IP_START_NUM, IP_END_NUM, CONTINENT, COUNTRY, PROVINCE, CITY,
DISTRICT, DESCRIPTION, ISP, AREA_CODE, COUNTRY_ENGLISH, COUNTRY_CODE, LONGITUDE,
LATITUDE
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from IP_LOCATION_PUBLIC
where ID = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from IP_LOCATION_PUBLIC
where ID = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.nis.domain.restful.IpLocationPublic">
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_IP_LOCATION_PUBLIC.Nextval as ID from DUAL
</selectKey>
insert into IP_LOCATION_PUBLIC (ID, IP_START, IP_END,
IP_START_NUM, IP_END_NUM, CONTINENT,
COUNTRY, PROVINCE, CITY,
DISTRICT, DESCRIPTION, ISP,
AREA_CODE, COUNTRY_ENGLISH, COUNTRY_CODE,
LONGITUDE, LATITUDE)
values (#{id,jdbcType=BIGINT}, #{ipStart,jdbcType=VARCHAR}, #{ipEnd,jdbcType=VARCHAR},
#{ipStartNum,jdbcType=BIGINT}, #{ipEndNum,jdbcType=BIGINT}, #{continent,jdbcType=VARCHAR},
#{country,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR},
#{district,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{isp,jdbcType=VARCHAR},
#{areaCode,jdbcType=VARCHAR}, #{countryEnglish,jdbcType=VARCHAR}, #{countryCode,jdbcType=VARCHAR},
#{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.nis.domain.restful.IpLocationPublic">
insert into IP_LOCATION_PUBLIC
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="ipStart != null">
IP_START,
</if>
<if test="ipEnd != null">
IP_END,
</if>
<if test="ipStartNum != null">
IP_START_NUM,
</if>
<if test="ipEndNum != null">
IP_END_NUM,
</if>
<if test="continent != null">
CONTINENT,
</if>
<if test="country != null">
COUNTRY,
</if>
<if test="province != null">
PROVINCE,
</if>
<if test="city != null">
CITY,
</if>
<if test="district != null">
DISTRICT,
</if>
<if test="description != null">
DESCRIPTION,
</if>
<if test="isp != null">
ISP,
</if>
<if test="areaCode != null">
AREA_CODE,
</if>
<if test="countryEnglish != null">
COUNTRY_ENGLISH,
</if>
<if test="countryCode != null">
COUNTRY_CODE,
</if>
<if test="longitude != null">
LONGITUDE,
</if>
<if test="latitude != null">
LATITUDE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="ipStart != null">
#{ipStart,jdbcType=VARCHAR},
</if>
<if test="ipEnd != null">
#{ipEnd,jdbcType=VARCHAR},
</if>
<if test="ipStartNum != null">
#{ipStartNum,jdbcType=BIGINT},
</if>
<if test="ipEndNum != null">
#{ipEndNum,jdbcType=BIGINT},
</if>
<if test="continent != null">
#{continent,jdbcType=VARCHAR},
</if>
<if test="country != null">
#{country,jdbcType=VARCHAR},
</if>
<if test="province != null">
#{province,jdbcType=VARCHAR},
</if>
<if test="city != null">
#{city,jdbcType=VARCHAR},
</if>
<if test="district != null">
#{district,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="isp != null">
#{isp,jdbcType=VARCHAR},
</if>
<if test="areaCode != null">
#{areaCode,jdbcType=VARCHAR},
</if>
<if test="countryEnglish != null">
#{countryEnglish,jdbcType=VARCHAR},
</if>
<if test="countryCode != null">
#{countryCode,jdbcType=VARCHAR},
</if>
<if test="longitude != null">
#{longitude,jdbcType=VARCHAR},
</if>
<if test="latitude != null">
#{latitude,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.nis.domain.restful.IpLocationPublic">
update IP_LOCATION_PUBLIC
<set>
<if test="ipStart != null">
IP_START = #{ipStart,jdbcType=VARCHAR},
</if>
<if test="ipEnd != null">
IP_END = #{ipEnd,jdbcType=VARCHAR},
</if>
<if test="ipStartNum != null">
IP_START_NUM = #{ipStartNum,jdbcType=BIGINT},
</if>
<if test="ipEndNum != null">
IP_END_NUM = #{ipEndNum,jdbcType=BIGINT},
</if>
<if test="continent != null">
CONTINENT = #{continent,jdbcType=VARCHAR},
</if>
<if test="country != null">
COUNTRY = #{country,jdbcType=VARCHAR},
</if>
<if test="province != null">
PROVINCE = #{province,jdbcType=VARCHAR},
</if>
<if test="city != null">
CITY = #{city,jdbcType=VARCHAR},
</if>
<if test="district != null">
DISTRICT = #{district,jdbcType=VARCHAR},
</if>
<if test="description != null">
DESCRIPTION = #{description,jdbcType=VARCHAR},
</if>
<if test="isp != null">
ISP = #{isp,jdbcType=VARCHAR},
</if>
<if test="areaCode != null">
AREA_CODE = #{areaCode,jdbcType=VARCHAR},
</if>
<if test="countryEnglish != null">
COUNTRY_ENGLISH = #{countryEnglish,jdbcType=VARCHAR},
</if>
<if test="countryCode != null">
COUNTRY_CODE = #{countryCode,jdbcType=VARCHAR},
</if>
<if test="longitude != null">
LONGITUDE = #{longitude,jdbcType=VARCHAR},
</if>
<if test="latitude != null">
LATITUDE = #{latitude,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.IpLocationPublic">
update IP_LOCATION_PUBLIC
set IP_START = #{ipStart,jdbcType=VARCHAR},
IP_END = #{ipEnd,jdbcType=VARCHAR},
IP_START_NUM = #{ipStartNum,jdbcType=BIGINT},
IP_END_NUM = #{ipEndNum,jdbcType=BIGINT},
CONTINENT = #{continent,jdbcType=VARCHAR},
COUNTRY = #{country,jdbcType=VARCHAR},
PROVINCE = #{province,jdbcType=VARCHAR},
CITY = #{city,jdbcType=VARCHAR},
DISTRICT = #{district,jdbcType=VARCHAR},
DESCRIPTION = #{description,jdbcType=VARCHAR},
ISP = #{isp,jdbcType=VARCHAR},
AREA_CODE = #{areaCode,jdbcType=VARCHAR},
COUNTRY_ENGLISH = #{countryEnglish,jdbcType=VARCHAR},
COUNTRY_CODE = #{countryCode,jdbcType=VARCHAR},
LONGITUDE = #{longitude,jdbcType=VARCHAR},
LATITUDE = #{latitude,jdbcType=VARCHAR}
where ID = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.IpRegionDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.IpRegion">
<result column="REGION_ID" jdbcType="BIGINT" property="regionId" />
<result column="GROUP_ID" jdbcType="BIGINT" property="groupId" />
<result column="ADDR_TYPE" jdbcType="INTEGER" property="addrType" />
<result column="SRC_IP" jdbcType="VARCHAR" property="srcIp" />
<result column="MASK_SRC_IP" jdbcType="VARCHAR" property="maskSrcIp" />
<result column="SRC_PORT" jdbcType="VARCHAR" property="srcPort" />
<result column="MASK_SRC_PORT" jdbcType="VARCHAR" property="maskSrcPort" />
<result column="DST_IP" jdbcType="VARCHAR" property="dstIp" />
<result column="MASK_DST_IP" jdbcType="VARCHAR" property="maskDstIp" />
<result column="DST_PORT" jdbcType="VARCHAR" property="dstPort" />
<result column="MASK_DST_PORT" jdbcType="VARCHAR" property="maskDstPort" />
<result column="PROTOCOL" jdbcType="INTEGER" property="protocol" />
<result column="DIRECTION" jdbcType="INTEGER" property="direction" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="LAST_UPDATE" jdbcType="TIMESTAMP" property="lastUpdate" />
<result column="PROC_SEQ" jdbcType="BIGINT" property="procSeq" />
</resultMap>
<sql id="ipRegionSql">
REGION_ID,GROUP_ID,
ADDR_TYPE,SRC_IP,MASK_SRC_IP,SRC_PORT,MASK_SRC_PORT,DST_IP,
MASK_DST_IP,DST_PORT,MASK_DST_PORT,PROTOCOL,DIRECTION,IS_VALID,OP_TIME,LAST_UPDATE,PROC_SEQ
</sql>
<select id="queryIpRegionById" parameterType="com.nis.domain.restful.IpRegion"
resultMap="BaseResultMap">
select
<include refid="ipRegionSql" />
from ${tableName} where REGION_ID = #{regionId,jdbcType=BIGINT}
</select>
<select id="queryIpRegionByGroupId" resultMap="BaseResultMap">
select
<include refid="ipRegionSql" />
from ${tableName} where GROUP_ID in
<foreach item="item" index="index" collection="groupIdArr" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<insert id="saveIpRegionBatch">
<!-- insert /*+append*/ into ${tableName} -->
insert into ${tableName}
(REGION_ID,
GROUP_ID,
ADDR_TYPE,
SRC_IP,
MASK_SRC_IP,
SRC_PORT,
MASK_SRC_PORT,
DST_IP,
MASK_DST_IP,
DST_PORT,
MASK_DST_PORT,
PROTOCOL,
DIRECTION,
IS_VALID,
OP_TIME,LAST_UPDATE
<!-- ,PROC_SEQ -->
)
<foreach collection="ipRegionList" item="item" index="index" open="("
close=")" separator="union">
select
#{item.regionId,jdbcType=BIGINT},
#{item.groupId,jdbcType=BIGINT},
#{item.addrType,jdbcType=INTEGER},
#{item.srcIp,jdbcType=VARCHAR},
#{item.maskSrcIp,jdbcType=VARCHAR},
#{item.srcPort,jdbcType=VARCHAR},
#{item.maskSrcPort,jdbcType=VARCHAR},
#{item.dstIp,jdbcType=VARCHAR},
#{item.maskDstIp,jdbcType=VARCHAR},
#{item.dstPort,jdbcType=VARCHAR},
#{item.maskDstPort,jdbcType=VARCHAR},
#{item.protocol,jdbcType=INTEGER},
#{item.direction,jdbcType=INTEGER},
#{item.isValid,jdbcType=INTEGER},
#{item.opTime,jdbcType=TIMESTAMP},
sysdate
<!-- #{item.procSeq,jdbcType=BIGINT} -->
from dual
</foreach>
</insert>
<insert id="saveIpRegion" parameterType="com.nis.domain.restful.IpRegion">
<!-- <selectKey keyProperty="regionId" resultType="java.lang.Long" -->
<!-- order="BEFORE"> 取消使用序列,界面会将id传过来 -->
<!-- select seq_regionId.nextval from dual -->
<!-- </selectKey> -->
insert into ${tableName}
(REGION_ID,
GROUP_ID,
ADDR_TYPE,
SRC_IP,
MASK_SRC_IP,
SRC_PORT,
MASK_SRC_PORT,
DST_IP,
MASK_DST_IP,
DST_PORT,
MASK_DST_PORT,
PROTOCOL,
DIRECTION,
IS_VALID,
<if test="lastUpdate != null">
LAST_UPDATE,
</if>
OP_TIME
)
values
(#{regionId,jdbcType=BIGINT},
#{groupId,jdbcType=BIGINT},
#{addrType,jdbcType=INTEGER},
#{srcIp,jdbcType=VARCHAR},
#{maskSrcIp,jdbcType=VARCHAR},
#{srcPort,jdbcType=VARCHAR},
#{maskSrcPort,jdbcType=VARCHAR},
#{dstIp,jdbcType=VARCHAR},
#{maskDstIp,jdbcType=VARCHAR},
#{dstPort,jdbcType=VARCHAR},
#{maskDstPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
<if test="lastUpdate != null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
#{opTime,jdbcType=TIMESTAMP}
)
</insert>
<update id="updateIpRegion" parameterType="com.nis.domain.restful.IpRegion">
UPDATE ${tableName}
<set>
<if test="isValid != null">
IS_VALID=#{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME=#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where REGION_ID=#{regionId}
</update>
<!--
<update id="updateIpRegion" parameterType="com.nis.domain.restful.IpRegion">
UPDATE ${tableName}
<set>
<if test="groupId != null">
GROUP_ID=#{groupId,jdbcType=BIGINT},
</if>
<if test="addrType != null">
ADDR_TYPE=#{addrType,jdbcType=INTEGER},
</if>
<if test="srcIp != null and srcIp !=''">
SRC_IP=#{srcIp,jdbcType=VARCHAR},
</if>
<if test="maskSrcIp != null and maskSrcIp !=''">
MASK_SRC_IP=#{maskSrcIp,jdbcType=VARCHAR},
</if>
<if test="srcPort != null and srcPort !=''">
SRC_PORT=#{srcPort,jdbcType=VARCHAR},
</if>
<if test="maskSrcPort != null and maskSrcPort !=''">
MASK_SRC_PORT=#{maskSrcPort,jdbcType=VARCHAR},
</if>
<if test="dstIp != null and dstIp !=''">
DST_IP=#{dstIp,jdbcType=VARCHAR},
</if>
<if test="maskDstIp != null and maskDstIp !=''">
MASK_DST_IP=#{maskDstIp,jdbcType=VARCHAR},
</if>
<if test="dstPort != null and dstPort !=''">
DST_PORT=#{dstPort,jdbcType=VARCHAR},
</if>
<if test="maskDstPort != null and maskDstPort !=''">
MASK_DST_PORT=#{maskDstPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null">
PROTOCOL=#{protocol,jdbcType=INTEGER},
</if>
<if test="direction != null">
DIRECTION=#{direction,jdbcType=INTEGER},
</if>
<if test="isValid != null">
IS_VALID=#{isValid,jdbcType=INTEGER},
</if>
<if test="opTime != null">
OP_TIME=#{opTime,jdbcType=TIMESTAMP},
</if>
</set>
where REGION_ID=#{regionId}
</update>
-->
</mapper>

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.JdjInfoDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.JdjInfo">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="FWQ_ID" jdbcType="BIGINT" property="fwqId" />
<result column="JC_IP" jdbcType="VARCHAR" property="jcIp" />
<result column="FD_IP" jdbcType="VARCHAR" property="fdIp" />
<result column="CZYID" jdbcType="BIGINT" property="czyid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result property="lastUpdate" jdbcType="TIMESTAMP" column="LAST_UPDATE"/>
</resultMap>
<sql id="Base_Column_List">
ID, NAME, FWQ_ID, JC_IP, FD_IP, CZYID, OP_TIME,LAST_UPDATE
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from JDJ_INFO
where ID = #{id,jdbcType=BIGINT}
</select>
<delete id="delete" parameterType="java.lang.Long">
delete from JDJ_INFO
where ID = #{id,jdbcType=BIGINT}
</delete>
<!--
<insert id="insert" parameterType="com.nis.domain.restful.JdjInfo">
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_JDJ_INFO.Nextval as ID from DUAL
</selectKey>
insert into JDJ_INFO (ID, NAME, FWQ_ID,
JC_IP, FD_IP, CZYID,
OP_TIME)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{fwqId,jdbcType=BIGINT},
#{jcIp,jdbcType=VARCHAR}, #{fdIp,jdbcType=VARCHAR}, #{czyid,jdbcType=BIGINT},
#{opTime,jdbcType=TIMESTAMP})
</insert>
-->
<insert id="insert" parameterType="com.nis.domain.restful.JdjInfo">
<!--
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="id">
SELECT SEQ_JDJ_INFO.Nextval as ID from DUAL
</selectKey> -->
insert into JDJ_INFO
<trim prefix="(" suffix=")" suffixOverrides=",">
ID,
<if test="name != null">
NAME,
</if>
<if test="fwqId != null">
FWQ_ID,
</if>
<if test="jcIp != null">
JC_IP,
</if>
<if test="fdIp != null">
FD_IP,
</if>
<if test="czyid != null">
CZYID,
</if>
<if test="opTime != null">
OP_TIME,
</if>
<if test="lastUpdate != null">
LAST_UPDATE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="fwqId != null">
#{fwqId,jdbcType=BIGINT},
</if>
<if test="jcIp != null">
#{jcIp,jdbcType=VARCHAR},
</if>
<if test="fdIp != null">
#{fdIp,jdbcType=VARCHAR},
</if>
<if test="czyid != null">
#{czyid,jdbcType=BIGINT},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="update" parameterType="com.nis.domain.restful.JdjInfo">
update JDJ_INFO
<set>
<if test="name != null">
NAME = #{name,jdbcType=VARCHAR},
</if>
<if test="fwqId != null">
FWQ_ID = #{fwqId,jdbcType=BIGINT},
</if>
<if test="jcIp != null">
JC_IP = #{jcIp,jdbcType=VARCHAR},
</if>
<if test="fdIp != null">
FD_IP = #{fdIp,jdbcType=VARCHAR},
</if>
<if test="czyid != null">
CZYID = #{czyid,jdbcType=BIGINT},
</if>
<if test="opTime != null">
OP_TIME = #{opTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdate != null">
LAST_UPDATE = #{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
<!--
<update id="updateByPrimaryKey" parameterType="com.nis.domain.restful.JdjInfo">
update JDJ_INFO
set NAME = #{name,jdbcType=VARCHAR},
FWQ_ID = #{fwqId,jdbcType=BIGINT},
JC_IP = #{jcIp,jdbcType=VARCHAR},
FD_IP = #{fdIp,jdbcType=VARCHAR},
CZYID = #{czyid,jdbcType=BIGINT},
OP_TIME = #{opTime,jdbcType=TIMESTAMP}
where ID = #{id,jdbcType=BIGINT}
</update>
-->
</mapper>

View File

@@ -0,0 +1,32 @@
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.nis.web.dao;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.stereotype.Component;
/**
* 标识MyBatis的DAO,方便{@link org.mybatis.spring.mapper.MapperScannerConfigurer}的扫描。
* @author thinkgem
* @version 2013-8-28
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Component
public @interface MyBatisDao {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
*/
String value() default "";
}

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.NumRegionDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.NumRegion">
<result column="REGION_ID" jdbcType="BIGINT" property="regionId" />
<result column="GROUP_ID" jdbcType="BIGINT" property="groupId" />
<result column="LOW_BOUNDARY" jdbcType="BIGINT" property="lowBoundary" />
<result column="UP_BOUNDARY" jdbcType="BIGINT" property="upBoundary" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="LAST_UPDATE" jdbcType="TIMESTAMP" property="lastUpdate" />
<result column="PROC_SEQ" jdbcType="BIGINT" property="procSeq" />
</resultMap>
<sql id="numRegionSql">
REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE,PROC_SEQ
</sql>
<select id="queryNumRegionById" parameterType="com.nis.domain.restful.NumRegion"
resultMap="BaseResultMap">
select
<include refid="numRegionSql" />
from ${tableName} where REGION_ID = #{regionId ,jdbcType=BIGINT }
</select>
<select id="queryNumRegionByGroupId" resultMap="BaseResultMap">
select
<include refid="numRegionSql" />
from ${tableName} where GROUP_ID in
<foreach item="item" index="index" collection="groupIdArr" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<insert id="saveNumRegionBatch">
<!-- insert /*+append*/ into ${tableName} -->
insert into ${tableName}
(REGION_ID ,
GROUP_ID ,
LOW_BOUNDARY ,
UP_BOUNDARY ,
IS_VALID ,
OP_TIME,LAST_UPDATE
<!-- ,PROC_SEQ -->
)
<foreach collection="numRegionList" item="item" index="index"
open="(" close=")" separator="union">
select
#{item.regionId,jdbcType=BIGINT},
#{item.groupId,jdbcType=BIGINT},
#{item.lowBoundary,jdbcType=BIGINT},
#{item.upBoundary,jdbcType=BIGINT},
#{item.isValid,jdbcType=INTEGER},
#{item.opTime,jdbcType=TIMESTAMP},
sysdate
<!-- ,#{item.procSeq,jdbcType=BIGINT} -->
from dual
</foreach>
</insert>
<insert id="saveNumRegion" parameterType="com.nis.domain.restful.NumRegion">
<!-- <selectKey keyProperty="regionId" resultType="java.lang.Long" -->
<!-- order="BEFORE"> 取消使用序列,界面会将id传过来 -->
<!-- select seq_regionId.nextval from dual -->
<!-- </selectKey> -->
insert into ${tableName}
(REGION_ID ,
GROUP_ID ,
LOW_BOUNDARY ,
UP_BOUNDARY ,
IS_VALID ,
<if test="lastUpdate != null">
LAST_UPDATE,
</if>
OP_TIME
)
values
(#{regionId,jdbcType=BIGINT},
#{groupId,jdbcType=BIGINT},
#{lowBoundary,jdbcType=BIGINT},
#{upBoundary,jdbcType=BIGINT},
#{isValid,jdbcType=INTEGER},
<if test="lastUpdate != null">
#{lastUpdate,jdbcType=TIMESTAMP},
</if>
#{opTime,jdbcType=TIMESTAMP}
)
</insert>
<update id="updateNumRegion" parameterType="com.nis.domain.restful.NumRegion">
UPDATE ${tableName}
<set>
<if test="isValid != null">
IS_VALID=#{isValid , jdbcType=INTEGER },
</if>
<if test="opTime != null">
OP_TIME= #{ opTime , jdbcType=TIMESTAMP },
</if>
<if test="lastUpdate != null">
LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where REGION_ID=#{regionId}
</update>
<!--
<update id="updateNumRegion" parameterType="com.nis.domain.restful.NumRegion">
UPDATE ${tableName}
<set>
<if test="groupId != null">
GROUP_ID=#{groupId , jdbcType=BIGINT },
</if>
<if test="lowBoundary != null">
LOW_BOUNDARY=#{lowBoundary,jdbcType=BIGINT},
</if>
<if test="upBoundary != null">
UP_BOUNDARY=#{upBoundary,jdbcType=BIGINT},
</if>
<if test="isValid != null">
IS_VALID=#{isValid , jdbcType=INTEGER },
</if>
<if test="opTime != null">
OP_TIME= #{ opTime , jdbcType=TIMESTAMP },
</if>
</set>
where REGION_ID=#{regionId}
</update>
-->
</mapper>

View File

@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.ServicesRequestLogDao">
<resultMap id="ServicesRequestLogMap" type="com.nis.domain.ServicesRequestLog">
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="OPERATOR" jdbcType="VARCHAR" property="operator" />
<result column="VERSION" jdbcType="VARCHAR" property="version" />
<result column="OPACTION" jdbcType="INTEGER" property="opAction" />
<result column="OPTIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="REQUEST_CONTENT" jdbcType="CLOB" property="requestContent" />
<result column="REQUEST_TIME" jdbcType="TIMESTAMP" property="requestTime" />
<result column="CONSUMER_TIME" jdbcType="BIGINT" property="consumerTime" />
<result column="REQUEST_IP" jdbcType="VARCHAR" property="requestIp" />
<result column="BUSINESS_CODE" jdbcType="INTEGER" property="businessCode" />
<result column="EXCEPTION_INFO" jdbcType="VARCHAR" property="exceptionInfo" />
<result column="SERVER_IP" jdbcType="VARCHAR" property="serverIp" />
</resultMap>
<sql id="Base_Column_List">
ID, OPERATOR, VERSION, OPACTION,OPTIME, REQUEST_CONTENT,
REQUEST_TIME,REQUEST_IP,
CONSUMER_TIME,BUSINESS_CODE,EXCEPTION_INFO,SERVER_IP
</sql>
<select id="getAllLog" parameterType="com.nis.domain.restful.ServicesRequestLogBean"
resultMap="ServicesRequestLogMap">
select
<include refid="Base_Column_List" />
from SERVICES_REQUEST_LOG
<where>
<if test="id != null">
AND ID = #{id}
</if>
<if test="operator != null and operator !=''">
AND operator = #{operator}
</if>
<if test="version != null and version !=''">
AND version = #{version}
</if>
<if test="opAction != null">
AND opAction = #{opAction}
</if>
<if test="opStartTime != null and opStartTime !=''">
<![CDATA[AND opTime >= to_date(#{opStartTime },'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="opEndTime != null and opEndTime !=''">
<![CDATA[AND opTime < to_date(#{opEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="requestContent != null and requestContent !=''">
AND REQUEST_CONTENT like '%'||#{requestContent}||'%'
</if>
<if test="requestStartTime != null and requestStartTime !=''">
<![CDATA[AND REQUEST_TIME >= to_date(#{requestStartTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="requestEndTime != null and requestEndTime !=''">
<![CDATA[AND REQUEST_TIME < to_date(#{requestEndTime},'yyyy-MM-dd HH24:mi:ss')]]>
</if>
<if test="consumerTime != null">
AND CONSUMER_TIME = #{consumerTime}
</if>
<if test="requestIp != null and requestIp !=''">
AND REQUEST_IP like '%'||#{requestIp}||'%'
</if>
<if test="businessCode != null">
AND BUSINESS_CODE =#{businessCode}
</if>
<if test="exceptionInfo != null and exceptionInfo !=''">
AND EXCEPTION_INFO like '%'||#{exceptionInfo}||'%'
</if>
<if test="serverIp != null and serverIp !=''">
AND SERVER_IP like '%'||#{serverIp}||'%'
</if>
</where>
order by request_time desc
</select>
<!-- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select <include refid="Base_Column_List" /> from SERVICES_REQUEST_LOG where
ID = #{id,jdbcType=BIGINT} </select> -->
<delete id="deleteById" parameterType="java.lang.Long">
delete from
SERVICES_REQUEST_LOG
where ID = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteAll">
delete from
SERVICES_REQUEST_LOG
</delete>
<insert id="insert" parameterType="com.nis.domain.ServicesRequestLog">
insert into SERVICES_REQUEST_LOG
<trim prefix="(" suffix=")" suffixOverrides=",">
ID,
<if test="operator != null">
OPERATOR,
</if>
<if test="version != null">
VERSION,
</if>
<if test="opAction != null">
OPACTION,
</if>
<if test="opTime != null">
OPTIME,
</if>
<if test="requestContent != null">
REQUEST_CONTENT,
</if>
<if test="requestTime != null">
REQUEST_TIME,
</if>
<if test="consumerTime != null">
CONSUMER_TIME,
</if>
<if test="requestIp != null">
REQUEST_IP,
</if>
<if test="businessCode != null">
BUSINESS_CODE,
</if>
<if test="exceptionInfo != null">
EXCEPTION_INFO,
</if>
<if test="serverIp != null">
SERVER_IP,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
SEQ_SERVICES_REQUEST_LOG.Nextval,
<if test="operator != null">
#{operator,jdbcType=VARCHAR},
</if>
<if test="version != null">
#{version,jdbcType=VARCHAR},
</if>
<if test="opAction != null">
#{opAction,jdbcType=INTEGER},
</if>
<if test="opTime != null">
#{opTime,jdbcType=TIMESTAMP},
</if>
<if test="requestContent != null">
#{requestContent,jdbcType=CLOB},
</if>
<if test="requestTime != null">
#{requestTime,jdbcType=TIMESTAMP},
</if>
<if test="consumerTime != null">
#{consumerTime,jdbcType=BIGINT},
</if>
<if test="requestIp != null">
#{requestIp,jdbcType=VARCHAR},
</if>
<if test="businessCode != null">
#{businessCode,jdbcType=INTEGER},
</if>
<if test="exceptionInfo != null">
#{exceptionInfo,jdbcType=VARCHAR},
</if>
<if test="serverIp != null">
#{serverIp,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>

View File

@@ -0,0 +1,25 @@
package com.nis.web.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.SrcIp;
@MyBatisDao
public interface SrcIpDao extends CrudDao<SrcIp> {
List<SrcIp> getIpInfo(@Param("ip") Long ipaddr);
int deleteByPrimaryKey(Integer seqId);
int insert(SrcIp record);
int insertSelective(SrcIp record);
SrcIp selectByPrimaryKey(Integer seqId);
int updateByPrimaryKeySelective(SrcIp record);
int updateByPrimaryKey(SrcIp record);
}

View File

@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.SrcIpDao" >
<resultMap id="BaseResultMap" type="com.nis.domain.SrcIp" >
<id column="seq_id" property="seqId" jdbcType="INTEGER" />
<result column="ip_start_addr" property="ipStartAddr" jdbcType="INTEGER" />
<result column="ip_end_addr" property="ipEndAddr" jdbcType="INTEGER" />
<result column="ip_addr_range" property="ipAddrRange" jdbcType="INTEGER" />
<result column="ip_start_string" property="ipStartString" jdbcType="VARCHAR" />
<result column="ip_end_string" property="ipEndString" jdbcType="VARCHAR" />
<result column="port" property="port" jdbcType="INTEGER" />
<result column="isp_id" property="ispId" jdbcType="BIGINT" />
<result column="area_id" property="areaId" jdbcType="BIGINT" />
<result column="flag" property="flag" jdbcType="INTEGER" />
<result column="description" property="description" jdbcType="VARCHAR" />
<result column="yl1" property="yl1" jdbcType="INTEGER" />
<result column="yl2" property="yl2" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
seq_id, ip_start_addr, ip_end_addr, ip_addr_range, ip_start_string, ip_end_string,
port, isp_id, area_id, flag, description, yl1, yl2
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from src_ip
where seq_id = #{seqId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from src_ip
where seq_id = #{seqId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.nis.domain.SrcIp" >
insert into src_ip (seq_id, ip_start_addr, ip_end_addr,
ip_addr_range, ip_start_string, ip_end_string,
port, isp_id, area_id,
flag, description, yl1,
yl2)
values (#{seqId,jdbcType=INTEGER}, #{ipStartAddr,jdbcType=INTEGER}, #{ipEndAddr,jdbcType=INTEGER},
#{ipAddrRange,jdbcType=INTEGER}, #{ipStartString,jdbcType=VARCHAR}, #{ipEndString,jdbcType=VARCHAR},
#{port,jdbcType=INTEGER}, #{ispId,jdbcType=BIGINT}, #{areaId,jdbcType=BIGINT},
#{flag,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{yl1,jdbcType=INTEGER},
#{yl2,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.nis.domain.SrcIp" >
insert into src_ip
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="seqId != null" >
seq_id,
</if>
<if test="ipStartAddr != null" >
ip_start_addr,
</if>
<if test="ipEndAddr != null" >
ip_end_addr,
</if>
<if test="ipAddrRange != null" >
ip_addr_range,
</if>
<if test="ipStartString != null" >
ip_start_string,
</if>
<if test="ipEndString != null" >
ip_end_string,
</if>
<if test="port != null" >
port,
</if>
<if test="ispId != null" >
isp_id,
</if>
<if test="areaId != null" >
area_id,
</if>
<if test="flag != null" >
flag,
</if>
<if test="description != null" >
description,
</if>
<if test="yl1 != null" >
yl1,
</if>
<if test="yl2 != null" >
yl2,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="seqId != null" >
#{seqId,jdbcType=INTEGER},
</if>
<if test="ipStartAddr != null" >
#{ipStartAddr,jdbcType=INTEGER},
</if>
<if test="ipEndAddr != null" >
#{ipEndAddr,jdbcType=INTEGER},
</if>
<if test="ipAddrRange != null" >
#{ipAddrRange,jdbcType=INTEGER},
</if>
<if test="ipStartString != null" >
#{ipStartString,jdbcType=VARCHAR},
</if>
<if test="ipEndString != null" >
#{ipEndString,jdbcType=VARCHAR},
</if>
<if test="port != null" >
#{port,jdbcType=INTEGER},
</if>
<if test="ispId != null" >
#{ispId,jdbcType=BIGINT},
</if>
<if test="areaId != null" >
#{areaId,jdbcType=BIGINT},
</if>
<if test="flag != null" >
#{flag,jdbcType=INTEGER},
</if>
<if test="description != null" >
#{description,jdbcType=VARCHAR},
</if>
<if test="yl1 != null" >
#{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null" >
#{yl2,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.nis.domain.SrcIp" >
update src_ip
<set >
<if test="ipStartAddr != null" >
ip_start_addr = #{ipStartAddr,jdbcType=INTEGER},
</if>
<if test="ipEndAddr != null" >
ip_end_addr = #{ipEndAddr,jdbcType=INTEGER},
</if>
<if test="ipAddrRange != null" >
ip_addr_range = #{ipAddrRange,jdbcType=INTEGER},
</if>
<if test="ipStartString != null" >
ip_start_string = #{ipStartString,jdbcType=VARCHAR},
</if>
<if test="ipEndString != null" >
ip_end_string = #{ipEndString,jdbcType=VARCHAR},
</if>
<if test="port != null" >
port = #{port,jdbcType=INTEGER},
</if>
<if test="ispId != null" >
isp_id = #{ispId,jdbcType=BIGINT},
</if>
<if test="areaId != null" >
area_id = #{areaId,jdbcType=BIGINT},
</if>
<if test="flag != null" >
flag = #{flag,jdbcType=INTEGER},
</if>
<if test="description != null" >
description = #{description,jdbcType=VARCHAR},
</if>
<if test="yl1 != null" >
yl1 = #{yl1,jdbcType=INTEGER},
</if>
<if test="yl2 != null" >
yl2 = #{yl2,jdbcType=VARCHAR},
</if>
</set>
where seq_id = #{seqId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.nis.domain.SrcIp" >
update src_ip
set ip_start_addr = #{ipStartAddr,jdbcType=INTEGER},
ip_end_addr = #{ipEndAddr,jdbcType=INTEGER},
ip_addr_range = #{ipAddrRange,jdbcType=INTEGER},
ip_start_string = #{ipStartString,jdbcType=VARCHAR},
ip_end_string = #{ipEndString,jdbcType=VARCHAR},
port = #{port,jdbcType=INTEGER},
isp_id = #{ispId,jdbcType=BIGINT},
area_id = #{areaId,jdbcType=BIGINT},
flag = #{flag,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
yl1 = #{yl1,jdbcType=INTEGER},
yl2 = #{yl2,jdbcType=VARCHAR}
where seq_id = #{seqId,jdbcType=INTEGER}
</update>
</mapper>

View File

@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.StrRegionDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.StrRegion">
<result column="REGION_ID" jdbcType="BIGINT" property="regionId" />
<result column="GROUP_ID" jdbcType="BIGINT" property="groupId" />
<result column="DISTRICT" jdbcType="VARCHAR" property="district" />
<result column="KEYWORDS" jdbcType="VARCHAR" property="keywords" />
<result column="EXPR_TYPE" jdbcType="INTEGER" property="exprType" />
<result column="MATCH_METHOD" jdbcType="INTEGER" property="matchMethod" />
<result column="IS_HEXBIN" jdbcType="INTEGER" property="isHexbin" />
<result column="IS_VALID" jdbcType="INTEGER" property="isValid" />
<result column="OP_TIME" jdbcType="TIMESTAMP" property="opTime" />
<result column="LAST_UPDATE" jdbcType="TIMESTAMP" property="lastUpdate" />
<result column="PROC_SEQ" jdbcType="BIGINT" property="procSeq" />
</resultMap>
<sql id="strRegionSql">
REGION_ID,
GROUP_ID,
KEYWORDS,
EXPR_TYPE,
MATCH_METHOD,
IS_HEXBIN,
IS_VALID,
OP_TIME,LAST_UPDATE,PROC_SEQ
</sql>
<sql id="strStrongRegionSql">
REGION_ID,
GROUP_ID,
DISTRICT,
KEYWORDS,
EXPR_TYPE,
MATCH_METHOD,
IS_HEXBIN,
IS_VALID,
OP_TIME,LAST_UPDATE,PROC_SEQ
</sql>
<select id="queryStrRegionById" parameterType="com.nis.domain.restful.StrRegion"
resultMap="BaseResultMap">
select
<include refid="strRegionSql" />
from ${tableName} where REGION_ID = #{regionId ,jdbcType=BIGINT }
</select>
<select id="queryStrStrongRegionByGroupId" resultMap="BaseResultMap">
select
<include refid="strStrongRegionSql" />
from ${tableName} where GROUP_ID in
<foreach item="item" index="index" collection="groupIdArr"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryStrRegionByGroupId" resultMap="BaseResultMap">
select
<include refid="strRegionSql" />
from ${tableName} where GROUP_ID in
<foreach item="item" index="index" collection="groupIdArr"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
<insert id="saveStrRegionBatch">
insert into ${tableName}
(REGION_ID,
GROUP_ID,
KEYWORDS,
EXPR_TYPE,
MATCH_METHOD ,
IS_HEXBIN,
IS_VALID,
OP_TIME,LAST_UPDATE
<!-- ,PROC_SEQ -->
)
<foreach collection="strRegionList" item="item" index="index"
open="(" close=")" separator="union">
select
#{item.regionId,jdbcType=BIGINT},
#{item.groupId,jdbcType=BIGINT},
#{item.keywords,jdbcType=VARCHAR},
#{item.exprType,jdbcType=INTEGER},
#{item.matchMethod,jdbcType=INTEGER},
#{item.isHexbin,jdbcType=INTEGER},
#{item.isValid,jdbcType=INTEGER},
#{item.opTime,jdbcType=TIMESTAMP},
sysdate
<!-- ,#{item.procSeq,jdbcType=BIGINT} -->
from dual
</foreach>
</insert>
<insert id="saveStrStrongRegionBatch">
insert into ${tableName}
(REGION_ID,
GROUP_ID,
DISTRICT,
KEYWORDS,
EXPR_TYPE,
MATCH_METHOD ,
IS_HEXBIN,
IS_VALID,
OP_TIME,LAST_UPDATE
)
<foreach collection="strRegionList" item="item" index="index"
open="(" close=")" separator="union">
select
#{item.regionId,jdbcType=BIGINT},
#{item.groupId,jdbcType=BIGINT},
#{item.district,jdbcType=VARCHAR},
#{item.keywords,jdbcType=VARCHAR},
#{item.exprType,jdbcType=INTEGER},
#{item.matchMethod,jdbcType=INTEGER},
#{item.isHexbin,jdbcType=INTEGER},
#{item.isValid,jdbcType=INTEGER},
#{item.opTime,jdbcType=TIMESTAMP},
<!-- #{item.lastUpdate,jdbcType=TIMESTAMP}, -->
sysdate
from dual
</foreach>
</insert>
<update id="updateStrRegion" parameterType="com.nis.domain.restful.StrRegion">
UPDATE ${tableName}
<set>
<if test="isValid != null">
IS_VALID=#{isValid , jdbcType=INTEGER },
</if>
<if test="opTime != null">
OP_TIME= #{ opTime , jdbcType=TIMESTAMP },
</if>
<if test="lastUpdate != null">
LAST_UPDATE=#{lastUpdate,jdbcType=TIMESTAMP},
</if>
</set>
where REGION_ID=#{regionId}
</update>
<!-- <update id="updateStrRegion" parameterType="com.nis.domain.restful.StrRegion">
UPDATE ${tableName} <set> <if test="groupId != null"> GROUP_ID =#{ groupId
, jdbcType=BIGINT }, </if> <if test="district != null and district !=''">
DISTRICT = #{ district , jdbcType=VARCHAR }, </if> <if test="keywords !=
null and keywords !=''"> KEYWORDS = #{ keywords , jdbcType=VARCHAR }, </if>
<if test="exprType != null"> EXPR_TYPE = #{ exprType , jdbcType=INTEGER },
</if> <if test="matchMethod != null"> MATCH_METHOD = #{ matchMethod , jdbcType=INTEGER
}, </if> <if test="isHexbin != null "> IS_HEXBIN = #{ isHexbin , jdbcType=INTEGER
}, </if> <if test="isValid != null"> IS_VALID=#{isValid , jdbcType=INTEGER
}, </if> <if test="opTime != null"> OP_TIME= #{ opTime , jdbcType=TIMESTAMP
}, </if> </set> where REGION_ID=#{regionId} </update> -->
</mapper>

View File

@@ -0,0 +1,11 @@
package com.nis.web.dao;
import java.util.List;
import com.nis.domain.SysArea;
@MyBatisDao
public interface SysAreaDao extends TreeDao<SysArea>{
List<SysArea> findByParentIdsLike(SysArea area);
}

View File

@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.SysAreaDao" >
<resultMap id="BaseResultMap" type="com.nis.domain.SysArea" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="parent_id" property="parentId" jdbcType="INTEGER" />
<result column="parent_ids" property="parentIds" jdbcType="VARCHAR" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="sort" property="sort" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="CHAR" />
<result column="remarks" property="remarks" jdbcType="VARCHAR" />
<result column="longitude" property="longitude" jdbcType="FLOAT" />
<result column="latitude" property="latitude" jdbcType="FLOAT" />
<result column="del_flag" property="delFlag" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, parent_id, parent_ids, name, sort, code, type, remarks, longitude, latitude, del_flag
</sql>
<sql id="areaColumns">
a.id,
a.parent_id AS "parent.id",
a.parent_ids,
a.code,
a.name,
a.sort,
a.type,
a.remarks,
a.longitude,
a.latitude,
a.del_flag,
p.name AS "parent.name",
p.parent_ids as "parent.parentIds"
</sql>
<sql id="areaJoins">
LEFT JOIN sys_area p ON p.id = a.parent_id
</sql>
<select id="get" resultType="sysArea">
SELECT
<include refid="areaColumns"/>
FROM sys_area a
<include refid="areaJoins"/>
WHERE a.id = #{id}
</select>
<select id="findAllList" resultType="sysArea">
SELECT
<include refid="areaColumns"/>
FROM sys_area a
<include refid="areaJoins"/>
WHERE a.type in (1,2,3,4) and a.del_flag = #{DEL_FLAG_NORMAL}
ORDER BY a.code
</select>
<select id="findByParentIdsLike" resultType="sysArea">
SELECT
<include refid="areaColumns"/>
FROM sys_area a
<include refid="areaJoins"/>
WHERE a.type in (1,2,3,4) and a.del_flag = #{DEL_FLAG_NORMAL} AND a.parent_ids LIKE #{parentIds}
ORDER BY a.code
</select>
<insert id="insert" parameterType="sysArea" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO sys_area(
parent_id,
parent_ids,
code,
name,
sort,
type,
longitude,
latitude,
remarks,
del_flag
) VALUES (
#{parent.id},
#{parentIds},
#{code},
#{name},
#{sort},
#{type},
#{longitude},
#{latitude},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE sys_area SET
parent_id = #{parent.id},
parent_ids = #{parentIds},
code = #{code},
name = #{name},
sort = #{sort},
type = #{type},
longitude = #{longitude},
latitude = #{latitude},
remarks = #{remarks}
WHERE id = #{id}
</update>
<update id="updateParentIds">
UPDATE sys_area SET
parent_id = #{parent.id},
parent_ids = #{parentIds}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE sys_area SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id} OR parent_ids LIKE
<if test="dbName == 'oracle'">'%,'||#{id}||',%'</if>
<if test="dbName == 'mssql'">'%,'+#{id}+',%'</if>
<if test="dbName == 'mysql'">CONCAT('%,', #{id}, ',%')</if>
</update>
</mapper>

View File

@@ -0,0 +1,32 @@
package com.nis.web.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.SysDataDictionaryName;
@MyBatisDao
public interface SysDictDao extends CrudDao<SysDataDictionaryName> {
List<SysDataDictionaryName> findDicByName(@Param("DEL_FLAG_NORMAL")String DEL_FLAG_NORMAL,@Param("modualName") String modualName);
List<SysDataDictionaryName> findDictList(SysDataDictionaryName sysDictName);
SysDataDictionaryName getDictById(@Param("DEL_FLAG_NORMAL")Integer DEL_FLAG_NORMAL,@Param("id") Integer id);
void insertDictName(SysDataDictionaryName sysDictName);
void updateDictName(SysDataDictionaryName sysDictName);
void insertDictItem(SysDataDictionaryItem sysDictitem);
void deleteDictItem(@Param("dictId")Integer dictId);
void deleteDictName(@Param("dictId")Integer dictId);
}

View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.SysDictDao" >
<resultMap id="dictResultMap" type="com.nis.domain.SysDataDictionaryName" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="module_name" property="moduleName" jdbcType="VARCHAR" />
<result column="mark" property="mark" jdbcType="VARCHAR" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
<result column="revision" property="revision" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
<result column="status" property="status" jdbcType="INTEGER" />
<collection property="dictItemList" ofType="SysDataDictionaryItem">
<id property="id" column="item_id"/>
<result property="itemCode" column="item_code"/>
<result property="itemValue" column="item_value"/>
<result property="itemDesc" column="item_desc"/>
<result property="itemSort" column="item_sort"/>
<result property="status" column="item_status"/>
<result property="type" column="type"/>
</collection>
</resultMap>
<sql id="Base_Column_List" >
id, module_name, mark, remark, revision, create_time, modify_time, status
</sql>
<sql id="dictColumns">
n.id,
n.module_name,
n.mark,
n.remark,
n.revision,
n.create_time,
n.modify_time,
n.status,
t.id as item_id,
t.item_code,
t.item_value,
t.item_desc,
t.item_sort,
t.status as item_status,
t.type
</sql>
<sql id="dictJoins">
LEFT JOIN sys_data_dictionary_item t ON t.dictionary_id = n.id and t.status= #{DEL_FLAG_NORMAL}
</sql>
<select id="findAllList" resultMap="dictResultMap">
SELECT
<include refid="dictColumns"/>
FROM sys_data_dictionary_name n
<include refid="dictJoins"/>
WHERE n.status = #{DEL_FLAG_NORMAL}
ORDER BY n.id,t.item_sort
</select>
<select id="findDicByName" resultMap="dictResultMap">
SELECT
<include refid="dictColumns"/>
FROM sys_data_dictionary_name n
<include refid="dictJoins"/>
WHERE n.status = #{DEL_FLAG_NORMAL} AND n.module_name = #{modualName}
ORDER BY n.id,t.item_sort
</select>
<select id="getDictById" resultMap="dictResultMap">
SELECT
<include refid="dictColumns"/>
FROM sys_data_dictionary_name n
<include refid="dictJoins"/>
WHERE n.status = #{DEL_FLAG_NORMAL} AND n.id = #{id}
</select>
<select id="findDictList" resultMap="dictResultMap" parameterType="com.nis.domain.SysDataDictionaryName">
SELECT * FROM sys_data_dictionary_name WHERE status=1
<if test="moduleName != null and moduleName != '' " >
AND module_name like '%${moduleName}%'
</if>
<if test="mark != null and mark != '' " >
AND mark like '%${mark}%'
</if>
<if test="beginDate !=null" >
AND create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND create_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY create_time desc
</otherwise>
</choose>
</select>
<!-- 插入词典标识信息 -->
<insert id="insertDictName" parameterType="com.nis.domain.SysDataDictionaryName" useGeneratedKeys="true" keyProperty="id" >
insert into sys_data_dictionary_name (module_name, mark,
remark, revision, create_time,
modify_time, status)
values ( #{moduleName,jdbcType=VARCHAR}, #{mark,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR}, #{revision,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{modifyTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER})
</insert>
<!-- 插入词典项信息 -->
<insert id="insertDictItem" parameterType="com.nis.domain.SysDataDictionaryItem" useGeneratedKeys="true" keyProperty="id" >
insert into sys_data_dictionary_item ( item_code, item_value,
item_desc, item_sort, status,
type, dictionary_id)
values (#{itemCode,jdbcType=VARCHAR}, #{itemValue,jdbcType=VARCHAR},
#{itemDesc,jdbcType=VARCHAR}, #{itemSort,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{type,jdbcType=INTEGER}, #{dictionaryId,jdbcType=INTEGER})
</insert>
<!-- 删除词典标识信息 -->
<delete id="deleteDictName" >
delete from sys_data_dictionary_name
where id = #{dictId}
</delete>
<!-- 删除词典项信息 -->
<delete id="deleteDictItem">
delete from sys_data_dictionary_item
where dictionary_id = #{dictId}
</delete>
<!-- 编辑词典标识信息 -->
<update id="updateDictName" parameterType="com.nis.domain.SysDataDictionaryName" >
update sys_data_dictionary_name
set module_name = #{moduleName,jdbcType=VARCHAR},
mark = #{mark,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
revision = #{revision,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@@ -0,0 +1,7 @@
package com.nis.web.dao;
import com.nis.domain.SysLog;
@MyBatisDao
public interface SysLogDao extends CrudDao<SysLog>{
}

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.SysLogDao" >
<select id="findList" resultType="sysLog">
SELECT
a.*
FROM sys_log a
WHERE a.create_date BETWEEN #{beginDate} AND #{endDate}
<if test="title != null and title != ''">
AND a.title LIKE
<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
</if>
<if test="createBy != null and createBy != ''">
AND a.create_by = #{createBy}
</if>
<if test="requestUri != null and requestUri != ''">
AND a.request_uri LIKE
<if test="dbName == 'oracle'">'%'||#{requestUri}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{requestUri}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{requestUri}, '%')</if>
</if>
<if test="exception != null and exception != ''">
AND a.state = 0
</if>
ORDER BY a.create_date DESC
</select>
<insert id="insert" parameterType="sysLog" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO sys_log(
type,
title,
create_by,
create_date,
remote_addr,
user_agent,
request_uri,
method,
state,
consumer_time,
params,
exception
) VALUES (
#{type},
#{title},
#{createBy},
#{createDate},
#{remoteAddr},
#{userAgent},
#{requestUri},
#{method},
#{state},
#{consumerTime},
#{params},
#{exception}
)
</insert>
</mapper>

View File

@@ -0,0 +1,23 @@
package com.nis.web.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.SysMenu;
@MyBatisDao
public interface SysMenuDao extends CrudDao<SysMenu>{
List<SysMenu> findSysMenuByUserId(@Param("userId") Long userId);
List<SysMenu> findByParentIdsLike(SysMenu m);
void updateParentIds(SysMenu e);
void updateSort(SysMenu menu);
}

View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.SysMenuDao" >
<sql id="menuColumns">
a.id,
a.parent_id AS "parent.id",
a.parent_ids,
a.name,
a.href,
a.target,
a.icon,
a.sort,
a.is_show,
a.permission,
a.remarks,
a.create_by AS "createBy.id",
a.create_date,
a.update_by AS "updateBy.id",
a.update_date,
a.del_flag,
a.quick_action,
a.menu_bg,
p.name AS "parent.name"
</sql>
<sql id="menuJoins">
LEFT JOIN sys_menu p ON p.id = a.parent_id
</sql>
<select id="get" resultType="sysMenu">
SELECT
<include refid="menuColumns"/>
FROM sys_menu a
<include refid="menuJoins"/>
WHERE a.id = #{id}
</select>
<select id="findAllList" resultType="sysMenu">
SELECT
<include refid="menuColumns"/>
FROM sys_menu a
<include refid="menuJoins"/>
WHERE a.del_flag = #{DEL_FLAG_NORMAL}
ORDER BY a.sort
</select>
<select id="findSysMenuByUserId" resultType="sysMenu">
SELECT
<include refid="menuColumns"/>
FROM sys_menu a
LEFT JOIN sys_menu p ON p.id = a.parent_id
WHERE a.del_flag = 1 AND a.id IN (
SELECT l.privilege_access_value
FROM sys_privilege l WHERE l.privilege_master='ROLE' AND l.privilege_access='1000' AND l.privilege_operation=1
AND l.privilege_master_value IN
( SELECT distinct(r.id) FROM sys_role r,sys_inter_user_role ur WHERE r.id = ur.role_id AND r.status=1 AND ur.user_id=#{userId} )
)
ORDER BY a.sort
</select>
<insert id="insert" parameterType="sysMenu" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sys_menu(
parent_id,
parent_ids,
name,
href,
target,
icon,
sort,
is_show,
permission,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{parent.id},
#{parentIds},
#{name},
#{href},
#{target},
#{icon},
#{sort},
#{isShow},
#{permission},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag}
)
</insert>
<update id="update">
UPDATE sys_menu SET
parent_id = #{parent.id},
parent_ids = #{parentIds},
name = #{name},
href = #{href},
target = #{target},
icon = #{icon},
sort = #{sort},
is_show = #{isShow},
permission = #{permission},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks}
WHERE id = #{id}
</update>
<select id="findByParentIdsLike" resultType="sysMenu">
SELECT
a.id,
a.parent_id AS "parent.id",
a.parent_ids
FROM sys_menu a
WHERE a.del_flag = #{DEL_FLAG_NORMAL} AND a.parent_ids LIKE #{parentIds}
ORDER BY a.sort
</select>
<update id="updateParentIds">
UPDATE sys_menu SET
parent_id = #{parent.id},
parent_ids = #{parentIds}
WHERE id = #{id}
</update>
<update id="updateSort">
UPDATE sys_menu SET
sort = #{sort}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE sys_menu SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id} OR parent_ids LIKE
<if test="dbName == 'oracle'">'%,'||#{id}||',%'</if>
<if test="dbName == 'mssql'">'%,'+#{id}+',%'</if>
<if test="dbName == 'mysql'">CONCAT('%,', #{id}, ',%')</if>
</update>
</mapper>

View File

@@ -0,0 +1,32 @@
package com.nis.web.dao;
import java.util.List;
import java.util.Map;
import com.nis.domain.SysOffice;
@MyBatisDao
public interface SysOfficeDao extends TreeDao<SysOffice> {
int deleteByPrimaryKey(Integer id);
int insert(SysOffice record);
int insertSelective(SysOffice record);
SysOffice selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SysOffice record);
int updateByPrimaryKey(SysOffice record);
List<SysOffice> selectSysOffice(SysOffice sysOffice);
List<SysOffice> selectLowerDeptement(Map<String, Object> hmap);
List<SysOffice> selectOfficeForDeptment(Map map);
List<SysOffice> selectOfficeForLetter(Map<String, Object> hmap);
}

View File

@@ -0,0 +1,331 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.SysOfficeDao" >
<resultMap id="OfficeResultMap" type="com.nis.domain.SysOffice" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="parent_id" property="parent.id" jdbcType="INTEGER" />
<result column="parent_ids" property="parentIds" jdbcType="VARCHAR" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="sort" property="sort" jdbcType="INTEGER" />
<result column="area_id" property="area.id" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="INTEGER" />
<result column="grade" property="grade" jdbcType="INTEGER" />
<result column="job_type" property="jobType" jdbcType="INTEGER" />
<result column="address" property="address" jdbcType="VARCHAR" />
<result column="zip_code" property="zipCode" jdbcType="VARCHAR" />
<result column="master" property="master" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="fax" property="fax" jdbcType="VARCHAR" />
<result column="email" property="email" jdbcType="VARCHAR" />
<result column="USEABLE" property="useable" jdbcType="INTEGER" />
<result column="PRIMARY_PERSON" property="primaryPerson.id" jdbcType="INTEGER" />
<result column="DEPUTY_PERSON" property="deputyPerson.id" jdbcType="INTEGER" />
<result column="remarks" property="remarks" jdbcType="VARCHAR" />
<result column="del_flag" property="delFlag" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, parent_id, parent_ids, name, en_name, sort, area_id, code, type, grade, job_type, address,
zip_code, master, phone, fax, email, USEABLE, PRIMARY_PERSON, DEPUTY_PERSON, remarks,
del_flag, create_time
</sql>
<select id="selectByPrimaryKey" resultMap="OfficeResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from sys_office
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectSysOffice" resultMap="OfficeResultMap" parameterType="com.nis.domain.SysOffice" >
select
<include refid="Base_Column_List" />
from sys_office
where 1=1
<if test="id != null" >
and Id = #{id,jdbcType=INTEGER}
</if>
<if test="parent != null" >
and parent_id = #{parent.id,jdbcType=INTEGER}
</if>
<if test="parentIds != null" >
and parent_ids = #{parentIds,jdbcType=VARCHAR}
</if>
<if test="name != null" >
and name = #{name,jdbcType=VARCHAR}
</if>
<if test="area != null" >
and area_id = #{area.id,jdbcType=INTEGER}
</if>
<if test="code != null" >
and code = #{code,jdbcType=VARCHAR}
</if>
<if test="grade != null" >
and grade = #{grade,jdbcType=INTEGER}
</if>
<if test="address != null" >
and address = #{address,jdbcType=VARCHAR}
</if>
<if test="zipCode != null" >
and zip_code = #{zipCode,jdbcType=VARCHAR}
</if>
<if test="master != null" >
and master = #{master,jdbcType=VARCHAR}
</if>
<if test="phone != null" >
and phone = #{phone,jdbcType=VARCHAR}
</if>
<if test="fax != null" >
and fax = #{fax,jdbcType=VARCHAR}
</if>
<if test="email != null" >
and email = #{email,jdbcType=VARCHAR}
</if>
<if test="useable != null" >
and USEABLE = #{useable,jdbcType=INTEGER}
</if>
<if test="primaryPerson != null" >
and PRIMARY_PERSON = #{primaryPerson,jdbcType=INTEGER}
</if>
<if test="deputyPerson != null" >
and DEPUTY_PERSON = #{deputyPerson,jdbcType=INTEGER}
</if>
<if test="remarks != null" >
and remarks = #{remarks,jdbcType=VARCHAR}
</if>
<if test="delFlag != null" >
and del_flag = #{delFlag,jdbcType=INTEGER}
</if>
<if test="createTime != null" >
and create_time = #{createTime,jdbcType=TIMESTAMP}
</if>
ORDER BY sort
</select>
<select id="selectOfficeForDeptment" resultMap="OfficeResultMap" parameterType="map" >
<if test="grade == 1">
SELECT *
FROM sys_office t1
WHERE ((TYPE = 3 AND grade = 1 ) OR (TYPE = 1 AND grade = 2)) and del_flag = #{delFlag}
ORDER BY sort
</if>
<if test="grade == 2 or grade == 3">
SELECT *
FROM sys_office
WHERE (
<if test="grandParentId != null ">
(
</if>
parent_id=#{parentId}
<if test="grandParentId != null ">
or parent_id=#{grandParentId} ) AND id !=#{parentId}
</if>
) and del_flag = #{delFlag}
ORDER BY sort
</if>
</select>
<select id="selectLowerDeptement" resultMap="OfficeResultMap" parameterType="map" >
SELECT * FROM sys_office WHERE ( parent_id=#{parentId} OR id =#{parentId} ) and del_flag = #{delFlag}
ORDER BY sort
</select>
<select id="selectOfficeForLetter" resultMap="OfficeResultMap" parameterType="map" >
<if test="grade == 1">
SELECT *
FROM sys_office
WHERE (TYPE = 2 OR TYPE = 1) AND grade = 2 and del_flag = #{delFlag}
ORDER BY sort
</if>
<if test="grade == 2">
SELECT *
FROM sys_office
WHERE parent_id=#{parentId} and del_flag = #{delFlag}
ORDER BY sort
</if>
</select>
<sql id="officeColumns">
a.id,
a.parent_id AS "parent.id",
a.parent_ids AS "parentIds",
a.area_id AS "area.id",
a.code,
a.name,
a.sort,
a.type,
a.grade,
a.job_type,
a.address,
a.zip_code,
a.master,
a.phone,
a.fax,
a.email,
a.remarks,
a.del_flag,
a.useable AS useable,
a.primary_person AS "primaryPerson.id",
a.deputy_person AS "deputyPerson.id",
p.name AS "parent.name",
ar.name AS "area.name",
ar.parent_ids AS "area.parentIds",
pp.name AS "primaryPerson.name",
dp.name AS "deputyPerson.name"
</sql>
<sql id="officeJoins">
LEFT JOIN sys_office p ON p.id = a.parent_id
LEFT JOIN sys_area ar ON ar.id = a.area_id
LEFT JOIN SYS_USER pp ON pp.id = a.primary_person
LEFT JOIN SYS_USER dp ON dp.id = a.deputy_person
</sql>
<select id="get" resultType="sysOffice">
SELECT
<include refid="officeColumns"/>
FROM sys_office a
<include refid="officeJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="sysOffice">
SELECT
<include refid="officeColumns"/>
FROM sys_office a
<include refid="officeJoins"/>
WHERE a.del_flag = #{DEL_FLAG_NORMAL}
<!-- 数据范围过滤 -->
${sqlMap.dsf}
OR a.id=#{currentUser.office.id}
ORDER BY a.code
</select>
<select id="findAllList" resultType="sysOffice">
SELECT
<include refid="officeColumns"/>
FROM sys_office a
<include refid="officeJoins"/>
WHERE a.del_flag = #{DEL_FLAG_NORMAL}
ORDER BY a.code
</select>
<select id="findByParentIdsLike" resultType="sysOffice">
SELECT
<include refid="officeColumns"/>
FROM sys_office a
<include refid="officeJoins"/>
WHERE a.del_flag = #{DEL_FLAG_NORMAL} AND a.parent_ids LIKE #{parentIds}
ORDER BY a.code
</select>
<insert id="insert" parameterType="sysOffice" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO sys_office(
parent_id,
parent_ids,
area_id,
code,
name,
sort,
type,
grade,
job_type,
address,
zip_code,
master,
phone,
fax,
email,
remarks,
del_flag,
useable,
primary_person,
deputy_person,
create_time
) VALUES (
#{parent.id},
#{parentIds},
#{area.id},
#{code},
#{name},
#{sort},
#{type},
#{grade},
#{jobType},
#{address},
#{zipCode},
#{master},
#{phone},
#{fax},
#{email},
#{remarks},
#{delFlag},
#{useable},
#{primaryPerson.id},
#{deputyPerson.id},
#{createTime}
)
</insert>
<update id="updateParentIds">
UPDATE sys_office SET
parent_id = #{parent.id},
parent_ids = #{parentIds}
WHERE id = #{id}
</update>
<update id="update">
UPDATE sys_office SET
parent_id = #{parent.id},
parent_ids = #{parentIds},
area_id = #{area.id},
code = #{code},
name = #{name},
type = #{type},
grade = #{grade},
job_type = #{jobType},
address = #{address},
zip_code = #{zipCode},
master = #{master},
phone = #{phone},
fax = #{fax},
email = #{email},
remarks = #{remarks},
useable=#{useable},
primary_person=#{primaryPerson.id},
deputy_person=#{deputyPerson.id}
WHERE id = #{id}
</update>
<update id="delete">
UPDATE sys_office SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id} OR parent_ids LIKE
<if test="dbName == 'oracle'">'%,'||#{id}||',%'</if>
<if test="dbName == 'mssql'">'%,'+#{id}+',%'</if>
<if test="dbName == 'mysql'">CONCAT('%,', #{id}, ',%')</if>
</update>
</mapper>

View File

@@ -0,0 +1,18 @@
package com.nis.web.dao;
import java.util.List;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
@MyBatisDao
public interface SysRoleDao extends CrudDao<SysRole>{
SysRole getByName(SysRole r);
void insertRoleMenu(SysRole role);
void deleteRoleMenu(SysRole role);
List<SysUser> findUserByRole(SysRole role);
}

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.SysRoleDao" >
<resultMap id="BaseResultMap" type="SysRole" >
<id column="ID" property="id" jdbcType="INTEGER" />
<result column="NAME" property="name" jdbcType="VARCHAR" />
<result column="ROLE_TYPE" property="roleType" jdbcType="VARCHAR" />
<result column="DATA_SCOPE" property="dataScope" jdbcType="INTEGER" />
<result column="REMARK" property="remark" jdbcType="VARCHAR" />
<result column="STATUS" property="status" jdbcType="INTEGER" />
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
<collection property="menuList" ofType="sysMenu">
<id property="id" column="menuList.id" />
</collection>
</resultMap>
<sql id="Base_Column_List" >
r.ID, r.NAME, r.ROLE_TYPE, r.DATA_SCOPE, r.REMARK, r.STATUS, r.CREATE_TIME
</sql>
<select id="get" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>,
rm.privilege_access_value AS "menuList.id"
FROM sys_role r
LEFT JOIN sys_privilege rm ON rm.privilege_master_value = r.id and rm.privilege_master='ROLE' and rm.privilege_access='1000'
WHERE r.id = #{id}
</select>
<select id="getByName" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_role r
WHERE r.name = #{name} AND r.status = #{DEL_FLAG_NORMAL}
</select>
<select id="findAllList" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_role r
WHERE r.status = #{DEL_FLAG_NORMAL}
ORDER BY r.id
</select>
<select id="findUserByRole" resultType="sysUser">
SELECT
u.id,
u.login_id,
u.name,
u.photo,
u.password,
u.email,
u.create_time,
u.status,
c.id AS "company.id",
c.name AS "company.name",
e.id AS "entity.id",
e.name AS "entity.name",
o.id AS "office.id",
o.name AS "office.name"
FROM sys_user u
JOIN sys_inter_user_role ir ON u.id=ir.user_id and ir.role_id=#{id}
LEFT JOIN sys_office c ON c.id=u.company_id AND c.useable=1
LEFT JOIN sys_office e ON e.id=u.entity_id AND e.useable=1
LEFT JOIN sys_office o ON o.id=u.office_id AND o.useable=1
WHERE u.status=1
</select>
<insert id="insert" parameterType="sysRole" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO sys_role(
name,
role_type,
data_scope,
create_time,
remark,
status
) VALUES (
#{name},
#{roleType},
#{dataScope},
#{createTime},
#{remark},
#{status}
)
</insert>
<update id="update">
UPDATE sys_role SET
name = #{name},
role_type = #{roleType},
data_scope = #{dataScope},
remark = #{remark}
WHERE id = #{id}
</update>
<insert id="insertRoleMenu">
INSERT INTO sys_privilege(
privilege_master,
privilege_master_value,
privilege_access,
privilege_access_value,
privilege_operation)
<foreach collection="menuList" item="menu" separator=" union all ">
SELECT 'ROLE',#{id},'1000',#{menu.id},1
<if test="dbName != 'mssql'">
FROM dual
</if>
</foreach>
</insert>
<delete id="deleteRoleMenu">
DELETE FROM sys_privilege WHERE privilege_master='ROLE' and privilege_master_value = #{id}
</delete>
<update id="delete">
UPDATE sys_role SET
status = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.SystemFunStatusDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.SystemFunStatus">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="proc_seq" jdbcType="BIGINT" property="procSeq" />
<result column="function" jdbcType="BIGINT" property="function" />
<result column="back_data" jdbcType="BIGINT" property="backData" />
<result column="effective_range" jdbcType="VARCHAR" property="effectiveRange" />
<result column="active_sys" jdbcType="INTEGER" property="activeSys" />
<result column="is_valid" jdbcType="INTEGER" property="isValid" />
<result column="op_time" jdbcType="TIMESTAMP" property="opTime" />
</resultMap>
<insert id="insert" parameterType="com.nis.domain.restful.SystemFunStatus">
insert into SYSTEM_FUN_STATUS
<trim prefix="(" suffix=")" suffixOverrides=",">
ID,
<if test="function != null">FUNCTION,</if>
<if test="backData != null">BACK_DATA,</if>
<if test="effectiveRange != null">EFFECTIVE_RANGE,</if>
<if test="activeSys != null">ACTIVE_SYS,</if>
<if test="isValid != null">IS_VALID,</if>
<if test="opTime != null">OP_TIME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="function != null">#{function,jdbcType=BIGINT},</if>
<if test="backData != null">#{backData,jdbcType=BIGINT},</if>
<if test="effectiveRange != null">#{effectiveRange,jdbcType=VARCHAR},</if>
<if test="activeSys != null">#{activeSys,jdbcType=INTEGER},</if>
<if test="isValid != null">#{isValid,jdbcType=INTEGER},</if>
<if test="opTime != null">#{opTime,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="update" parameterType="com.nis.domain.restful.SystemFunStatus">
update SYSTEM_FUN_STATUS
<set>
<if test="function != null">FUNCTION = #{function,jdbcType=BIGINT},</if>
<if test="backData != null">BACK_DATA = #{backData,jdbcType=BIGINT},</if>
<if test="effectiveRange != null">EFFECTIVE_RANGE = #{effectiveRange,jdbcType=VARCHAR},</if>
<if test="activeSys != null">ACTIVE_SYS = #{activeSys,jdbcType=INTEGER},</if>
<if test="isValid != null">IS_VALID = #{isValid,jdbcType=INTEGER},</if>
<if test="opTime != null">OP_TIME = #{opTime,jdbcType=TIMESTAMP},</if>
</set>
where ID = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,29 @@
package com.nis.web.dao;
import java.util.List;
import com.nis.domain.TreeEntity;
/**
* DAO支持类实现
* @author ThinkGem
* @version 2014-05-16
* @param <T>
*/
public interface TreeDao<T extends TreeEntity<T>> extends CrudDao<T> {
/**
* 找到所有子节点
* @param entity
* @return
*/
public List<T> findByParentIdsLike(T entity);
/**
* 更新所有父节点字段
* @param entity
* @return
*/
public int updateParentIds(T entity);
}

View File

@@ -0,0 +1,69 @@
package com.nis.web.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.SysUser;
@MyBatisDao
public interface UserDao extends CrudDao<SysUser> {
/**
* 通过主键ID获取相关用户不包含密码
* @param id
* @return
*/
SysUser getUserById(@Param("id") Long id);
/**
* 通过登录账户获取相关用户,不包含密码
* @param loginName
* @return
*/
SysUser getUserByLoginName(@Param("loginName") String loginName);
/**
* 删除用户角色关联数据
* @param user id
* @return
*/
public int deleteUserRole(Long id);
/**
* 查询用户附带关联:部门、角色
* @param user
* @return
*/
SysUser getUserWithRelation(SysUser user);
void insertUserRole(SysUser user);
public int deleteUserOffice(Long id);
void insertUserOffice(SysUser user);
List<SysUser> findUserByRoleId(Long id);
List<SysUser> findUserByOfficeId(Long id);
void removeUserInRole(@Param("userId") Long userId, @Param("roleId") Long roleId);
void updateUserInfo(SysUser user);
void updatePasswordById(SysUser user);
List<Map> findDeptLeader(Integer DeptementId);
int officeIsExistOfCompany(@Param("officeId") Long officeId, @Param("companyId") Long companyId);
}

View File

@@ -0,0 +1,419 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nis.web.dao.UserDao">
<!-- 生产环境使用-->
<cache eviction="LRU" flushInterval="60000" size="512" readOnly="true">
</cache>
<!-- 通过别名映射对象 -->
<select id="getUserById" parameterType="long" resultType="sysUser">
select
id as "id",
login_id as "loginId",
name,
identity,
photo,
email email,
create_time createTime,
status status
from sys_user where id=#{id}
</select>
<select id="getUserByLoginName" resultMap="userResultMap">
select
id,
login_id,
name,
identity,
photo,
email,
create_time,
status
from sys_user where login_id=#{loginName}
</select>
<!-- map 转为对象 -->
<resultMap type="sysUser" id="userResultMap">
<id property="id" column="id"/>
<result property="loginId" column="login_id"/>
<result property="name" column="name"/>
<result property="identity" column="identity"/>
<result property="photo" column="photo"/>
<result property="email" column="email"/>
<result property="createTime" column="create_time"/>
<result property="status" column="status"/>
</resultMap>
<resultMap type="sysUser" id="userWithRelationResultMap">
<id property="id" column="user_id"/>
<result property="loginId" column="login_id"/>
<result property="name" column="user_name"/>
<result property="identity" column="identity"/>
<result property="photo" column="photo"/>
<result property="password" column="password"/>
<result property="email" column="email"/>
<result property="createTime" column="user_create_time"/>
<result property="status" column="user_status"/>
<result property="company.id" column="company.id"/>
<result property="company.name" column="company.name"/>
<result property="company.parent.id" column="company.parent.id"/>
<result property="company.parentIds" column="company.parentIds"/>
<result property="company.type" column="company.type"/>
<result property="company.grade" column="company.grade"/>
<result property="company.jobType" column="company.job_type"/>
<result property="entity.id" column="entity.id"/>
<result property="entity.name" column="entity.name"/>
<result property="entity.parent.id" column="entity.parent.id"/>
<result property="entity.parentIds" column="entity.parentIds"/>
<result property="entity.type" column="entity.type"/>
<result property="entity.grade" column="entity.grade"/>
<result property="entity.jobType" column="entity.job_type"/>
<result property="office.id" column="office.id"/>
<result property="office.name" column="office.name"/>
<result property="office.parent.id" column="office.parent.id"/>
<result property="office.parentIds" column="office.parentIds"/>
<result property="office.type" column="office.type"/>
<result property="office.grade" column="office.grade"/>
<result property="office.jobType" column="office.job_type"/>
<collection property="userRoleList" ofType="sysRole">
<id property="id" column="role_id"/>
<result property="name" column="role_name"/>
<result property="dataScope" column="data_scope"/>
<result property="remark" column="role_desc"/>
<result property="status" column="role_status"/>
<result property="createTime" column="role_create_time"/>
</collection>
</resultMap>
<select id="findUserByRoleId" resultType="sysUser">
SELECT
u.id,
u.login_id,
u.name,
u.identity,
u.photo,
u.password,
u.email,
u.create_time,
u.status,
c.id AS "company.id",
c.name AS "company.name",
e.id AS "entity.id",
e.name AS "entity.name",
o.id AS "office.id",
o.name AS "office.name"
FROM sys_user u
JOIN sys_inter_user_role ir ON u.id=ir.user_id and ir.role_id=#{id}
LEFT JOIN sys_office c ON c.id=u.company_id AND c.useable=1
LEFT JOIN sys_office e ON e.id=u.entity_id AND e.useable=1
LEFT JOIN sys_office o ON o.id=u.office_id AND o.useable=1
WHERE u.status=1
</select>
<!-- 通过别名映射对象 -->
<select id="findUserByOfficeId" parameterType="long" resultType="sysUser">
select
id as "id",
login_id as "loginId",
identity,
name,
photo,
email email,
create_time createTime,
status status,
company_id AS "company.id",
entity_id AS "entity.id",
office_id AS "office.id"
from sys_user where office_id=#{id}
</select>
<select id="officeIsExistOfCompany" parameterType="long" resultType="Integer">
select
count(id)
from sys_office where id=#{officeId}
and id in (select id from sys_office where parent_ids like
CONCAT((select parent_ids from sys_office where id=#{companyId}), #{companyId}, ',%'))
</select>
<sql id="userColumns">
u.id AS user_id,
u.photo,
u.login_id,
u.name AS user_name,
u.identity,
u.password,
u.email,
u.create_time AS user_create_time,
u.status AS user_status,
u.company_id AS "company.id",
c.name AS "company.name",
c.parent_id AS "company.parent.id",
c.parent_ids AS "company.parentIds",
c.type AS "company.type",
c.grade AS "company.grade",
c.job_type AS "company.job_type",
u.office_id AS "office.id",
o.name AS "office.name",
o.parent_id AS "office.parent.id",
o.parent_ids AS "office.parentIds",
o.type AS "office.type",
o.grade AS "office.grade",
o.job_type AS "office.job_type",
u.entity_id AS "entity.id",
e.name AS "entity.name",
e.parent_id AS "entity.parent.id",
e.parent_ids AS "entity.parentIds",
e.type AS "entity.type",
e.grade AS "entity.grade",
e.job_type AS "entity.job_type",
r.id AS role_id,
r.name AS role_name,
r.data_scope,
r.remark AS role_desc,
r.status AS role_status,
r.create_time AS role_create_time
</sql>
<sql id="userJoins">
LEFT JOIN sys_office c ON c.id = u.company_id AND c.useable=1
LEFT JOIN sys_office e ON e.id=u.entity_id AND e.useable=1
LEFT JOIN sys_office o ON o.id=u.office_id AND o.useable=1
LEFT JOIN sys_inter_user_role ir ON u.id=ir.user_id
LEFT JOIN sys_role r ON r.id=ir.role_id AND r.status=1
</sql>
<select id="getUserWithRelation" resultMap="userWithRelationResultMap">
SELECT
<include refid="userColumns"/>
FROM sys_user u
<include refid="userJoins"/>
WHERE u.status=#{DEL_FLAG_NORMAL}
<if test=" id != null">
AND u.id=#{id}
</if>
<if test=" loginId != null">
AND u.login_id=#{loginId}
</if>
</select>
<select id="findList" resultType="sysUser">
select
u.id,
u.login_id,
u.photo,
u.name,
u.identity,
u.email,
u.create_time,
u.status,
u.company_id AS "company.id",
c.name AS "company.name",
c.parent_id AS "company.parent.id",
c.parent_ids AS "company.parentIds",
c.type AS "company.type",
c.grade AS "company.grade",
c.job_type AS "company.job_type",
u.entity_id AS "entity.id",
e.name AS "entity.name",
e.parent_id AS "entity.parent.id",
e.parent_ids AS "entity.parentIds",
e.type AS "entity.type",
e.grade AS "entity.grade",
e.job_type AS "entity.job_type",
u.office_id AS "office.id",
o.name AS "office.name",
o.parent_id AS "office.parent.id",
o.parent_ids AS "office.parentIds",
o.type AS "office.type",
o.grade AS "office.grade",
o.job_type AS "office.job_type"
from sys_user u
LEFT JOIN sys_office c ON c.id = u.company_id AND c.useable=1
LEFT JOIN sys_office e ON e.id=u.entity_id AND e.useable=1
LEFT JOIN sys_office o ON o.id=u.office_id AND o.useable=1
WHERE u.status=#{DEL_FLAG_NORMAL}
<if test="company != null and company.id != null">
AND (c.id = #{company.id} OR c.parent_ids LIKE
<if test="dbName == 'oracle'">'%,'||#{company.id}||',%')</if>
<if test="dbName == 'mssql'">'%,'+#{company.id}+',%')</if>
<if test="dbName == 'mysql'">CONCAT('%,', #{company.id}, ',%'))</if>
</if>
<if test="entity != null and entity.id != null">
AND (e.id = #{entity.id} OR e.parent_ids LIKE
<if test="dbName == 'oracle'">'%,'||#{entity.id}||',%')</if>
<if test="dbName == 'mssql'">'%,'+#{entity.id}+',%')</if>
<if test="dbName == 'mysql'">CONCAT('%,', #{entity.id}, ',%'))</if>
</if>
<if test="office != null and office.id != null">
AND (o.id = #{office.id} OR o.parent_ids LIKE
<if test="dbName == 'oracle'">'%,'||#{office.id}||',%')</if>
<if test="dbName == 'mssql'">'%,'+#{office.id}+',%')</if>
<if test="dbName == 'mysql'">CONCAT('%,', #{office.id}, ',%'))</if>
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
<!-- 如果不是超级管理员,则不显示超级管理员用户 -->
<if test="!currentUser.admin">
AND u.login_id != 'admin'
</if>
<if test="loginId != null and loginId !=''">
AND u.login_id=#{loginId}
</if>
<if test="name != null and name != ''">
AND u.name like
<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{name}, '%')</if>
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY u.create_time desc,u.name asc
</otherwise>
</choose>
</select>
<insert id="insert" parameterType="sysUser" useGeneratedKeys="true" keyProperty="id" >
insert into sys_user(LOGIN_ID,PHOTO,NAME,IDENTITY,EMAIL,PASSWORD,CREATE_TIME,STATUS,COMPANY_ID,ENTITY_ID,OFFICE_ID)
values(#{loginId},#{photo},#{name},#{identity},#{email},#{password},#{createTime},#{status},#{company.id},#{entity.id},#{office.id})
</insert>
<!-- 更新用户 -->
<update id="update">
UPDATE sys_user SET
login_id= #{loginId},
password = #{password},
name = #{name},
identity = #{identity},
photo = #{photo},
email = #{email},
company_id = #{company.id},
entity_id = #{entity.id},
office_id = #{office.id}
WHERE id = #{id}
</update>
<!-- 插入用户和角色关联表数据 -->
<insert id="insertUserRole">
INSERT INTO sys_inter_user_role(role_id, user_id)
<foreach collection="userRoleList" item="role" separator=" union all ">
SELECT #{role.id},#{id}
<if test="dbName != 'mssql'">
FROM dual
</if>
</foreach>
</insert>
<!-- 插入用户和部门关联表数据 -->
<insert id="insertUserOffice">
INSERT INTO sys_inter_user_office(office_id, user_id)
<foreach collection="userOfficeList" item="office" separator=" union all ">
SELECT #{office.id},#{id}
<if test="dbName != 'mssql'">
FROM dual
</if>
</foreach>
</insert>
<!-- 删除用户和角色关联表数据 -->
<delete id="deleteUserRole">
DELETE FROM sys_inter_user_role WHERE user_id = #{id}
</delete>
<!-- 删除用户所属角色,唯一对应-->
<delete id="removeUserInRole">
DELETE FROM sys_inter_user_role WHERE user_id = #{userId} and role_id = #{roleId}
</delete>
<!-- 删除用户和部门关联表数据 -->
<delete id="deleteUserOffice">
DELETE FROM sys_inter_user_office WHERE user_id = #{id}
</delete>
<!-- 逻辑删除用户 -->
<update id="delete">
UPDATE sys_user SET
status = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 更新用户信息 -->
<update id="updateUserInfo">
UPDATE sys_user SET
email = #{email},
photo = #{photo}
WHERE id = #{id}
</update>
<!-- 更新用户密码 -->
<update id="updatePasswordById">
UPDATE sys_user SET
password = #{password}
WHERE id = #{id}
</update>
<select id="findDeptLeader" parameterType="Integer" resultType="map">
SELECT t3.* FROM (
SELECT t2.id,t2.name FROM sys_inter_user_office t1
LEFT JOIN sys_user t2 ON t1.USER_ID=t2.ID
WHERE t1.office_id=#{deptementId} AND t2.status=1) t3
LEFT JOIN sys_inter_user_role t4 ON t3.id=t4.user_Id
LEFT JOIN sys_role t5 ON t5.id=t4.role_id
WHERE t5.id=7 AND t5.status=1
</select>
</mapper>

View File

@@ -0,0 +1,173 @@
package com.nis.web.security;
import java.io.Serializable;
import java.util.Collection;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.UnknownSessionException;
import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.support.DefaultSubjectContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.StringUtils;
/**
* 系统安全认证实现类
* @author
* @version
*/
public class CacheSessionDAO extends EnterpriseCacheSessionDAO implements SessionDAO {
private Logger logger = LoggerFactory.getLogger(getClass());
public CacheSessionDAO() {
super();
}
@Override
protected void doUpdate(Session session) {
if (session == null || session.getId() == null) {
return;
}
HttpServletRequest request = Servlets.getRequest();
if (request != null){
String uri = request.getServletPath();
// 如果是静态文件则不更新SESSION
if (Servlets.isStaticFile(uri)){
return;
}
// 如果是视图文件则不更新SESSION
if (StringUtils.startsWith(uri, Configurations.getStringProperty("web.view.prefix","/WEB-INF/views/"))
&& StringUtils.endsWith(uri,Configurations.getStringProperty("web.view.suffix",".jsp"))){
return;
}
// 手动控制不更新SESSION
String updateSession = request.getParameter("updateSession");
if (Constants.FALSE.equals(updateSession) || Constants.NO.equals(updateSession)){
return;
}
}
super.doUpdate(session);
logger.debug("update {} {}", session.getId(), request != null ? request.getRequestURI() : "");
}
@Override
protected void doDelete(Session session) {
if (session == null || session.getId() == null) {
return;
}
super.doDelete(session);
logger.debug("delete {} ", session.getId());
}
@Override
protected Serializable doCreate(Session session) {
HttpServletRequest request = Servlets.getRequest();
if (request != null){
String uri = request.getServletPath();
// 如果是静态文件则不创建SESSION
if (Servlets.isStaticFile(uri)){
return null;
}
}
super.doCreate(session);
logger.debug("doCreate {} {}", session, request != null ? request.getRequestURI() : "");
return session.getId();
}
@Override
protected Session doReadSession(Serializable sessionId) {
return super.doReadSession(sessionId);
}
@Override
public Session readSession(Serializable sessionId) throws UnknownSessionException {
try{
Session s = null;
HttpServletRequest request = Servlets.getRequest();
if (request != null){
String uri = request.getServletPath();
// 如果是静态文件则不获取SESSION
if (Servlets.isStaticFile(uri)){
return null;
}
s = (Session)request.getAttribute("session_"+sessionId);
}
if (s != null){
return s;
}
Session session = super.readSession(sessionId);
logger.debug("readSession {} {}", sessionId, request != null ? request.getRequestURI() : "");
if (request != null && session != null){
request.setAttribute("session_"+sessionId, session);
}
return session;
}catch (UnknownSessionException e) {
return null;
}
}
/**
* 获取活动会话
* @param includeLeave 是否包括离线最后访问时间大于3分钟为离线会话
* @return
*/
@Override
public Collection<Session> getActiveSessions(boolean includeLeave) {
return getActiveSessions(includeLeave, null, null);
}
/**
* 获取活动会话
* @param includeLeave 是否包括离线最后访问时间大于3分钟为离线会话
* @param principal 根据登录者对象获取活动会话
* @param filterSession 不为空,则过滤掉(不包含)这个会话。
* @return
*/
@Override
public Collection<Session> getActiveSessions(boolean includeLeave, Object principal, Session filterSession) {
// 如果包括离线,并无登录者条件。
if (includeLeave && principal == null){
return getActiveSessions();
}
Set<Session> sessions = Sets.newHashSet();
for (Session session : getActiveSessions()){
boolean isActiveSession = false;
// 不包括离线并符合最后访问时间小于等于3分钟条件。
if (includeLeave || DateUtils.pastMinutes(session.getLastAccessTime()) <= 3){
isActiveSession = true;
}
// 符合登陆者条件。
if (principal != null){
PrincipalCollection pc = (PrincipalCollection)session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY);
if (principal.toString().equals(pc != null ? pc.getPrimaryPrincipal().toString() : StringUtils.EMPTY)){
isActiveSession = true;
}
}
// 过滤掉的SESSION
if (filterSession != null && filterSession.getId().equals(session.getId())){
isActiveSession = false;
}
if (isActiveSession){
sessions.add(session);
}
}
return sessions;
}
}

View File

@@ -0,0 +1,95 @@
package com.nis.web.security;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.stereotype.Service;
import com.nis.util.Constants;
import com.nis.util.IpUtil;
import com.nis.util.StringUtils;
@Service
public class FormAuthenticationFilter extends org.apache.shiro.web.filter.authc.FormAuthenticationFilter {
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) {
String username = getUsername(request);
String password = getPassword(request);
if (password==null){
password = "";
}
boolean rememberMe = isRememberMe(request);
String host =IpUtil.getIpAddr((HttpServletRequest)request);
String captcha = getCaptcha(request);
boolean mobile = isMobileLogin(request);
return new UsernamePasswordToken(username, password.toCharArray(), rememberMe, host, captcha, mobile);
}
protected String getCaptcha(ServletRequest request) {
return WebUtils.getCleanParam(request, Constants.DEFAULT_CAPTCHA_PARAM);
}
protected boolean isMobileLogin(ServletRequest request) {
return WebUtils.isTrue(request, Constants.DEFAULT_MOBILE_PARAM);
}
/**
* 登录成功之后跳转URL
*/
public String getSuccessUrl() {
return super.getSuccessUrl();
}
@Override
protected void issueSuccessRedirect(ServletRequest request,
ServletResponse response) throws Exception {
// Principal p = UserUtils.getPrincipal();
// if (p != null && !p.isMobileLogin()){
WebUtils.issueRedirect(request, response, getSuccessUrl(), null, true);
// }else{
// super.issueSuccessRedirect(request, response);
// }
}
/**
* 登录失败调用事件
*/
@Override
protected boolean onLoginFailure(AuthenticationToken token,
AuthenticationException e, ServletRequest request, ServletResponse response) {
String className = e.getClass().getName(), message = "";
if (IncorrectCredentialsException.class.getName().equals(className)
|| UnknownAccountException.class.getName().equals(className)){
message = "用户或密码错误, 请重试.";
}
else if (e.getMessage() != null && StringUtils.startsWith(e.getMessage(), "msg:")){
message = StringUtils.replace(e.getMessage(), "msg:", "");
}
else{
message = "系统出现点问题,请稍后再试!";
e.printStackTrace(); // 输出到控制台
}
request.setAttribute(getFailureKeyAttribute(), className);
request.setAttribute(Constants.DEFAULT_MESSAGE_PARAM, message);
return true;
}
}

View File

@@ -0,0 +1,69 @@
package com.nis.web.security;
import java.io.Serializable;
import java.security.SecureRandom;
import java.util.UUID;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.SessionIdGenerator;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.nis.util.Encodes;
/**
* 封装各种生成唯一性ID算法的工具类.
* @author
* @version 2013-01-15
*/
@Service
@Lazy(false)
public class IdGen implements SessionIdGenerator {
private static SecureRandom random = new SecureRandom();
/**
* 封装JDK自带的UUID, 通过Random数字生成, 中间无-分割.
*/
public static String uuid() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
/**
* 使用SecureRandom随机生成Long.
*/
public static long randomLong() {
return Math.abs(random.nextLong());
}
/**
* 基于Base62编码的SecureRandom随机生成bytes.
*/
public static String randomBase62(int length) {
byte[] randomBytes = new byte[length];
random.nextBytes(randomBytes);
return Encodes.encodeBase62(randomBytes);
}
/**
* Activiti ID 生成
*/
public String getNextId() {
return IdGen.uuid();
}
@Override
public Serializable generateId(Session session) {
return IdGen.uuid();
}
public static void main(String[] args) {
System.out.println(IdGen.uuid());
System.out.println(IdGen.uuid().length());
System.out.println(new IdGen().getNextId());
for (int i=0; i<1000; i++){
System.out.println(IdGen.randomLong() + " " + IdGen.randomBase62(5));
}
}
}

View File

@@ -0,0 +1,262 @@
/**
* Copyright (c) 2005-2012 springside.org.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
package com.nis.web.security;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeMap;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.Validate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.google.common.net.HttpHeaders;
import com.nis.util.Configurations;
import com.nis.util.Encodes;
import com.nis.util.StringUtils;
import com.nis.web.security.SystemAuthorizingRealm.Principal;
/**
* Http与Servlet工具类.
* @author calvin/thinkgem
* @version 2014-8-19
*/
public class Servlets {
// -- 常用数值定义 --//
public static final long ONE_YEAR_SECONDS = 60 * 60 * 24 * 365;
// 静态文件后缀
private final static String[] staticFiles = StringUtils.split(Configurations.getStringProperty("web.staticFile",""), ",");
// 动态映射URL后缀
private final static String urlSuffix = Configurations.getStringProperty("urlSuffix", ".jsp");
/**
* 设置客户端缓存过期时间 的Header.
*/
public static void setExpiresHeader(HttpServletResponse response, long expiresSeconds) {
// Http 1.0 header, set a fix expires date.
response.setDateHeader(HttpHeaders.EXPIRES, System.currentTimeMillis() + expiresSeconds * 1000);
// Http 1.1 header, set a time after now.
response.setHeader(HttpHeaders.CACHE_CONTROL, "private, max-age=" + expiresSeconds);
}
/**
* 设置禁止客户端缓存的Header.
*/
public static void setNoCacheHeader(HttpServletResponse response) {
// Http 1.0 header
response.setDateHeader(HttpHeaders.EXPIRES, 1L);
response.addHeader(HttpHeaders.PRAGMA, "no-cache");
// Http 1.1 header
response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, max-age=0");
}
/**
* 设置LastModified Header.
*/
public static void setLastModifiedHeader(HttpServletResponse response, long lastModifiedDate) {
response.setDateHeader(HttpHeaders.LAST_MODIFIED, lastModifiedDate);
}
/**
* 设置Etag Header.
*/
public static void setEtag(HttpServletResponse response, String etag) {
response.setHeader(HttpHeaders.ETAG, etag);
}
/**
* 根据浏览器If-Modified-Since Header, 计算文件是否已被修改.
*
* 如果无修改, checkIfModify返回false ,设置304 not modify status.
*
* @param lastModified 内容的最后修改时间.
*/
public static boolean checkIfModifiedSince(HttpServletRequest request, HttpServletResponse response,
long lastModified) {
long ifModifiedSince = request.getDateHeader(HttpHeaders.IF_MODIFIED_SINCE);
if ((ifModifiedSince != -1) && (lastModified < ifModifiedSince + 1000)) {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return false;
}
return true;
}
/**
* 根据浏览器 If-None-Match Header, 计算Etag是否已无效.
*
* 如果Etag有效, checkIfNoneMatch返回false, 设置304 not modify status.
*
* @param etag 内容的ETag.
*/
public static boolean checkIfNoneMatchEtag(HttpServletRequest request, HttpServletResponse response, String etag) {
String headerValue = request.getHeader(HttpHeaders.IF_NONE_MATCH);
if (headerValue != null) {
boolean conditionSatisfied = false;
if (!"*".equals(headerValue)) {
StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ",");
while (!conditionSatisfied && commaTokenizer.hasMoreTokens()) {
String currentToken = commaTokenizer.nextToken();
if (currentToken.trim().equals(etag)) {
conditionSatisfied = true;
}
}
} else {
conditionSatisfied = true;
}
if (conditionSatisfied) {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
response.setHeader(HttpHeaders.ETAG, etag);
return false;
}
}
return true;
}
/**
* 设置让浏览器弹出下载对话框的Header.
*
* @param fileName 下载后的文件名.
*/
public static void setFileDownloadHeader(HttpServletResponse response, String fileName) {
try {
// 中文文件名支持
String encodedfileName = new String(fileName.getBytes(), "ISO8859-1");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedfileName + "\"");
} catch (UnsupportedEncodingException e) {
e.getMessage();
}
}
/**
* 取得带相同前缀的Request Parameters, copy from spring WebUtils.
*
* 返回的结果的Parameter名已去除前缀.
*/
@SuppressWarnings("rawtypes")
public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) {
Validate.notNull(request, "Request must not be null");
Enumeration paramNames = request.getParameterNames();
Map<String, Object> params = new TreeMap<String, Object>();
String pre = prefix;
if (pre == null) {
pre = "";
}
while (paramNames != null && paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
if ("".equals(pre) || paramName.startsWith(pre)) {
String unprefixed = paramName.substring(pre.length());
String[] values = request.getParameterValues(paramName);
if (values == null || values.length == 0) {
values = new String[]{};
// Do nothing, no values found at all.
} else if (values.length > 1) {
params.put(unprefixed, values);
} else {
params.put(unprefixed, values[0]);
}
}
}
return params;
}
/**
* 组合Parameters生成Query String的Parameter部分,并在paramter name上加上prefix.
*
*/
public static String encodeParameterStringWithPrefix(Map<String, Object> params, String prefix) {
StringBuilder queryStringBuilder = new StringBuilder();
String pre = prefix;
if (pre == null) {
pre = "";
}
Iterator<Entry<String, Object>> it = params.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Object> entry = it.next();
queryStringBuilder.append(pre).append(entry.getKey()).append("=").append(entry.getValue());
if (it.hasNext()) {
queryStringBuilder.append("&");
}
}
return queryStringBuilder.toString();
}
/**
* 客户端对Http Basic验证的 Header进行编码.
*/
public static String encodeHttpBasic(String userName, String password) {
String encode = userName + ":" + password;
return "Basic " + Encodes.encodeBase64(encode.getBytes());
}
/**
* 是否是Ajax异步请求
* @param request
*/
public static boolean isAjaxRequest(HttpServletRequest request){
String accept = request.getHeader("accept");
String xRequestedWith = request.getHeader("X-Requested-With");
Principal principal = UserUtils.getPrincipal();
// 如果是异步请求或是手机端,则直接返回信息
return ((accept != null && accept.indexOf("application/json") != -1
|| (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
|| (principal != null && principal.isMobileLogin())));
}
/**
* 获取当前请求对象
* @return
*/
public static HttpServletRequest getRequest(){
try{
return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
}catch(Exception e){
return null;
}
}
/**
* 判断访问URI是否是静态文件请求
* @throws Exception
*/
public static boolean isStaticFile(String uri){
if (staticFiles == null){
try {
throw new Exception("检测到“app.properties”中没有配置“web.staticFile”属性。配置示例\n#静态文件后缀\n"
+"web.staticFile=.css,.js,.png,.jpg,.gif,.jpeg,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk");
} catch (Exception e) {
e.printStackTrace();
}
}
// if ((StringUtils.startsWith(uri, "/static/") || StringUtils.endsWithAny(uri, sfs))
// && !StringUtils.endsWithAny(uri, ".jsp") && !StringUtils.endsWithAny(uri, ".java")){
// return true;
// }
if (StringUtils.endsWithAny(uri, staticFiles) && !StringUtils.endsWithAny(uri, urlSuffix)
&& !StringUtils.endsWithAny(uri, ".jsp") && !StringUtils.endsWithAny(uri, ".java")){
return true;
}
return false;
}
}

View File

@@ -0,0 +1,25 @@
package com.nis.web.security;
import java.util.Collection;
import org.apache.shiro.session.Session;
public interface SessionDAO extends org.apache.shiro.session.mgt.eis.SessionDAO {
/**
* 获取活动会话
* @param includeLeave 是否包括离线最后访问时间大于3分钟为离线会话
* @return
*/
public Collection<Session> getActiveSessions(boolean includeLeave);
/**
* 获取活动会话
* @param includeLeave 是否包括离线最后访问时间大于3分钟为离线会话
* @param principal 根据登录者对象获取活动会话
* @param filterSession 不为空,则过滤掉(不包含)这个会话。
* @return
*/
public Collection<Session> getActiveSessions(boolean includeLeave, Object principal, Session filterSession);
}

View File

@@ -0,0 +1,208 @@
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.nis.web.security;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.session.InvalidSessionException;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.UnknownSessionException;
import org.apache.shiro.session.mgt.SessionContext;
import org.apache.shiro.session.mgt.SessionKey;
import org.apache.shiro.session.mgt.SimpleSession;
import org.apache.shiro.web.servlet.Cookie;
import org.apache.shiro.web.servlet.ShiroHttpServletRequest;
import org.apache.shiro.web.servlet.SimpleCookie;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.apache.shiro.web.util.WebUtils;
import com.nis.util.StringUtils;
/**
* 自定义WEB会话管理类
* @author ThinkGem
* @version 2014-7-20
*/
public class SessionManager extends DefaultWebSessionManager {
public SessionManager() {
super();
}
@Override
protected Serializable getSessionId(ServletRequest request, ServletResponse response) {
// 如果参数中包含“__sid”参数则使用此sid会话。 例如http://localhost/project?__sid=xxx&__cookie=true
String sid = request.getParameter("__sid");
if (StringUtils.isNotBlank(sid)) {
// 是否将sid保存到cookie浏览器模式下使用此参数。
if (WebUtils.isTrue(request, "__cookie")){
HttpServletRequest rq = (HttpServletRequest)request;
HttpServletResponse rs = (HttpServletResponse)response;
Cookie template = getSessionIdCookie();
Cookie cookie = new SimpleCookie(template);
cookie.setValue(sid); cookie.saveTo(rq, rs);
}
// 设置当前session状态
request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_SOURCE,
ShiroHttpServletRequest.URL_SESSION_ID_SOURCE); // session来源与url
request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID, sid);
request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_IS_VALID, Boolean.TRUE);
return sid;
}else{
return super.getSessionId(request, response);
}
}
@Override
public void validateSessions() {
super.validateSessions();
}
protected Session retrieveSession(SessionKey sessionKey) {
try{
return super.retrieveSession(sessionKey);
}catch (UnknownSessionException e) {
// 获取不到SESSION不抛出异常
return null;
}
}
public Date getStartTimestamp(SessionKey key) {
try{
return super.getStartTimestamp(key);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
return null;
}
}
public Date getLastAccessTime(SessionKey key) {
try{
return super.getLastAccessTime(key);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
return null;
}
}
public long getTimeout(SessionKey key){
try{
return super.getTimeout(key);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
return 0;
}
}
public void setTimeout(SessionKey key, long maxIdleTimeInMillis) {
try{
super.setTimeout(key, maxIdleTimeInMillis);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
}
}
public void touch(SessionKey key) {
try{
super.touch(key);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
}
}
public String getHost(SessionKey key) {
try{
return super.getHost(key);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
return null;
}
}
public Collection<Object> getAttributeKeys(SessionKey key) {
try{
return super.getAttributeKeys(key);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
return null;
}
}
public Object getAttribute(SessionKey sessionKey, Object attributeKey) {
try{
return super.getAttribute(sessionKey, attributeKey);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
return null;
}
}
public void setAttribute(SessionKey sessionKey, Object attributeKey, Object value) {
try{
super.setAttribute(sessionKey, attributeKey, value);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
}
}
public Object removeAttribute(SessionKey sessionKey, Object attributeKey) {
try{
return super.removeAttribute(sessionKey, attributeKey);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
return null;
}
}
public void stop(SessionKey key) {
try{
super.stop(key);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
}
}
public void checkValid(SessionKey key) {
try{
super.checkValid(key);
}catch (InvalidSessionException e) {
// 获取不到SESSION不抛出异常
}
}
@Override
protected Session doCreateSession(SessionContext context) {
try{
return super.doCreateSession(context);
}catch (IllegalStateException e) {
return null;
}
}
@Override
protected Session newSessionInstance(SessionContext context) {
Session session = super.newSessionInstance(context);
session.setTimeout(getGlobalSessionTimeout());
return session;
}
@Override
public Session start(SessionContext context) {
try{
return super.start(context);
}catch (NullPointerException e) {
SimpleSession session = new SimpleSession();
session.setId(0);
return session;
}
}
}

View File

@@ -0,0 +1,295 @@
package com.nis.web.security;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.annotation.PostConstruct;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.credential.DefaultPasswordService;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.authc.credential.PasswordService;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.code.kaptcha.Constants;
import com.nis.domain.SysMenu;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
import com.nis.util.Configurations;
import com.nis.util.Encodes;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.util.TreeUtil;
import com.nis.web.service.SystemService;
/**
* 系统安全认证实现类
* @author
* @version 2014-7-5
*/
@Service
public class SystemAuthorizingRealm extends AuthorizingRealm {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private SystemService systemService;
/**
* 认证回调函数, 登录时调用
* Authentication 存放用户名、密码地方,身份认证
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) {
UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
int activeSessionSize = systemService.getActiveSessions(false).size();
if (logger.isDebugEnabled()){
logger.debug("login submit, active session size: {}, username: {}", activeSessionSize, token.getUsername());
}
// 校验登录验证码
if (UserUtils.isValidateCodeLogin(token.getUsername(), false, false)){
if (!UserUtils.validateCodeIsValid(token.getCaptcha())){
throw new AuthenticationException("msg:验证码错误, 请重试.");
}
}
// 校验用户名密码
SysUser user = systemService.getUserByLoginName(token.getUsername());
if (user != null) {
if (com.nis.util.Constants.NO.equals(user.getStatus())){
throw new AuthenticationException("msg:该已帐号禁止登录.");
}
byte[] salt = Encodes.decodeHex(user.getPassword().substring(0,16));
return new SimpleAuthenticationInfo(new Principal(user, token.isMobileLogin()), user.getPassword().substring(16), ByteSource.Util.bytes(salt), getName());
}
return null;
}
/**
* 授权查询回调函数, 进行鉴权但缓存中无用户的授权信息时调用
* Authorzation 授权,存放用户权限
*/
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
Principal principal = (Principal) getAvailablePrincipal(principals);
// 获取当前已登录的用户
if (!com.nis.util.Constants.TRUE.equals(Configurations.getStringProperty("user.multiAccountLogin","true"))){
Collection<Session> sessions = systemService.getActiveSessions(true, principal, UserUtils.getSession());
if (sessions.size() > 0){
// 如果是登录进来的,则踢出已在线用户
if (UserUtils.getSubject().isAuthenticated()){
for (Session session : sessions){
systemService.deleteSession(session);
}
}
// 记住我进来的,并且当前用户已登录,则退出当前用户提示信息。
else{
UserUtils.getSubject().logout();
throw new AuthenticationException("msg:账号已在其它地方登录,请重新登录。");
}
}
}
SysUser user = systemService.getUserByLoginName(principal.getLoginName());
if (user != null) {
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
List<SysMenu> list = UserUtils.getMenuList();
if(!StringUtil.isEmpty(list)) {
for (SysMenu menu :list) {
if (!StringUtil.isBlank(menu.getPermission())) {
// 添加基于Permission的权限信息
for (String permission : StringUtils.split(menu.getPermission(),",")){
info.addStringPermission(permission);
}
}
}
}
// 添加用户权限
info.addStringPermission("user");
// 添加用户角色信息
for (SysRole role : user.getUserRoleList()){
info.addRole(role.getName());
}
// 更新登录IP和时间,集成用户日志记录
//systemService.updateUserLoginInfo(user);
// 记录登录日志
LogUtils.saveLog(Servlets.getRequest(), "系统登录");
return info;
}
return null;
}
@Override
protected void checkPermission(Permission permission, AuthorizationInfo info) {
authorizationValidate(permission);
super.checkPermission(permission, info);
}
@Override
protected boolean[] isPermitted(List<Permission> permissions, AuthorizationInfo info) {
if (permissions != null && !permissions.isEmpty()) {
for (Permission permission : permissions) {
authorizationValidate(permission);
}
}
return super.isPermitted(permissions, info);
}
@Override
public boolean isPermitted(PrincipalCollection principals, Permission permission) {
authorizationValidate(permission);
return super.isPermitted(principals, permission);
}
@Override
protected boolean isPermittedAll(Collection<Permission> permissions, AuthorizationInfo info) {
if (permissions != null && !permissions.isEmpty()) {
for (Permission permission : permissions) {
authorizationValidate(permission);
}
}
return super.isPermittedAll(permissions, info);
}
/**
* 授权验证方法
* @param permission
*/
private void authorizationValidate(Permission permission){
// 模块授权预留接口
}
/**
* 设定密码校验的Hash算法与迭代次数
*/
@PostConstruct
public void initCredentialsMatcher() {
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(com.nis.util.Constants.HASH_ALGORITHM);
matcher.setHashIterations(com.nis.util.Constants.HASH_INTERATIONS);
setCredentialsMatcher(matcher);
}
// /**
// * 清空用户关联权限认证,待下次使用时重新加载
// */
// public void clearCachedAuthorizationInfo(Principal principal) {
// SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, getName());
// clearCachedAuthorizationInfo(principals);
// }
/**
* 授权用户信息
*/
public static class Principal implements Serializable {
private static final long serialVersionUID = 1L;
private Long id; // 编号
private String loginName; // 登录名
private String name; // 姓名
private boolean mobileLogin; // 是否手机登录
private String email;
// private Map<String, Object> cacheMap;
public Principal(SysUser user, boolean mobileLogin) {
this.id = user.getId();
this.loginName = user.getLoginId();
this.name = user.getName();
this.email = user.getEmail();
this.mobileLogin = mobileLogin;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLoginName() {
return loginName;
}
public String getName() {
return name;
}
public boolean isMobileLogin() {
return mobileLogin;
}
// @JsonIgnore
// public Map<String, Object> getCacheMap() {
// if (cacheMap==null){
// cacheMap = new HashMap<String, Object>();
// }
// return cacheMap;
// }
/**
* 获取SESSIONID
*/
public String getSessionid() {
try{
return (String) UserUtils.getSession().getId();
}catch (Exception e) {
return "";
}
}
@Override
public String toString() {
return String.valueOf(id);
}
}
}

View File

@@ -0,0 +1,428 @@
package com.nis.web.security;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.UnavailableSecurityManagerException;
import org.apache.shiro.session.InvalidSessionException;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import com.google.code.kaptcha.Constants;
import com.google.common.collect.Maps;
import com.nis.domain.SysArea;
import com.nis.domain.SysMenu;
import com.nis.domain.SysOffice;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
import com.nis.util.CacheUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.util.TreeUtil;
import com.nis.web.dao.SysAreaDao;
import com.nis.web.dao.SysMenuDao;
import com.nis.web.dao.SysOfficeDao;
import com.nis.web.dao.SysRoleDao;
import com.nis.web.dao.UserDao;
import com.nis.web.security.SystemAuthorizingRealm.Principal;
import com.nis.web.service.BaseService;
import com.nis.web.service.SpringContextHolder;
/**
* 用户工具类
* @author darnell
* @version
*/
public class UserUtils {
private static UserDao userDao = SpringContextHolder.getBean(UserDao.class);
private static SysOfficeDao officeDao = SpringContextHolder.getBean(SysOfficeDao.class);
private static SysRoleDao roleDao = SpringContextHolder.getBean(SysRoleDao.class);
private static SysMenuDao sysMenuDao = SpringContextHolder.getBean(SysMenuDao.class);
private static SysAreaDao areaDao = SpringContextHolder.getBean(SysAreaDao.class);
public static final String USER_CACHE = "userCache";
public static final String USER_CACHE_ID_ = "id_";
public static final String USER_CACHE_LOGIN_NAME_ = "ln";
public static final String USER_CACHE_LIST_BY_OFFICE_ID_ = "oid_";
public static final String CACHE_ROLE_LIST = "roleList";
public static final String CACHE_MENU_LIST = "menuList";
public static final String CACHE_AREA_LIST = "areaList";
public static final String CACHE_OFFICE_LIST = "officeList";
public static final String CACHE_OFFICE_ALL_LIST = "officeAllList";
public static final String CACHE_OFFICE_ALL_MAP = "officeAllMap";
/**
* 根据ID获取用户
* @param id
* @return 取不到返回null
*/
public static SysUser get(String id){
SysUser user = (SysUser)CacheUtils.get(USER_CACHE, USER_CACHE_ID_ + id);
if (user == null){
user = userDao.getUserWithRelation(new SysUser(Long.valueOf(id),null));
if (user == null){
return null;
}
CacheUtils.put(USER_CACHE, USER_CACHE_ID_ + user.getId(), user);
CacheUtils.put(USER_CACHE, USER_CACHE_LOGIN_NAME_ + user.getLoginId(), user);
}
return user;
}
/**
* 根据登录名获取用户
* @param loginName
* @return 取不到返回null
*/
public static SysUser getByLoginName(String loginName){
SysUser user = (SysUser)CacheUtils.get(USER_CACHE, USER_CACHE_LOGIN_NAME_ + loginName);
if (user == null){
user = userDao.getUserWithRelation(new SysUser(null,loginName));
if (user == null){
return null;
}
CacheUtils.put(USER_CACHE, USER_CACHE_ID_ + user.getId(), user);
CacheUtils.put(USER_CACHE, USER_CACHE_LOGIN_NAME_ + user.getLoginId(), user);
}
return user;
}
/**
* 清除当前用户缓存
*/
public static void clearCache(){
removeCache(CACHE_ROLE_LIST);
removeCache(CACHE_MENU_LIST);
removeCache(CACHE_AREA_LIST);
removeCache(CACHE_OFFICE_LIST);
removeCache(CACHE_OFFICE_ALL_LIST);
UserUtils.clearCache(getUser());
}
/**
* 清除指定用户缓存
* @param user
*/
public static void clearCache(SysUser user){
CacheUtils.remove(USER_CACHE, USER_CACHE_ID_ + user.getId());
CacheUtils.remove(USER_CACHE, USER_CACHE_LOGIN_NAME_ + user.getLoginId());
CacheUtils.remove(USER_CACHE, USER_CACHE_LOGIN_NAME_ + user.getOldLoginId());
if (user.getOffice() != null && user.getOffice().getId() != null){
CacheUtils.remove(USER_CACHE, USER_CACHE_LIST_BY_OFFICE_ID_ + user.getOffice().getId());
}
}
/**
* 获取当前用户
* @return 取不到返回 new User()
*/
public static SysUser getUser(){
Principal principal = getPrincipal();
if (principal!=null){
SysUser user = get(String.valueOf(principal.getId()));
if (user != null){
return user;
}
return new SysUser();
}
// 如果没有登录则返回实例化空的User对象。
return new SysUser();
}
/**
* 验证码是否合法
* @param validateCode
* @return
*/
public static boolean validateCodeIsValid(String validateCode) {
String code = (String) getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
return (StringUtil.isBlank(validateCode) || validateCode.toUpperCase().equals(code));
}
/**
* 获取当前用户角色列表
* @return
*/
public static List<SysRole> getRoleList(){
@SuppressWarnings("unchecked")
List<SysRole> roleList = (List<SysRole>)getCache(CACHE_ROLE_LIST);
if (roleList == null){
roleList = roleDao.findAllList(new SysRole());
putCache(CACHE_ROLE_LIST, roleList);
}
return roleList;
}
/**
* 获取当前用户授权菜单
* @return
*/
public static List<SysMenu> getMenuList(){
@SuppressWarnings("unchecked")
List<SysMenu> menuList = (List<SysMenu>)getCache(CACHE_MENU_LIST);
if (menuList == null){
SysUser user = getUser();
if (user.isAdmin()){
menuList = sysMenuDao.findAllList(new SysMenu());
}else{
menuList = sysMenuDao.findSysMenuByUserId(user.getId());
}
putCache(CACHE_MENU_LIST, menuList);
}
return menuList;
}
public static String getMenuNameById(String id) {
for (SysMenu menu : getMenuList()) {
if (menu.getId() == Long.valueOf(id)) {
return menu.getName();
}
}
return "";
}
/**
* 按照菜单各级递归排列
* @return
*/
public static List<SysMenu> getMenuTreeList(){
return new TreeUtil(getMenuList()).buildTree();
}
/**
* 验证用户是否有该权限
* @param permission
* @return
*/
public static boolean checkPermission(String permission) {
return SecurityUtils.getSubject().isPermitted(permission);
}
/**
* 获取当前用户有权限访问的部门
* @return
*/
public static List<SysOffice> getOfficeList(){
@SuppressWarnings("unchecked")
List<SysOffice> officeList = (List<SysOffice>)getCache(CACHE_OFFICE_LIST);
if (officeList == null){
SysUser user = getUser();
if (user.isAdmin()){
officeList = officeDao.findAllList(new SysOffice());
}else{
SysOffice office = new SysOffice();
office.getSqlMap().put("dsf", BaseService.dataScopeFilter(user, "a", ""));
officeList = officeDao.findList(office);
}
putCache(CACHE_OFFICE_LIST, officeList);
}
return officeList;
}
/**
* 获取当前用户授权的区域
* @return
*/
public static List<SysArea> getAreaList(){
@SuppressWarnings("unchecked")
List<SysArea> areaList = (List<SysArea>)getCache(CACHE_AREA_LIST);
if (areaList == null){
areaList = areaDao.findAllList(new SysArea());
putCache(CACHE_AREA_LIST, areaList);
}
return areaList;
}
/**
* 获取当前用户有权限访问的部门
* @return
*/
public static List<SysOffice> getOfficeAllList(){
@SuppressWarnings("unchecked")
List<SysOffice> officeList = (List<SysOffice>)getCache(CACHE_OFFICE_ALL_LIST);
if (officeList == null){
officeList = officeDao.findAllList(new SysOffice());
putCache(CACHE_OFFICE_ALL_MAP, getOfficeAllMap(officeList));
}
return officeList;
}
/**
* 获取当前用户有权限访问的部门
* @return
*/
public static Map<Long, SysOffice> getOfficeAllMap(){
@SuppressWarnings("unchecked")
Map<Long, SysOffice> officeMap = (Map<Long, SysOffice>)getCache(CACHE_OFFICE_ALL_MAP);
if (officeMap == null){
officeMap = getOfficeAllMap(getOfficeAllList());
}
return officeMap;
}
private static Map<Long, SysOffice> getOfficeAllMap(List<SysOffice> officeList) {
Map<Long, SysOffice> officeMap = new HashMap<Long,SysOffice>();
for (SysOffice office: officeList) {
officeMap.put(office.getId(), office);
}
return officeMap;
}
/**
* 获取当前部门各个部门级别描述
* @param deptId
* @return
*/
public static String getOfficeDesc(Long deptId) {
StringBuilder offices = new StringBuilder();
Map<Long, SysOffice> officeMap = getOfficeAllMap();
SysOffice office = officeMap.get(deptId);
if(!StringUtil.isEmpty(office)) {
String[] parentIds = office.getParentIds().split(",");
for(String id : parentIds) {
if (StringUtils.isNotBlank(id) && !id.equals("0") && !id.equals("1")) {//去除空|0无意义|1顶部公司组织机构
SysOffice parentOffice = officeMap.get(Long.valueOf(id));
offices.append(StringUtil.isEmpty(parentOffice) ? "" : parentOffice.getName()).append("-");
}
}
offices.append(office.getName());
}
return offices.toString();
}
/**
* 获取授权主要对象
*/
public static Subject getSubject(){
return SecurityUtils.getSubject();
}
/**
* 获取当前登录者对象
*/
public static Principal getPrincipal(){
try{
Subject subject = SecurityUtils.getSubject();
Principal principal = (Principal)subject.getPrincipal();
if (principal != null){
return principal;
}
// subject.logout();
}catch (UnavailableSecurityManagerException e) {
}catch (InvalidSessionException e){
}
return null;
}
public static Session getSession(){
try{
Subject subject = SecurityUtils.getSubject();
Session session = subject.getSession(false);
if (session == null){
session = subject.getSession();
}
if (session != null){
return session;
}
// subject.logout();
}catch (InvalidSessionException e){
}
return null;
}
// ============== User Cache ==============
public static Object getCache(String key) {
return getCache(key, null);
}
public static Object getCache(String key, Object defaultValue) {
// Object obj = getCacheMap().get(key);
Object obj = getSession().getAttribute(key);
return obj==null?defaultValue:obj;
}
public static void putCache(String key, Object value) {
// getCacheMap().put(key, value);
getSession().setAttribute(key, value);
}
public static void removeCache(String key) {
// getCacheMap().remove(key);
getSession().removeAttribute(key);
}
/**
* 是否是验证码登录
* @param useruame 用户名
* @param isFail 计数加1
* @param clean 计数清零
* @return
*/
@SuppressWarnings("unchecked")
public static boolean isValidateCodeLogin(String useruame, boolean isFail, boolean clean){
Map<String, Integer> loginFailMap = (Map<String, Integer>)CacheUtils.get("loginFailMap");
if (loginFailMap==null){
loginFailMap = Maps.newHashMap();
CacheUtils.put("loginFailMap", loginFailMap);
}
Integer loginFailNum = loginFailMap.get(useruame);
if (loginFailNum==null){
loginFailNum = 0;
}
if (isFail){
loginFailNum++;
loginFailMap.put(useruame, loginFailNum);
}
if (clean){
loginFailMap.remove(useruame);
}
return loginFailNum >= 3;
}
}

View File

@@ -0,0 +1,37 @@
package com.nis.web.security;
import org.apache.shiro.web.filter.authc.LogoutFilter;
public class UsernamePasswordToken extends org.apache.shiro.authc.UsernamePasswordToken {
private static final long serialVersionUID = 1L;
private String captcha;
private boolean mobileLogin;
public UsernamePasswordToken() {
super();
}
public UsernamePasswordToken(String username, char[] password,
boolean rememberMe, String host, String captcha, boolean mobileLogin) {
super(username, password, rememberMe, host);
this.captcha = captcha;
this.mobileLogin = mobileLogin;
}
public String getCaptcha() {
return captcha;
}
public void setCaptcha(String captcha) {
this.captcha = captcha;
}
public boolean isMobileLogin() {
return mobileLogin;
}
}

View File

@@ -0,0 +1,8 @@
package com.nis.web.service;
import org.springframework.stereotype.Service;
@Service
public class ArchiveServcie extends BaseService{
}

View File

@@ -0,0 +1,44 @@
package com.nis.web.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import com.nis.domain.SysArea;
import com.nis.util.StringUtil;
import com.nis.web.dao.SysAreaDao;
import com.nis.web.security.UserUtils;
@Service
public class AreaService extends TreeService<SysAreaDao, SysArea> {
@Autowired
private SysAreaDao areaDao;
public List<SysArea> findAll() {
return UserUtils.getAreaList();
}
public List<SysArea> findAllAreaList(SysArea area) {
if (!StringUtil.isEmpty(area.getId())) {
area.setParentIds(area.getParentIds()+area.getId()+","+"%");
} else {
//area.setParentIds(area.getParentIds()+"%");
return Lists.newArrayList();
}
return areaDao.findByParentIdsLike(area);
}
public void saveOrUpdate(SysArea sysArea) {
if (StringUtil.isEmpty(sysArea.getId())) {
sysArea.setDelFlag(1);
}
this.save(sysArea);
UserUtils.removeCache(UserUtils.CACHE_AREA_LIST);
}
}

View File

@@ -0,0 +1,153 @@
package com.nis.web.service;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
import com.nis.util.StringUtils;
/**
* Service基类
* @author ThinkGem
* @version 2014-05-16
*/
public abstract class BaseService {
/**
* 日志对象
*/
protected Logger logger = LoggerFactory.getLogger(getClass());
/**
* 数据范围过滤
* @param user 当前用户对象通过“entity.getCurrentUser()”获取
* @param officeAlias 机构表别名,多个用“,”逗号隔开。
* @param userAlias 用户表别名,多个用“,”逗号隔开,传递空,忽略此参数
* @return 标准连接条件对象
*/
public static String dataScopeFilter(SysUser user, String officeAlias, String userAlias) {
StringBuilder sqlString = new StringBuilder();
// 进行权限过滤,多个角色权限范围之间为或者关系。
List<Integer> dataScope = Lists.newArrayList();
if (StringUtils.isBlank(user.getLoginId())){
return "";
}
// 超级管理员,跳过权限过滤
if (user.isAdmin()){
boolean isDataScopeAll = isContainsDataScopeAll(user.getUserRoleList());
for (SysRole r : user.getUserRoleList()) {
for (String oa : StringUtils.split(officeAlias, ",")){
if (!dataScope.contains(r.getDataScope()) && StringUtils.isNotBlank(oa)){
sqlString.append(createScopeSql(r.getDataScope(),oa,user));
dataScope.add(r.getDataScope());
}
}
}
// 如果没有全部数据权限,并设置了用户别名,则当前权限为本人;如果未设置别名,当前无权限为已植入权限
if (!isDataScopeAll){
if (StringUtils.isNotBlank(userAlias)){
for (String ua : StringUtils.split(userAlias, ",")){
sqlString.append(" OR " + ua + ".id = '" + user.getId() + "'");
}
}else {
for (String oa : StringUtils.split(officeAlias, ",")){
//sqlString.append(" OR " + oa + ".id = " + user.getOffice().getId());
sqlString.append(" OR " + oa + ".id IS NULL");
}
}
}else{
// 如果包含全部权限,则去掉之前添加的所有条件,并跳出循环。
sqlString = new StringBuilder();
}
}
if (StringUtils.isNotBlank(sqlString.toString())){
return " AND (" + sqlString.substring(4) + ")";
}
return "";
}
/**
* 测试数据是否包含全集
* @return
*/
private static boolean isContainsDataScopeAll(List<SysRole> roleList) {
boolean isDataScopeAll = false;
for(SysRole role : roleList) {
if(SysRole.DATA_SCOPE_ALL.equals(role.getDataScope())){
isDataScopeAll = true;
break;
}
}
return isDataScopeAll;
}
/**
* 过滤机构信息
* @param dataScope 数据范围1所有数据2所在公司及以下数据3所在公司数据4所在部门及以下数据5所在部门数据6所在单位及以下数据7所在单位数据
* @return
*/
private static String createScopeSql(int dataScope,String officeAlias,SysUser user) {
StringBuilder scopeSql = new StringBuilder(1024);
if (SysRole.DATA_SCOPE_COMPANY_AND_CHILD.equals(dataScope)){
scopeSql.append(" OR " + officeAlias + ".id = " + user.getCompany().getId());
scopeSql.append(" OR " + officeAlias + ".parent_ids LIKE '" + user.getCompany().getParentIds() + user.getCompany().getId() + ",%'");
}
else if (SysRole.DATA_SCOPE_COMPANY.equals(dataScope)){
scopeSql.append(" OR " + officeAlias + ".id = " + user.getCompany().getId());
// 包括本公司下的部门 type=1:公司type=2单位 3.部门)
scopeSql.append(" OR (" + officeAlias + ".parent_id = '" + user.getCompany().getId() + "' AND " + officeAlias + ".type>1)");
}
else if (SysRole.DATA_SCOPE_OFFICE_AND_CHILD.equals(dataScope)){
scopeSql.append(" OR " + officeAlias + ".id = " + user.getOffice().getId());
scopeSql.append(" OR " + officeAlias + ".parent_ids LIKE '" + user.getOffice().getParentIds() + user.getOffice().getId() + ",%'");
}
else if (SysRole.DATA_SCOPE_OFFICE.equals(dataScope)){
scopeSql.append(" OR " + officeAlias + ".id = " + user.getOffice().getId());
}
else if (SysRole.DATA_SCOPE_ENTITY_AND_CHILD.equals(dataScope)){
scopeSql.append(" OR " + officeAlias + ".id = " + user.getEntity().getId());
scopeSql.append(" OR " + officeAlias + ".parent_ids LIKE '" + user.getEntity().getParentIds() + user.getEntity().getId() + ",%'");
} else if (SysRole.DATA_SCOPE_ENTITY.equals(dataScope)){
scopeSql.append(" OR " + officeAlias + ".id = " + user.getEntity().getId());
// 包括本公司下的部门 type=1:公司type=2单位 3.部门)
scopeSql.append(" OR (" + officeAlias + ".parent_id = '" + user.getEntity().getId() + "' AND " + officeAlias + ".type>1)");
}
return scopeSql.toString();
}
}

View File

@@ -0,0 +1,6 @@
package com.nis.web.service;
public interface CommonService {
}

View File

@@ -0,0 +1,180 @@
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.nis.web.service;
import java.lang.reflect.Field;
import java.util.List;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.nis.domain.BaseEntity;
import com.nis.domain.Page;
import com.nis.util.Constants;
import com.nis.web.dao.CrudDao;
/**
* Service基类
* @author ThinkGem
* @version 2014-05-16
*/
public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>> extends BaseService {
/**
* 持久层对象
*/
@Autowired
protected D dao;
/**
* 获取单条数据
* @param id
* @return
*/
public T get(Long id) {
return dao.get(id);
}
/**
* 获取单条数据
* @param entity
* @return
*/
public T get(T entity) {
return dao.get(entity);
}
/**
* 查询列表数据
* @param entity
* @return
*/
public List<T> findList(T entity) {
return dao.findList(entity);
}
/**
* 查询分页数据
* @param page 分页对象
* @param entity
* @return
*/
public Page<T> findPage(Page<T> page, T entity) {
entity.setPage(page);
page.setList(dao.findList(entity));
return page;
}
/**
* 保存数据(插入或更新)
* @param entity
*/
public void save(T entity) {
if (entity.getIsNewRecord()){
dao.insert(entity);
}else{
dao.update(entity);
}
}
/**
* 删除数据
* @param entity
*/
public void delete(T entity) {
dao.delete(entity);
}
/**
*
* saveBatch(批量全部保存数据)
* (这里描述这个方法适用条件 可选)
* @param data 数据集合
* @param mClass 传入的dao.xml里的mapper
* @author wx
* @since 1.0.0
*/
@SuppressWarnings("unchecked")
public void saveBatch(List<T> data,@SuppressWarnings("rawtypes")Class mClass) {
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
try{
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
for(int index = 0; index < data.size();index++){
T t = data.get(index);
((CrudDao<T>) batchSqlSession.getMapper(mClass)).insert(t);
}
batchSqlSession.commit();
// }catch (Exception e){
// batchSqlSession.rollback();
// throw e;
}finally {
if(batchSqlSession != null){
batchSqlSession.close();
}
}
}
/**
*
* updateBatch(批量更新全部数据)
* (这里描述这个方法适用条件 可选)
* @param data 数据集合
* @param mClass 传入的dao.xml里的mapper
* @author wx
* @since 1.0.0
*/
@SuppressWarnings("unchecked")
public void updateBatch(List<T> data,@SuppressWarnings("rawtypes") Class mClass) {
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
try{
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
for(int index = 0; index < data.size();index++){
T t = data.get(index);
((CrudDao<T>) batchSqlSession.getMapper(mClass)).update(t);
}
batchSqlSession.commit();
// }catch (Exception e){
// batchSqlSession.rollback();
// throw e;
}finally {
if(batchSqlSession != null){
batchSqlSession.close();
}
}
}
/**
*
* deleteBatch(批量删除全部数据)
* (这里描述这个方法适用条件 可选)
* @param data 数据集合
* @param mClass 传入的dao.xml里的mapper
* @author wx
* @since 1.0.0
*/
@SuppressWarnings("unchecked")
public void deleteBatch(List<T> data,@SuppressWarnings("rawtypes") Class mClass) {
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
try{
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
for(int index = 0; index < data.size();index++){
T t = data.get(index);
((CrudDao<T>) batchSqlSession.getMapper(mClass)).delete(t);
}
batchSqlSession.commit();
// }catch (Exception e){
// batchSqlSession.rollback();
// throw e;
}finally {
if(batchSqlSession != null){
batchSqlSession.close();
}
}
}
}

View File

@@ -0,0 +1,108 @@
package com.nis.web.service;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.Page;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.SysDataDictionaryName;
import com.nis.util.DateUtil;
import com.nis.util.StringUtil;
import com.nis.web.dao.SysDictDao;
import com.nis.web.security.UserUtils;
@Service
public class DictService extends BaseService {
/**@Resource**/
@Autowired
private SysDictDao dictDao;
public Page<SysDataDictionaryName> findDictList(Page<SysDataDictionaryName> page, SysDataDictionaryName sysDictName) {
// 设置分页参数
sysDictName.setPage(page);
// 执行分页查询
page.setList(dictDao.findDictList(sysDictName));
return page;
}
public void saveOrUpdate(SysDataDictionaryName sysDictName) {
if(StringUtil.isEmpty(sysDictName.getId())) {//新增
sysDictName.setCreateTime(new Date());
sysDictName.setModifyTime(new Date());
sysDictName.setStatus(1);
dictDao.insertDictName(sysDictName);
List<SysDataDictionaryItem> dictItemList = sysDictName.getDictItemList();
if(!StringUtil.isEmpty(dictItemList) && dictItemList.size()>0) {
for (SysDataDictionaryItem dictItem : dictItemList) {
dictItem.setDictionaryId(sysDictName.getId().intValue());
dictDao.insertDictItem(dictItem);
}
}
}else {//修改
//累加修改记录
String newRevision = "用户"+UserUtils.getUser().getName()+",在"+DateUtil.getCurrentDate(DateUtil.YYYY_MM_DD_HH24_MM_SS)+"修改!";
StringBuilder revisionBuilder = new StringBuilder(newRevision);
String oldRevision = sysDictName.getRevision();
if(!StringUtil.isBlank(oldRevision)){
if(oldRevision.split("\\|").length<10){
revisionBuilder.append("|").append(oldRevision);
}else {
revisionBuilder.append("|").append(oldRevision.substring(0,oldRevision.lastIndexOf("|")));
}
}
sysDictName.setRevision(revisionBuilder.toString());
sysDictName.setModifyTime(new Date());
sysDictName.setStatus(1);
dictDao.updateDictName(sysDictName);
dictDao.deleteDictItem(sysDictName.getId().intValue());//删除所有词条项信息
List<SysDataDictionaryItem> dictItemList = sysDictName.getDictItemList();
if(!StringUtil.isEmpty(dictItemList) && dictItemList.size()>0) {
for (SysDataDictionaryItem dictItem : dictItemList) {
dictItem.setDictionaryId(sysDictName.getId().intValue());
dictDao.insertDictItem(dictItem);
}
}
}
}
public void deleteDict(Integer dictId) {
//删除词典项
dictDao.deleteDictItem(dictId);
//删除词典标识
dictDao.deleteDictName(dictId);
}
public SysDataDictionaryName getDictByIdWithRelation(Integer id) {
return dictDao.getDictById(1,id);
}
}

View File

@@ -0,0 +1,628 @@
package com.nis.web.service;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.sql.ResultSet;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.mapping.ResultMap;
import org.apache.ibatis.mapping.ResultMapping;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.log4j.Logger;
import com.nis.domain.Page;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.HiveDataSource;
import com.nis.util.HiveJDBC;
import com.nis.util.StringUtil;
import com.nis.util.redis.SaveRedisThread;
public class HiveSqlService {
private final static Logger logger = Logger.getLogger(HiveJDBC.class);
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static ResultSet getResultSet(Page page, Object bean, String tableName,
Map<String, Map<String, String>> col2col, String orderBy, String searchActiveSys) throws Exception {
tableName = tableName.toLowerCase();
tableName = Configurations.getStringProperty(tableName, "t_" + tableName).trim();
String showColmun = getFiledsSql(bean.getClass().getSimpleName(), page.getFields());
StringBuffer sql = new StringBuffer();
Map<String, String> filedAndColumnMap = getFiledAndColumnMap(bean.getClass());
if (null == showColmun || showColmun.equals("")) {
for (String key : filedAndColumnMap.keySet()) {
if (!filedAndColumnMap.get(key).toLowerCase().equals("id")) {
sql.append(filedAndColumnMap.get(key) + ",");
}
}
} else {
sql.append(showColmun);
}
String sqlTrim = sql.toString().trim();
if (sqlTrim.endsWith(",")) {
sqlTrim = sqlTrim.substring(0, sqlTrim.length() - 1);
}
sql.setLength(0);
sql.append(" select " + sqlTrim + " from " + tableName + " t where 1=1 ");
if (bean != null) {
Class<?> clazz = bean.getClass();
for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
// 获取所有的字段包括public,private,protected,private
// Field[] fields = bean.getClass().getDeclaredFields();
Field[] fields = clazz.getDeclaredFields();
Long foundTimePartStart = null;
Long foundTimePartEnd = null;
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
String key = f.getName();// 获取字段名
if (f.getType().getName().equals("java.lang.String") && key.startsWith("search")) {
Object value = getFieldValue(bean, key);
if (value != null) {
setFieldValue(bean, key, value.toString().trim());
if (key.endsWith("Time")) {// 日期开始或结束的字段
if (col2col.containsKey(key)) {
value = sdf.parse(value.toString().trim()).getTime() / 1000;
if (key.toLowerCase().equals("searchfoundstarttime")) {
foundTimePartStart = Long.parseLong(value.toString()) / 3600;
}
if (key.toLowerCase().equals("searchfoundendtime")) {
foundTimePartEnd = Long.parseLong(value.toString()) / 3600;
}
if (col2col.get(key).get("start") != null) {
// sql.append(" and " +
// filedAndColumnMap.get(col2col.get(key).get("start"))
// + ">=to_date('" +
// value.toString().trim()
// + "','yyyy-mm-dd HH24:mi:ss')");
sql.append(" and " + filedAndColumnMap.get(col2col.get(key).get("start")) + ">="
+ value + "L");
} else {
// sql.append(" and " +
// filedAndColumnMap.get(col2col.get(key).get("end"))
// + "<=to_date('" +
// value.toString().trim()
// + "','yyyy-mm-dd HH24:mi:ss')");
sql.append(" and " + filedAndColumnMap.get(col2col.get(key).get("end")) + "<"
+ value + "L");
}
}
} else {
if (key.toLowerCase().startsWith("search")) {
key = key.replace("search", "");
key = key.substring(0, 1).toLowerCase() + key.substring(1);
}
if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& (key.toLowerCase().equals("cfgid")
|| key.toLowerCase().equals("entranceid"))) {
sql.append(
" and " + filedAndColumnMap.get(key) + "=" + value.toString().trim() + "L");
} else if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& (key.toLowerCase().equals("protocol") || key.toLowerCase().equals("serverip")
|| key.toLowerCase().equals("clientip")
|| key.toLowerCase().equals("url")
|| key.toLowerCase().equals("mailfrom")
|| key.toLowerCase().equals("mailto")
|| key.toLowerCase().equals("encryptmode")
|| key.toLowerCase().equals("exprotocol")
|| key.toLowerCase().equals("cljip"))) {
sql.append(" and " + filedAndColumnMap.get(key) + "='" + value.toString().trim()
+ "'");
} else if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& key.toLowerCase().equals("servicetype")) {
sql.append(" and " + filedAndColumnMap.get(key) + "=" + value.toString().trim());
}
}
}
}
}
//if (null != searchActiveSys && !searchActiveSys.equals(Constants.ACTIVESYS_A)) {// B版数据库才有found_time_partition字段,A版毛衣found_time_partition分区字段
if (null != searchActiveSys){//为A版日志库添加分区字段
if (null != foundTimePartStart) {
sql.append(" and found_time_partition>=" + foundTimePartStart + "L");
}
if (null != foundTimePartEnd) {
sql.append(" and found_time_partition<" + foundTimePartEnd + "L");
}
}
}
}
Integer startNum = (page.getPageNo() - 1) * page.getPageSize() + 1;
Integer endNum = startNum - 1 + page.getPageSize();
// sql.append(" order by " + orderBy + " limit 10000) t1) t2 where
// row_Num between " + startNum + " and " + endNum);
sql.append(" limit " + Constants.EVERY_GETHIVEDATANUM);
logger.info("获取数据中心日志sql===================" + sql);
// ResultSet query = HiveJDBC.query(sql.toString());
ResultSet query = HiveDataSource.query(sql.toString(), searchActiveSys);
logger.info("获取数据中心日志成功");
return query;
}
public static Long getHivePageCount(Object bean, String countKey, String tableName,
Map<String, Map<String, String>> col2col, String searchActiveSys) throws Exception {
tableName = tableName.toLowerCase();
tableName = Configurations.getStringProperty(tableName, "t_" + tableName).trim();
StringBuffer countSql = new StringBuffer();
Map<String, String> filedAndColumnMap = getFiledAndColumnMap(bean.getClass());
countSql.append("select count(1) from " + tableName + " where 1=1 ");
if (bean != null) {
Class<?> clazz = bean.getClass();
for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
// 获取所有的字段包括public,private,protected,private
// Field[] fields = bean.getClass().getDeclaredFields();
Field[] fields = clazz.getDeclaredFields();
Long foundTimePartStart = null;
Long foundTimePartEnd = null;
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
String key = f.getName();// 获取字段名
if (f.getType().getName().equals("java.lang.String") && key.startsWith("search")) {
Object value = getFieldValue(bean, key);
if (value != null) {
setFieldValue(bean, key, value.toString().trim());
if (key.endsWith("Time")) {// 日期开始或结束的字段
if (col2col.containsKey(key)) {
value = sdf.parse(value.toString().trim()).getTime() / 1000;
if (key.toLowerCase().equals("searchfoundstarttime")) {
foundTimePartStart = Long.parseLong(value.toString()) / 3600;
}
if (key.toLowerCase().equals("searchfoundendtime")) {
foundTimePartEnd = Long.parseLong(value.toString()) / 3600;
}
if (col2col.get(key).get("start") != null) {
countSql.append(" and " + filedAndColumnMap.get(col2col.get(key).get("start"))
+ ">=" + value + "L");
} else {
countSql.append(" and " + filedAndColumnMap.get(col2col.get(key).get("end"))
+ "<" + value + "L");
}
}
} else {
if (key.toLowerCase().startsWith("search")) {
key = key.replace("search", "");
key = key.substring(0, 1).toLowerCase() + key.substring(1);
}
if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& (key.toLowerCase().equals("cfgid")
|| key.toLowerCase().equals("entranceid"))) {
countSql.append(
" and " + filedAndColumnMap.get(key) + "=" + value.toString().trim() + "L");
} else if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& (key.toLowerCase().equals("protocol") || key.toLowerCase().equals("serverip")
|| key.toLowerCase().equals("clientip")
|| key.toLowerCase().equals("url")
|| key.toLowerCase().equals("mailfrom")
|| key.toLowerCase().equals("mailto")
|| key.toLowerCase().equals("encryptmode")
|| key.toLowerCase().equals("exprotocol")
|| key.toLowerCase().equals("cljip"))) {
countSql.append(" and " + filedAndColumnMap.get(key) + "='"
+ value.toString().trim() + "'");
} else if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& key.toLowerCase().equals("servicetype")) {
countSql.append(
" and " + filedAndColumnMap.get(key) + "=" + value.toString().trim());
}
}
}
}
}
//if (null != searchActiveSys && !searchActiveSys.equals(Constants.ACTIVESYS_A)) {// B版数据库才有found_time_partition字段,A版毛衣found_time_partition分区字段
if (null != searchActiveSys){
if (null != foundTimePartStart) {
countSql.append(" and found_time_partition>=" + foundTimePartStart + "L");
}
if (null != foundTimePartEnd) {
countSql.append(" and found_time_partition<" + foundTimePartEnd + "L");
}
}
}
}
logger.info("获取数据中心日志总条数sql==================" + countSql.toString());
// ResultSet countRs = HiveJDBC.query(countSql.toString());
ResultSet countRs = HiveDataSource.query(countSql.toString(), searchActiveSys);
String countStr = null;
while (countRs.next()) {
countStr = countRs.getObject(1).toString();
break;
}
if (countStr == null || countStr.equals("")) {
logger.info("获取数据中心日志总条数成功总共===================0条配置");
return 0l;
}
Long count = Long.valueOf(countStr);
logger.info("获取数据中心日志总条数成功总共===================" + count + "条配置");
// HiveJDBC.closeConn();
if (Constants.IS_OPEN_REDIS && Constants.DATACENTER_OPEN_REDIS) {
new SaveRedisThread(countKey, count, Constants.HIVE_EXPIRE).start();
}
return count;
}
public static ResultSet getResultSet2(Page page, Object bean, String tableName,
Map<String, Map<String, String>> col2col, String orderBy, String searchActiveSys) throws Exception {
tableName = tableName.toLowerCase();
tableName = Configurations.getStringProperty(tableName, "t_" + tableName).trim();
String showColmun = getFiledsSql(bean.getClass().getSimpleName(), page.getFields());
StringBuffer sql = new StringBuffer();
Map<String, String> filedAndColumnMap = getFiledAndColumnMap(bean.getClass());
if (null == showColmun || showColmun.equals("")) {
for (String key : filedAndColumnMap.keySet()) {
if (!filedAndColumnMap.get(key).toLowerCase().equals("id")) {
sql.append(filedAndColumnMap.get(key) + ",");
}
}
} else {
sql.append(showColmun);
}
String sqlTrim = sql.toString().trim();
if (sqlTrim.endsWith(",")) {
sqlTrim = sqlTrim.substring(0, sqlTrim.length() - 1);
}
sql.setLength(0);
sql.append("select " + sqlTrim + " from(select " + sqlTrim + ",row_Num from(select " + sqlTrim
+ ",row_number() over() as row_Num from " + tableName + " t where 1=1 ");
if (bean != null) {
Class<?> clazz = bean.getClass();
for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
// 获取所有的字段包括public,private,protected,private
// Field[] fields = bean.getClass().getDeclaredFields();
Field[] fields = clazz.getDeclaredFields();
Long foundTimePartStart = null;
Long foundTimePartEnd = null;
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
String key = f.getName();// 获取字段名
if (f.getType().getName().equals("java.lang.String") && key.startsWith("search")) {
Object value = getFieldValue(bean, key);
if (value != null) {
setFieldValue(bean, key, value.toString().trim());
if (key.endsWith("Time")) {// 日期开始或结束的字段
if (col2col.containsKey(key)) {
value = sdf.parse(value.toString().trim()).getTime() / 1000;
if (key.toLowerCase().equals("searchfoundstarttime")) {
foundTimePartStart = Long.parseLong(value.toString()) / 3600;
}
if (key.toLowerCase().equals("searchfoundendtime")) {
foundTimePartEnd = Long.parseLong(value.toString()) / 3600;
}
if (col2col.get(key).get("start") != null) {
// sql.append(" and " +
// filedAndColumnMap.get(col2col.get(key).get("start"))
// + ">=to_date('" +
// value.toString().trim()
// + "','yyyy-mm-dd HH24:mi:ss')");
sql.append(" and " + filedAndColumnMap.get(col2col.get(key).get("start")) + ">="
+ value + "L");
} else {
// sql.append(" and " +
// filedAndColumnMap.get(col2col.get(key).get("end"))
// + "<=to_date('" +
// value.toString().trim()
// + "','yyyy-mm-dd HH24:mi:ss')");
sql.append(" and " + filedAndColumnMap.get(col2col.get(key).get("end")) + "<"
+ value + "L");
}
}
} else {
if (key.toLowerCase().startsWith("search")) {
key = key.replace("search", "");
key = key.substring(0, 1).toLowerCase() + key.substring(1);
}
if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& (key.toLowerCase().equals("cfgid")
|| key.toLowerCase().equals("entranceid"))) {
sql.append(
" and " + filedAndColumnMap.get(key) + "=" + value.toString().trim() + "L");
} else if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& (key.toLowerCase().equals("protocol") || key.toLowerCase().equals("serverip")
|| key.toLowerCase().equals("clientip")
|| key.toLowerCase().equals("cljip"))) {
sql.append(" and " + filedAndColumnMap.get(key) + "='" + value.toString().trim()
+ "'");
} else if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& key.toLowerCase().equals("servicetype")) {
sql.append(" and " + filedAndColumnMap.get(key) + "=" + value.toString().trim());
}
}
}
}
}
if (null != searchActiveSys && !searchActiveSys.equals(Constants.ACTIVESYS_A)) {// B版数据库才有found_time_partition字段,A版毛衣found_time_partition分区字段
if (null != foundTimePartStart) {
sql.append(" and found_time_partition>=" + foundTimePartStart + "L");
}
if (null != foundTimePartEnd) {
sql.append(" and found_time_partition<" + foundTimePartEnd + "L");
}
}
}
}
Integer startNum = (page.getPageNo() - 1) * page.getPageSize() + 1;
Integer endNum = startNum - 1 + page.getPageSize();
sql.append(
" order by " + orderBy + " limit 10000) t1) t2 where row_Num between " + startNum + " and " + endNum);
logger.info("获取数据中心日志sql===================" + sql);
ResultSet query = HiveJDBC.query(sql.toString(), searchActiveSys);
logger.info("获取数据中心日志成功");
return query;
}
public static Long getHivePageCount2(Object bean, String tableName, Map<String, Map<String, String>> col2col,
String searchActiveSys) throws Exception {
tableName = tableName.toLowerCase();
tableName = Configurations.getStringProperty(tableName, "t_" + tableName).trim();
StringBuffer countSql = new StringBuffer();
Map<String, String> filedAndColumnMap = getFiledAndColumnMap(bean.getClass());
countSql.append("select count(1) from " + tableName + " where 1=1 ");
if (bean != null) {
Class<?> clazz = bean.getClass();
for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
// 获取所有的字段包括public,private,protected,private
// Field[] fields = bean.getClass().getDeclaredFields();
Field[] fields = clazz.getDeclaredFields();
Long foundTimePartStart = null;
Long foundTimePartEnd = null;
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
String key = f.getName();// 获取字段名
if (f.getType().getName().equals("java.lang.String") && key.startsWith("search")) {
Object value = getFieldValue(bean, key);
if (value != null) {
setFieldValue(bean, key, value.toString().trim());
if (key.endsWith("Time")) {// 日期开始或结束的字段
if (col2col.containsKey(key)) {
value = sdf.parse(value.toString().trim()).getTime() / 1000;
if (key.toLowerCase().equals("searchfoundstarttime")) {
foundTimePartStart = Long.parseLong(value.toString()) / 3600;
}
if (key.toLowerCase().equals("searchfoundendtime")) {
foundTimePartEnd = Long.parseLong(value.toString()) / 3600;
}
if (col2col.get(key).get("start") != null) {
countSql.append(" and " + filedAndColumnMap.get(col2col.get(key).get("start"))
+ ">=" + value + "L");
} else {
countSql.append(" and " + filedAndColumnMap.get(col2col.get(key).get("end"))
+ "<" + value + "L");
}
}
} else {
if (key.toLowerCase().startsWith("search")) {
key = key.replace("search", "");
key = key.substring(0, 1).toLowerCase() + key.substring(1);
}
if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& (key.toLowerCase().equals("cfgid")
|| key.toLowerCase().equals("entranceid"))) {
countSql.append(
" and " + filedAndColumnMap.get(key) + "=" + value.toString().trim() + "L");
} else if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& (key.toLowerCase().equals("protocol") || key.toLowerCase().equals("serverip")
|| key.toLowerCase().equals("clientip")
|| key.toLowerCase().equals("cljip"))) {
countSql.append(" and " + filedAndColumnMap.get(key) + "='"
+ value.toString().trim() + "'");
} else if (!value.toString().trim().equals("") && filedAndColumnMap.containsKey(key)
&& key.toLowerCase().equals("servicetype")) {
countSql.append(
" and " + filedAndColumnMap.get(key) + "=" + value.toString().trim());
}
}
}
}
}
if (null != searchActiveSys && !searchActiveSys.equals(Constants.ACTIVESYS_A)) {// B版数据库才有found_time_partition字段,A版毛衣found_time_partition分区字段
if (null != foundTimePartStart) {
countSql.append(" and found_time_partition>=" + foundTimePartStart + "L");
}
if (null != foundTimePartEnd) {
countSql.append(" and found_time_partition<" + foundTimePartEnd + "L");
}
}
}
}
logger.info("获取数据中心日志总条数sql==================" + countSql.toString());
ResultSet countRs = HiveJDBC.query(countSql.toString(), searchActiveSys);
String countStr = null;
while (countRs.next()) {
countStr = countRs.getObject(1).toString();
break;
}
if (countStr == null || countStr.equals("")) {
logger.info("获取数据中心日志总条数成功总共===================0条配置");
return 0l;
}
Long count = Long.valueOf(countStr);
logger.info("获取数据中心日志总条数成功总共===================" + count + "条配置");
HiveJDBC.closeConn();
return count;
}
public static String getFiledsSql(String mapName, String fileds) throws Exception {
String[] fieldsColoumn = null;
String orderByStr = "";
// 所有字段名
List<String> columnList = new ArrayList<String>();
// 所有属性名
List<String> propertyList = new ArrayList<String>();
// 属性名称为key字段名称为value
Map<String, String> columnMap = new HashMap<String, String>();
if (!StringUtil.isBlank(fileds)) {
// 解析Fileds的字段/属性名称
fieldsColoumn = fileds.split(",");
// 从resultMap中获取字段名称和属性名称
if (fieldsColoumn != null) {
SqlSessionFactory sqlSessionFactory = SpringContextHolder.getBean(SqlSessionFactory.class);
ResultMap map = sqlSessionFactory.getConfiguration().getResultMap(mapName + "Map");
List<ResultMapping> mapping = map.getResultMappings();
for (ResultMapping mapp : mapping) {
columnList.add(mapp.getColumn().toLowerCase());
propertyList.add(mapp.getProperty());
columnMap.put(mapp.getProperty(), mapp.getColumn());
}
}
if (fieldsColoumn != null) {
fileds = "";
for (String column : fieldsColoumn) {
if (!StringUtil.isBlank(column)) {
column = column.trim();
if (columnList.contains(column)) {
fileds += "," + column;
} else if (propertyList.contains(column)) {
fileds += "," + columnMap.get(column).toString();
}
}
}
if (!StringUtil.isBlank(fileds)) {
fileds = fileds.substring(1);
}
}
}
return fileds;
}
public static Map<String, String> getFiledAndColumnMap(Class clazz) {
Map<String, String> map = new HashMap<String, String>();
SqlSessionFactory sqlSessionFactory = SpringContextHolder.getBean(SqlSessionFactory.class);
ResultMap resultMap = sqlSessionFactory.getConfiguration().getResultMap(clazz.getSimpleName() + "Map");
List<ResultMapping> mapping = resultMap.getResultMappings();
for (ResultMapping mapp : mapping) {
map.put(mapp.getProperty(), mapp.getColumn().toLowerCase());
}
return map;
}
/**
* 利用反射通过get方法获取bean中字段fieldName的值
*
* @param bean
* @param fieldName
* @return
* @throws Exception
*/
private static Object getFieldValue(Object bean, String fieldName) throws Exception {
StringBuffer result = new StringBuffer();
String methodName = result.append("get").append(fieldName.substring(0, 1).toUpperCase())
.append(fieldName.substring(1)).toString();
Object rObject = null;
Method method = null;
@SuppressWarnings("rawtypes")
Class[] classArr = new Class[0];
method = bean.getClass().getMethod(methodName, classArr);
rObject = method.invoke(bean, new Object[0]);
return rObject;
}
/**
* 利用发射调用bean.set方法将value设置到字段
*
* @param bean
* @param fieldName
* @param value
* @throws Exception
*/
private static void setFieldValue(Object bean, String fieldName, Object value) throws Exception {
StringBuffer result = new StringBuffer();
String methodName = result.append("set").append(fieldName.substring(0, 1).toUpperCase())
.append(fieldName.substring(1)).toString();
/**
* 利用发射调用bean.set方法将value设置到字段
*/
Class[] classArr = new Class[1];
classArr[0] = "java.lang.String".getClass();
Method method = bean.getClass().getMethod(methodName, classArr);
method.invoke(bean, value);
}
/**
* 比较开始时间或者结束时间是否比当前系统时间早48小时
*
* @param startTime
* 开始时间
* @param endTime
* 结束时间
* @return
* @throws ParseException
*/
public static boolean ifTimeGreaterThan48(String startTime, String endTime) throws Exception {
logger.info("ifTimeGreaterThan48方法开始" + System.currentTimeMillis());
if (null != startTime && !startTime.equals("") && null != endTime && !endTime.equals("")) {// 开始和结束时间都不为空
Date startDate = sdf.parse(startTime);
Date endDate = sdf.parse(endTime);
if (startDate.getTime() < endDate.getTime()) {// 开始时间比结束时间早
logger.info("ifTimeGreaterThan48方法结束" + System.currentTimeMillis());
return gt48(endTime);
} else {// 开始时间比结束时间晚,不符合一般情况
logger.info("ifTimeGreaterThan48方法结束" + System.currentTimeMillis());
return false;
}
} else if (null != endTime && !endTime.equals("")) {// 开始时间为空,结束时间不为空
logger.info("ifTimeGreaterThan48方法结束" + System.currentTimeMillis());
return gt48(endTime);
} else if (null != startTime && !startTime.equals("")) {// 结束时间为空,开始时间不为空
logger.info("ifTimeGreaterThan48方法结束" + System.currentTimeMillis());
return gt48(startTime);
} else {// 开始和结束时间都为空
logger.info("ifTimeGreaterThan48方法结束" + System.currentTimeMillis());
return false;
}
}
public static boolean gt48(String eqTime) throws ParseException {
logger.info("gt48方法开始" + System.currentTimeMillis());
Date eqDate = sdf.parse(eqTime);
Long dateNum = eqDate.getTime();
Long currentDate = new Date().getTime();
Long time = 0l;
if (dateNum < currentDate) {
time = currentDate - dateNum;// 获取结束时间与当前系统时间的时间差毫秒数
} else {
logger.info("gt48方法结束" + System.currentTimeMillis());
return false;// 结束时间比当前系统时间晚,不符合从数据中心查询数据要求(当前日期48小时前数据从数据中心查询)
}
double hours = time.doubleValue() / (1000 * 60 * 60);
Long datacenterTime = Constants.DATACENTER_TIME;
double doubleValue = datacenterTime.doubleValue();
if (hours > doubleValue) {
logger.info("gt48方法结束" + System.currentTimeMillis());
return true;// 符合要求
} else {
logger.info("gt48方法结束" + System.currentTimeMillis());
return false;
}
}
public static void main(String[] args) {
Long datacenterTime = Constants.DATACENTER_TIME;
double doubleValue = datacenterTime.doubleValue();
System.out.println(doubleValue);
}
}

View File

@@ -0,0 +1,27 @@
package com.nis.web.service;
import org.springframework.stereotype.Service;
import com.nis.domain.Page;
import com.nis.domain.SysLog;
import com.nis.util.DateUtils;
import com.nis.web.dao.SysLogDao;
@Service
public class LogService extends CrudService<SysLogDao, SysLog> {
public Page<SysLog> findPage(Page<SysLog> page, SysLog sysLog) {
// 设置默认时间范围,默认当前月
if (sysLog.getBeginDate() == null){
sysLog.setBeginDate(DateUtils.setDays(DateUtils.parseDate(DateUtils.getDate()), 1));
}
if (sysLog.getEndDate() == null){
sysLog.setEndDate(DateUtils.addMonths(sysLog.getBeginDate(), 1));
}
return super.findPage(page, sysLog);
}
}

View File

@@ -0,0 +1,97 @@
package com.nis.web.service;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.SysMenu;
import com.nis.domain.SysUser;
import com.nis.util.CacheUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.dao.SysMenuDao;
import com.nis.web.security.UserUtils;
@Service
public class MenuService extends BaseService {
@Autowired
private SysMenuDao menuDao;
public List<SysMenu> findAllMenu() {
return UserUtils.getMenuList();
}
public SysMenu getMenu(Long id) {
return menuDao.get(id);
}
public void saveOrUpdateMenu(SysMenu menu) {
// 获取父节点实体
menu.setParent(this.getMenu(menu.getParent().getId()));
// 获取修改前的parentIds用于更新子节点的parentIds
String oldParentIds = menu.getParentIds();
// 设置新的父节点串
menu.setParentIds(menu.getParent().getParentIds()+menu.getParent().getId()+",");
SysUser user = UserUtils.getUser();
// 保存或更新实体
if (StringUtil.isEmpty(menu.getId())){
menu.setUpdateBy(user);
menu.setCreateBy(user);
menu.setCreateDate(new Date());
menu.setUpdateDate(menu.getCreateDate());
menu.setDelFlag(1);
menuDao.insert(menu);
}else{
menu.setUpdateBy(user);
menu.setUpdateDate(new Date());
menuDao.update(menu);
}
// 更新子节点 parentIds
SysMenu m = new SysMenu();
m.setParentIds("%,"+menu.getId()+",%");
List<SysMenu> list = menuDao.findByParentIdsLike(m);
for (SysMenu e : list){
e.setParentIds(e.getParentIds().replace(oldParentIds, menu.getParentIds()));
menuDao.updateParentIds(e);
}
// 清除用户菜单缓存
UserUtils.removeCache(UserUtils.CACHE_MENU_LIST);
// // 清除权限缓存
// systemRealm.clearAllCachedAuthorizationInfo();
// 清除日志相关缓存
CacheUtils.remove(LogUtils.CACHE_MENU_NAME_PATH_MAP);
}
public void deleteMenu(SysMenu menu) {
menuDao.delete(menu);
// 清除用户菜单缓存
UserUtils.removeCache(UserUtils.CACHE_MENU_LIST);
// // 清除权限缓存
// systemRealm.clearAllCachedAuthorizationInfo();
// 清除日志相关缓存
CacheUtils.remove(LogUtils.CACHE_MENU_NAME_PATH_MAP);
}
public void updateMenuSort(SysMenu menu) {
menuDao.updateSort(menu);
// 清除用户菜单缓存
UserUtils.removeCache(UserUtils.CACHE_MENU_LIST);
// // 清除权限缓存
// systemRealm.clearAllCachedAuthorizationInfo();
// 清除日志相关缓存
CacheUtils.remove(LogUtils.CACHE_MENU_NAME_PATH_MAP);
}
}

View File

@@ -0,0 +1,108 @@
package com.nis.web.service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.nis.domain.SysOffice;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.web.dao.SysOfficeDao;
import com.nis.web.security.UserUtils;
@Service
public class OfficeService extends TreeService<SysOfficeDao, SysOffice>{
public List<SysOffice> findAll() {
return UserUtils.getOfficeList();
}
public List<SysOffice> findList(Boolean isAll){
if (isAll != null && isAll){
return UserUtils.getOfficeAllList();
}else{
return UserUtils.getOfficeList();
}
}
public SysOffice selectByPrimaryKey(Integer id){
if(id != null){
return dao.selectByPrimaryKey(id);
}else{
return null;
}
}
public List<SysOffice> findAllOfficeList(SysOffice office){
//office.getSqlMap().put("dsf", dataScopeFilter(UserUtils.getUser(), "a", ""));
if (!StringUtil.isEmpty(office.getId()) && office.getId() != 1l) {
office.setParentIds(office.getParentIds()+office.getId()+","+"%");
} else {
office.setParentIds(office.getParentIds()+"%");
}
return dao.findByParentIdsLike(office);
}
public void saveOrUpdate(SysOffice office) {
if (StringUtil.isEmpty(office.getId())) {
office.setCreateTime(new Date());
office.setDelFlag(1);
}
this.save(office);
if(office.getChildDeptList() != null) {
SysOffice childOffice = null;
for(String id : office.getChildDeptList()){
childOffice = new SysOffice();
childOffice.setName(DictUtils.getDictLabel("SYS_OFFICE_COMMON", id, "未知"));
childOffice.setParent(office);
childOffice.setArea(office.getArea());
childOffice.setType(2);
childOffice.setGrade(office.getGrade()+1);
childOffice.setUseable(1);
childOffice.setCreateTime(new Date());
childOffice.setDelFlag(1);
this.save(childOffice);
}
}
UserUtils.removeCache(UserUtils.CACHE_OFFICE_LIST);
}
public void delete(SysOffice office) {
super.delete(office);
UserUtils.removeCache(UserUtils.CACHE_OFFICE_LIST);
}
public List<SysOffice> selectOfficeForDeptment(Map map) {
List<SysOffice> sysOfficeList=dao.selectOfficeForDeptment(map);
return sysOfficeList;
}
public List<SysOffice> selectOfficeForLetter(Map<String, Object> hmap) {
List<SysOffice> sysOfficeList=dao.selectOfficeForLetter(hmap);
return sysOfficeList;
}
public List<SysOffice> selectLowerDeptement(Map<String, Object> hmap) {
List<SysOffice> sysOfficeList=dao.selectLowerDeptement(hmap);
return sysOfficeList;
}
public List<SysOffice> selectSysOffice(SysOffice sysOffice) {
return dao.selectSysOffice(sysOffice);
}
}

View File

@@ -0,0 +1,80 @@
package com.nis.web.service;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
import com.nis.util.StringUtil;
import com.nis.web.dao.SysRoleDao;
import com.nis.web.security.UserUtils;
@Service
public class RoleService extends BaseService {
@Autowired
private SysRoleDao roleDao;
public List<SysRole> findAllRole() {
return UserUtils.getRoleList();
}
public SysRole getRole(Long id) {
return roleDao.get(id);
}
public SysRole getRoleByName(String name) {
SysRole r = new SysRole();
r.setName(name);
return roleDao.getByName(r);
}
public void saveOrUpdate(SysRole role) {
if (StringUtil.isEmpty(role.getId())){
role.setCreateTime(new Date());
role.setStatus(1);
roleDao.insert(role);
// 同步到Activiti
//saveActivitiGroup(role);
}else{
roleDao.update(role);
// 更新角色与菜单关联
roleDao.deleteRoleMenu(role);
}
if (role.getMenuList().size() > 0){
roleDao.insertRoleMenu(role);
}
// 同步到Activiti
//saveActivitiGroup(role);
// 清除用户角色缓存
UserUtils.removeCache(UserUtils.CACHE_ROLE_LIST);
List<SysUser> userList = roleDao.findUserByRole(role);
for (SysUser user : userList) {
UserUtils.clearCache(user);
}
// // 清除权限缓存
// systemRealm.clearAllCachedAuthorizationInfo();
}
public void deleteRole(SysRole role) {
roleDao.delete(role);
// 同步到Activiti
//deleteActivitiGroup(role);
// 清除用户角色缓存
//UserUtils.removeCache(UserUtils.CACHE_ROLE_LIST);
UserUtils.clearCache();
// // 清除权限缓存
// systemRealm.clearAllCachedAuthorizationInfo();
}
}

View File

@@ -0,0 +1,88 @@
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.nis.web.service;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
/**
* 以静态变量保存Spring ApplicationContext, 可在任何代码任何地方任何时候取出ApplicaitonContext.
*
* @author Zaric
* @date 2013-5-29 下午1:25:40
*/
@Service
@Lazy(false)
public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
private static ApplicationContext applicationContext = null;
private static Logger logger = LoggerFactory.getLogger(SpringContextHolder.class);
/**
* 取得存储在静态变量中的ApplicationContext.
*/
public static ApplicationContext getApplicationContext() {
assertContextInjected();
return applicationContext;
}
/**
* 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) {
assertContextInjected();
return (T) applicationContext.getBean(name);
}
/**
* 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
public static <T> T getBean(Class<T> requiredType) {
assertContextInjected();
return applicationContext.getBean(requiredType);
}
/**
* 清除SpringContextHolder中的ApplicationContext为Null.
*/
public static void clearHolder() {
if (logger.isDebugEnabled()){
logger.debug("清除SpringContextHolder中的ApplicationContext:" + applicationContext);
}
applicationContext = null;
}
/**
* 实现ApplicationContextAware接口, 注入Context到静态变量中.
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
SpringContextHolder.applicationContext = applicationContext;
}
/**
* 实现DisposableBean接口, 在Context关闭时清理静态变量.
*/
@Override
public void destroy() throws Exception {
SpringContextHolder.clearHolder();
}
/**
* 检查ApplicationContext不为空.
*/
private static void assertContextInjected() {
Validate.validState(applicationContext != null, "applicaitonContext属性未注入, 请在applicationContext.xml中定义SpringContextHolder.");
}
}

View File

@@ -0,0 +1,161 @@
package com.nis.web.service;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.impl.OMNamespaceImpl;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.rpc.client.RPCServiceClient;
import org.apache.commons.io.FileUtils;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.SrcIp;
import com.nis.domain.SysRole;
import com.nis.domain.SysUser;
import com.nis.util.Configurations;
import com.nis.util.DateUtils;
import com.nis.util.IpUtil;
import com.nis.util.StringUtil;
import com.nis.util.TimeConstants;
import com.nis.web.dao.SrcIpDao;
import com.nis.web.dao.SysOfficeDao;
import com.nis.web.dao.UserDao;
import com.nis.web.security.Servlets;
import com.nis.web.security.SessionDAO;
import com.nis.web.security.UserUtils;
@Service
public class SystemService extends BaseService{
@Autowired
private SessionDAO sessionDao;
@Autowired
private UserDao userDao;
@Autowired
private SysOfficeDao sysOfficeDao;
@Autowired
private SrcIpDao srcIpDao;
public Collection<Session> getActiveSessions(boolean includeLeave) {
return sessionDao.getActiveSessions(includeLeave);
}
public Collection<Session> getActiveSessions(boolean includeLeave, Object principal, Session filterSession) {
return sessionDao.getActiveSessions(includeLeave, principal, filterSession);
}
public void deleteSession(Session session) {
sessionDao.delete(session);
}
public SysUser getUserByLoginName(String loginName) {
return UserUtils.getByLoginName(loginName);
}
public List<SrcIp> ipLookUp(String ip) {
return srcIpDao.getIpInfo(IpUtil.getIpHostDesimal(ip));
}
public SysUser assignUserToRole(SysRole role, SysUser user) {
if (user == null){
return null;
}
List<Long> roleIds = user.getRoleIdList();
if (roleIds.contains(role.getId())) {
return null;
}
user.getUserRoleList().clear();
user.getUserRoleList().add(role);
userDao.insertUserRole(user);
UserUtils.clearCache(user);
return user;
}
public Boolean outUserInRole(SysRole role, SysUser user) {
List<SysRole> roles = user.getUserRoleList();
for (SysRole e : roles){
if (e.getId().equals(role.getId())){
roles.remove(e);
userDao.removeUserInRole(user.getId(),role.getId());
return true;
}
}
return false;
}
public boolean officeIsValid(Long officeId, Long companyId) {
return userDao.officeIsExistOfCompany(officeId, companyId) >0 ? true : false;
}
/**
* 结果信息存入文件
* @param result
* @throws IOException
*/
private void saveToFile(String prefixName, String result) throws IOException{
String flieName = prefixName + DateUtils.formatDate(new Date(), TimeConstants.YYYYMMDDHH24MMSS);
String filePath = Servlets.getRequest().getServletContext().getRealPath(Configurations.getStringProperty("userfiles.basedir", "")) + File.separator
+ "upload" + File.separator + flieName + ".txt";
FileUtils.writeStringToFile(new File(filePath), result, false);
}
/**
* 新增设置header信息需要修改里面rid、sid对应的值、sid为服务唯一标识、 rid为请求者唯一标识
*/
private static OMElement setHeader(String ns, String rid, String sid) {
OMFactory fac = OMAbstractFactory.getOMFactory();
// OMNamespace指定此SOAP文档名称空间。
OMNamespaceImpl omNs = (OMNamespaceImpl) fac.createOMNamespace(ns, "ns1");
// 创建header元素并指定其在omNs指代的名称空间中,header名称固定为CyberpoliceSBReqHeader。
OMElement method = fac.createOMElement("CyberpoliceSBReqHeader", omNs);
// 指定元素的文本内容。
OMElement ridE = fac.createOMElement("rid", omNs);
// TODO将下面的值修改为请求者在系统中的唯一标识
ridE.setText(rid);
method.addChild(ridE);
OMElement sidE = fac.createOMElement("sid", omNs);
// TODO将下面的值修改要请求服务的唯一标识
sidE.setText(sid);
method.addChild(sidE);
OMElement timeoutE = fac.createOMElement("timeout", omNs);
// TODO将下面的值修改为请求的超时时间单位秒
timeoutE.setText(Configurations.getStringProperty("webservice.request.timeout", "60"));
method.addChild(timeoutE);
OMElement secE = fac.createOMElement("sec", omNs);
// TODO将下面的值修改为请求密码如果使用其他加密方式则根据要求统一修改即可
secE.setText("");
method.addChild(secE);
return method;
}
}

View File

@@ -0,0 +1,81 @@
package com.nis.web.service;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.TreeEntity;
import com.nis.exceptions.ServiceException;
import com.nis.util.Reflections;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.dao.TreeDao;
/**
* Service基类
* @author ThinkGem
* @version 2014-05-16
*/
public abstract class TreeService<D extends TreeDao<T>, T extends TreeEntity<T>> extends CrudService<D, T> {
public void save(T entity) {
@SuppressWarnings("unchecked")
Class<T> entityClass = Reflections.getClassGenricType(getClass(), 1);
// 如果没有设置父节点,则代表为跟节点,有则获取父节点实体
if (entity.getParent() == null || StringUtil.isEmpty(entity.getParentId())
|| "0".equals(entity.getParentId())){
entity.setParent(null);
}else{
entity.setParent(super.get(entity.getParentId()));
}
if (entity.getParent() == null){
T parentEntity = null;
try {
parentEntity = entityClass.getConstructor(Long.class).newInstance(0l);
} catch (Exception e) {
throw new ServiceException(e);
}
entity.setParent(parentEntity);
entity.getParent().setParentIds(StringUtils.EMPTY);
}
// 获取修改前的parentIds用于更新子节点的parentIds
String oldParentIds = entity.getParentIds();
// 设置新的父节点串
entity.setParentIds(entity.getParent().getParentIds()+entity.getParent().getId()+",");
// 保存或更新实体
super.save(entity);
// 更新子节点 parentIds
T o = null;
try {
o = entityClass.newInstance();
} catch (Exception e) {
throw new ServiceException(e);
}
o.setParentIds("%,"+entity.getId()+",%");
List<T> list = dao.findByParentIdsLike(o);
for (T e : list){
if (e.getParentIds() != null && oldParentIds != null){
e.setParentIds(e.getParentIds().replace(oldParentIds, entity.getParentIds()));
preUpdateChild(entity, e);
dao.updateParentIds(e);
}
}
}
/**
* 预留接口,用户更新子节前调用
* @param childEntity
*/
protected void preUpdateChild(T entity, T childEntity) {
}
}

View File

@@ -0,0 +1,162 @@
package com.nis.web.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.Page;
import com.nis.domain.SysUser;
import com.nis.exceptions.ServiceException;
import com.nis.util.CacheUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.dao.UserDao;
import com.nis.web.security.UserUtils;
@Service
public class UserService extends BaseService {
/**@Resource**/
@Autowired
private UserDao userDao;
/**
* 获取用户
* @param id
* @return
*/
public SysUser getUser(String id) {
return UserUtils.get(id);
}
public Page<SysUser> findUser(Page<SysUser> page, SysUser user) {
// 生成数据权限过滤条件dsf为dataScopeFilter的简写在xml中使用 ${sqlMap.dsf}调用权限SQL
user.getSqlMap().put("dsf", dataScopeFilter(user.getCurrentUser(), "o", "u"));
// 设置分页参数
user.setPage(page);
// 执行分页查询
page.setList(userDao.findList(user));
return page;
}
public SysUser getUserById(Long id) {
return userDao.getUserById(id);
}
public SysUser getUserByLoginName(String loginName) {
return userDao.getUserByLoginName(loginName);
}
public SysUser getUserByIdWithRelation(Long userId) {
return userDao.getUserWithRelation(new SysUser(userId, null));
}
public void saveOrUpdate(SysUser user) {
if (StringUtil.isEmpty(user.getId())) {
user.setCreateTime(new Date());
user.setStatus(1);
userDao.insert(user);
} else {
SysUser oldUser = userDao.getUserWithRelation(user);
// 清除原用户机构用户缓存
if (!StringUtil.isEmpty(oldUser.getOffice())) {
CacheUtils.remove(UserUtils.USER_CACHE, UserUtils.USER_CACHE_LIST_BY_OFFICE_ID_ + oldUser.getOffice().getId());
}
userDao.update(user);
userDao.deleteUserRole(user.getId());
//userDao.deleteUserOffice(user.getId());
}
/*if (!StringUtil.isEmpty(user.getOffice())) {
user.addOffice(user.getOffice());
userDao.insertUserOffice(user);
}else {
throw new ServiceException(user.getLoginId() + "没有设置部门!");
}*/
if (!StringUtil.isEmpty(user.getUserRoleList())) {
userDao.insertUserRole(user);
} else {
throw new ServiceException(user.getLoginId() + "没有设置角色!");
}
// 将当前用户同步到Activiti
//saveActivitiUser(user);
UserUtils.clearCache(user);
// 清除权限缓存
//systemRealm.clearAllCachedAuthorizationInfo();
}
public void deleteUser(SysUser user) {
userDao.delete(user);
// 同步到Activiti
//deleteActivitiUser(user);
// 清除用户缓存
UserUtils.clearCache(user);
// // 清除权限缓存
// systemRealm.clearAllCachedAuthorizationInfo();
}
public void updatePasswordById(Long id, String loginId, String newPassword) {
SysUser user = new SysUser(id,loginId);
user.setPassword(StringUtils.entryptPassword(newPassword));
userDao.updatePasswordById(user);
UserUtils.clearCache(user);
// // 清除权限缓存
// systemRealm.clearAllCachedAuthorizationInfo();
}
public List<SysUser> findUserByRoleId(Long id) {
return userDao.findUserByRoleId(id);
}
public List<SysUser> findUserByOfficeId(Long id) {
return userDao.findUserByOfficeId(id);
}
public void updateUserInfo(SysUser user) {
userDao.updateUserInfo(user);
// 清除用户缓存
UserUtils.clearCache(user);
// // 清除权限缓存
// systemRealm.clearAllCachedAuthorizationInfo();
}
public List<Map> findDeptLeader(Integer DeptementId){
return userDao.findDeptLeader(DeptementId);
}
}

Some files were not shown because too many files have changed in this diff Show More