This commit is contained in:
parent
64bac10fe7
commit
181af797d8
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.google.code.kaptcha.Producer;
|
import com.google.code.kaptcha.Producer;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.redis.RedisCache;
|
import com.hchyun.common.core.redis.RedisCache;
|
||||||
import com.hchyun.common.utils.sign.Base64;
|
import com.hchyun.common.utils.sign.Base64;
|
||||||
import com.hchyun.common.utils.uuid.IdUtils;
|
import com.hchyun.common.utils.uuid.IdUtils;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.hchyun.common.config.HchYunConfig;
|
import com.hchyun.common.config.HchYunConfig;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.common.utils.file.FileUploadUtils;
|
import com.hchyun.common.utils.file.FileUploadUtils;
|
||||||
import com.hchyun.common.utils.file.FileUtils;
|
import com.hchyun.common.utils.file.FileUtils;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.framework.web.domain.Server;
|
import com.hchyun.framework.web.domain.Server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.poi.ExcelUtil;
|
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.poi.ExcelUtil;
|
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.core.redis.RedisCache;
|
import com.hchyun.common.core.redis.RedisCache;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.controller.HcyBaseController;
|
import com.hchyun.common.core.controller.HcyBaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.system.entity.Regular;
|
import com.hchyun.system.entity.Regular;
|
||||||
import com.hchyun.system.service.RegularService;
|
import com.hchyun.system.service.RegularService;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.annotation.RepeatSubmit;
|
import com.hchyun.common.annotation.RepeatSubmit;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.entity.SysDept;
|
import com.hchyun.common.core.entity.entity.SysDept;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictData;
|
import com.hchyun.common.core.entity.entity.SysDictData;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictType;
|
import com.hchyun.common.core.entity.entity.SysDictType;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.entity.SysMenu;
|
import com.hchyun.common.core.entity.entity.SysMenu;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
import com.hchyun.common.core.domain.model.LoginBody;
|
import com.hchyun.common.core.entity.model.LoginBody;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
import com.hchyun.framework.web.service.SysLoginService;
|
import com.hchyun.framework.web.service.SysLoginService;
|
||||||
import com.hchyun.framework.web.service.SysPermissionService;
|
import com.hchyun.framework.web.service.SysPermissionService;
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.entity.SysMenu;
|
import com.hchyun.common.core.entity.entity.SysMenu;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.config.HchYunConfig;
|
import com.hchyun.common.config.HchYunConfig;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.InitBinder;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.hchyun.common.constant.HttpStatus;
|
import com.hchyun.common.constant.HttpStatus;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.PageDomain;
|
import com.hchyun.common.core.page.PageDomain;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.core.page.TableSupport;
|
import com.hchyun.common.core.page.TableSupport;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.hchyun.common.core.controller;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.hchyun.common.constant.HttpStatus;
|
import com.hchyun.common.constant.HttpStatus;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.PageDomain;
|
import com.hchyun.common.core.page.PageDomain;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.core.page.TableSupport;
|
import com.hchyun.common.core.page.TableSupport;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain;
|
package com.hchyun.common.core.entity;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import com.hchyun.common.constant.HttpStatus;
|
import com.hchyun.common.constant.HttpStatus;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain;
|
package com.hchyun.common.core.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain;
|
package com.hchyun.common.core.entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package com.hchyun.common.core.domain;
|
package com.hchyun.common.core.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.hchyun.common.core.domain.entity.SysDept;
|
import com.hchyun.common.core.entity.entity.SysDept;
|
||||||
import com.hchyun.common.core.domain.entity.SysMenu;
|
import com.hchyun.common.core.entity.entity.SysMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Treeselect树结构实体类
|
* Treeselect树结构实体类
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain.entity;
|
package com.hchyun.common.core.entity.entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -7,7 +7,7 @@ import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表 sys_dept
|
* 部门表 sys_dept
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain.entity;
|
package com.hchyun.common.core.entity.entity;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
@ -7,7 +7,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典数据表 sys_dict_data
|
* 字典数据表 sys_dict_data
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain.entity;
|
package com.hchyun.common.core.entity.entity;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
@ -6,7 +6,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典类型表 sys_dict_type
|
* 字典类型表 sys_dict_type
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain.entity;
|
package com.hchyun.common.core.entity.entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -7,7 +7,7 @@ import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单权限表 sys_menu
|
* 菜单权限表 sys_menu
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain.entity;
|
package com.hchyun.common.core.entity.entity;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
@ -6,7 +6,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色表 sys_role
|
* 角色表 sys_role
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain.entity;
|
package com.hchyun.common.core.entity.entity;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -13,7 +13,7 @@ import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.annotation.Excel.Type;
|
import com.hchyun.common.annotation.Excel.Type;
|
||||||
import com.hchyun.common.annotation.Excels;
|
import com.hchyun.common.annotation.Excels;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户对象 sys_user
|
* 用户对象 sys_user
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.hchyun.common.core.domain.model;
|
package com.hchyun.common.core.entity.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录对象
|
* 用户登录对象
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package com.hchyun.common.core.domain.model;
|
package com.hchyun.common.core.entity.model;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录用户身份权限
|
* 登录用户身份权限
|
||||||
|
|
@ -4,15 +4,15 @@ import java.lang.management.ManagementFactory;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时间工具类
|
* 时间工具类
|
||||||
*
|
*
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
*/
|
*/
|
||||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
{
|
|
||||||
public static String YYYY = "yyyy";
|
public static String YYYY = "yyyy";
|
||||||
|
|
||||||
public static String YYYY_MM = "yyyy-MM";
|
public static String YYYY_MM = "yyyy-MM";
|
||||||
|
|
@ -22,65 +22,55 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||||
|
|
||||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
private static String[] parsePatterns = {
|
private static String[] parsePatterns = {
|
||||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
"yyyy-MM-dd" , "yyyy-MM-dd HH:mm:ss" , "yyyy-MM-dd HH:mm" , "yyyy-MM" ,
|
||||||
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
"yyyy/MM/dd" , "yyyy/MM/dd HH:mm:ss" , "yyyy/MM/dd HH:mm" , "yyyy/MM" ,
|
||||||
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
"yyyy.MM.dd" , "yyyy.MM.dd HH:mm:ss" , "yyyy.MM.dd HH:mm" , "yyyy.MM"};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前Date型日期
|
* 获取当前Date型日期
|
||||||
*
|
*
|
||||||
* @return Date() 当前日期
|
* @return Date() 当前日期
|
||||||
*/
|
*/
|
||||||
public static Date getNowDate()
|
public static Date getNowDate() {
|
||||||
{
|
|
||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前日期, 默认格式为yyyy-MM-dd
|
* 获取当前日期, 默认格式为yyyy-MM-dd
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static String getDate()
|
public static String getDate() {
|
||||||
{
|
|
||||||
return dateTimeNow(YYYY_MM_DD);
|
return dateTimeNow(YYYY_MM_DD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String getTime()
|
|
||||||
{
|
public static final String getTime() {
|
||||||
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String dateTimeNow()
|
public static final String dateTimeNow() {
|
||||||
{
|
|
||||||
return dateTimeNow(YYYYMMDDHHMMSS);
|
return dateTimeNow(YYYYMMDDHHMMSS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String dateTimeNow(final String format)
|
public static final String dateTimeNow(final String format) {
|
||||||
{
|
|
||||||
return parseDateToStr(format, new Date());
|
return parseDateToStr(format, new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String dateTime(final Date date)
|
public static final String dateTime(final Date date) {
|
||||||
{
|
|
||||||
return parseDateToStr(YYYY_MM_DD, date);
|
return parseDateToStr(YYYY_MM_DD, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String parseDateToStr(final String format, final Date date)
|
public static final String parseDateToStr(final String format, final Date date) {
|
||||||
{
|
|
||||||
return new SimpleDateFormat(format).format(date);
|
return new SimpleDateFormat(format).format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Date dateTime(final String format, final String ts)
|
public static final Date dateTime(final String format, final String ts) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return new SimpleDateFormat(format).parse(ts);
|
return new SimpleDateFormat(format).parse(ts);
|
||||||
}
|
} catch (ParseException e) {
|
||||||
catch (ParseException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -88,8 +78,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 日期路径 即年/月/日 如2018/08/08
|
* 日期路径 即年/月/日 如2018/08/08
|
||||||
*/
|
*/
|
||||||
public static final String datePath()
|
public static final String datePath() {
|
||||||
{
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
||||||
}
|
}
|
||||||
|
|
@ -97,8 +86,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 日期路径 即年/月/日 如20180808
|
* 日期路径 即年/月/日 如20180808
|
||||||
*/
|
*/
|
||||||
public static final String dateTime()
|
public static final String dateTime() {
|
||||||
{
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
return DateFormatUtils.format(now, "yyyyMMdd");
|
return DateFormatUtils.format(now, "yyyyMMdd");
|
||||||
}
|
}
|
||||||
|
|
@ -106,27 +94,21 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 日期型字符串转化为日期 格式
|
* 日期型字符串转化为日期 格式
|
||||||
*/
|
*/
|
||||||
public static Date parseDate(Object str)
|
public static Date parseDate(Object str) {
|
||||||
{
|
if (str == null) {
|
||||||
if (str == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return parseDate(str.toString(), parsePatterns);
|
return parseDate(str.toString(), parsePatterns);
|
||||||
}
|
} catch (ParseException e) {
|
||||||
catch (ParseException e)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取服务器启动时间
|
* 获取服务器启动时间
|
||||||
*/
|
*/
|
||||||
public static Date getServerStartDate()
|
public static Date getServerStartDate() {
|
||||||
{
|
|
||||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||||
return new Date(time);
|
return new Date(time);
|
||||||
}
|
}
|
||||||
|
|
@ -134,8 +116,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
/**
|
/**
|
||||||
* 计算两个时间差
|
* 计算两个时间差
|
||||||
*/
|
*/
|
||||||
public static String getDatePoor(Date endDate, Date nowDate)
|
public static String getDatePoor(Date endDate, Date nowDate) {
|
||||||
{
|
|
||||||
long nd = 1000 * 24 * 60 * 60;
|
long nd = 1000 * 24 * 60 * 60;
|
||||||
long nh = 1000 * 60 * 60;
|
long nh = 1000 * 60 * 60;
|
||||||
long nm = 1000 * 60;
|
long nm = 1000 * 60;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.hchyun.common.utils;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictData;
|
import com.hchyun.common.core.entity.entity.SysDictData;
|
||||||
import com.hchyun.common.core.redis.RedisCache;
|
import com.hchyun.common.core.redis.RedisCache;
|
||||||
import com.hchyun.common.utils.spring.SpringUtils;
|
import com.hchyun.common.utils.spring.SpringUtils;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import com.hchyun.common.constant.HttpStatus;
|
import com.hchyun.common.constant.HttpStatus;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.exception.CustomException;
|
import com.hchyun.common.exception.CustomException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.annotation.Excel.Type;
|
import com.hchyun.common.annotation.Excel.Type;
|
||||||
import com.hchyun.common.annotation.Excels;
|
import com.hchyun.common.annotation.Excels;
|
||||||
import com.hchyun.common.config.HchYunConfig;
|
import com.hchyun.common.config.HchYunConfig;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.text.Convert;
|
import com.hchyun.common.core.text.Convert;
|
||||||
import com.hchyun.common.exception.CustomException;
|
import com.hchyun.common.exception.CustomException;
|
||||||
import com.hchyun.common.utils.DateUtils;
|
import com.hchyun.common.utils.DateUtils;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.hchyun.common.annotation.DataScope;
|
import com.hchyun.common.annotation.DataScope;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.common.utils.spring.SpringUtils;
|
import com.hchyun.common.utils.spring.SpringUtils;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.servlet.HandlerMapping;
|
import org.springframework.web.servlet.HandlerMapping;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.enums.BusinessStatus;
|
import com.hchyun.common.enums.BusinessStatus;
|
||||||
import com.hchyun.common.enums.HttpMethod;
|
import com.hchyun.common.enums.HttpMethod;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hchyun.common.annotation.RepeatSubmit;
|
import com.hchyun.common.annotation.RepeatSubmit;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.framework.web.service.TokenService;
|
import com.hchyun.framework.web.service.TokenService;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.hchyun.common.constant.HttpStatus;
|
import com.hchyun.common.constant.HttpStatus;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ import org.springframework.security.web.authentication.logout.LogoutSuccessHandl
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.constant.HttpStatus;
|
import com.hchyun.common.constant.HttpStatus;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.framework.dao.AsyncDao;
|
import com.hchyun.framework.dao.AsyncDao;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||||
import com.hchyun.common.constant.HttpStatus;
|
import com.hchyun.common.constant.HttpStatus;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.exception.BaseException;
|
import com.hchyun.common.exception.BaseException;
|
||||||
import com.hchyun.common.exception.CustomException;
|
import com.hchyun.common.exception.CustomException;
|
||||||
import com.hchyun.common.exception.DemoModeException;
|
import com.hchyun.common.exception.DemoModeException;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import java.util.Set;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.core.redis.RedisCache;
|
import com.hchyun.common.core.redis.RedisCache;
|
||||||
import com.hchyun.common.exception.CustomException;
|
import com.hchyun.common.exception.CustomException;
|
||||||
import com.hchyun.common.exception.user.CaptchaException;
|
import com.hchyun.common.exception.user.CaptchaException;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
import com.hchyun.system.service.ISysMenuService;
|
import com.hchyun.system.service.ISysMenuService;
|
||||||
import com.hchyun.system.service.ISysRoleService;
|
import com.hchyun.system.service.ISysRoleService;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.hchyun.common.constant.Constants;
|
import com.hchyun.common.constant.Constants;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.core.redis.RedisCache;
|
import com.hchyun.common.core.redis.RedisCache;
|
||||||
import com.hchyun.common.utils.ServletUtils;
|
import com.hchyun.common.utils.ServletUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.enums.UserStatus;
|
import com.hchyun.common.enums.UserStatus;
|
||||||
import com.hchyun.common.exception.BaseException;
|
import com.hchyun.common.exception.BaseException;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|
@ -19,7 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.core.text.Convert;
|
import com.hchyun.common.core.text.Convert;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
|
|
@ -30,13 +31,12 @@ import com.hchyun.generator.service.IGenTableService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代码生成 操作处理
|
* 代码生成 操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/tool/gen")
|
@RequestMapping("/tool/gen")
|
||||||
public class GenController extends BaseController
|
public class GenController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGenTableService genTableService;
|
private IGenTableService genTableService;
|
||||||
|
|
||||||
|
|
@ -48,8 +48,7 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo genList(GenTable genTable)
|
public TableDataInfo genList(GenTable genTable) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<GenTable> list = genTableService.selectGenTableList(genTable);
|
List<GenTable> list = genTableService.selectGenTableList(genTable);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -60,15 +59,14 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:query')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:query')")
|
||||||
@GetMapping(value = "/{talbleId}")
|
@GetMapping(value = "/{talbleId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long talbleId)
|
public AjaxResult getInfo(@PathVariable Long talbleId) {
|
||||||
{
|
|
||||||
GenTable table = genTableService.selectGenTableById(talbleId);
|
GenTable table = genTableService.selectGenTableById(talbleId);
|
||||||
List<GenTable> tables = genTableService.selectGenTableAll();
|
List<GenTable> tables = genTableService.selectGenTableAll();
|
||||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
|
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("info", table);
|
map.put("info" , table);
|
||||||
map.put("rows", list);
|
map.put("rows" , list);
|
||||||
map.put("tables", tables);
|
map.put("tables" , tables);
|
||||||
return AjaxResult.success(map);
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,8 +75,7 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
||||||
@GetMapping("/db/list")
|
@GetMapping("/db/list")
|
||||||
public TableDataInfo dataList(GenTable genTable)
|
public TableDataInfo dataList(GenTable genTable) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<GenTable> list = genTableService.selectDbTableList(genTable);
|
List<GenTable> list = genTableService.selectDbTableList(genTable);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -89,8 +86,7 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
||||||
@GetMapping(value = "/column/{talbleId}")
|
@GetMapping(value = "/column/{talbleId}")
|
||||||
public TableDataInfo columnList(Long tableId)
|
public TableDataInfo columnList(Long tableId) {
|
||||||
{
|
|
||||||
TableDataInfo dataInfo = new TableDataInfo();
|
TableDataInfo dataInfo = new TableDataInfo();
|
||||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
||||||
dataInfo.setRows(list);
|
dataInfo.setRows(list);
|
||||||
|
|
@ -102,10 +98,9 @@ public class GenController extends BaseController
|
||||||
* 导入表结构(保存)
|
* 导入表结构(保存)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
@Log(title = "代码生成" , businessType = BusinessType.IMPORT)
|
||||||
@PostMapping("/importTable")
|
@PostMapping("/importTable")
|
||||||
public AjaxResult importTableSave(String tables)
|
public AjaxResult importTableSave(String tables) {
|
||||||
{
|
|
||||||
String[] tableNames = Convert.toStrArray(tables);
|
String[] tableNames = Convert.toStrArray(tables);
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
||||||
|
|
@ -114,13 +109,13 @@ public class GenController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* todo
|
||||||
* 修改保存代码生成业务
|
* 修改保存代码生成业务
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
@Log(title = "代码生成" , businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
|
public AjaxResult editSave(@Validated @RequestBody GenTable genTable) {
|
||||||
{
|
|
||||||
genTableService.validateEdit(genTable);
|
genTableService.validateEdit(genTable);
|
||||||
genTableService.updateGenTable(genTable);
|
genTableService.updateGenTable(genTable);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
@ -130,10 +125,9 @@ public class GenController extends BaseController
|
||||||
* 删除代码生成
|
* 删除代码生成
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:remove')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:remove')")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.DELETE)
|
@Log(title = "代码生成" , businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{tableIds}")
|
@DeleteMapping("/{tableIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] tableIds)
|
public AjaxResult remove(@PathVariable Long[] tableIds) {
|
||||||
{
|
|
||||||
genTableService.deleteGenTableByIds(tableIds);
|
genTableService.deleteGenTableByIds(tableIds);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
@ -143,8 +137,7 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:preview')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:preview')")
|
||||||
@GetMapping("/preview/{tableId}")
|
@GetMapping("/preview/{tableId}")
|
||||||
public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
|
public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException {
|
||||||
{
|
|
||||||
Map<String, String> dataMap = genTableService.previewCode(tableId);
|
Map<String, String> dataMap = genTableService.previewCode(tableId);
|
||||||
return AjaxResult.success(dataMap);
|
return AjaxResult.success(dataMap);
|
||||||
}
|
}
|
||||||
|
|
@ -153,10 +146,9 @@ public class GenController extends BaseController
|
||||||
* 生成代码(下载方式)
|
* 生成代码(下载方式)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
@Log(title = "代码生成" , businessType = BusinessType.GENCODE)
|
||||||
@GetMapping("/download/{tableName}")
|
@GetMapping("/download/{tableName}")
|
||||||
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
|
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
|
||||||
{
|
|
||||||
byte[] data = genTableService.downloadCode(tableName);
|
byte[] data = genTableService.downloadCode(tableName);
|
||||||
genCode(response, data);
|
genCode(response, data);
|
||||||
}
|
}
|
||||||
|
|
@ -165,22 +157,24 @@ public class GenController extends BaseController
|
||||||
* 生成代码(自定义路径)
|
* 生成代码(自定义路径)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
@Log(title = "代码生成" , businessType = BusinessType.GENCODE)
|
||||||
@GetMapping("/genCode/{tableName}")
|
@GetMapping("/genCode/{tableName}")
|
||||||
public AjaxResult genCode(@PathVariable("tableName") String tableName)
|
public AjaxResult genCode(@PathVariable("tableName") String tableName) {
|
||||||
{
|
boolean start = genTableService.generatorCode(tableName);
|
||||||
genTableService.generatorCode(tableName);
|
if (start) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("模板渲染失败!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步数据库
|
* 同步数据库
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:edit')")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
@Log(title = "代码生成" , businessType = BusinessType.UPDATE)
|
||||||
@GetMapping("/synchDb/{tableName}")
|
@GetMapping("/synchDb/{tableName}")
|
||||||
public AjaxResult synchDb(@PathVariable("tableName") String tableName)
|
public AjaxResult synchDb(@PathVariable("tableName") String tableName) {
|
||||||
{
|
|
||||||
genTableService.synchDb(tableName);
|
genTableService.synchDb(tableName);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
@ -189,10 +183,9 @@ public class GenController extends BaseController
|
||||||
* 批量生成代码
|
* 批量生成代码
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
@PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
@Log(title = "代码生成" , businessType = BusinessType.GENCODE)
|
||||||
@GetMapping("/batchGenCode")
|
@GetMapping("/batchGenCode")
|
||||||
public void batchGenCode(HttpServletResponse response, String tables) throws IOException
|
public void batchGenCode(HttpServletResponse response, String tables) throws IOException {
|
||||||
{
|
|
||||||
String[] tableNames = Convert.toStrArray(tables);
|
String[] tableNames = Convert.toStrArray(tables);
|
||||||
byte[] data = genTableService.downloadCode(tableNames);
|
byte[] data = genTableService.downloadCode(tableNames);
|
||||||
genCode(response, data);
|
genCode(response, data);
|
||||||
|
|
@ -201,13 +194,12 @@ public class GenController extends BaseController
|
||||||
/**
|
/**
|
||||||
* 生成zip文件
|
* 生成zip文件
|
||||||
*/
|
*/
|
||||||
private void genCode(HttpServletResponse response, byte[] data) throws IOException
|
private void genCode(HttpServletResponse response, byte[] data) throws IOException {
|
||||||
{
|
|
||||||
response.reset();
|
response.reset();
|
||||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
response.addHeader("Access-Control-Allow-Origin" , "*");
|
||||||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
response.addHeader("Access-Control-Expose-Headers" , "Content-Disposition");
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
|
response.setHeader("Content-Disposition" , "attachment; filename=\"ruoyi.zip\"");
|
||||||
response.addHeader("Content-Length", "" + data.length);
|
response.addHeader("Content-Length" , "" + data.length);
|
||||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||||
IOUtils.write(data, response.getOutputStream());
|
IOUtils.write(data, response.getOutputStream());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import com.hchyun.generator.entity.GenTableColumn;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface GenTableColumnMapper
|
public interface GenTableColumnDao
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 根据表名称查询列信息
|
* 根据表名称查询列信息
|
||||||
|
|
@ -37,10 +37,10 @@ public interface GenTableColumnMapper
|
||||||
/**
|
/**
|
||||||
* 修改业务字段
|
* 修改业务字段
|
||||||
*
|
*
|
||||||
* @param genTableColumn 业务字段信息
|
* @param genTableColumns 业务字段信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateGenTableColumn(GenTableColumn genTableColumn);
|
public int updateGenTableColumn(List<GenTableColumn> genTableColumns);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除业务字段
|
* 删除业务字段
|
||||||
|
|
@ -2,13 +2,14 @@ package com.hchyun.generator.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.hchyun.generator.entity.GenTable;
|
import com.hchyun.generator.entity.GenTable;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务 数据层
|
* 业务 数据层
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface GenTableMapper
|
public interface GenTableDao
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询业务列表
|
* 查询业务列表
|
||||||
|
|
@ -80,4 +81,6 @@ public interface GenTableMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteGenTableByIds(Long[] ids);
|
public int deleteGenTableByIds(Long[] ids);
|
||||||
|
|
||||||
|
int insertMenu(@Param("paramSQL") String sql);
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import com.hchyun.common.constant.GenConstants;
|
import com.hchyun.common.constant.GenConstants;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.hchyun.generator.entity;
|
package com.hchyun.generator.entity;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -56,6 +56,12 @@ public class GenTableColumn extends BaseEntity
|
||||||
/** 是否查询字段(1是) */
|
/** 是否查询字段(1是) */
|
||||||
private String isQuery;
|
private String isQuery;
|
||||||
|
|
||||||
|
/** 是否正则(1否)*/
|
||||||
|
private Long isRegular;
|
||||||
|
|
||||||
|
/** 正则表达式内容 */
|
||||||
|
private String regular;
|
||||||
|
|
||||||
/** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */
|
/** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */
|
||||||
private String queryType;
|
private String queryType;
|
||||||
|
|
||||||
|
|
@ -68,6 +74,23 @@ public class GenTableColumn extends BaseEntity
|
||||||
/** 排序 */
|
/** 排序 */
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
public Long getIsRegular() {
|
||||||
|
return isRegular;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsRegular(Long isRegular) {
|
||||||
|
this.isRegular = isRegular;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegular() {
|
||||||
|
return regular;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegular(String regular) {
|
||||||
|
this.regular = regular;
|
||||||
|
}
|
||||||
|
|
||||||
public void setColumnId(Long columnId)
|
public void setColumnId(Long columnId)
|
||||||
{
|
{
|
||||||
this.columnId = columnId;
|
this.columnId = columnId;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
package com.hchyun.generator.service;
|
package com.hchyun.generator.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.hchyun.common.core.text.Convert;
|
import com.hchyun.common.core.text.Convert;
|
||||||
import com.hchyun.generator.entity.GenTableColumn;
|
import com.hchyun.generator.entity.GenTableColumn;
|
||||||
import com.hchyun.generator.dao.GenTableColumnMapper;
|
import com.hchyun.generator.dao.GenTableColumnDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务字段 服务层实现
|
* 业务字段 服务层实现
|
||||||
|
|
@ -16,7 +17,7 @@ import com.hchyun.generator.dao.GenTableColumnMapper;
|
||||||
public class GenTableColumnServiceImpl implements IGenTableColumnService
|
public class GenTableColumnServiceImpl implements IGenTableColumnService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private GenTableColumnMapper genTableColumnMapper;
|
private GenTableColumnDao genTableColumnDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询业务字段列表
|
* 查询业务字段列表
|
||||||
|
|
@ -27,7 +28,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
|
||||||
@Override
|
@Override
|
||||||
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId)
|
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId)
|
||||||
{
|
{
|
||||||
return genTableColumnMapper.selectGenTableColumnListByTableId(tableId);
|
return genTableColumnDao.selectGenTableColumnListByTableId(tableId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -39,7 +40,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
|
||||||
@Override
|
@Override
|
||||||
public int insertGenTableColumn(GenTableColumn genTableColumn)
|
public int insertGenTableColumn(GenTableColumn genTableColumn)
|
||||||
{
|
{
|
||||||
return genTableColumnMapper.insertGenTableColumn(genTableColumn);
|
return genTableColumnDao.insertGenTableColumn(genTableColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -51,7 +52,9 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
|
||||||
@Override
|
@Override
|
||||||
public int updateGenTableColumn(GenTableColumn genTableColumn)
|
public int updateGenTableColumn(GenTableColumn genTableColumn)
|
||||||
{
|
{
|
||||||
return genTableColumnMapper.updateGenTableColumn(genTableColumn);
|
List<GenTableColumn> genTableColumns = new ArrayList<GenTableColumn>();
|
||||||
|
genTableColumns.add(genTableColumn);
|
||||||
|
return genTableColumnDao.updateGenTableColumn(genTableColumns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -63,6 +66,6 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
|
||||||
@Override
|
@Override
|
||||||
public int deleteGenTableColumnByIds(String ids)
|
public int deleteGenTableColumnByIds(String ids)
|
||||||
{
|
{
|
||||||
return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
|
return genTableColumnDao.deleteGenTableColumnByIds(Convert.toLongArray(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.velocity.Template;
|
import org.apache.velocity.Template;
|
||||||
import org.apache.velocity.VelocityContext;
|
import org.apache.velocity.VelocityContext;
|
||||||
|
|
@ -30,172 +31,155 @@ import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.common.utils.file.FileUtils;
|
import com.hchyun.common.utils.file.FileUtils;
|
||||||
import com.hchyun.generator.entity.GenTable;
|
import com.hchyun.generator.entity.GenTable;
|
||||||
import com.hchyun.generator.entity.GenTableColumn;
|
import com.hchyun.generator.entity.GenTableColumn;
|
||||||
import com.hchyun.generator.dao.GenTableColumnMapper;
|
import com.hchyun.generator.dao.GenTableColumnDao;
|
||||||
import com.hchyun.generator.dao.GenTableMapper;
|
import com.hchyun.generator.dao.GenTableDao;
|
||||||
import com.hchyun.generator.util.GenUtils;
|
import com.hchyun.generator.util.GenUtils;
|
||||||
import com.hchyun.generator.util.VelocityInitializer;
|
import com.hchyun.generator.util.VelocityInitializer;
|
||||||
import com.hchyun.generator.util.VelocityUtils;
|
import com.hchyun.generator.util.VelocityUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务 服务层实现
|
* 业务 服务层实现
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class GenTableServiceImpl implements IGenTableService
|
public class GenTableServiceImpl implements IGenTableService {
|
||||||
{
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
|
private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GenTableMapper genTableMapper;
|
private GenTableDao genTableDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GenTableColumnMapper genTableColumnMapper;
|
private GenTableColumnDao genTableColumnDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询业务信息
|
* 查询业务信息
|
||||||
*
|
*
|
||||||
* @param id 业务ID
|
* @param id 业务ID
|
||||||
* @return 业务信息
|
* @return 业务信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GenTable selectGenTableById(Long id)
|
public GenTable selectGenTableById(Long id) {
|
||||||
{
|
GenTable genTable = genTableDao.selectGenTableById(id);
|
||||||
GenTable genTable = genTableMapper.selectGenTableById(id);
|
|
||||||
setTableFromOptions(genTable);
|
setTableFromOptions(genTable);
|
||||||
return genTable;
|
return genTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询业务列表
|
* 查询业务列表
|
||||||
*
|
*
|
||||||
* @param genTable 业务信息
|
* @param genTable 业务信息
|
||||||
* @return 业务集合
|
* @return 业务集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GenTable> selectGenTableList(GenTable genTable)
|
public List<GenTable> selectGenTableList(GenTable genTable) {
|
||||||
{
|
return genTableDao.selectGenTableList(genTable);
|
||||||
return genTableMapper.selectGenTableList(genTable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询据库列表
|
* 查询据库列表
|
||||||
*
|
*
|
||||||
* @param genTable 业务信息
|
* @param genTable 业务信息
|
||||||
* @return 数据库表集合
|
* @return 数据库表集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GenTable> selectDbTableList(GenTable genTable)
|
public List<GenTable> selectDbTableList(GenTable genTable) {
|
||||||
{
|
return genTableDao.selectDbTableList(genTable);
|
||||||
return genTableMapper.selectDbTableList(genTable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询据库列表
|
* 查询据库列表
|
||||||
*
|
*
|
||||||
* @param tableNames 表名称组
|
* @param tableNames 表名称组
|
||||||
* @return 数据库表集合
|
* @return 数据库表集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GenTable> selectDbTableListByNames(String[] tableNames)
|
public List<GenTable> selectDbTableListByNames(String[] tableNames) {
|
||||||
{
|
return genTableDao.selectDbTableListByNames(tableNames);
|
||||||
return genTableMapper.selectDbTableListByNames(tableNames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有表信息
|
* 查询所有表信息
|
||||||
*
|
*
|
||||||
* @return 表信息集合
|
* @return 表信息集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GenTable> selectGenTableAll()
|
public List<GenTable> selectGenTableAll() {
|
||||||
{
|
return genTableDao.selectGenTableAll();
|
||||||
return genTableMapper.selectGenTableAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改业务
|
* todo 修改业务
|
||||||
*
|
*
|
||||||
* @param genTable 业务信息
|
* @param genTable 业务信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateGenTable(GenTable genTable)
|
public void updateGenTable(GenTable genTable) {
|
||||||
{
|
|
||||||
String options = JSON.toJSONString(genTable.getParams());
|
String options = JSON.toJSONString(genTable.getParams());
|
||||||
genTable.setOptions(options);
|
genTable.setOptions(options);
|
||||||
int row = genTableMapper.updateGenTable(genTable);
|
int row = genTableDao.updateGenTable(genTable);
|
||||||
if (row > 0)
|
if (row > 0) {
|
||||||
{
|
// for (GenTableColumn cenTableColumn : genTable.getColumns())
|
||||||
for (GenTableColumn cenTableColumn : genTable.getColumns())
|
// {
|
||||||
{
|
genTableColumnDao.updateGenTableColumn(genTable.getColumns());
|
||||||
genTableColumnMapper.updateGenTableColumn(cenTableColumn);
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除业务对象
|
* 删除业务对象
|
||||||
*
|
*
|
||||||
* @param tableIds 需要删除的数据ID
|
* @param tableIds 需要删除的数据ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteGenTableByIds(Long[] tableIds)
|
public void deleteGenTableByIds(Long[] tableIds) {
|
||||||
{
|
genTableDao.deleteGenTableByIds(tableIds);
|
||||||
genTableMapper.deleteGenTableByIds(tableIds);
|
genTableColumnDao.deleteGenTableColumnByIds(tableIds);
|
||||||
genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入表结构
|
* 导入表结构
|
||||||
*
|
*
|
||||||
* @param tableList 导入表列表
|
* @param tableList 导入表列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void importGenTable(List<GenTable> tableList)
|
public void importGenTable(List<GenTable> tableList) {
|
||||||
{
|
|
||||||
Long operName = SecurityUtils.getUserId();
|
Long operName = SecurityUtils.getUserId();
|
||||||
try
|
try {
|
||||||
{
|
for (GenTable table : tableList) {
|
||||||
for (GenTable table : tableList)
|
|
||||||
{
|
|
||||||
String tableName = table.getTableName();
|
String tableName = table.getTableName();
|
||||||
GenUtils.initTable(table, operName);
|
GenUtils.initTable(table, operName);
|
||||||
int row = genTableMapper.insertGenTable(table);
|
int row = genTableDao.insertGenTable(table);
|
||||||
if (row > 0)
|
if (row > 0) {
|
||||||
{
|
|
||||||
// 保存列信息
|
// 保存列信息
|
||||||
List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
List<GenTableColumn> genTableColumns = genTableColumnDao.selectDbTableColumnsByName(tableName);
|
||||||
for (GenTableColumn column : genTableColumns)
|
for (GenTableColumn column : genTableColumns) {
|
||||||
{
|
|
||||||
GenUtils.initColumnField(column, table);
|
GenUtils.initColumnField(column, table);
|
||||||
genTableColumnMapper.insertGenTableColumn(column);
|
genTableColumnDao.insertGenTableColumn(column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new CustomException("导入失败:" + e.getMessage());
|
throw new CustomException("导入失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预览代码
|
* 预览代码
|
||||||
*
|
*
|
||||||
* @param tableId 表编号
|
* @param tableId 表编号
|
||||||
* @return 预览数据列表
|
* @return 预览数据列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> previewCode(Long tableId)
|
public Map<String, String> previewCode(Long tableId) {
|
||||||
{
|
|
||||||
Map<String, String> dataMap = new LinkedHashMap<>();
|
Map<String, String> dataMap = new LinkedHashMap<>();
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
GenTable table = genTableMapper.selectGenTableById(tableId);
|
GenTable table = genTableDao.selectGenTableById(tableId);
|
||||||
// 设置主子表信息
|
// 设置主子表信息
|
||||||
setSubTable(table);
|
setSubTable(table);
|
||||||
// 设置主键列信息
|
// 设置主键列信息
|
||||||
|
|
@ -206,9 +190,11 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||||
for (String template : templates)
|
for (String template : templates) {
|
||||||
{
|
|
||||||
// 渲染模板
|
// 渲染模板
|
||||||
|
if (template.equals("")){
|
||||||
|
|
||||||
|
}
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||||
tpl.merge(context, sw);
|
tpl.merge(context, sw);
|
||||||
|
|
@ -219,13 +205,12 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成代码(下载方式)
|
* 生成代码(下载方式)
|
||||||
*
|
*
|
||||||
* @param tableName 表名称
|
* @param tableName 表名称
|
||||||
* @return 数据
|
* @return 数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public byte[] downloadCode(String tableName)
|
public byte[] downloadCode(String tableName) {
|
||||||
{
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||||
generatorCode(tableName, zip);
|
generatorCode(tableName, zip);
|
||||||
|
|
@ -235,14 +220,14 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成代码(自定义路径)
|
* 生成代码(自定义路径)
|
||||||
*
|
*
|
||||||
* @param tableName 表名称
|
* @param tableName 表名称
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void generatorCode(String tableName)
|
public boolean generatorCode(String tableName) {
|
||||||
{
|
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
GenTable table = genTableDao.selectGenTableByName(tableName);
|
||||||
// 设置主子表信息
|
// 设置主子表信息
|
||||||
setSubTable(table);
|
setSubTable(table);
|
||||||
// 设置主键列信息
|
// 设置主键列信息
|
||||||
|
|
@ -254,88 +239,103 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||||
for (String template : templates)
|
for (String template : templates) {
|
||||||
{
|
if (!StringUtils.containsAny(template, "sql.vm" , "api.js.vm" , "index.vue.vm" , "index-tree.vue.vm")) {
|
||||||
if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm"))
|
|
||||||
{
|
|
||||||
// 渲染模板
|
// 渲染模板
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||||
tpl.merge(context, sw);
|
tpl.merge(context, sw);
|
||||||
try
|
if (template.equals("vm/sql/sql.vm")) {
|
||||||
{
|
Boolean start = insertMenuItem(sw);
|
||||||
String path = getGenPath(table, template);
|
if (start){
|
||||||
FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8);
|
return false;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
}else {
|
||||||
{
|
try {
|
||||||
throw new CustomException("渲染模板失败,表名:" + table.getTableName());
|
String path = getGenPath(table, template);
|
||||||
|
FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("渲染模板失败,表名:" + table.getTableName());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步数据库
|
* 同步数据库
|
||||||
*
|
*
|
||||||
* @param tableName 表名称
|
* @param tableName 表名称
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void synchDb(String tableName)
|
public void synchDb(String tableName) {
|
||||||
{
|
GenTable table = genTableDao.selectGenTableByName(tableName);
|
||||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
|
||||||
List<GenTableColumn> tableColumns = table.getColumns();
|
List<GenTableColumn> tableColumns = table.getColumns();
|
||||||
List<String> tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
List<String> tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
||||||
|
|
||||||
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
List<GenTableColumn> dbTableColumns = genTableColumnDao.selectDbTableColumnsByName(tableName);
|
||||||
if (StringUtils.isEmpty(dbTableColumns))
|
if (StringUtils.isEmpty(dbTableColumns)) {
|
||||||
{
|
|
||||||
throw new CustomException("同步数据失败,原表结构不存在");
|
throw new CustomException("同步数据失败,原表结构不存在");
|
||||||
}
|
}
|
||||||
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
||||||
|
|
||||||
dbTableColumns.forEach(column -> {
|
dbTableColumns.forEach(column -> {
|
||||||
if (!tableColumnNames.contains(column.getColumnName()))
|
if (!tableColumnNames.contains(column.getColumnName())) {
|
||||||
{
|
|
||||||
GenUtils.initColumnField(column, table);
|
GenUtils.initColumnField(column, table);
|
||||||
genTableColumnMapper.insertGenTableColumn(column);
|
genTableColumnDao.insertGenTableColumn(column);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
|
List<GenTableColumn> delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList());
|
||||||
if (StringUtils.isNotEmpty(delColumns))
|
if (StringUtils.isNotEmpty(delColumns)) {
|
||||||
{
|
genTableColumnDao.deleteGenTableColumns(delColumns);
|
||||||
genTableColumnMapper.deleteGenTableColumns(delColumns);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量生成代码(下载方式)
|
* 批量生成代码(下载方式)
|
||||||
*
|
*
|
||||||
* @param tableNames 表数组
|
* @param tableNames 表数组
|
||||||
* @return 数据
|
* @return 数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public byte[] downloadCode(String[] tableNames)
|
public byte[] downloadCode(String[] tableNames) {
|
||||||
{
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||||
for (String tableName : tableNames)
|
for (String tableName : tableNames) {
|
||||||
{
|
zip = generatorCode(tableName, zip);
|
||||||
generatorCode(tableName, zip);
|
if (zip==null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
IOUtils.closeQuietly(zip);
|
IOUtils.closeQuietly(zip);
|
||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
boolean insertMenuItem(StringWriter stringWriter){
|
||||||
|
try {
|
||||||
|
String sql = stringWriter.toString();
|
||||||
|
int start = genTableDao.insertMenu(sql);
|
||||||
|
if (start > 0){
|
||||||
|
return false;
|
||||||
|
}else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 查询表信息并生成代码
|
* todo 查询表信息并生成代码
|
||||||
*/
|
*/
|
||||||
private void generatorCode(String tableName, ZipOutputStream zip)
|
private ZipOutputStream generatorCode(String tableName, ZipOutputStream zip) {
|
||||||
{
|
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
GenTable table = genTableDao.selectGenTableByName(tableName);
|
||||||
// 设置主子表信息
|
// 设置主子表信息
|
||||||
setSubTable(table);
|
setSubTable(table);
|
||||||
// 设置主键列信息
|
// 设置主键列信息
|
||||||
|
|
@ -347,60 +347,52 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||||
for (String template : templates)
|
for (String template : templates) {
|
||||||
{
|
|
||||||
// 渲染模板
|
// 渲染模板
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||||
tpl.merge(context, sw);
|
tpl.merge(context, sw);
|
||||||
try
|
|
||||||
{
|
if (template.equals("vm/sql/sql.vm")) {
|
||||||
|
Boolean start = insertMenuItem(sw);
|
||||||
|
if (start){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
// 添加到zip
|
// 添加到zip
|
||||||
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
|
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
|
||||||
IOUtils.write(sw.toString(), zip, Constants.UTF8);
|
IOUtils.write(sw.toString(), zip, Constants.UTF8);
|
||||||
IOUtils.closeQuietly(sw);
|
IOUtils.closeQuietly(sw);
|
||||||
zip.flush();
|
zip.flush();
|
||||||
zip.closeEntry();
|
zip.closeEntry();
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
log.error("渲染模板失败,表名:" + table.getTableName(), e);
|
log.error("渲染模板失败,表名:" + table.getTableName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return zip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存参数校验
|
* todo 修改保存参数校验
|
||||||
*
|
*
|
||||||
* @param genTable 业务信息
|
* @param genTable 业务信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void validateEdit(GenTable genTable)
|
public void validateEdit(GenTable genTable) {
|
||||||
{
|
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) {
|
||||||
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
|
|
||||||
{
|
|
||||||
String options = JSON.toJSONString(genTable.getParams());
|
String options = JSON.toJSONString(genTable.getParams());
|
||||||
JSONObject paramsObj = JSONObject.parseObject(options);
|
JSONObject paramsObj = JSONObject.parseObject(options);
|
||||||
if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE)))
|
if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) {
|
||||||
{
|
|
||||||
throw new CustomException("树编码字段不能为空");
|
throw new CustomException("树编码字段不能为空");
|
||||||
}
|
} else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) {
|
||||||
else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE)))
|
|
||||||
{
|
|
||||||
throw new CustomException("树父编码字段不能为空");
|
throw new CustomException("树父编码字段不能为空");
|
||||||
}
|
} else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) {
|
||||||
else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME)))
|
|
||||||
{
|
|
||||||
throw new CustomException("树名称字段不能为空");
|
throw new CustomException("树名称字段不能为空");
|
||||||
}
|
} else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) {
|
||||||
else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory()))
|
if (StringUtils.isEmpty(genTable.getSubTableName())) {
|
||||||
{
|
|
||||||
if (StringUtils.isEmpty(genTable.getSubTableName()))
|
|
||||||
{
|
|
||||||
throw new CustomException("关联子表的表名不能为空");
|
throw new CustomException("关联子表的表名不能为空");
|
||||||
}
|
} else if (StringUtils.isEmpty(genTable.getSubTableFkName())) {
|
||||||
else if (StringUtils.isEmpty(genTable.getSubTableFkName()))
|
|
||||||
{
|
|
||||||
throw new CustomException("子表关联的外键名不能为空");
|
throw new CustomException("子表关联的外键名不能为空");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -409,35 +401,27 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置主键列信息
|
* 设置主键列信息
|
||||||
*
|
*
|
||||||
* @param table 业务表信息
|
* @param table 业务表信息
|
||||||
*/
|
*/
|
||||||
public void setPkColumn(GenTable table)
|
public void setPkColumn(GenTable table) {
|
||||||
{
|
for (GenTableColumn column : table.getColumns()) {
|
||||||
for (GenTableColumn column : table.getColumns())
|
if (column.isPk()) {
|
||||||
{
|
|
||||||
if (column.isPk())
|
|
||||||
{
|
|
||||||
table.setPkColumn(column);
|
table.setPkColumn(column);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StringUtils.isNull(table.getPkColumn()))
|
if (StringUtils.isNull(table.getPkColumn())) {
|
||||||
{
|
|
||||||
table.setPkColumn(table.getColumns().get(0));
|
table.setPkColumn(table.getColumns().get(0));
|
||||||
}
|
}
|
||||||
if (GenConstants.TPL_SUB.equals(table.getTplCategory()))
|
if (GenConstants.TPL_SUB.equals(table.getTplCategory())) {
|
||||||
{
|
for (GenTableColumn column : table.getSubTable().getColumns()) {
|
||||||
for (GenTableColumn column : table.getSubTable().getColumns())
|
if (column.isPk()) {
|
||||||
{
|
|
||||||
if (column.isPk())
|
|
||||||
{
|
|
||||||
table.getSubTable().setPkColumn(column);
|
table.getSubTable().setPkColumn(column);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StringUtils.isNull(table.getSubTable().getPkColumn()))
|
if (StringUtils.isNull(table.getSubTable().getPkColumn())) {
|
||||||
{
|
|
||||||
table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0));
|
table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -445,34 +429,30 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置主子表信息
|
* 设置主子表信息
|
||||||
*
|
*
|
||||||
* @param table 业务表信息
|
* @param table 业务表信息
|
||||||
*/
|
*/
|
||||||
public void setSubTable(GenTable table)
|
public void setSubTable(GenTable table) {
|
||||||
{
|
|
||||||
String subTableName = table.getSubTableName();
|
String subTableName = table.getSubTableName();
|
||||||
if (StringUtils.isNotEmpty(subTableName))
|
if (StringUtils.isNotEmpty(subTableName)) {
|
||||||
{
|
table.setSubTable(genTableDao.selectGenTableByName(subTableName));
|
||||||
table.setSubTable(genTableMapper.selectGenTableByName(subTableName));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置代码生成其他选项值
|
* 设置代码生成其他选项值
|
||||||
*
|
*
|
||||||
* @param genTable 设置后的生成对象
|
* @param genTable 设置后的生成对象
|
||||||
*/
|
*/
|
||||||
public void setTableFromOptions(GenTable genTable)
|
public void setTableFromOptions(GenTable genTable) {
|
||||||
{
|
|
||||||
JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions());
|
JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions());
|
||||||
if (StringUtils.isNotNull(paramsObj))
|
if (StringUtils.isNotNull(paramsObj)) {
|
||||||
{
|
|
||||||
String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
|
String treeCode = paramsObj.getString(GenConstants.TREE_CODE);
|
||||||
String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE);
|
String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE);
|
||||||
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
||||||
String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID);
|
String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID);
|
||||||
String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
|
String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
|
||||||
|
|
||||||
genTable.setTreeCode(treeCode);
|
genTable.setTreeCode(treeCode);
|
||||||
genTable.setTreeParentCode(treeParentCode);
|
genTable.setTreeParentCode(treeParentCode);
|
||||||
genTable.setTreeName(treeName);
|
genTable.setTreeName(treeName);
|
||||||
|
|
@ -483,16 +463,14 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取代码生成地址
|
* 获取代码生成地址
|
||||||
*
|
*
|
||||||
* @param table 业务表信息
|
* @param table 业务表信息
|
||||||
* @param template 模板文件路径
|
* @param template 模板文件路径
|
||||||
* @return 生成地址
|
* @return 生成地址
|
||||||
*/
|
*/
|
||||||
public static String getGenPath(GenTable table, String template)
|
public static String getGenPath(GenTable table, String template) {
|
||||||
{
|
|
||||||
String genPath = table.getGenPath();
|
String genPath = table.getGenPath();
|
||||||
if (StringUtils.equals(genPath, "/"))
|
if (StringUtils.equals(genPath, "/")) {
|
||||||
{
|
|
||||||
return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table);
|
return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table);
|
||||||
}
|
}
|
||||||
return genPath + File.separator + VelocityUtils.getFileName(template, table);
|
return genPath + File.separator + VelocityUtils.getFileName(template, table);
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public interface IGenTableService
|
||||||
* @param tableName 表名称
|
* @param tableName 表名称
|
||||||
* @return 数据
|
* @return 数据
|
||||||
*/
|
*/
|
||||||
public void generatorCode(String tableName);
|
public boolean generatorCode(String tableName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步数据库
|
* 同步数据库
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.hchyun.generator.util;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
import org.apache.velocity.VelocityContext;
|
import org.apache.velocity.VelocityContext;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hchyun.common.constant.GenConstants;
|
import com.hchyun.common.constant.GenConstants;
|
||||||
|
|
@ -53,6 +55,8 @@ public class VelocityUtils
|
||||||
velocityContext.put("packageName", packageName);
|
velocityContext.put("packageName", packageName);
|
||||||
velocityContext.put("author", genTable.getFunctionAuthor());
|
velocityContext.put("author", genTable.getFunctionAuthor());
|
||||||
velocityContext.put("datetime", DateUtils.getDate());
|
velocityContext.put("datetime", DateUtils.getDate());
|
||||||
|
// velocityContext.put("createTime", DateUtils.getTime());
|
||||||
|
velocityContext.put("createBy", SecurityUtils.getUserId());
|
||||||
velocityContext.put("pkColumn", genTable.getPkColumn());
|
velocityContext.put("pkColumn", genTable.getPkColumn());
|
||||||
velocityContext.put("importList", getImportList(genTable));
|
velocityContext.put("importList", getImportList(genTable));
|
||||||
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||||
|
|
@ -126,8 +130,8 @@ public class VelocityUtils
|
||||||
public static List<String> getTemplateList(String tplCategory)
|
public static List<String> getTemplateList(String tplCategory)
|
||||||
{
|
{
|
||||||
List<String> templates = new ArrayList<String>();
|
List<String> templates = new ArrayList<String>();
|
||||||
templates.add("vm/java/domain.java.vm");
|
templates.add("vm/java/entity.java.vm");
|
||||||
templates.add("vm/java/mapper.java.vm");
|
templates.add("vm/java/dao.java.vm");
|
||||||
templates.add("vm/java/service.java.vm");
|
templates.add("vm/java/service.java.vm");
|
||||||
templates.add("vm/java/serviceImpl.java.vm");
|
templates.add("vm/java/serviceImpl.java.vm");
|
||||||
templates.add("vm/java/controller.java.vm");
|
templates.add("vm/java/controller.java.vm");
|
||||||
|
|
@ -145,7 +149,7 @@ public class VelocityUtils
|
||||||
else if (GenConstants.TPL_SUB.equals(tplCategory))
|
else if (GenConstants.TPL_SUB.equals(tplCategory))
|
||||||
{
|
{
|
||||||
templates.add("vm/vue/index.vue.vm");
|
templates.add("vm/vue/index.vue.vm");
|
||||||
templates.add("vm/java/sub-domain.java.vm");
|
templates.add("vm/java/sub-entity.java.vm");
|
||||||
}
|
}
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
@ -170,17 +174,17 @@ public class VelocityUtils
|
||||||
String mybatisPath = MYBATIS_PATH + "/" + moduleName;
|
String mybatisPath = MYBATIS_PATH + "/" + moduleName;
|
||||||
String vuePath = "vue";
|
String vuePath = "vue";
|
||||||
|
|
||||||
if (template.contains("domain.java.vm"))
|
if (template.contains("entity.java.vm"))
|
||||||
{
|
{
|
||||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
fileName = StringUtils.format("{}/entity/{}.java", javaPath, className);
|
||||||
}
|
}
|
||||||
if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
|
if (template.contains("sub-entity.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
|
||||||
{
|
{
|
||||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
fileName = StringUtils.format("{}/entity/{}.java", javaPath, genTable.getSubTable().getClassName());
|
||||||
}
|
}
|
||||||
else if (template.contains("mapper.java.vm"))
|
else if (template.contains("dao.java.vm"))
|
||||||
{
|
{
|
||||||
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
fileName = StringUtils.format("{}/dao/{}dao.java", javaPath, className);
|
||||||
}
|
}
|
||||||
else if (template.contains("service.java.vm"))
|
else if (template.contains("service.java.vm"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.hchyun.generator.dao.GenTableColumnMapper">
|
<mapper namespace="com.hchyun.generator.dao.GenTableColumnDao">
|
||||||
|
|
||||||
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
||||||
<id property="columnId" column="column_id" />
|
<id property="columnId" column="column_id" />
|
||||||
|
|
@ -14,11 +14,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="javaField" column="java_field" />
|
<result property="javaField" column="java_field" />
|
||||||
<result property="isPk" column="is_pk" />
|
<result property="isPk" column="is_pk" />
|
||||||
<result property="isIncrement" column="is_increment" />
|
<result property="isIncrement" column="is_increment" />
|
||||||
<result property="isRequired" column="is_required" />
|
|
||||||
<result property="isInsert" column="is_insert" />
|
<result property="isInsert" column="is_insert" />
|
||||||
<result property="isEdit" column="is_edit" />
|
<result property="isEdit" column="is_edit" />
|
||||||
<result property="isList" column="is_list" />
|
<result property="isList" column="is_list" />
|
||||||
<result property="isQuery" column="is_query" />
|
<result property="isQuery" column="is_query" />
|
||||||
|
<result property="isRegular" column="is_regular" />
|
||||||
<result property="queryType" column="query_type" />
|
<result property="queryType" column="query_type" />
|
||||||
<result property="htmlType" column="html_type" />
|
<result property="htmlType" column="html_type" />
|
||||||
<result property="dictType" column="dict_type" />
|
<result property="dictType" column="dict_type" />
|
||||||
|
|
@ -30,9 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectGenTableColumnVo">
|
<sql id="selectGenTableColumnVo">
|
||||||
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
|
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time,is_regular from gen_table_column
|
||||||
</sql>
|
</sql>
|
||||||
|
<!--todo 获取数据库每行的配置信息-->
|
||||||
<select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
|
<select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
|
||||||
<include refid="selectGenTableColumnVo"/>
|
<include refid="selectGenTableColumnVo"/>
|
||||||
where table_id = #{tableId}
|
where table_id = #{tableId}
|
||||||
|
|
@ -88,26 +88,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<!--todo x修改行配置信息-->
|
||||||
<update id="updateGenTableColumn" parameterType="GenTableColumn">
|
<update id="updateGenTableColumn" parameterType="GenTableColumn">
|
||||||
update gen_table_column
|
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||||
<set>
|
update gen_table_column
|
||||||
column_comment = #{columnComment},
|
<set>
|
||||||
java_type = #{javaType},
|
column_comment = #{item.columnComment},
|
||||||
java_field = #{javaField},
|
java_type = #{item.javaType},
|
||||||
is_insert = #{isInsert},
|
java_field = #{item.javaField},
|
||||||
is_edit = #{isEdit},
|
is_insert = #{item.isInsert},
|
||||||
is_list = #{isList},
|
is_edit = #{item.isEdit},
|
||||||
is_query = #{isQuery},
|
is_list = #{item.isList},
|
||||||
is_required = #{isRequired},
|
is_query = #{item.isQuery},
|
||||||
query_type = #{queryType},
|
is_required = #{item.isRequired},
|
||||||
html_type = #{htmlType},
|
is_regular = #{item.isRegular},
|
||||||
dict_type = #{dictType},
|
query_type = #{item.queryType},
|
||||||
sort = #{sort},
|
html_type = #{item.htmlType},
|
||||||
update_by = #{updateBy},
|
dict_type = #{item.dictType},
|
||||||
update_time = sysdate()
|
sort = #{item.sort},
|
||||||
</set>
|
update_by = #{item.updateBy},
|
||||||
where column_id = #{columnId}
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
|
where column_id = #{item.columnId}
|
||||||
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteGenTableColumnByIds" parameterType="Long">
|
<delete id="deleteGenTableColumnByIds" parameterType="Long">
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.hchyun.generator.dao.GenTableMapper">
|
<mapper namespace="com.hchyun.generator.dao.GenTableDao">
|
||||||
|
|
||||||
<resultMap type="GenTable" id="GenTableResult">
|
<resultMap type="GenTable" id="GenTableResult">
|
||||||
<id property="tableId" column="table_id" />
|
<id property="tableId" column="table_id" />
|
||||||
|
|
@ -27,8 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
<resultMap type="com.hchyun.generator.entity.GenTableColumn" id="GenTableColumnResult">
|
||||||
<id property="columnId" column="column_id" />
|
<id property="columnId" column="column_id" />
|
||||||
<result property="tableId" column="table_id" />
|
<result property="tableId" column="table_id" />
|
||||||
<result property="columnName" column="column_name" />
|
<result property="columnName" column="column_name" />
|
||||||
|
|
@ -43,6 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="isEdit" column="is_edit" />
|
<result property="isEdit" column="is_edit" />
|
||||||
<result property="isList" column="is_list" />
|
<result property="isList" column="is_list" />
|
||||||
<result property="isQuery" column="is_query" />
|
<result property="isQuery" column="is_query" />
|
||||||
|
<result property="isRegular" column="is_regular" />
|
||||||
|
<result property="regular" column="regular" />
|
||||||
<result property="queryType" column="query_type" />
|
<result property="queryType" column="query_type" />
|
||||||
<result property="htmlType" column="html_type" />
|
<result property="htmlType" column="html_type" />
|
||||||
<result property="dictType" column="dict_type" />
|
<result property="dictType" column="dict_type" />
|
||||||
|
|
@ -52,11 +54,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<insert id="insertMenu">
|
||||||
|
${paramSQL}
|
||||||
|
</insert>
|
||||||
<sql id="selectGenTableVo">
|
<sql id="selectGenTableVo">
|
||||||
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
<include refid="selectGenTableVo"/>
|
<include refid="selectGenTableVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
|
@ -93,38 +98,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
||||||
and table_name in
|
and table_name in
|
||||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
<foreach collection="array" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
||||||
and table_name = #{tableName}
|
and table_name = #{tableName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--todo 获取表信息 预览代码使用-->
|
||||||
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort, c.is_regular, r.regular
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
|
LEFT JOIN sys_regular r ON c.is_regular = r.id
|
||||||
where t.table_id = #{tableId} order by c.sort
|
where t.table_id = #{tableId} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort, c.is_regular, r.regular
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
|
LEFT JOIN sys_regular r ON c.is_regular = r.id
|
||||||
where t.table_name = #{tableName} order by c.sort
|
where t.table_name = #{tableName} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
<!-- todo 查询数据库行配置信息-->
|
||||||
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
|
|
@ -132,7 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
order by c.sort
|
order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
||||||
insert into gen_table (
|
insert into gen_table (
|
||||||
<if test="tableName != null">table_name,</if>
|
<if test="tableName != null">table_name,</if>
|
||||||
|
|
@ -166,7 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateGenTable" parameterType="GenTable">
|
<update id="updateGenTable" parameterType="GenTable">
|
||||||
update gen_table
|
update gen_table
|
||||||
<set>
|
<set>
|
||||||
|
|
@ -190,9 +198,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</set>
|
</set>
|
||||||
where table_id = #{tableId}
|
where table_id = #{tableId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteGenTableByIds" parameterType="Long">
|
<delete id="deleteGenTableByIds" parameterType="Long">
|
||||||
delete from gen_table where table_id in
|
delete from gen_table where table_id in
|
||||||
<foreach collection="array" item="tableId" open="(" separator="," close=")">
|
<foreach collection="array" item="tableId" open="(" separator="," close=")">
|
||||||
#{tableId}
|
#{tableId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package ${packageName}.mapper;
|
package ${packageName}.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.entity.${ClassName};
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
import ${packageName}.domain.${subClassName};
|
import ${packageName}.entity.${subClassName};
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package ${packageName}.domain;
|
package ${packageName}.entity;
|
||||||
|
|
||||||
#foreach ($import in $importList)
|
#foreach ($import in $importList)
|
||||||
import ${import};
|
import ${import};
|
||||||
|
|
@ -7,9 +7,9 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.entity.BaseEntity;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
import com.ruoyi.common.core.domain.TreeEntity;
|
import com.ruoyi.common.core.entity.TreeEntity;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package ${packageName}.service;
|
package ${packageName}.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.entity.${ClassName};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}Service接口
|
* ${functionName}Service接口
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import ${packageName}.domain.${subClassName};
|
import ${packageName}.entity.${subClassName};
|
||||||
#end
|
#end
|
||||||
import ${packageName}.mapper.${ClassName}Mapper;
|
import ${packageName}.mapper.${ClassName}Mapper;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.entity.${ClassName};
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.service.I${ClassName}Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package ${packageName}.domain;
|
package ${packageName}.entity;
|
||||||
|
|
||||||
#foreach ($import in $subImportList)
|
#foreach ($import in $subImportList)
|
||||||
import ${import};
|
import ${import};
|
||||||
|
|
@ -6,7 +6,7 @@ import ${import};
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${subTable.functionName}对象 ${subTableName}
|
* ${subTable.functionName}对象 ${subTableName}
|
||||||
|
|
@ -1,22 +1,22 @@
|
||||||
-- 菜单 SQL
|
-- 菜单 SQL
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单');
|
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', ${createBy}, sysdate(), 0, null, '${functionName}菜单');
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
-- 按钮父菜单ID
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
SELECT @parentId := LAST_INSERT_ID();
|
||||||
|
|
||||||
-- 按钮 SQL
|
-- 按钮 SQL
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', ${createBy}, sysdate(), 0, null, '');
|
||||||
|
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', ${createBy}, sysdate(), 0, null, '');
|
||||||
|
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', ${createBy}, sysdate(), 0, null, '');
|
||||||
|
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', ${createBy}, sysdate(), 0, null, '');
|
||||||
|
|
||||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, '');
|
values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', ${createBy}, sysdate(), 0, null, '');
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
<mapper namespace="${packageName}.dao.${ClassName}Mapper">
|
||||||
|
|
||||||
<resultMap type="${ClassName}" id="${ClassName}Result">
|
<resultMap type="${ClassName}" id="${ClassName}Result">
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.exception.job.TaskException;
|
import com.hchyun.common.exception.job.TaskException;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.hchyun.common.annotation.Log;
|
import com.hchyun.common.annotation.Log;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.domain.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
import com.hchyun.common.core.page.TableDataInfo;
|
||||||
import com.hchyun.common.enums.BusinessType;
|
import com.hchyun.common.enums.BusinessType;
|
||||||
import com.hchyun.common.utils.poi.ExcelUtil;
|
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.constant.ScheduleConstants;
|
import com.hchyun.common.constant.ScheduleConstants;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.quartz.util.CronUtils;
|
import com.hchyun.quartz.util.CronUtils;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import java.util.Date;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务调度日志表 sys_job_log
|
* 定时任务调度日志表 sys_job_log
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.hchyun.system.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.hchyun.common.core.domain.entity.SysDept;
|
import com.hchyun.common.core.entity.entity.SysDept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理 数据层
|
* 部门管理 数据层
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.hchyun.system.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictData;
|
import com.hchyun.common.core.entity.entity.SysDictData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典表 数据层
|
* 字典表 数据层
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.hchyun.system.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictType;
|
import com.hchyun.common.core.entity.entity.SysDictType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典表 数据层
|
* 字典表 数据层
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.hchyun.system.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.hchyun.common.core.domain.entity.SysMenu;
|
import com.hchyun.common.core.entity.entity.SysMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单表 数据层
|
* 菜单表 数据层
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.hchyun.system.dao;
|
package com.hchyun.system.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色表 数据层
|
* 角色表 数据层
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.hchyun.system.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户表 数据层
|
* 用户表 数据层
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.hchyun.system.entity;
|
package com.hchyun.system.entity;
|
||||||
|
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置表 sys_config
|
* 参数配置表 sys_config
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import java.util.Date;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统访问记录表 sys_logininfor
|
* 系统访问记录表 sys_logininfor
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 sys_notice
|
* 通知公告表 sys_notice
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import java.util.Date;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录表 oper_log
|
* 操作日志记录表 oper_log
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.annotation.Excel.ColumnType;
|
import com.hchyun.common.annotation.Excel.ColumnType;
|
||||||
import com.hchyun.common.core.domain.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位表 sys_post
|
* 岗位表 sys_post
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.hchyun.system.service;
|
package com.hchyun.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.hchyun.common.core.domain.TreeSelect;
|
import com.hchyun.common.core.entity.TreeSelect;
|
||||||
import com.hchyun.common.core.domain.entity.SysDept;
|
import com.hchyun.common.core.entity.entity.SysDept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理 服务层
|
* 部门管理 服务层
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.hchyun.system.service;
|
package com.hchyun.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictData;
|
import com.hchyun.common.core.entity.entity.SysDictData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典 业务层
|
* 字典 业务层
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.hchyun.system.service;
|
package com.hchyun.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictData;
|
import com.hchyun.common.core.entity.entity.SysDictData;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictType;
|
import com.hchyun.common.core.entity.entity.SysDictType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典 业务层
|
* 字典 业务层
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package com.hchyun.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import com.hchyun.common.core.domain.TreeSelect;
|
import com.hchyun.common.core.entity.TreeSelect;
|
||||||
import com.hchyun.common.core.domain.entity.SysMenu;
|
import com.hchyun.common.core.entity.entity.SysMenu;
|
||||||
import com.hchyun.system.entity.vo.RouterVo;
|
import com.hchyun.system.entity.vo.RouterVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.hchyun.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色业务层
|
* 角色业务层
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.hchyun.system.service;
|
package com.hchyun.system.service;
|
||||||
|
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.system.entity.SysUserOnline;
|
import com.hchyun.system.entity.SysUserOnline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.hchyun.system.service;
|
package com.hchyun.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层
|
* 用户 业务层
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.hchyun.common.annotation.DataScope;
|
import com.hchyun.common.annotation.DataScope;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.domain.TreeSelect;
|
import com.hchyun.common.core.entity.TreeSelect;
|
||||||
import com.hchyun.common.core.domain.entity.SysDept;
|
import com.hchyun.common.core.entity.entity.SysDept;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
import com.hchyun.common.exception.CustomException;
|
import com.hchyun.common.exception.CustomException;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.system.dao.SysDeptDao;
|
import com.hchyun.system.dao.SysDeptDao;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.hchyun.system.service.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictData;
|
import com.hchyun.common.core.entity.entity.SysDictData;
|
||||||
import com.hchyun.common.utils.DictUtils;
|
import com.hchyun.common.utils.DictUtils;
|
||||||
import com.hchyun.system.dao.SysDictDataDao;
|
import com.hchyun.system.dao.SysDictDataDao;
|
||||||
import com.hchyun.system.service.ISysDictDataService;
|
import com.hchyun.system.service.ISysDictDataService;
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictData;
|
import com.hchyun.common.core.entity.entity.SysDictData;
|
||||||
import com.hchyun.common.core.domain.entity.SysDictType;
|
import com.hchyun.common.core.entity.entity.SysDictType;
|
||||||
import com.hchyun.common.exception.CustomException;
|
import com.hchyun.common.exception.CustomException;
|
||||||
import com.hchyun.common.utils.DictUtils;
|
import com.hchyun.common.utils.DictUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ import java.util.stream.Collectors;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.domain.TreeSelect;
|
import com.hchyun.common.core.entity.TreeSelect;
|
||||||
import com.hchyun.common.core.domain.entity.SysMenu;
|
import com.hchyun.common.core.entity.entity.SysMenu;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.system.entity.vo.MetaVo;
|
import com.hchyun.system.entity.vo.MetaVo;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.hchyun.common.annotation.DataScope;
|
import com.hchyun.common.annotation.DataScope;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
import com.hchyun.common.exception.CustomException;
|
import com.hchyun.common.exception.CustomException;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.common.utils.spring.SpringUtils;
|
import com.hchyun.common.utils.spring.SpringUtils;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.hchyun.system.service.impl;
|
package com.hchyun.system.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.hchyun.common.core.domain.model.LoginUser;
|
import com.hchyun.common.core.entity.model.LoginUser;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.system.entity.SysUserOnline;
|
import com.hchyun.system.entity.SysUserOnline;
|
||||||
import com.hchyun.system.service.ISysUserOnlineService;
|
import com.hchyun.system.service.ISysUserOnlineService;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.hchyun.common.annotation.DataScope;
|
import com.hchyun.common.annotation.DataScope;
|
||||||
import com.hchyun.common.constant.UserConstants;
|
import com.hchyun.common.constant.UserConstants;
|
||||||
import com.hchyun.common.core.domain.entity.SysRole;
|
import com.hchyun.common.core.entity.entity.SysRole;
|
||||||
import com.hchyun.common.core.domain.entity.SysUser;
|
import com.hchyun.common.core.entity.entity.SysUser;
|
||||||
import com.hchyun.common.exception.CustomException;
|
import com.hchyun.common.exception.CustomException;
|
||||||
import com.hchyun.common.utils.SecurityUtils;
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.system.domain.SysStu;
|
||||||
|
import com.ruoyi.system.service.ISysStuService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-01-22
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/stu")
|
||||||
|
public class SysStuController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysStuService sysStuService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询学生列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:stu:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysStu sysStu)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysStu> list = sysStuService.selectSysStuList(sysStu);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出学生列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:stu:export')")
|
||||||
|
@Log(title = "学生", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public AjaxResult export(SysStu sysStu)
|
||||||
|
{
|
||||||
|
List<SysStu> list = sysStuService.selectSysStuList(sysStu);
|
||||||
|
ExcelUtil<SysStu> util = new ExcelUtil<SysStu>(SysStu.class);
|
||||||
|
return util.exportExcel(list, "stu");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取学生详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:stu:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(sysStuService.selectSysStuById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增学生
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:stu:add')")
|
||||||
|
@Log(title = "学生", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody SysStu sysStu)
|
||||||
|
{
|
||||||
|
return toAjax(sysStuService.insertSysStu(sysStu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改学生
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:stu:edit')")
|
||||||
|
@Log(title = "学生", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody SysStu sysStu)
|
||||||
|
{
|
||||||
|
return toAjax(sysStuService.updateSysStu(sysStu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除学生
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:stu:remove')")
|
||||||
|
@Log(title = "学生", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(sysStuService.deleteSysStuByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.entity.SysStu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-01-22
|
||||||
|
*/
|
||||||
|
public interface SysStuMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询学生
|
||||||
|
*
|
||||||
|
* @param id 学生ID
|
||||||
|
* @return 学生
|
||||||
|
*/
|
||||||
|
public SysStu selectSysStuById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询学生列表
|
||||||
|
*
|
||||||
|
* @param sysStu 学生
|
||||||
|
* @return 学生集合
|
||||||
|
*/
|
||||||
|
public List<SysStu> selectSysStuList(SysStu sysStu);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增学生
|
||||||
|
*
|
||||||
|
* @param sysStu 学生
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysStu(SysStu sysStu);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改学生
|
||||||
|
*
|
||||||
|
* @param sysStu 学生
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysStu(SysStu sysStu);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除学生
|
||||||
|
*
|
||||||
|
* @param id 学生ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysStuById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除学生
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysStuByIds(Long[] ids);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.ruoyi.system.entity;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.entity.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生对象 sys_stu
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-01-22
|
||||||
|
*/
|
||||||
|
public class SysStu extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 学生姓名 */
|
||||||
|
@Excel(name = "学生姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 电话 */
|
||||||
|
@Excel(name = "电话")
|
||||||
|
private Long tel;
|
||||||
|
|
||||||
|
/** 电子邮件 */
|
||||||
|
@Excel(name = "电子邮件")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setTel(Long tel)
|
||||||
|
{
|
||||||
|
this.tel = tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTel()
|
||||||
|
{
|
||||||
|
return tel;
|
||||||
|
}
|
||||||
|
public void setEmail(String email)
|
||||||
|
{
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail()
|
||||||
|
{
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("name", getName())
|
||||||
|
.append("tel", getTel())
|
||||||
|
.append("email", getEmail())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue