Commit b2e23f8f by 黄杰

readme commit

parent a11e23e3
......@@ -2,7 +2,7 @@ package com.ihooyah.common.biz;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ihooyah.common.msg.RespInfo;
import com.ihooyah.common.msg.TableRespInfo;
import com.ihooyah.common.util.Query;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.common.Mapper;
......@@ -83,7 +83,7 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
return mapper.selectCountByExample(example);
}
public RespInfo selectByQuery(Query query) {
public TableRespInfo selectByQuery(Query query) {
Class<T> clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
Example example = new Example(clazz);
if (query.entrySet().size() > 0) {
......@@ -101,7 +101,7 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
}
Page<Object> result = PageHelper.startPage(query.getPage(), query.getLimit());
List<T> list = mapper.selectByExample(example);
return RespInfo.mobiSuccess(list);
return new TableRespInfo<T>(result.getTotal(), list);
}
}
......@@ -28,4 +28,7 @@ public class BaseEntity implements Serializable
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
......@@ -2,8 +2,8 @@ package com.ihooyah.common.handler;
import com.ihooyah.common.exception.BaseException;
import com.ihooyah.common.exception.UserTokenException;
import com.ihooyah.common.msg.ObjectRespInfo;
import com.ihooyah.common.msg.RespEnum;
import com.ihooyah.common.msg.RespInfo;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
......@@ -17,29 +17,29 @@ import javax.servlet.http.HttpServletResponse;
public class GlobalExceptionHandler {
@ExceptionHandler(BindException.class)
public RespInfo validateErrorHandler(HttpServletResponse response, BindException e) {
public ObjectRespInfo validateErrorHandler(HttpServletResponse response, BindException e) {
BindingResult bindingResult = e.getBindingResult();
if (bindingResult.hasErrors() && bindingResult.getFieldError() != null) {
return new RespInfo(RespEnum.ERROR.getCode(), bindingResult.getFieldError().getDefaultMessage());
return new ObjectRespInfo(RespEnum.ERROR.getCode(), bindingResult.getFieldError().getDefaultMessage());
}else{
return new RespInfo(RespEnum.ERROR.getCode(),"Form validation error");
return new ObjectRespInfo(RespEnum.ERROR.getCode(),"Form validation error");
}
}
@ExceptionHandler(UserTokenException.class)
public RespInfo userTokenExceptionHandler(HttpServletResponse response, UserTokenException ex) {
return new RespInfo(ex.getStatus(),ex.getMessage());
public ObjectRespInfo userTokenExceptionHandler(HttpServletResponse response, UserTokenException ex) {
return new ObjectRespInfo(ex.getStatus(),ex.getMessage());
}
@ExceptionHandler(BaseException.class)
public RespInfo baseExceptionHandler(HttpServletResponse response, BaseException ex) {
return new RespInfo(RespEnum.ERROR.getCode(), ex.getMessage());
public ObjectRespInfo baseExceptionHandler(HttpServletResponse response, BaseException ex) {
return new ObjectRespInfo(RespEnum.ERROR.getCode(), ex.getMessage());
}
@ExceptionHandler(Exception.class)
public RespInfo otherExceptionHandler(HttpServletResponse response, Exception ex) {
return new RespInfo(RespEnum.ERROR.getCode(), ex.getMessage());
public ObjectRespInfo otherExceptionHandler(HttpServletResponse response, Exception ex) {
return new ObjectRespInfo(RespEnum.ERROR.getCode(), ex.getMessage());
}
......
package com.ihooyah.common.msg;
import lombok.Getter;
import lombok.Setter;
/**
* 描述
*
* @author fatiaojie
* @date 2020/4/1 9:31
*/
@Getter
@Setter
public class BaseRespInfo {
private Integer code = 200;
private String msg = "";
public BaseRespInfo(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public BaseRespInfo(){
}
}
package com.ihooyah.common.msg;
/**
* 描述
*
* @author fatiaojie
* @date 2020/4/1 9:44
*/
public class ObjectRespInfo <T> extends BaseRespInfo {
T result;
String endpoint ="";
public ObjectRespInfo(){
}
public ObjectRespInfo(T result,String endpoint){
this.setResult(result);
this.setEndpoint(endpoint);
}
public ObjectRespInfo(Integer code, String msg) {
this.setCode(code);
this.setMsg(msg);
this.result = result;
}
public ObjectRespInfo(Integer code, String msg, T result){
this.setCode(code);
this.setMsg(msg);
this.result = result;
}
public static ObjectRespInfo out(RespEnum respEnum) {
// this.setCode(respEnum.getCode());
// this.setMsg(respEnum.getMsg());
// return this;
return new ObjectRespInfo(respEnum.getCode(), respEnum.getMsg());
}
public static ObjectRespInfo out(RespEnum respEnum, Object object) {
ObjectRespInfo respInfo = new ObjectRespInfo(respEnum.getCode(), respEnum.getMsg(), object);
respInfo.setEndpoint("web");
return respInfo;
}
public static ObjectRespInfo mobiSuccess(RespEnum respEnum, Object object) {
ObjectRespInfo respInfo = new ObjectRespInfo(respEnum.getCode(), respEnum.getMsg(), object);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiSuccess() {
ObjectRespInfo respInfo = new ObjectRespInfo(RespEnum.SUCCESS.getCode(), "", "");
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiSuccess(Object obj) {
ObjectRespInfo respInfo = new ObjectRespInfo(RespEnum.SUCCESS.getCode(), "", obj);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiSuccess(String msg, Object obj) {
ObjectRespInfo respInfo = new ObjectRespInfo(RespEnum.SUCCESS.getCode(), msg, obj);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiSuccess(String msg) {
ObjectRespInfo respInfo = new ObjectRespInfo(RespEnum.SUCCESS.getCode(), msg);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiError() {
ObjectRespInfo respInfo = new ObjectRespInfo(RespEnum.ERROR.getCode(), RespEnum.ERROR.getMsg());
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiError(String msg) {
ObjectRespInfo respInfo = new ObjectRespInfo(RespEnum.ERROR.getCode(), msg);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiError(String msg, Object object) {
ObjectRespInfo respInfo = new ObjectRespInfo(RespEnum.ERROR.getCode(), msg, object);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiError(RespEnum respEnum, String errorMsg) {
ObjectRespInfo respInfo = null;
respInfo = new ObjectRespInfo(respEnum.getCode(), errorMsg, "");
respInfo.setEndpoint("mobi");
return respInfo;
}
public static ObjectRespInfo mobiError(RespEnum respEnum) {
ObjectRespInfo respInfo = new ObjectRespInfo(respEnum.getCode(), respEnum.getMsg(), "");
respInfo.setEndpoint("mobi");
return respInfo;
}
public T getResult() {
return result;
}
public void setResult(T result) {
this.result = result;
}
public String getEndpoint() {
return endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
}
package com.ihooyah.common.msg;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* Http请求统一返回结构
*
* @param
* @author 王尧 【wangyao@ihooyah.com】
* @return
* @date 2018/3/30 下午7:59
**/
public class RespInfo {
private Integer code = -1;
private String msg = "";
private Object result = "";
private Object endpoint = "";
public RespInfo(Integer code, String msg, Object result) {
this.code = code;
this.msg = msg;
this.result = result;
}
public RespInfo(Integer code, String msg) {
this.code = code;
this.msg = msg;
this.result = result;
}
public RespInfo() {
}
public static RespInfo out(RespEnum respEnum) {
return new RespInfo(respEnum.getCode(), respEnum.getMsg());
}
public static RespInfo out(RespEnum respEnum, Object object) {
RespInfo respInfo = new RespInfo(respEnum.getCode(), respEnum.getMsg(), object);
respInfo.setEndpoint("web");
return respInfo;
}
public static RespInfo mobiSuccess(RespEnum respEnum, Object object) {
RespInfo respInfo = new RespInfo(respEnum.getCode(), respEnum.getMsg(), object);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiSuccess() {
RespInfo respInfo = new RespInfo(RespEnum.SUCCESS.getCode(), "", "");
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiSuccess(Object obj) {
RespInfo respInfo = new RespInfo(RespEnum.SUCCESS.getCode(), "", obj);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiSuccess(String msg, Object obj) {
RespInfo respInfo = new RespInfo(RespEnum.SUCCESS.getCode(), msg, obj);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiSuccess(String msg) {
RespInfo respInfo = new RespInfo(RespEnum.SUCCESS.getCode(), msg);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiError() {
RespInfo respInfo = new RespInfo(RespEnum.ERROR.getCode(), RespEnum.ERROR.getMsg());
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiError(String msg) {
RespInfo respInfo = new RespInfo(RespEnum.ERROR.getCode(), msg);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiError(String msg, Object object) {
RespInfo respInfo = new RespInfo(RespEnum.ERROR.getCode(), msg, object);
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiError(RespEnum respEnum, String errorMsg) {
RespInfo respInfo = null;
respInfo = new RespInfo(respEnum.getCode(), errorMsg, "");
respInfo.setEndpoint("mobi");
return respInfo;
}
public static RespInfo mobiError(RespEnum respEnum) {
RespInfo respInfo = new RespInfo(respEnum.getCode(), respEnum.getMsg(), "");
respInfo.setEndpoint("mobi");
return respInfo;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
public Object getEndpoint() {
return endpoint;
}
public void setEndpoint(Object endpoint) {
this.endpoint = endpoint;
}
public <T> T getResultObject(Class<T> clazz) {
if (RespEnum.SUCCESS.getCode() == this.getCode()) {
if (StringUtils.isBlank(this.getResult().toString())) {
return null;
}
JSONObject jsonObject = (JSONObject) getResult();
return jsonObject.toJavaObject(clazz);
}
return null;
}
public <T> List<T> getResultList(Class<T> clazz) {
if (RespEnum.SUCCESS.getCode() == this.getCode()) {
if (StringUtils.isBlank(this.getResult().toString())) {
return new ArrayList<>();
}
JSONArray jsonArray = (JSONArray) getResult();
return jsonArray.toJavaList(clazz);
}
return new ArrayList<>();
}
}
package com.ihooyah.common.msg;
import java.util.List;
/**
* 描述
*
* @author fatiaojie
* @date 2020/4/1 9:56
*/
public class TableRespInfo<T> extends BaseRespInfo {
TableData<T> result;
public TableRespInfo(long total, List<T> rows) {
this.result = new TableData<T>(total, rows);
}
public TableRespInfo() {
this.result = new TableData<T>();
}
TableRespInfo<T> total(int total) {
this.result.setTotal(total);
return this;
}
TableRespInfo<T> total(List<T> rows) {
this.result.setRows(rows);
return this;
}
public TableData<T> getResult() {
return result;
}
public void setResult(TableData<T> result) {
this.result = result;
}
class TableData<T> {
long total;
List<T> rows;
public TableData(long total, List<T> rows) {
this.total = total;
this.rows = rows;
}
public TableData() {
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public List<T> getRows() {
return rows;
}
public void setRows(List<T> rows) {
this.rows = rows;
}
}
}
package com.ihooyah.common.rest;
import com.ihooyah.common.biz.BaseBiz;
import com.ihooyah.common.context.BaseContextHandler;
import com.ihooyah.common.msg.ObjectRespInfo;
import com.ihooyah.common.msg.TableRespInfo;
import com.ihooyah.common.util.Query;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Slf4j
public class BaseController<Biz extends BaseBiz,Entity> {
@Autowired
protected HttpServletRequest request;
@Autowired
protected Biz baseBiz;
@RequestMapping(value = "",method = RequestMethod.POST)
@ResponseBody
public ObjectRespInfo<Entity> add(@RequestBody Entity entity){
baseBiz.insertSelective(entity);
return new ObjectRespInfo<Entity>();
}
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
@ResponseBody
public ObjectRespInfo<Entity> get(@PathVariable int id){
ObjectRespInfo<Entity> entityObjectRestResponse = new ObjectRespInfo<>();
Object o = baseBiz.selectById(id);
entityObjectRestResponse.setResult((Entity)o);
return entityObjectRestResponse;
}
@RequestMapping(value = "/{id}",method = RequestMethod.PUT)
@ResponseBody
public ObjectRespInfo<Entity> update(@RequestBody Entity entity){
baseBiz.updateSelectiveById(entity);
return new ObjectRespInfo<Entity>();
}
@RequestMapping(value = "/{id}",method = RequestMethod.DELETE)
@ResponseBody
public ObjectRespInfo<Entity> remove(@PathVariable int id){
baseBiz.deleteById(id);
return new ObjectRespInfo<Entity>();
}
@RequestMapping(value = "/all",method = RequestMethod.GET)
@ResponseBody
public List<Entity> all(){
return baseBiz.selectListAll();
}
@RequestMapping(value = "/page",method = RequestMethod.GET)
@ResponseBody
public TableRespInfo<Entity> list(@RequestParam Map<String, Object> params){
//查询列表数据
Query query = new Query(params);
return baseBiz.selectByQuery(query);
}
public String getCurrentUserName(){
return BaseContextHandler.getUsername();
}
public String getCurrentUserId(){
return BaseContextHandler.getUserID();
}
}
package com.ihooyah.common.util;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 时间工具类
*
* @author ruoyi
*/
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
{
public static String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
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"};
/**
* 获取当前Date型日期
*
* @return Date() 当前日期
*/
public static Date getNowDate()
{
return new Date();
}
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
* @return String
*/
public static String getDate()
{
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime()
{
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static final String dateTimeNow()
{
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static final String dateTimeNow(final String format)
{
return parseDateToStr(format, new Date());
}
public static final String dateTime(final Date date)
{
return parseDateToStr(YYYY_MM_DD, date);
}
public static final String parseDateToStr(final String format, final Date date)
{
return new SimpleDateFormat(format).format(date);
}
public static final Date dateTime(final String format, final String ts)
{
try
{
return new SimpleDateFormat(format).parse(ts);
}
catch (ParseException e)
{
throw new RuntimeException(e);
}
}
/**
* 日期路径 即年/月/日 如2018/08/08
*/
public static final String datePath()
{
Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
/**
* 日期路径 即年/月/日 如20180808
*/
public static final String dateTime()
{
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
/**
* 日期型字符串转化为日期 格式
*/
public static Date parseDate(Object str)
{
if (str == null)
{
return null;
}
try
{
return parseDate(str.toString(), parsePatterns);
}
catch (ParseException e)
{
return null;
}
}
/**
* 获取服务器启动时间
*/
public static Date getServerStartDate()
{
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
/**
* 计算两个时间差
*/
public static String getDatePoor(Date endDate, Date nowDate)
{
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟";
}
}
package com.ihooyah.common.util;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* 获取IP方法
*
* @author ruoyi
*/
public class IpUtils
{
public static String getIpAddr(HttpServletRequest request)
{
if (request == null)
{
return "unknown";
}
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("X-Forwarded-For");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("X-Real-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getRemoteAddr();
}
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip.split(",")[0];
}
public static boolean internalIp(String ip)
{
byte[] addr = textToNumericFormatV4(ip);
if (null != addr) {
return internalIp(addr) || "127.0.0.1".equals(ip);
}
return false;
}
private static boolean internalIp(byte[] addr)
{
final byte b0 = addr[0];
final byte b1 = addr[1];
// 10.x.x.x/8
final byte SECTION_1 = 0x0A;
// 172.16.x.x/12
final byte SECTION_2 = (byte) 0xAC;
final byte SECTION_3 = (byte) 0x10;
final byte SECTION_4 = (byte) 0x1F;
// 192.168.x.x/16
final byte SECTION_5 = (byte) 0xC0;
final byte SECTION_6 = (byte) 0xA8;
switch (b0)
{
case SECTION_1:
return true;
case SECTION_2:
if (b1 >= SECTION_3 && b1 <= SECTION_4)
{
return true;
}
case SECTION_5:
switch (b1)
{
case SECTION_6:
return true;
}
default:
return false;
}
}
/**
* 将IPv4地址转换成字节
*
* @param text IPv4地址
* @return byte 字节
*/
public static byte[] textToNumericFormatV4(String text)
{
if (text.length() == 0)
{
return null;
}
byte[] bytes = new byte[4];
String[] elements = text.split("\\.", -1);
try
{
long l;
int i;
switch (elements.length)
{
case 1:
l = Long.parseLong(elements[0]);
if ((l < 0L) || (l > 4294967295L))
return null;
bytes[0] = (byte) (int) (l >> 24 & 0xFF);
bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 2:
l = Integer.parseInt(elements[0]);
if ((l < 0L) || (l > 255L))
return null;
bytes[0] = (byte) (int) (l & 0xFF);
l = Integer.parseInt(elements[1]);
if ((l < 0L) || (l > 16777215L))
return null;
bytes[1] = (byte) (int) (l >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 3:
for (i = 0; i < 2; ++i)
{
l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L))
return null;
bytes[i] = (byte) (int) (l & 0xFF);
}
l = Integer.parseInt(elements[2]);
if ((l < 0L) || (l > 65535L))
return null;
bytes[2] = (byte) (int) (l >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 4:
for (i = 0; i < 4; ++i)
{
l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L))
return null;
bytes[i] = (byte) (int) (l & 0xFF);
}
break;
default:
return null;
}
}
catch (NumberFormatException e)
{
return null;
}
return bytes;
}
public static String getHostIp()
{
try
{
return InetAddress.getLocalHost().getHostAddress();
}
catch (UnknownHostException e)
{
}
return "127.0.0.1";
}
public static String getHostName()
{
try
{
return InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException e)
{
}
return "未知";
}
}
\ No newline at end of file
package com.ihooyah.common.util;
import org.apache.commons.lang3.RandomStringUtils;
public class RandomUtil
{
private static char[] chars = new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z'};
private static char[] nubers = new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};
/**
* 生成随机字符串,包含数字和字母
* @param length 长度
* @return
* @author zmr
*/
public static String randomStr(int length)
{
return RandomStringUtils.random(length, chars);
}
/**
* 生成随机字符串,只包含数字
* @param length 长度
* @return
* @author zmr
*/
public static String randomInt(int length)
{
return RandomStringUtils.random(length, nubers);
}
}
package com.ihooyah.common.util.spring;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@Lazy(false)
public class SpringContextHolder implements ApplicationContextAware, DisposableBean
{
private static ApplicationContext applicationContext = null;
/**
* 取得存储在静态变量中的ApplicationContext.
*/
public static ApplicationContext getApplicationContext()
{
return applicationContext;
}
/**
* 实现ApplicationContextAware接口, 注入Context到静态变量中.
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext)
{
SpringContextHolder.applicationContext = applicationContext;
}
/**
* 清除SpringContextHolder中的ApplicationContext为Null.
*/
public static void clearHolder()
{
if (log.isDebugEnabled())
{
log.debug("清除SpringContextHolder中的ApplicationContext:" + applicationContext);
}
applicationContext = null;
}
/**
* 发布事件
*
* @param event
*/
public static void publishEvent(ApplicationEvent event)
{
if (applicationContext == null)
{
return;
}
applicationContext.publishEvent(event);
}
/**
* 实现DisposableBean接口, 在Context关闭时清理静态变量.
*/
@Override
@SneakyThrows
public void destroy()
{
SpringContextHolder.clearHolder();
}
}
\ No newline at end of file
package com.ihooyah.common.util.spring;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;
/**
* spring工具类 方便在非spring管理环境中获取bean
*
* @author ruoyi
*/
@Component
public final class SpringUtils implements BeanFactoryPostProcessor
{
/** Spring应用上下文环境 */
private static ConfigurableListableBeanFactory beanFactory;
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
{
SpringUtils.beanFactory = beanFactory;
}
/**
* 获取对象
*
* @param name
* @return Object 一个以所给名字注册的bean的实例
* @throws org.springframework.beans.BeansException
*
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) throws BeansException
{
return (T) beanFactory.getBean(name);
}
/**
* 获取类型为requiredType的对象
*
* @param clz
* @return
* @throws org.springframework.beans.BeansException
*
*/
public static <T> T getBean(Class<T> clz) throws BeansException
{
T result = (T) beanFactory.getBean(clz);
return result;
}
/**
* 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
*
* @param name
* @return boolean
*/
public static boolean containsBean(String name)
{
return beanFactory.containsBean(name);
}
/**
* 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
*
* @param name
* @return boolean
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*
*/
public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException
{
return beanFactory.isSingleton(name);
}
/**
* @param name
* @return Class 注册对象的类型
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*
*/
public static Class<?> getType(String name) throws NoSuchBeanDefinitionException
{
return beanFactory.getType(name);
}
/**
* 如果给定的bean名字在bean定义中有别名,则返回这些别名
*
* @param name
* @return
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*
*/
public static String[] getAliases(String name) throws NoSuchBeanDefinitionException
{
return beanFactory.getAliases(name);
}
}
package com.ihooyah.common.util.text;
import com.ihooyah.common.util.StringUtils;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
/**
* 字符集工具类
*
* @author ruoyi
*/
public class CharsetKit
{
/** ISO-8859-1 */
public static final String ISO_8859_1 = "ISO-8859-1";
/** UTF-8 */
public static final String UTF_8 = "UTF-8";
/** GBK */
public static final String GBK = "GBK";
/** ISO-8859-1 */
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
/** UTF-8 */
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
/** GBK */
public static final Charset CHARSET_GBK = Charset.forName(GBK);
/**
* 转换为Charset对象
*
* @param charset 字符集,为空则返回默认字符集
* @return Charset
*/
public static Charset charset(String charset)
{
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
}
/**
* 转换字符串的字符集编码
*
* @param source 字符串
* @param srcCharset 源字符集,默认ISO-8859-1
* @param destCharset 目标字符集,默认UTF-8
* @return 转换后的字符集
*/
public static String convert(String source, String srcCharset, String destCharset)
{
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
}
/**
* 转换字符串的字符集编码
*
* @param source 字符串
* @param srcCharset 源字符集,默认ISO-8859-1
* @param destCharset 目标字符集,默认UTF-8
* @return 转换后的字符集
*/
public static String convert(String source, Charset srcCharset, Charset destCharset)
{
if (null == srcCharset)
{
srcCharset = StandardCharsets.ISO_8859_1;
}
if (null == destCharset)
{
srcCharset = StandardCharsets.UTF_8;
}
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
{
return source;
}
return new String(source.getBytes(srcCharset), destCharset);
}
/**
* @return 系统字符集编码
*/
public static String systemCharset()
{
return Charset.defaultCharset().name();
}
}
package com.ihooyah.common.util.text;
import com.ihooyah.common.util.StringUtils;
/**
* 字符串格式化
*
* @author ruoyi
*/
public class StrFormatter
{
public static final String EMPTY_JSON = "{}";
public static final char C_BACKSLASH = '\\';
public static final char C_DELIM_START = '{';
public static final char C_DELIM_END = '}';
/**
* 格式化字符串<br>
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
* 例:<br>
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
*
* @param strPattern 字符串模板
* @param argArray 参数列表
* @return 结果
*/
public static String format(final String strPattern, final Object... argArray)
{
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
{
return strPattern;
}
final int strPatternLength = strPattern.length();
// 初始化定义好的长度以获得更好的性能
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
int handledPosition = 0;
int delimIndex;// 占位符所在位置
for (int argIndex = 0; argIndex < argArray.length; argIndex++)
{
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
if (delimIndex == -1)
{
if (handledPosition == 0)
{
return strPattern;
}
else
{ // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString();
}
}
else
{
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
{
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
{
// 转义符之前还有一个转义符,占位符依旧有效
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
else
{
// 占位符被转义
argIndex--;
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(C_DELIM_START);
handledPosition = delimIndex + 1;
}
}
else
{
// 正常占位符
sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
}
}
// 加入最后一个占位符后所有的字符
sbuf.append(strPattern, handledPosition, strPattern.length());
return sbuf.toString();
}
}
......@@ -12,7 +12,7 @@ import java.util.ArrayList;
import java.util.Collections;
@Configuration("shopWebConfig")
@Configuration("systemWebConfig")
@Primary
public class WebConfiguration implements WebMvcConfigurer {
@Bean
......
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 地区表 districts
*
* @author ruoyi
* @date 2018-12-19
*/
public class Districts extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private Integer id;
/** 上级编号 */
private Integer pid;
/** 层级 */
private Integer deep;
/** 名称 */
private String name;
/** 上级名称 */
private String pname;
/** 拼音 */
private String pinyin;
/** 拼音缩写 */
private String pinyinShor;
/** 扩展名 */
private String extName;
/** 操作人 */
private String operator;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setPid(Integer pid)
{
this.pid = pid;
}
public Integer getPid()
{
return pid;
}
public void setDeep(Integer deep)
{
this.deep = deep;
}
public Integer getDeep()
{
return deep;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public String getPname()
{
return pname;
}
public void setPname(String pname)
{
this.pname = pname;
}
public void setPinyin(String pinyin)
{
this.pinyin = pinyin;
}
public String getPinyin()
{
return pinyin;
}
public void setPinyinShor(String pinyinShor)
{
this.pinyinShor = pinyinShor;
}
public String getPinyinShor()
{
return pinyinShor;
}
public void setExtName(String extName)
{
this.extName = extName;
}
public String getExtName()
{
return extName;
}
public void setOperator(String operator)
{
this.operator = operator;
}
public String getOperator()
{
return operator;
}
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId()).append("pid", getPid())
.append("deep", getDeep()).append("name", getName()).append("pinyin", getPinyin())
.append("pinyinShor", getPinyinShor()).append("extName", getExtName())
.append("createTime", getCreateTime()).append("updateTime", getUpdateTime())
.append("operator", getOperator()).toString();
}
}
/*
* @(#)Donate.java 2019年12月20日 下午2:04:15
* Copyright 2019 zmr, Inc. All rights reserved.
* PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.ihooyah.modules.system.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import tk.mybatis.mapper.annotation.KeySql;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
/**
* <p>File:Donate.java</p>
* <p>Title: 捐赠</p>
* <p>Description:</p>
* <p>Copyright: Copyright (c) 2019 2019年12月20日 下午2:04:15</p>
* <p>Company: zmrit.com </p>
* @author zmr
* @version 1.0
*/
@Data
@Accessors(chain = true)
public class Donate
{
@Id
@KeySql(useGeneratedKeys = true)
private Integer id;
private String nick;
private Double amount;
private Integer canal;
private String remark;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;
@Transient
private String beginTime;
@Transient
private String endTime;
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.annotation.Excel;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 参数配置表 sys_config
*
* @author ruoyi
*/
public class SysConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 参数主键 */
@Excel(name = "参数主键")
private Long configId;
/** 参数名称 */
@Excel(name = "参数名称")
private String configName;
/** 参数键名 */
@Excel(name = "参数键名")
private String configKey;
/** 参数键值 */
@Excel(name = "参数键值")
private String configValue;
/** 系统内置(Y是 N否) */
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
private String configType;
public Long getConfigId()
{
return configId;
}
public void setConfigId(Long configId)
{
this.configId = configId;
}
public String getConfigName()
{
return configName;
}
public void setConfigName(String configName)
{
this.configName = configName;
}
public String getConfigKey()
{
return configKey;
}
public void setConfigKey(String configKey)
{
this.configKey = configKey;
}
public String getConfigValue()
{
return configValue;
}
public void setConfigValue(String configValue)
{
this.configValue = configValue;
}
public String getConfigType()
{
return configType;
}
public void setConfigType(String configType)
{
this.configType = configType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("configId", getConfigId())
.append("configName", getConfigName())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("configType", getConfigType())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 部门表 sys_dept
*
* @author ruoyi
*/
public class SysDept extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 部门ID */
private Long deptId;
/** 父部门ID */
private Long parentId;
/** 祖级列表 */
private String ancestors;
/** 部门名称 */
private String deptName;
/** 显示顺序 */
private String orderNum;
/** 负责人 */
private String leader;
/** 负责人编号 */
private Long leaderId;
/** 联系电话 */
private String phone;
/** 邮箱 */
private String email;
/** 部门状态:0正常,1停用 */
private String status;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
/** 父部门名称 */
private String parentName;
public Long getDeptId()
{
return deptId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public String getAncestors()
{
return ancestors;
}
public void setAncestors(String ancestors)
{
this.ancestors = ancestors;
}
public String getDeptName()
{
return deptName;
}
public void setDeptName(String deptName)
{
this.deptName = deptName;
}
public String getOrderNum()
{
return orderNum;
}
public void setOrderNum(String orderNum)
{
this.orderNum = orderNum;
}
public String getLeader()
{
return leader;
}
public void setLeader(String leader)
{
this.leader = leader;
}
public Long getLeaderId()
{
return leaderId;
}
public void setLeaderId(Long leaderId)
{
this.leaderId = leaderId;
}
public String getPhone()
{
return phone;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getDelFlag()
{
return delFlag;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("deptId", getDeptId())
.append("parentId", getParentId()).append("ancestors", getAncestors()).append("deptName", getDeptName())
.append("orderNum", getOrderNum()).append("leader", getLeader()).append("leaderId", getLeaderId()).append("phone", getPhone())
.append("email", getEmail()).append("status", getStatus()).append("delFlag", getDelFlag()).toString();
}
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.annotation.Excel;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 字典数据表 sys_dict_data
*
* @author ruoyi
*/
public class SysDictData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 字典编码 */
@Excel(name = "字典编码")
private Long dictCode;
/** 字典排序 */
@Excel(name = "字典排序")
private Long dictSort;
/** 字典标签 */
@Excel(name = "字典标签")
private String dictLabel;
/** 字典键值 */
@Excel(name = "字典键值")
private String dictValue;
/** 字典类型 */
@Excel(name = "字典类型")
private String dictType;
/** 样式属性(其他样式扩展) */
@Excel(name = "字典样式")
private String cssClass;
/** 表格字典样式 */
private String listClass;
/** 是否默认(Y是 N否) */
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
private String isDefault;
/** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
public Long getDictCode()
{
return dictCode;
}
public void setDictCode(Long dictCode)
{
this.dictCode = dictCode;
}
public Long getDictSort()
{
return dictSort;
}
public void setDictSort(Long dictSort)
{
this.dictSort = dictSort;
}
public String getDictLabel()
{
return dictLabel;
}
public void setDictLabel(String dictLabel)
{
this.dictLabel = dictLabel;
}
public String getDictValue()
{
return dictValue;
}
public void setDictValue(String dictValue)
{
this.dictValue = dictValue;
}
public String getDictType()
{
return dictType;
}
public void setDictType(String dictType)
{
this.dictType = dictType;
}
public String getCssClass()
{
return cssClass;
}
public void setCssClass(String cssClass)
{
this.cssClass = cssClass;
}
public String getListClass()
{
return listClass;
}
public void setListClass(String listClass)
{
this.listClass = listClass;
}
public String getIsDefault()
{
return isDefault;
}
public void setIsDefault(String isDefault)
{
this.isDefault = isDefault;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictCode", getDictCode())
.append("dictSort", getDictSort())
.append("dictLabel", getDictLabel())
.append("dictValue", getDictValue())
.append("dictType", getDictType())
.append("cssClass", getCssClass())
.append("listClass", getListClass())
.append("isDefault", getIsDefault())
.append("status", getStatus())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.annotation.Excel;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 字典类型表 sys_dict_type
*
* @author ruoyi
*/
public class SysDictType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 字典主键 */
@Excel(name = "字典主键")
private Long dictId;
/** 字典名称 */
@Excel(name = "字典名称")
private String dictName;
/** 字典类型 */
@Excel(name = "字典类型 ")
private String dictType;
/** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
public Long getDictId()
{
return dictId;
}
public void setDictId(Long dictId)
{
this.dictId = dictId;
}
public String getDictName()
{
return dictName;
}
public void setDictName(String dictName)
{
this.dictName = dictName;
}
public String getDictType()
{
return dictType;
}
public void setDictType(String dictType)
{
this.dictType = dictType;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictId", getDictId())
.append("dictName", getDictName())
.append("dictType", getDictType())
.append("status", getStatus())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.annotation.Excel;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 系统访问记录表 sys_logininfor
*
* @author ruoyi
*/
public class SysLogininfor extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
@Excel(name = "序号")
private Long infoId;
/** 用户账号 */
@Excel(name = "用户账号")
private String loginName;
/** 登录状态 0成功 1失败 */
@Excel(name = "登录状态", readConverterExp = "0=成功,1=失败")
private String status;
/** 登录IP地址 */
@Excel(name = "登录地址")
private String ipaddr;
/** 登录地点 */
@Excel(name = "登录地点")
private String loginLocation;
/** 浏览器类型 */
@Excel(name = "浏览器")
private String browser;
/** 操作系统 */
@Excel(name = "操作系统 ")
private String os;
/** 提示消息 */
@Excel(name = "提示消息")
private String msg;
/** 访问时间 */
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date loginTime;
public Long getInfoId()
{
return infoId;
}
public void setInfoId(Long infoId)
{
this.infoId = infoId;
}
public String getLoginName()
{
return loginName;
}
public void setLoginName(String loginName)
{
this.loginName = loginName;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getIpaddr()
{
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation;
}
public String getBrowser()
{
return browser;
}
public void setBrowser(String browser)
{
this.browser = browser;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public String getMsg()
{
return msg;
}
public void setMsg(String msg)
{
this.msg = msg;
}
public Date getLoginTime()
{
return loginTime;
}
public void setLoginTime(Date loginTime)
{
this.loginTime = loginTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("infoId", getInfoId())
.append("loginName", getLoginName())
.append("ipaddr", getIpaddr())
.append("loginLocation", getLoginLocation())
.append("browser", getBrowser())
.append("os", getOs())
.append("status", getStatus())
.append("msg", getMsg())
.append("loginTime", getLoginTime())
.toString();
}
}
\ No newline at end of file
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.ArrayList;
import java.util.List;
/**
* 菜单权限表 sys_menu
*
* @author ruoyi
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SysMenu extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 菜单ID */
private Long menuId;
/** 菜单名称 */
private String menuName;
/** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId;
/** 打开方式 (_blank新窗口) */
private String target;
/** 显示顺序 */
private String orderNum;
/** 类型:0目录,1菜单,2按钮 */
private String menuType;
/** 菜单URL */
private String menuKey;
/** 组件 */
private String component;
/** 菜单状态:0显示,1隐藏 */
private String visible;
/** 权限字符串 */
private String perms;
/** 菜单图标 */
private String icon;
/** 链接地址 */
private String path;
/** 重定向地址 */
private String redirect;
/** 隐藏子菜单 */
private Boolean hiddenChildren;
/** 隐藏 PageHeader 组件中的页面带的 面包屑和页面标题栏 */
private Boolean hiddenHeader;
/** 子菜单 */
private List<SysMenu> children = new ArrayList<SysMenu>();
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 通知公告表 sys_notice
*
* @author ruoyi
*/
public class SysNotice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 公告ID */
private Long noticeId;
/** 公告标题 */
private String noticeTitle;
/** 公告类型(1通知 2公告) */
private String noticeType;
/** 公告内容 */
private String noticeContent;
/** 公告状态(0正常 1关闭) */
private String status;
public Long getNoticeId()
{
return noticeId;
}
public void setNoticeId(Long noticeId)
{
this.noticeId = noticeId;
}
public void setNoticeTitle(String noticeTitle)
{
this.noticeTitle = noticeTitle;
}
public String getNoticeTitle()
{
return noticeTitle;
}
public void setNoticeType(String noticeType)
{
this.noticeType = noticeType;
}
public String getNoticeType()
{
return noticeType;
}
public void setNoticeContent(String noticeContent)
{
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
return noticeContent;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.annotation.Excel;
import com.ihooyah.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 操作日志记录表 oper_log
*
* @author ruoyi
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SysOperLog extends BaseEntity
{
//
private static final long serialVersionUID = -5556121284445360558L;
/** 日志主键 */
@Excel(name = "操作序号")
private Long operId;
/** 操作模块 */
@Excel(name = "操作模块")
private String title;
/** 业务类型(0其它 1新增 2修改 3删除) */
@Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
private Integer businessType;
/** 请求方法 */
@Excel(name = "请求方法")
private String method;
/** 请求方式 */
@Excel(name = "请求方式")
private String requestMethod;
/** 操作类别(0其它 1后台用户 2手机端用户) */
@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
private Integer operatorType;
/** 操作人员 */
@Excel(name = "操作人员")
private String operName;
/** 部门名称 */
@Excel(name = "部门名称")
private String deptName;
/** 请求url */
@Excel(name = "请求地址")
private String operUrl;
/** 操作地址 */
@Excel(name = "操作地址")
private String operIp;
/** 操作地点 */
@Excel(name = "操作地点")
private String operLocation;
/** 请求参数 */
@Excel(name = "请求参数")
private String operParam;
/** 操作状态(0正常 1异常) */
@Excel(name = "状态", readConverterExp = "0=正常,1=异常")
private Integer status;
/** 错误消息 */
@Excel(name = "错误消息")
private String errorMsg;
/** 操作时间 */
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date operTime;
}
package com.ihooyah.modules.system.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
/**
* 文件上传
*/
@Data
@Table(name = "sys_oss")
public class SysOss implements Serializable
{
//
private static final long serialVersionUID = 1356257283938225230L;
@Id
private Long id;
/** 文件名 */
private String fileName;
/** 文件后缀 */
private String fileSuffix;
/** URL地址 */
private String url;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 上传者 */
private String createBy;
/** 服务商 */
private Integer service;
/** 用于表格行内编辑*/
@Transient
private Boolean editable;
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.annotation.Excel;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 岗位表 sys_post
*
* @author ruoyi
*/
public class SysPost extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 岗位序号 */
@Excel(name = "岗位序号")
private Long postId;
/** 岗位编码 */
@Excel(name = "岗位编码")
private String postCode;
/** 岗位名称 */
@Excel(name = "岗位名称")
private String postName;
/** 岗位排序 */
@Excel(name = "岗位排序")
private String postSort;
/** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 用户是否存在此岗位标识 默认不存在 */
private boolean flag = false;
public Long getPostId()
{
return postId;
}
public void setPostId(Long postId)
{
this.postId = postId;
}
public String getPostCode()
{
return postCode;
}
public void setPostCode(String postCode)
{
this.postCode = postCode;
}
public String getPostName()
{
return postName;
}
public void setPostName(String postName)
{
this.postName = postName;
}
public String getPostSort()
{
return postSort;
}
public void setPostSort(String postSort)
{
this.postSort = postSort;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public boolean isFlag()
{
return flag;
}
public void setFlag(boolean flag)
{
this.flag = flag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("postId", getPostId())
.append("postCode", getPostCode())
.append("postName", getPostName())
.append("postSort", getPostSort())
.append("status", getStatus())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.annotation.Excel;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/**
* 角色表 sys_role
*
* @author ruoyi
*/
public class SysRole extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 角色ID */
@Excel(name = "角色序号")
private Long roleId;
/** 角色名称 */
@Excel(name = "角色名称")
private String roleName;
/** 角色权限 */
@Excel(name = "角色权限")
private String roleKey;
/** 角色排序 */
@Excel(name = "角色排序")
private String roleSort;
/** 数据范围(1:所有数据权限;2:自定数据权限) */
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限")
private String dataScope;
/** 角色状态(0正常 1停用) */
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
/** 用户是否存在此角色标识 默认不存在 */
private boolean flag = false;
/** 菜单组 */
private List<Long> menuIds;
/** 部门组(数据权限) */
private Long[] deptIds;
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public String getDataScope()
{
return dataScope;
}
public void setDataScope(String dataScope)
{
this.dataScope = dataScope;
}
public String getRoleName()
{
return roleName;
}
public void setRoleName(String roleName)
{
this.roleName = roleName;
}
public String getRoleKey()
{
return roleKey;
}
public void setRoleKey(String roleKey)
{
this.roleKey = roleKey;
}
public String getRoleSort()
{
return roleSort;
}
public void setRoleSort(String roleSort)
{
this.roleSort = roleSort;
}
public String getStatus()
{
return status;
}
public String getDelFlag()
{
return delFlag;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public void setStatus(String status)
{
this.status = status;
}
public boolean isFlag()
{
return flag;
}
public void setFlag(boolean flag)
{
this.flag = flag;
}
public List<Long> getMenuIds()
{
return menuIds;
}
public void setMenuIds(List<Long> menuIds)
{
this.menuIds = menuIds;
}
public Long[] getDeptIds()
{
return deptIds;
}
public void setDeptIds(Long[] deptIds)
{
this.deptIds = deptIds;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("roleName", getRoleName())
.append("roleKey", getRoleKey())
.append("roleSort", getRoleSort())
.append("dataScope", getDataScope())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 角色和部门关联 sys_role_dept
*
* @author ruoyi
*/
public class SysRoleDept
{
/** 角色ID */
private Long roleId;
/** 部门ID */
private Long deptId;
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public Long getDeptId()
{
return deptId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("deptId", getDeptId())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 角色和菜单关联 sys_role_menu
*
* @author ruoyi
*/
public class SysRoleMenu
{
/** 角色ID */
private Long roleId;
/** 菜单ID */
private Long menuId;
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("menuId", getMenuId())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ihooyah.common.annotation.Excel;
import com.ihooyah.common.entity.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
* 用户对象 sys_user
*
* @author ruoyi
*/
public class SysUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户ID */
@Excel(name = "用户序号", prompt = "用户编号")
private Long userId;
/** 部门ID */
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
private Long deptId;
/** 部门父ID */
private Long parentId;
/** 登录名称 */
@Excel(name = "登录名称")
private String loginName;
/** 用户名称 */
@Excel(name = "用户名称")
private String userName;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */
@Excel(name = "手机号码")
private String phonenumber;
/** 用户性别 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/** 用户头像 */
private String avatar;
/** 密码 */
private String password;
/** 盐加密 */
private String salt;
/** 帐号状态(0正常 1停用) */
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
/** 最后登陆IP */
@Excel(name = "最后登陆IP", type = Excel.Type.EXPORT)
private String loginIp;
/** 最后登陆时间 */
@Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date loginDate;
/** 部门对象 */
@Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT)
private SysDept dept;
private List<SysRole> roles;
/** 角色组 */
private List<Long> roleIds;
/** 岗位组 */
private Long[] postIds;
private Set<String> buttons;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public boolean isAdmin()
{
return isAdmin(this.userId);
}
public static boolean isAdmin(Long userId)
{
return userId != null && 1L == userId;
}
public Long getDeptId()
{
return deptId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public String getLoginName()
{
return loginName;
}
public void setLoginName(String loginName)
{
this.loginName = loginName;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public String getPhonenumber()
{
return phonenumber;
}
public void setPhonenumber(String phonenumber)
{
this.phonenumber = phonenumber;
}
public String getSex()
{
return sex;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getAvatar()
{
return avatar;
}
public void setAvatar(String avatar)
{
this.avatar = avatar;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getSalt()
{
return salt;
}
public void setSalt(String salt)
{
this.salt = salt;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getDelFlag()
{
return delFlag;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getLoginIp()
{
return loginIp;
}
public void setLoginIp(String loginIp)
{
this.loginIp = loginIp;
}
public Date getLoginDate()
{
return loginDate;
}
public void setLoginDate(Date loginDate)
{
this.loginDate = loginDate;
}
public SysDept getDept()
{
if (dept == null)
{
dept = new SysDept();
}
return dept;
}
public void setDept(SysDept dept)
{
this.dept = dept;
}
public List<SysRole> getRoles()
{
return roles;
}
public void setRoles(List<SysRole> roles)
{
this.roles = roles;
}
public List<Long> getRoleIds()
{
return roleIds;
}
public void setRoleIds(List<Long> roleIds)
{
this.roleIds = roleIds;
}
public Long[] getPostIds()
{
return postIds;
}
public void setPostIds(Long[] postIds)
{
this.postIds = postIds;
}
public Set<String> getButtons()
{
return buttons;
}
public void setButtons(Set<String> buttons)
{
this.buttons = buttons;
}
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("userId", getUserId())
.append("deptId", getDeptId()).append("loginName", getLoginName()).append("userName", getUserName())
.append("email", getEmail()).append("phonenumber", getPhonenumber()).append("sex", getSex())
.append("avatar", getAvatar()).append("password", getPassword()).append("salt", getSalt())
.append("status", getStatus()).append("delFlag", getDelFlag()).append("loginIp", getLoginIp())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import com.ihooyah.common.entity.BaseEntity;
import com.ihooyah.common.enums.OnlineStatus;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 当前在线会话 sys_user_online
*
* @author ruoyi
*/
public class SysUserOnline extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户会话id */
private String sessionId;
/** 部门名称 */
private String deptName;
/** 登录名称 */
private String loginName;
/** 登录IP地址 */
private String ipaddr;
/** 登录地址 */
private String loginLocation;
/** 浏览器类型 */
private String browser;
/** 操作系统 */
private String os;
/** session创建时间 */
private Date startTimestamp;
/** session最后访问时间 */
private Date lastAccessTime;
/** 超时时间,单位为分钟 */
private Long expireTime;
/** 在线状态 */
private OnlineStatus status = OnlineStatus.on_line;
public String getSessionId()
{
return sessionId;
}
public void setSessionId(String sessionId)
{
this.sessionId = sessionId;
}
public String getDeptName()
{
return deptName;
}
public void setDeptName(String deptName)
{
this.deptName = deptName;
}
public String getLoginName()
{
return loginName;
}
public void setLoginName(String loginName)
{
this.loginName = loginName;
}
public String getIpaddr()
{
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation;
}
public String getBrowser()
{
return browser;
}
public void setBrowser(String browser)
{
this.browser = browser;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public Date getStartTimestamp()
{
return startTimestamp;
}
public void setStartTimestamp(Date startTimestamp)
{
this.startTimestamp = startTimestamp;
}
public Date getLastAccessTime()
{
return lastAccessTime;
}
public void setLastAccessTime(Date lastAccessTime)
{
this.lastAccessTime = lastAccessTime;
}
public Long getExpireTime()
{
return expireTime;
}
public void setExpireTime(Long expireTime)
{
this.expireTime = expireTime;
}
public OnlineStatus getStatus()
{
return status;
}
public void setStatus(OnlineStatus status)
{
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("sessionId", getSessionId())
.append("loginName", getLoginName())
.append("deptName", getDeptName())
.append("ipaddr", getIpaddr())
.append("loginLocation", getLoginLocation())
.append("browser", getBrowser())
.append("os", getOs())
.append("status", getStatus())
.append("startTimestamp", getStartTimestamp())
.append("lastAccessTime", getLastAccessTime())
.append("expireTime", getExpireTime())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户和岗位关联 sys_user_post
*
* @author ruoyi
*/
public class SysUserPost
{
/** 用户ID */
private Long userId;
/** 岗位ID */
private Long postId;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getPostId()
{
return postId;
}
public void setPostId(Long postId)
{
this.postId = postId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("postId", getPostId())
.toString();
}
}
package com.ihooyah.modules.system.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户和角色关联 sys_user_role
*
* @author ruoyi
*/
public class SysUserRole
{
/** 用户ID */
private Long userId;
/** 角色ID */
private Long roleId;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("roleId", getRoleId())
.toString();
}
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.Districts;
import java.util.List;
/**
* 地区 数据层
*
* @author ruoyi
* @date 2018-12-19
*/
public interface DistrictsMapper
{
/**
* 查询地区信息
*
* @param id 地区ID
* @return 地区信息
*/
public Districts selectDistrictsById(Integer id);
/**
* 查询地区列表
*
* @param districts 地区信息
* @return 地区集合
*/
public List<Districts> selectDistrictsList(Districts districts);
/**
* 新增地区
*
* @param districts 地区信息
* @return 结果
*/
public int insertDistricts(Districts districts);
/**
* 修改地区
*
* @param districts 地区信息
* @return 结果
*/
public int updateDistricts(Districts districts);
/**
* 删除地区
*
* @param id 地区ID
* @return 结果
*/
public int deleteDistrictsById(Integer id);
/**
* 批量删除地区
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteDistrictsByIds(String[] ids);
}
\ No newline at end of file
package com.ihooyah.modules.system.mapper;
import com.ihooyah.common.mapper.BaseMapper;
import com.ihooyah.modules.system.entity.Donate;
/**
* 捐赠 数据层
*
*/
public interface DonateMapper extends BaseMapper<Donate>
{
}
\ No newline at end of file
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysConfig;
import java.util.List;
/**
* 参数配置 数据层
*
* @author ruoyi
*/
public interface SysConfigMapper
{
/**
* 查询参数配置信息
*
* @param config 参数配置信息
* @return 参数配置信息
*/
public SysConfig selectConfig(SysConfig config);
/**
* 查询参数配置列表
*
* @param config 参数配置信息
* @return 参数配置集合
*/
public List<SysConfig> selectConfigList(SysConfig config);
/**
* 根据键名查询参数配置信息
*
* @param configKey 参数键名
* @return 参数配置信息
*/
public SysConfig checkConfigKeyUnique(String configKey);
/**
* 新增参数配置
*
* @param config 参数配置信息
* @return 结果
*/
public int insertConfig(SysConfig config);
/**
* 修改参数配置
*
* @param config 参数配置信息
* @return 结果
*/
public int updateConfig(SysConfig config);
/**
* 批量删除参数配置
*
* @param configIds 需要删除的数据ID
* @return 结果
*/
public int deleteConfigByIds(String[] configIds);
}
\ No newline at end of file
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysDept;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* 部门管理 数据层
*
* @author ruoyi
*/
public interface SysDeptMapper
{
/**
* 查询部门人数
*
* @param dept 部门信息
* @return 结果
*/
public int selectDeptCount(SysDept dept);
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果
*/
public int checkDeptExistUser(Long deptId);
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectDeptList(SysDept dept);
/**
* 删除部门管理信息
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
/**
* 新增部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int insertDept(SysDept dept);
/**
* 修改部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int updateDept(SysDept dept);
/**
* 修改子元素关系
*
* @param depts 子元素
* @return 结果
*/
public int updateDeptChildren(@Param("depts") List<SysDept> depts);
/**
* 根据部门ID查询信息
*
* @param deptId 部门ID
* @return 部门信息
*/
public SysDept selectDeptById(Long deptId);
/**
* 校验部门名称是否唯一
*
* @param deptName 部门名称
* @param parentId 父部门ID
* @return 结果
*/
public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
/**
* 根据角色ID查询部门
*
* @param roleId 角色ID
* @return 部门列表
*/
public List<String> selectRoleDeptTree(Long roleId);
/**
* 修改所在部门的父级部门状态
*
* @param dept 部门
*/
public void updateDeptStatus(SysDept dept);
/**
* 根据ID查询所有子部门
* @param id
* @return
*/
public List<SysDept> selectChildrenDeptById(Long id);
/**
* 根据角色编号查询所有部门ID
* @param roleId
* @return
* @author zmr
*/
public Set<String> selectRoleDeptIds(Long roleId);
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysDictData;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 字典表 数据层
*
* @author ruoyi
*/
public interface SysDictDataMapper
{
/**
* 根据条件分页查询字典数据
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataList(SysDictData dictData);
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
public List<SysDictData> selectDictDataByType(String dictType);
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
/**
* 根据字典数据ID查询信息
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
public SysDictData selectDictDataById(Long dictCode);
/**
* 查询字典数据
*
* @param dictType 字典类型
* @return 字典数据
*/
public int countDictDataByType(String dictType);
/**
* 通过字典ID删除字典数据信息
*
* @param dictCode 字典数据ID
* @return 结果
*/
public int deleteDictDataById(Long dictCode);
/**
* 批量删除字典数据
*
* @param ids 需要删除的数据
* @return 结果
*/
public int deleteDictDataByIds(String[] ids);
/**
* 新增字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int insertDictData(SysDictData dictData);
/**
* 修改字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int updateDictData(SysDictData dictData);
/**
* 同步修改字典类型
*
* @param oldDictType 旧字典类型
* @param newDictType 新旧字典类型
* @return 结果
*/
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysDictType;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 字典表 数据层
*
* @author ruoyi
*/
@Mapper
public interface SysDictTypeMapper
{
/**
* 根据条件分页查询字典类型
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeList(SysDictType dictType);
/**
* 根据所有字典类型
*
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeAll();
/**
* 根据字典类型ID查询信息
*
* @param dictId 字典类型ID
* @return 字典类型
*/
public SysDictType selectDictTypeById(Long dictId);
/**
* 通过字典ID删除字典信息
*
* @param dictId 字典ID
* @return 结果
*/
public int deleteDictTypeById(Long dictId);
/**
* 批量删除字典类型
*
* @param ids 需要删除的数据
* @return 结果
*/
public int deleteDictTypeByIds(Long[] ids);
/**
* 新增字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int insertDictType(SysDictType dictType);
/**
* 修改字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int updateDictType(SysDictType dictType);
/**
* 校验字典类型称是否唯一
*
* @param dictType 字典类型
* @return 结果
*/
public SysDictType checkDictTypeUnique(String dictType);
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysLogininfor;
import java.util.List;
/**
* 系统访问日志情况信息 数据层
*
* @author ruoyi
*/
public interface SysLogininforMapper
{
/**
* 新增系统登录日志
*
* @param logininfor 访问日志对象
*/
public void insertLogininfor(SysLogininfor logininfor);
/**
* 查询系统登录日志集合
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
public List<SysLogininfor> selectLogininforList(SysLogininfor logininfor);
/**
* 批量删除系统登录日志
*
* @param ids 需要删除的数据
* @return 结果
*/
public int deleteLogininforByIds(String[] ids);
/**
* 清空系统登录日志
*
* @return 结果
*/
public int cleanLogininfor();
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysMenu;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 菜单表 数据层
*
* @author ruoyi
*/
public interface SysMenuMapper
{
/**
* 查询系统所有菜单(含按钮)
*
* @return 菜单列表
*/
public List<SysMenu> selectMenuAll();
/**
* 查询系统正常显示菜单(不含按钮)
*
* @return 菜单列表
*/
public List<SysMenu> selectMenuNormalAll();
/**
* 根据用户ID查询菜单
*
* @param userId 用户ID
* @return 菜单列表
*/
public List<SysMenu> selectMenusByUserId(Long userId);
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
public List<String> selectPermsByUserId(Long userId);
/**
* 根据角色ID查询菜单
*
* @param roleId 角色ID
* @return 权限列表
*/
public List<SysMenu> selectMenuIdsByRoleId(Long roleId);
/**
* 根据角色ID查询菜单
*
* @param roleId 角色ID
* @return 菜单列表
*/
public List<String> selectMenuTree(Long roleId);
/**
* 查询系统菜单列表
*
* @param menu 菜单信息
* @return 菜单列表
*/
public List<SysMenu> selectMenuList(SysMenu menu);
/**
* 删除菜单管理信息
*
* @param menuId 菜单ID
* @return 结果
*/
public int deleteMenuById(Long menuId);
/**
* 根据菜单ID查询信息
*
* @param menuId 菜单ID
* @return 菜单信息
*/
public SysMenu selectMenuById(Long menuId);
/**
* 查询菜单数量
*
* @param parentId 菜单父ID
* @return 结果
*/
public int selectCountMenuByParentId(Long parentId);
/**
* 新增菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int insertMenu(SysMenu menu);
/**
* 修改菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int updateMenu(SysMenu menu);
/**
* 校验菜单名称是否唯一
*
* @param menuName 菜单名称
* @param parentId 父菜单ID
* @return 结果
*/
public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysNotice;
import java.util.List;
/**
* 公告 数据层
*
* @author ruoyi
*/
public interface SysNoticeMapper
{
/**
* 查询公告信息
*
* @param noticeId 公告ID
* @return 公告信息
*/
public SysNotice selectNoticeById(Long noticeId);
/**
* 查询公告列表
*
* @param notice 公告信息
* @return 公告集合
*/
public List<SysNotice> selectNoticeList(SysNotice notice);
/**
* 新增公告
*
* @param notice 公告信息
* @return 结果
*/
public int insertNotice(SysNotice notice);
/**
* 修改公告
*
* @param notice 公告信息
* @return 结果
*/
public int updateNotice(SysNotice notice);
/**
* 批量删除公告
*
* @param noticeIds 需要删除的数据ID
* @return 结果
*/
public int deleteNoticeByIds(String[] noticeIds);
}
\ No newline at end of file
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysOperLog;
import java.util.List;
/**
* 操作日志 数据层
*
* @author ruoyi
*/
public interface SysOperLogMapper
{
/**
* 新增操作日志
*
* @param operLog 操作日志对象
*/
public void insertOperlog(SysOperLog operLog);
/**
* 查询系统操作日志集合
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
/**
* 批量删除系统操作日志
*
* @param ids 需要删除的数据
* @return 结果
*/
public int deleteOperLogByIds(String[] ids);
/**
* 查询操作日志详细
*
* @param operId 操作ID
* @return 操作日志对象
*/
public SysOperLog selectOperLogById(Long operId);
/**
* 清空操作日志
*/
public void cleanOperLog();
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.common.mapper.BaseMapper;
import com.ihooyah.modules.system.entity.SysOss;
/**
* 文件上传
*/
public interface SysOssMapper extends BaseMapper<SysOss>
{
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysPost;
import java.util.List;
/**
* 岗位信息 数据层
*
* @author ruoyi
*/
public interface SysPostMapper
{
/**
* 查询岗位数据集合
*
* @param post 岗位信息
* @return 岗位数据集合
*/
public List<SysPost> selectPostList(SysPost post);
/**
* 查询所有岗位
*
* @return 岗位列表
*/
public List<SysPost> selectPostAll();
/**
* 根据用户ID查询岗位
*
* @param userId 用户ID
* @return 岗位列表
*/
public List<SysPost> selectPostsByUserId(Long userId);
/**
* 通过岗位ID查询岗位信息
*
* @param postId 岗位ID
* @return 角色对象信息
*/
public SysPost selectPostById(Long postId);
/**
* 批量删除岗位信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deletePostByIds(Long[] ids);
/**
* 修改岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int updatePost(SysPost post);
/**
* 新增岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int insertPost(SysPost post);
/**
* 校验岗位名称
*
* @param postName 岗位名称
* @return 结果
*/
public SysPost checkPostNameUnique(String postName);
/**
* 校验岗位编码
*
* @param postCode 岗位编码
* @return 结果
*/
public SysPost checkPostCodeUnique(String postCode);
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysRoleDept;
import java.util.List;
/**
* 角色与部门关联表 数据层
*
* @author ruoyi
*/
public interface SysRoleDeptMapper
{
/**
* 通过角色ID删除角色和部门关联
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleDeptByRoleId(Long roleId);
/**
* 批量删除角色部门关联信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteRoleDept(Long[] ids);
/**
* 查询部门使用数量
*
* @param deptId 部门ID
* @return 结果
*/
public int selectCountRoleDeptByDeptId(Long deptId);
/**
* 批量新增角色部门信息
*
* @param roleDeptList 角色部门列表
* @return 结果
*/
public int batchRoleDept(List<SysRoleDept> roleDeptList);
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysRole;
import java.util.List;
/**
* 角色表 数据层
*
* @author ruoyi
*/
public interface SysRoleMapper
{
/**
* 根据条件分页查询角色数据
*
* @param role 角色信息
* @return 角色数据集合信息
*/
public List<SysRole> selectRoleList(SysRole role);
/**
* 根据用户ID查询角色
*
* @param userId 用户ID
* @return 角色列表
*/
public List<SysRole> selectRolesByUserId(Long userId);
/**
* 通过角色ID查询角色
*
* @param roleId 角色ID
* @return 角色对象信息
*/
public SysRole selectRoleById(Long roleId);
/**
* 通过角色ID删除角色
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleById(Long roleId);
/**
* 批量角色用户信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteRoleByIds(Long[] ids);
/**
* 修改角色信息
*
* @param role 角色信息
* @return 结果
*/
public int updateRole(SysRole role);
/**
* 新增角色信息
*
* @param role 角色信息
* @return 结果
*/
public int insertRole(SysRole role);
/**
* 校验角色名称是否唯一
*
* @param roleName 角色名称
* @return 角色信息
*/
public SysRole checkRoleNameUnique(String roleName);
/**
* 校验角色权限是否唯一
*
* @param roleKey 角色权限
* @return 角色信息
*/
public SysRole checkRoleKeyUnique(String roleKey);
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysRoleMenu;
import java.util.List;
/**
* 角色与菜单关联表 数据层
*
* @author ruoyi
*/
public interface SysRoleMenuMapper
{
/**
* 通过角色ID删除角色和菜单关联
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleMenuByRoleId(Long roleId);
/**
* 批量删除角色菜单关联信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteRoleMenu(Long[] ids);
/**
* 查询菜单使用数量
*
* @param menuId 菜单ID
* @return 结果
*/
public int selectCountRoleMenuByMenuId(Long menuId);
/**
* 批量新增角色菜单信息
*
* @param roleMenuList 角色菜单列表
* @return 结果
*/
public int batchRoleMenu(List<SysRoleMenu> roleMenuList);
}
package com.ihooyah.modules.system.mapper;
import com.ihooyah.modules.system.entity.SysUser;
import java.util.List;
import java.util.Set;
/**
* 用户表 数据层
*
* @author ruoyi
*/
public interface SysUserMapper
{
/**
* 根据条件分页查询用户列表
*
* @param sysUser 用户信息
* @return 用户信息集合信息
*/
public List<SysUser> selectUserList(SysUser sysUser);
/**
* 根据条件分页查询未已配用户角色列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<SysUser> selectAllocatedList(SysUser user);
/**
* 根据条件分页查询未分配用户角色列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<SysUser> selectUnallocatedList(SysUser user);
/**
* 通过用户名查询用户
*
* @param userName 用户名
* @return 用户对象信息
*/
public SysUser selectUserByLoginName(String userName);
/**
* 通过手机号码查询用户
*
* @param phoneNumber 手机号码
* @return 用户对象信息
*/
public SysUser selectUserByPhoneNumber(String phoneNumber);
/**
* 通过邮箱查询用户
*
* @param email 邮箱
* @return 用户对象信息
*/
public SysUser selectUserByEmail(String email);
/**
* 通过用户ID查询用户
*
* @param userId 用户ID
* @return 用户对象信息
*/
public SysUser selectUserById(Long userId);
/**
* 通过用户ID删除用户
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserById(Long userId);
/**
* 批量删除用户信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteUserByIds(Long[] ids);
/**
* 修改用户信息
*
* @param user 用户信息
* @return 结果
*/
public int updateUser(SysUser user);
/**
* 新增用户信息
*
* @param user 用户信息
* @return 结果
*/
public int insertUser(SysUser user);
/**
* 校验用户名称是否唯一
*
* @param loginName 登录名称
* @return 结果
*/
public int checkLoginNameUnique(String loginName);
/**
* 校验手机号码是否唯一
*
* @param phonenumber 手机号码
* @return 结果
*/
public SysUser checkPhoneUnique(String phonenumber);
/**
* 校验email是否唯一
*
* @param email 用户邮箱
* @return 结果
*/
public SysUser checkEmailUnique(String email);
/**
* 查询拥有当前角色的所有用户编号
* @param roleIds 角色编号
* @return
* @author zmr
*/
public Set<Long> selectUserIdsHasRoles(Long[] roleIds);
/**
* 查询拥有当前角色的所有用户编号
* @param deptIds 部门编号
* @return
* @author zmr
*/
public Set<Long> selectUserIdsInDepts(Long[] deptIds);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment