Commit 72c20035 by xlx

新增mybatis模块

parent 52ba6026
Showing with 907 additions and 1116 deletions
...@@ -22,7 +22,13 @@ ...@@ -22,7 +22,13 @@
<groupId>com.matchtech</groupId> <groupId>com.matchtech</groupId>
<artifactId>matchtech-common-core</artifactId> <artifactId>matchtech-common-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-mybatis</artifactId>
<version>3.1.1</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -2,17 +2,12 @@ package com.matchtech.system.api; ...@@ -2,17 +2,12 @@ package com.matchtech.system.api;
import com.matchtech.common.core.constants.SecurityConstants; import com.matchtech.common.core.constants.SecurityConstants;
import com.matchtech.common.core.constants.ServiceNameConstants; import com.matchtech.common.core.constants.ServiceNameConstants;
import com.matchtech.common.core.domain.R; import com.matchtech.common.dto.page.resp.ApiResponseEntity;
import com.matchtech.common.core.page.resp.ApiResponseEntity;
import com.matchtech.system.api.domain.SysUser;
import com.matchtech.system.api.factory.RemoteUserFallbackFactory; import com.matchtech.system.api.factory.RemoteUserFallbackFactory;
import com.matchtech.system.api.model.LoginUser; import com.matchtech.system.api.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
/** /**
......
...@@ -3,7 +3,7 @@ package com.matchtech.system.api.domain; ...@@ -3,7 +3,7 @@ package com.matchtech.system.api.domain;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
import jakarta.validation.constraints.Email; import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
......
package com.matchtech.system.api.domain; package com.matchtech.system.api.domain;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
......
package com.matchtech.system.api.domain; package com.matchtech.system.api.domain;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern; import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
......
...@@ -4,7 +4,7 @@ import java.util.Date; ...@@ -4,7 +4,7 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.matchtech.common.core.annotation.Excel; import com.matchtech.common.core.annotation.Excel;
import com.matchtech.common.core.annotation.Excel.ColumnType; import com.matchtech.common.core.annotation.Excel.ColumnType;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
/** /**
* 系统访问记录表 sys_logininfor * 系统访问记录表 sys_logininfor
......
...@@ -4,7 +4,7 @@ import java.util.Date; ...@@ -4,7 +4,7 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.matchtech.common.core.annotation.Excel; import com.matchtech.common.core.annotation.Excel;
import com.matchtech.common.core.annotation.Excel.ColumnType; import com.matchtech.common.core.annotation.Excel.ColumnType;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
/** /**
* 操作日志记录表 oper_log * 操作日志记录表 oper_log
......
package com.matchtech.system.api.domain; package com.matchtech.system.api.domain;
import java.util.Set; import com.matchtech.common.core.annotation.Excel;
import com.matchtech.common.core.annotation.Excel.ColumnType;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import java.util.Set;
import com.matchtech.common.core.annotation.Excel;
import com.matchtech.common.core.annotation.Excel.ColumnType;
/** /**
* 角色表 sys_role * 角色表 sys_role
......
...@@ -5,7 +5,7 @@ import com.matchtech.common.core.annotation.Excel.ColumnType; ...@@ -5,7 +5,7 @@ import com.matchtech.common.core.annotation.Excel.ColumnType;
import com.matchtech.common.core.annotation.Excel.Type; import com.matchtech.common.core.annotation.Excel.Type;
import com.matchtech.common.core.annotation.Excels; import com.matchtech.common.core.annotation.Excels;
import com.matchtech.common.core.constants.UserConstants; import com.matchtech.common.core.constants.UserConstants;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
......
package com.matchtech.system.api.factory; package com.matchtech.system.api.factory;
import com.matchtech.common.core.domain.R; import com.matchtech.common.dto.page.resp.ApiResponseEntity;
import com.matchtech.common.core.page.resp.ApiResponseEntity;
import com.matchtech.system.api.RemoteUserService; import com.matchtech.system.api.RemoteUserService;
import com.matchtech.system.api.domain.SysUser;
import com.matchtech.system.api.model.LoginUser; import com.matchtech.system.api.model.LoginUser;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
......
...@@ -55,9 +55,11 @@ ...@@ -55,9 +55,11 @@
<!-- matchtech Common Swagger --> <!-- matchtech Common Swagger -->
<dependency> <dependency>
<groupId>com.matchtech</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>matchtech-common-swagger</artifactId> <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>4.3.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.matchtech.matchtechauthlocal.controller; package com.matchtech.matchtechauthlocal.controller;
import com.matchtech.common.core.constants.SecurityConstants; import com.matchtech.common.core.constants.SecurityConstants;
import com.matchtech.common.core.page.resp.ApiResponseEntity; import com.matchtech.common.dto.page.resp.ApiResponseEntity;
import com.matchtech.common.core.page.resp.ApiResponseUtils; import com.matchtech.common.dto.page.resp.ApiResponseUtils;
import com.matchtech.common.core.web.controller.BaseController; import com.matchtech.common.core.web.controller.BaseController;
import com.matchtech.common.dto.login.SysLoginDto; import com.matchtech.common.dto.login.SysLoginDto;
import com.matchtech.common.dto.login.SysLoginVo;
import com.matchtech.common.dto.login.TokenDto; import com.matchtech.common.dto.login.TokenDto;
import com.matchtech.common.redis.constant.RedisConstants; import com.matchtech.common.redis.constant.RedisConstants;
import com.matchtech.common.redis.service.RedisUtils; import com.matchtech.common.redis.service.RedisUtils;
...@@ -22,8 +21,6 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -22,8 +21,6 @@ import org.springframework.web.bind.annotation.RequestBody;
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 java.util.Map;
@Tag(name = "系统登录") @Tag(name = "系统登录")
@RestController @RestController
@RequestMapping(value = "a/sys/") @RequestMapping(value = "a/sys/")
......
...@@ -35,12 +35,6 @@ ...@@ -35,12 +35,6 @@
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>
</dependency> </dependency>
<!-- Spring Web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<!-- Transmittable ThreadLocal --> <!-- Transmittable ThreadLocal -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
...@@ -53,26 +47,6 @@ ...@@ -53,26 +47,6 @@
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
</dependency>
<!-- MyBatis 测试 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>3.0.2</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>com.oracle.database.jdbc</groupId> <groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId> <artifactId>ojdbc11</artifactId>
...@@ -133,12 +107,6 @@ ...@@ -133,12 +107,6 @@
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
</dependency> </dependency>
<!-- Java Servlet -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
...@@ -150,8 +118,9 @@ ...@@ -150,8 +118,9 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.matchtech</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>matchtech-common-swagger</artifactId> <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>4.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -170,6 +139,16 @@ ...@@ -170,6 +139,16 @@
<version>${mapstruct.version}</version> <version>${mapstruct.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-dto</artifactId>
</dependency>
</dependencies> </dependencies>
<!-- matchtech-common-core中的spring-web依赖(第31行)-->
<!-- matchtech-common-core中的jakarta.servlet-api依赖(第121行)-->
<!-- matchtech-common-core中的mybatis-plus-boot-starter等依赖(第49-57行)-->
</project> </project>
...@@ -7,7 +7,6 @@ import java.lang.annotation.Target; ...@@ -7,7 +7,6 @@ import java.lang.annotation.Target;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.IndexedColors;
import com.matchtech.common.core.utils.poi.ExcelHandlerAdapter;
/** /**
* 自定义导出Excel数据注解 * 自定义导出Excel数据注解
...@@ -140,11 +139,6 @@ public @interface Excel ...@@ -140,11 +139,6 @@ public @interface Excel
public HorizontalAlignment align() default HorizontalAlignment.CENTER; public HorizontalAlignment align() default HorizontalAlignment.CENTER;
/** /**
* 自定义数据处理器
*/
public Class<?> handler() default ExcelHandlerAdapter.class;
/**
* 自定义数据处理器参数 * 自定义数据处理器参数
*/ */
public String[] args() default {}; public String[] args() default {};
......
package com.matchtech.common.core.page;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@Schema(description = "分页响应VO")
public class PageVO<T> implements Serializable {
private static final long serialVersionUID = -5165369386930215118L;
@Schema(description = "返回数据")
private List<T> list;
@Schema(description = "总条数")
private Long count;
@Schema(description = "当前页")
private Integer pageNo;
@Schema(description = "总页数")
private Integer pages;
@Schema(description = "每页条数")
private Integer pageSize;
public PageVO(List<T> list, Long count, Integer pageNo, Integer pages, Integer pageSize) {
this.list = list;
this.count = count;
this.pageNo = pageNo;
this.pageSize = pageSize;
this.pages = pages;
}
public PageVO(Page<?> page, List<T> list) {
this.list = list;
this.count = page.getTotal();
this.pageNo = (int) page.getCurrent();
this.pageSize = (int) page.getSize();
this.pages = (int) page.getPages();
}
public static <T> PageVO<T> getPage(Page<T> pages) {
PageVO<T> data = new PageVO<>();
data.setList(pages.getRecords());
data.setCount(pages.getTotal());
data.setPageNo((int) pages.getCurrent());
data.setPages((int) pages.getPages());
data.setPageSize((int) pages.getSize());
return data;
}
public static <T> PageVO<T> getPage(Page<?> pages, List<T> list) {
PageVO<T> data = new PageVO<>();
data.setList(list);
data.setCount(pages.getTotal());
data.setPageNo((int) pages.getCurrent());
data.setPages((int) pages.getPages());
data.setPageSize((int) pages.getSize());
return data;
}
public PageVO() {
}
}
package com.matchtech.common.core.page.result;
import com.matchtech.common.core.utils.LocaleUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@Data
@Schema(description = "excel导入错误信息VO")
public class ExcelErrorVo implements Serializable {
@Schema(description = "行数")
private Integer row;
@Schema(description = "标题")
private String title;
@Schema(description = "错误信息")
private String msg;
public ExcelErrorVo(Integer row, String title, String msg) {
this.row = row;
this.title = title;
this.msg = LocaleUtil.getMessage(msg);
}
public ExcelErrorVo() {
}
public static void isNotNull(String value, List<ExcelErrorVo> errorVoList, int i, String title) {
if (StringUtils.isBlank(value)) {
errorVoList.add(new ExcelErrorVo(i, title, "数据不为空"));
}
}
public static void notExists(String value, List<ExcelErrorVo> errorVoList, int i, String title) {
if (StringUtils.isBlank(value)) {
errorVoList.add(new ExcelErrorVo(i, title, "数据库数据不存在"));
}
}
public static void exists(Map<String, String> emailMap, String key, List<ExcelErrorVo> errorVoList, int i, String title) {
if (StringUtils.isBlank(key)) {
return;
}
String value = emailMap.get(key);
if (StringUtils.isNotBlank(value)) {
errorVoList.add(new ExcelErrorVo(i, title, "数据重复"));
} else {
emailMap.put(key, "system");
}
}
}
package com.matchtech.common.core.page.result;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@Schema(description = "excel导入VO")
public class ExcelImportVo implements Serializable {
@Schema(description = "错误信息导入")
private String message;
@Schema(description = "总条数")
private Integer totalCount;
@Schema(description = "错误条数")
private Integer errorCount;
@Schema(description = "成功条数")
private Integer successCount;
@Schema(description = "错误信息")
private List<?> list;
@Schema(description = "成功返回的信息")
private List<?> successList;
}
package com.matchtech.common.core.utils;
import com.github.pagehelper.PageHelper;
import com.matchtech.common.core.utils.sql.SqlUtil;
import com.matchtech.common.core.web.page.PageDomain;
import com.matchtech.common.core.web.page.TableSupport;
/**
* 分页工具类
*
* @author matchtech
*/
public class PageUtils extends PageHelper
{
/**
* 设置请求分页数据
*/
public static void startPage()
{
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
Boolean reasonable = pageDomain.getReasonable();
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
}
/**
* 清理分页的线程变量
*/
public static void clearPage()
{
PageHelper.clearPage();
}
}
...@@ -8,8 +8,6 @@ import java.io.OutputStream; ...@@ -8,8 +8,6 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
...@@ -131,41 +129,6 @@ public class FileUtils ...@@ -131,41 +129,6 @@ public class FileUtils
} }
/** /**
* 下载文件名重新编码
*
* @param request 请求对象
* @param fileName 文件名
* @return 编码后的文件名
*/
public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException
{
final String agent = request.getHeader("USER-AGENT");
String filename = fileName;
if (agent.contains("MSIE"))
{
// IE浏览器
filename = URLEncoder.encode(filename, "utf-8");
filename = filename.replace("+", " ");
}
else if (agent.contains("Firefox"))
{
// 火狐浏览器
filename = new String(fileName.getBytes(), "ISO8859-1");
}
else if (agent.contains("Chrome"))
{
// google浏览器
filename = URLEncoder.encode(filename, "utf-8");
}
else
{
// 其它浏览器
filename = URLEncoder.encode(filename, "utf-8");
}
return filename;
}
/**
* 返回文件名 * 返回文件名
* *
* @param filePath 文件 * @param filePath 文件
...@@ -223,21 +186,7 @@ public class FileUtils ...@@ -223,21 +186,7 @@ public class FileUtils
* @param realFileName 真实文件名 * @param realFileName 真实文件名
* @return * @return
*/ */
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException
{
String percentEncodedFileName = percentEncode(realFileName);
StringBuilder contentDispositionValue = new StringBuilder();
contentDispositionValue.append("attachment; filename=")
.append(percentEncodedFileName)
.append(";")
.append("filename*=")
.append("utf-8''")
.append(percentEncodedFileName);
response.setHeader("Content-disposition", contentDispositionValue.toString());
response.setHeader("download-filename", percentEncodedFileName);
}
/** /**
* 百分号编码工具方法 * 百分号编码工具方法
......
package com.matchtech.common.core.web.domain;
import com.matchtech.common.core.domain.BaseEntity;
import java.util.ArrayList;
import java.util.List;
/**
* Tree基类
*
* @author matchtech
*/
public class TreeEntity extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId;
/** 显示顺序 */
private Integer orderNum;
/** 祖级列表 */
private String ancestors;
/** 子部门 */
private List<?> children = new ArrayList<>();
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
public String getAncestors()
{
return ancestors;
}
public void setAncestors(String ancestors)
{
this.ancestors = ancestors;
}
public List<?> getChildren()
{
return children;
}
public void setChildren(List<?> children)
{
this.children = children;
}
}
package com.matchtech.common.core.web.page;
import com.matchtech.common.core.utils.StringUtils;
/**
* 分页数据
*
* @author matchtech
*/
public class PageDomain
{
/** 当前记录起始索引 */
private Integer pageNum;
/** 每页显示记录数 */
private Integer pageSize;
/** 排序列 */
private String orderByColumn;
/** 排序的方向desc或者asc */
private String isAsc = "asc";
/** 分页参数合理化 */
private Boolean reasonable = true;
public String getOrderBy()
{
if (StringUtils.isEmpty(orderByColumn))
{
return "";
}
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
}
public Integer getPageNum()
{
return pageNum;
}
public void setPageNum(Integer pageNum)
{
this.pageNum = pageNum;
}
public Integer getPageSize()
{
return pageSize;
}
public void setPageSize(Integer pageSize)
{
this.pageSize = pageSize;
}
public String getOrderByColumn()
{
return orderByColumn;
}
public void setOrderByColumn(String orderByColumn)
{
this.orderByColumn = orderByColumn;
}
public String getIsAsc()
{
return isAsc;
}
public void setIsAsc(String isAsc)
{
if (StringUtils.isNotEmpty(isAsc))
{
// 兼容前端排序类型
if ("ascending".equals(isAsc))
{
isAsc = "asc";
}
else if ("descending".equals(isAsc))
{
isAsc = "desc";
}
this.isAsc = isAsc;
}
}
public Boolean getReasonable()
{
if (StringUtils.isNull(reasonable))
{
return Boolean.TRUE;
}
return reasonable;
}
public void setReasonable(Boolean reasonable)
{
this.reasonable = reasonable;
}
}
package com.matchtech.common.core.web.page;
import java.io.Serializable;
import java.util.List;
/**
* 表格分页数据对象
*
* @author matchtech
*/
public class TableDataInfo implements Serializable
{
private static final long serialVersionUID = 1L;
/** 总记录数 */
private long total;
/** 列表数据 */
private List<?> rows;
/** 消息状态码 */
private int code;
/** 消息内容 */
private String msg;
/**
* 表格数据对象
*/
public TableDataInfo()
{
}
/**
* 分页
*
* @param list 列表数据
* @param total 总记录数
*/
public TableDataInfo(List<?> list, long total)
{
this.rows = list;
this.total = total;
}
public long getTotal()
{
return total;
}
public void setTotal(long total)
{
this.total = total;
}
public List<?> getRows()
{
return rows;
}
public void setRows(List<?> rows)
{
this.rows = rows;
}
public int getCode()
{
return code;
}
public void setCode(int code)
{
this.code = code;
}
public String getMsg()
{
return msg;
}
public void setMsg(String msg)
{
this.msg = msg;
}
}
\ No newline at end of file
package com.matchtech.common.core.web.page;
import com.matchtech.common.core.text.Convert;
import com.matchtech.common.core.utils.ServletUtils;
/**
* 表格数据处理
*
* @author matchtech
*/
public class TableSupport
{
/**
* 当前记录起始索引
*/
public static final String PAGE_NUM = "pageNum";
/**
* 每页显示记录数
*/
public static final String PAGE_SIZE = "pageSize";
/**
* 排序列
*/
public static final String ORDER_BY_COLUMN = "orderByColumn";
/**
* 排序的方向 "desc" 或者 "asc".
*/
public static final String IS_ASC = "isAsc";
/**
* 分页参数合理化
*/
public static final String REASONABLE = "reasonable";
/**
* 封装分页对象
*/
public static PageDomain getPageDomain()
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
return pageDomain;
}
public static PageDomain buildPageRequest()
{
return getPageDomain();
}
}
...@@ -22,6 +22,12 @@ ...@@ -22,6 +22,12 @@
<groupId>com.matchtech</groupId> <groupId>com.matchtech</groupId>
<artifactId>matchtech-common-security</artifactId> <artifactId>matchtech-common-security</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-mybatis</artifactId>
<version>3.1.1</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -3,7 +3,7 @@ package com.matchtech.common.datascope.aspect; ...@@ -3,7 +3,7 @@ package com.matchtech.common.datascope.aspect;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
......
...@@ -36,5 +36,11 @@ ...@@ -36,5 +36,11 @@
<artifactId>matchtech-common-core</artifactId> <artifactId>matchtech-common-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-mybatis</artifactId>
<version>3.1.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.matchtech.common.datasource.config; package com.matchtech.common.datasource.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import org.apache.ibatis.reflection.MetaObject; import org.apache.ibatis.reflection.MetaObject;
......
...@@ -17,15 +17,22 @@ ...@@ -17,15 +17,22 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.matchtech</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>matchtech-common-swagger</artifactId> <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>4.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
</dependency>
</dependencies> </dependencies>
......
package com.matchtech.common.dto.constants;
/**
* 信息编号常量
*
* @author chenyingyi 信息类型: info, error, warning, notice 格式: validation + 信息类型 +
* 模块 + 信息 请按模块区分 例如VALIDATION_ERROR_EXCEPTION
*/
public enum GlobalCodeMessageEnum {
/**
* 系统业务编码 100 - 999编码
*/
// 系统编码
// 成功
SUCCESS(200, "success"),
//部分外部接口响应需要返回0
SUCCESS2(0, "success"),
// 未知异常
SYSTEM_ERROR_EXCEPTION(500, "system.error.exception"),
// 请求方法不对
SYSTEM_ERROR_NOT_ALLOWED(405, "请求方法不对,请检查请求方法(post,get等)"),
// 未找到
SYSTEM_ERROR_NOT_FOUND(404, "请求地址不存在,请检查请求链接"),
// 无权限访问
SYSTEM_ERROR_NOT_AUTH(403, "无权限访问"),
// token错误
SYSTEM_ERROR_TOKEN(101, "system.error.token"),
// 签名错误
SYSTEM_ERROR_SIGN(102, "system.error.sign"),
// 解密错误
SYSTEM_ERROR_DECRYPT(103, "system.error.decrypt"),
// 空指针
SYSTEM_ERROR_NULLPOINTER(104, "未找到数据"),
// 非法参数
SYSTEM_ERROR_ILLEGAL_ARGUMENT(105, "非法参数,请检查参数"),
// 参数类型不匹配
SYSTEM_ERROR_TYPE_MISMATCH(106, "参数类型不匹配"),
// 请求参数缺失
SYSTEM_ERROR_MISSING_SERVLET_REQUEST_PARAMETER(107, "请求参数缺失,必填参数不能为空"),
//body传参异常
SYSTEM_ERROR_BODY_MISMATCH(108, "body参数异常,采用body传参,格式json"),
SYSTEM_ERROR_FILEURL(109, "本地存储不支持获取下载路径"),
SYSTEM_USER_NOT_FOUND(110, "用户未找到"),
SYSTEM_USER_LOGIN_NAME_EXISTS(111, "登录名已存在"),
SYSTEM_TOKEN_NOT_FOUND(112, "token不能为空"),
SYSTEM_TOKEN_OVERDUE(113, "token已失效,请重新登录"),
SYSTEM_CONNECT_TIME_OUT(114, "第三方接口超时"),
SYS_USERNAME_OR_PASSWORD_ERROR(115, "用户名或密码错误"),
SYS_USER_LOGIN_FORBIDDEN(116, "该用户已被禁止登录"),
SYS_USER_OLD_PASSWORD_ERROR(117, "旧密码错误"),
SYS_USER_LOCKED(118, "该用户已被锁定,请稍后再试"),
SYS_USER_INCORRECT_CAPTCHA(119, "验证码错误"),
SYSTEM_ROLE_NOT_FOUND(130, "角色不存在"),
SYSTEM_ROLE_LOGIN_NAME_EXISTS(131, "角色名称已存在"),
SYSTEM_ROLE_IS_SYSTEM_DATA(132, "越权操作,该角色为系统数据"),
SYSTEM_OFFICE_NOT_FOUND(150, "机构不存在"),
SYSTEM_OFFICE_PARENT_NOT_FOUND(151, "父级机构不存在"),
SYSTEM_OFFICE_EXIST_CHILDREN_NOT_ALLOWED(152, "存在下级机构,不可删除"),
SYSTEM_OFFICE_EXIST_USER_NOT_ALLOWED(153, "该机构下存在用户,不可删除"),
DATA_NOT_FOUND(154, "数据未找到"),
SYSTEM_NOT_ADMIN_USER(155, "非admin账号,无法删除角色"),
/**
* 字典
*/
SYS_DICTIONARY_CATEGORY_CODE_EXIT(500, "编码已存在"),
SYS_DICTIONARY_CODE_EXIT(500, "编码已存在"),
SYS_DICTIONARY_VALUE_EXIT(500, "数据值已存在"),
/**
* 用户角色
*/
SYS_USER_ROLE_NOT_USER_EMPTY(500, "请至少选择一个用户或者角色"),
VALIDATION_ERROR_EXCEPTION(1000, "数据校验编码"),
SUB_LIBRARY_CODE_ERROR(2001,"子库编码需为字母+数字组合"),
;
/**
* 消息码
*/
private int code;
/**
* 消息内容
*/
private String message;
private GlobalCodeMessageEnum(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
\ No newline at end of file
package com.matchtech.common.dto.constants;
/**
* 返回状态码
*
* @author matchtech
*/
public class HttpStatus
{
/**
* 操作成功
*/
public static final int SUCCESS = 200;
/**
* 对象创建成功
*/
public static final int CREATED = 201;
/**
* 请求已经被接受
*/
public static final int ACCEPTED = 202;
/**
* 操作已经执行成功,但是没有返回数据
*/
public static final int NO_CONTENT = 204;
/**
* 资源已被移除
*/
public static final int MOVED_PERM = 301;
/**
* 重定向
*/
public static final int SEE_OTHER = 303;
/**
* 资源没有被修改
*/
public static final int NOT_MODIFIED = 304;
/**
* 参数列表错误(缺少,格式不匹配)
*/
public static final int BAD_REQUEST = 400;
/**
* 未授权
*/
public static final int UNAUTHORIZED = 401;
/**
* 访问受限,授权过期
*/
public static final int FORBIDDEN = 403;
/**
* 资源,服务未找到
*/
public static final int NOT_FOUND = 404;
/**
* 不允许的http方法
*/
public static final int BAD_METHOD = 405;
/**
* 资源冲突,或者资源被锁
*/
public static final int CONFLICT = 409;
/**
* 不支持的数据,媒体类型
*/
public static final int UNSUPPORTED_TYPE = 415;
/**
* 系统内部错误
*/
public static final int ERROR = 500;
/**
* 接口未实现
*/
public static final int NOT_IMPLEMENTED = 501;
/**
* 系统警告消息
*/
public static final int WARN = 601;
}
package com.matchtech.common.core.page; package com.matchtech.common.dto.page;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
......
package com.matchtech.common.core.page; package com.matchtech.common.dto.page;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
......
package com.matchtech.common.core.page; package com.matchtech.common.dto.page;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
...@@ -56,32 +55,6 @@ public final class PageResult<T> implements Serializable { ...@@ -56,32 +55,6 @@ public final class PageResult<T> implements Serializable {
this.pages = pages; this.pages = pages;
} }
public PageResult(Page<?> page, List<T> list) {
this.list = list;
this.count = page.getTotal();
this.pageNo = (int) page.getCurrent();
this.pageSize = (int) page.getSize();
this.pages = (int) page.getPages();
}
public static <T> PageVO<T> getPage(Page<T> pages) {
PageVO<T> data = new PageVO<>();
data.setList(pages.getRecords());
data.setCount(pages.getTotal());
data.setPageNo((int) pages.getCurrent());
data.setPages((int) pages.getPages());
data.setPageSize((int) pages.getSize());
return data;
}
public static <T> PageVO<T> getPage(Page<?> pages, List<T> list) {
PageVO<T> data = new PageVO<>();
data.setList(list);
data.setCount(pages.getTotal());
data.setPageNo((int) pages.getCurrent());
data.setPages((int) pages.getPages());
data.setPageSize((int) pages.getSize());
return data;
}
} }
package com.matchtech.common.core.page; package com.matchtech.common.dto.page;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
......
package com.matchtech.common.core.page.resp; package com.matchtech.common.dto.page.resp;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.matchtech.common.core.constants.GlobalCodeMessageEnum; import com.matchtech.common.dto.constants.GlobalCodeMessageEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
......
package com.matchtech.common.core.page.resp; package com.matchtech.common.dto.page.resp;
import com.matchtech.common.core.constants.GlobalCodeMessageEnum;
import com.matchtech.common.dto.constants.GlobalCodeMessageEnum;
/** /**
* @author Administrator * @author Administrator
......
package com.matchtech.common.dto.web;
import cn.hutool.core.util.StrUtil;
import com.matchtech.common.dto.constants.HttpStatus;
import java.util.HashMap;
import java.util.Objects;
/**
* 操作消息提醒
*
* @author matchtech
*/
public class AjaxResult extends HashMap<String, Object>
{
private static final long serialVersionUID = 1L;
/** 状态码 */
public static final String CODE_TAG = "code";
/** 返回内容 */
public static final String MSG_TAG = "msg";
/** 数据对象 */
public static final String DATA_TAG = "data";
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
public AjaxResult()
{
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param msg 返回内容
*/
public AjaxResult(int code, String msg)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg, Object data)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (Objects.nonNull(data))
{
super.put(DATA_TAG, data);
}
}
/**
* 返回成功消息
*
* @return 成功消息
*/
public static AjaxResult success()
{
return AjaxResult.success("操作成功");
}
/**
* 返回成功数据
*
* @return 成功消息
*/
public static AjaxResult success(Object data)
{
return AjaxResult.success("操作成功", data);
}
/**
* 返回成功消息
*
* @param msg 返回内容
* @return 成功消息
*/
public static AjaxResult success(String msg)
{
return AjaxResult.success(msg, null);
}
/**
* 返回成功消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 成功消息
*/
public static AjaxResult success(String msg, Object data)
{
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
/**
* 返回警告消息
*
* @param msg 返回内容
* @return 警告消息
*/
public static AjaxResult warn(String msg)
{
return AjaxResult.warn(msg, null);
}
/**
* 返回警告消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
*/
public static AjaxResult warn(String msg, Object data)
{
return new AjaxResult(HttpStatus.WARN, msg, data);
}
/**
* 返回错误消息
*
* @return 错误消息
*/
public static AjaxResult error()
{
return AjaxResult.error("操作失败");
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @return 错误消息
*/
public static AjaxResult error(String msg)
{
return AjaxResult.error(msg, null);
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 错误消息
*/
public static AjaxResult error(String msg, Object data)
{
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
/**
* 返回错误消息
*
* @param code 状态码
* @param msg 返回内容
* @return 错误消息
*/
public static AjaxResult error(int code, String msg)
{
return new AjaxResult(code, msg, null);
}
/**
* 是否为成功消息
*
* @return 结果
*/
public boolean isSuccess()
{
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
}
/**
* 是否为警告消息
*
* @return 结果
*/
public boolean isWarn()
{
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
/**
* 是否为错误消息
*
* @return 结果
*/
public boolean isError()
{
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
}
/**
* 方便链式调用
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
}
...@@ -2,6 +2,9 @@ package com.matchtech.common.log.aspect; ...@@ -2,6 +2,9 @@ package com.matchtech.common.log.aspect;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import com.matchtech.common.servlet.utils.ServletUtils;
import com.matchtech.common.servlet.utils.ip.IpUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
...@@ -21,9 +24,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -21,9 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.matchtech.common.core.text.Convert; import com.matchtech.common.core.text.Convert;
import com.matchtech.common.core.utils.ExceptionUtil; import com.matchtech.common.core.utils.ExceptionUtil;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.common.core.utils.ip.IpUtils;
import com.matchtech.common.log.annotation.Log; import com.matchtech.common.log.annotation.Log;
import com.matchtech.common.log.enums.BusinessStatus; import com.matchtech.common.log.enums.BusinessStatus;
import com.matchtech.common.log.filter.PropertyPreExcludeFilter; import com.matchtech.common.log.filter.PropertyPreExcludeFilter;
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common</artifactId>
<version>3.1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>matchtech-common-mybatis</artifactId>
<description>matchtech-common-mybatis</description>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
</dependency>
<!-- MyBatis 测试 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>3.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-dto</artifactId>
</dependency>
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-core</artifactId>
</dependency>
</dependencies>
</project>
package com.matchtech.common.core.mybatis; package com.matchtech.common.mybatis;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -7,11 +7,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -7,11 +7,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.matchtech.common.core.page.PageParam;
import com.matchtech.common.core.page.PageReqDto;
import com.matchtech.common.core.page.PageResult;
import com.matchtech.common.core.page.SortingField;
import com.matchtech.common.core.text.Convert; import com.matchtech.common.core.text.Convert;
import com.matchtech.common.dto.page.PageParam;
import com.matchtech.common.dto.page.PageReqDto;
import com.matchtech.common.dto.page.PageResult;
import com.matchtech.common.dto.page.SortingField;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
......
package com.matchtech.common.core.mybatis; package com.matchtech.common.mybatis;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......
package com.matchtech.common.core.mybatis; package com.matchtech.common.mybatis;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -7,12 +7,11 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool; ...@@ -7,12 +7,11 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matchtech.common.core.page.PageParam;
import com.matchtech.common.core.page.PageReqDto;
import com.matchtech.common.core.page.PageResult;
import com.matchtech.common.core.page.SortingField;
import com.matchtech.common.core.text.Convert; import com.matchtech.common.core.text.Convert;
import com.matchtech.common.dto.page.PageParam;
import com.matchtech.common.dto.page.PageReqDto;
import com.matchtech.common.dto.page.PageResult;
import com.matchtech.common.dto.page.SortingField;
import net.sf.jsqlparser.expression.Alias; import net.sf.jsqlparser.expression.Alias;
import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.schema.Table; import net.sf.jsqlparser.schema.Table;
......
package com.matchtech.common.core.mybatis; package com.matchtech.common.mybatis;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
......
package com.matchtech.common.core.mybatis; package com.matchtech.common.mybatis;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper; import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
......
package com.matchtech.common.core.mybatis; package com.matchtech.common.mybatis;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
......
package com.matchtech.common.core.domain; package com.matchtech.common.mybatis.domain;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
......
package com.matchtech.common.mybatis.utils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.matchtech.common.dto.page.PageResult;
import java.util.List;
/**
* @author lixl
*/
public class PageUtil {
public static <T> PageResult toPageResult(Page<?> page, List<T> list) {
PageResult res = new PageResult();
res.setList(list);
res.setCount(page.getTotal());
res.setPageNo((int) page.getCurrent());
res.setPages((int) page.getPages());
res.setPageSize((int) page.getSize());
return res;
}
}
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
<artifactId>matchtech-common-dto</artifactId> <artifactId>matchtech-common-dto</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-servlet</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
package com.matchtech.common.security.aspect; package com.matchtech.common.security.aspect;
import com.matchtech.common.servlet.utils.ServletUtils;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
...@@ -7,7 +8,6 @@ import org.springframework.core.Ordered; ...@@ -7,7 +8,6 @@ import org.springframework.core.Ordered;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.matchtech.common.core.constants.SecurityConstants; import com.matchtech.common.core.constants.SecurityConstants;
import com.matchtech.common.core.exception.InnerAuthException; import com.matchtech.common.core.exception.InnerAuthException;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.common.security.annotation.InnerAuth; import com.matchtech.common.security.annotation.InnerAuth;
......
package com.matchtech.common.security.feign; package com.matchtech.common.security.feign;
import java.util.Map; import java.util.Map;
import com.matchtech.common.servlet.utils.ServletUtils;
import com.matchtech.common.servlet.utils.ip.IpUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.matchtech.common.core.constants.SecurityConstants; import com.matchtech.common.core.constants.SecurityConstants;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.common.core.utils.ip.IpUtils;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.RequestTemplate; import feign.RequestTemplate;
......
package com.matchtech.common.security.interceptor; package com.matchtech.common.security.interceptor;
import com.matchtech.common.servlet.utils.ServletUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.AsyncHandlerInterceptor; import org.springframework.web.servlet.AsyncHandlerInterceptor;
import com.matchtech.common.core.constants.SecurityConstants; import com.matchtech.common.core.constants.SecurityConstants;
import com.matchtech.common.core.context.SecurityContextHolder; import com.matchtech.common.core.context.SecurityContextHolder;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.common.security.auth.AuthUtil; import com.matchtech.common.security.auth.AuthUtil;
import com.matchtech.common.security.utils.SecurityUtils; import com.matchtech.common.security.utils.SecurityUtils;
......
...@@ -5,6 +5,8 @@ import java.util.Map; ...@@ -5,6 +5,8 @@ import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.matchtech.common.dto.login.TokenDto; import com.matchtech.common.dto.login.TokenDto;
import com.matchtech.common.servlet.utils.ServletUtils;
import com.matchtech.common.servlet.utils.ip.IpUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -13,9 +15,7 @@ import org.springframework.stereotype.Component; ...@@ -13,9 +15,7 @@ import org.springframework.stereotype.Component;
import com.matchtech.common.core.constants.CacheConstants; import com.matchtech.common.core.constants.CacheConstants;
import com.matchtech.common.core.constants.SecurityConstants; import com.matchtech.common.core.constants.SecurityConstants;
import com.matchtech.common.core.utils.JwtUtils; import com.matchtech.common.core.utils.JwtUtils;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.common.core.utils.ip.IpUtils;
import com.matchtech.common.core.utils.uuid.IdUtils; import com.matchtech.common.core.utils.uuid.IdUtils;
import com.matchtech.common.redis.service.RedisService; import com.matchtech.common.redis.service.RedisService;
import com.matchtech.common.security.utils.SecurityUtils; import com.matchtech.common.security.utils.SecurityUtils;
......
package com.matchtech.common.security.utils; package com.matchtech.common.security.utils;
import com.matchtech.common.servlet.utils.ServletUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.matchtech.common.core.constants.SecurityConstants; import com.matchtech.common.core.constants.SecurityConstants;
import com.matchtech.common.core.constants.TokenConstants; import com.matchtech.common.core.constants.TokenConstants;
import com.matchtech.common.core.context.SecurityContextHolder; import com.matchtech.common.core.context.SecurityContextHolder;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.system.api.model.LoginUser; import com.matchtech.system.api.model.LoginUser;
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common</artifactId>
<version>3.1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-servlet</artifactId>
<version>3.1.1</version>
<name>matchtech-common-servlet</name>
<description>matchtech-common-servlet</description>
<dependencies>
<!-- Spring Web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<!-- Java Servlet -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-core</artifactId>
</dependency>
</dependencies>
</project>
package com.matchtech.common.core.utils.poi; package com.matchtech.common.servlet.poi;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
......
package com.matchtech.common.core.utils.poi; package com.matchtech.common.servlet.poi;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
...@@ -454,10 +454,10 @@ public class ExcelUtil<T> ...@@ -454,10 +454,10 @@ public class ExcelUtil<T>
{ {
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator()); val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
} }
else if (!attr.handler().equals(ExcelHandlerAdapter.class)) // else if (!attr.handler().equals(ExcelHandlerAdapter.class))
{ // {
val = dataFormatHandlerAdapter(val, attr, null); // val = dataFormatHandlerAdapter(val, attr, null);
} // }
ReflectUtils.invokeSetter(entity, propertyName, val); ReflectUtils.invokeSetter(entity, propertyName, val);
} }
} }
...@@ -1015,10 +1015,10 @@ public class ExcelUtil<T> ...@@ -1015,10 +1015,10 @@ public class ExcelUtil<T>
{ {
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).doubleValue()); cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).doubleValue());
} }
else if (!attr.handler().equals(ExcelHandlerAdapter.class)) // else if (!attr.handler().equals(ExcelHandlerAdapter.class))
{ // {
cell.setCellValue(dataFormatHandlerAdapter(value, attr, cell)); // cell.setCellValue(dataFormatHandlerAdapter(value, attr, cell));
} // }
else else
{ {
// 设置列类型 // 设置列类型
...@@ -1226,13 +1226,13 @@ public class ExcelUtil<T> ...@@ -1226,13 +1226,13 @@ public class ExcelUtil<T>
{ {
try try
{ {
Object instance = excel.handler().getDeclaredConstructor().newInstance(); // Object instance = excel.handler().getDeclaredConstructor().newInstance();
Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class }); // Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class });
value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb); // value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb);
} }
catch (Exception e) catch (Exception e)
{ {
log.error("不能格式化数据 " + excel.handler(), e.getMessage()); // log.error("不能格式化数据 " + excel.handler(), e.getMessage());
} }
return Convert.toStr(value); return Convert.toStr(value);
} }
......
package com.matchtech.common.core.servlet; package com.matchtech.common.servlet.servlet;
import jakarta.servlet.ReadListener; import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream; import jakarta.servlet.ServletInputStream;
......
package com.matchtech.common.core.servlet; package com.matchtech.common.servlet.servlet;
import jakarta.servlet.ServletOutputStream; import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.WriteListener; import jakarta.servlet.WriteListener;
......
package com.matchtech.common.core.servlet; package com.matchtech.common.servlet.servlet;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
......
package com.matchtech.common.core.utils; package com.matchtech.common.servlet.utils;
import java.io.IOException; import com.matchtech.common.core.constants.Constants;
import java.io.UnsupportedEncodingException; import com.matchtech.common.core.text.Convert;
import java.net.URLDecoder; import com.matchtech.common.core.utils.StringUtils;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import jakarta.servlet.ServletRequest; import jakarta.servlet.ServletRequest;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.util.LinkedCaseInsensitiveMap; import org.springframework.util.LinkedCaseInsensitiveMap;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import com.alibaba.fastjson2.JSON;
import com.matchtech.common.core.constants.Constants; import java.io.IOException;
import com.matchtech.common.core.domain.R; import java.io.UnsupportedEncodingException;
import com.matchtech.common.core.text.Convert; import java.net.URLDecoder;
import reactor.core.publisher.Mono; import java.net.URLEncoder;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/** /**
* 客户端工具类 * 客户端工具类
...@@ -237,17 +231,18 @@ public class ServletUtils ...@@ -237,17 +231,18 @@ public class ServletUtils
return StringUtils.inStringIgnoreCase(ajax, "json", "xml"); return StringUtils.inStringIgnoreCase(ajax, "json", "xml");
} }
/** /**
* 内容 * 内容
* *
* @param str 内容 * @param str 内容
* @return 码后的内容 * @return 码后的内容
*/ */
public static String urlEncode(String str) public static String urlDecode(String str)
{ {
try try
{ {
return URLEncoder.encode(str, Constants.UTF8); return URLDecoder.decode(str, Constants.UTF8);
} }
catch (UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {
...@@ -256,16 +251,16 @@ public class ServletUtils ...@@ -256,16 +251,16 @@ public class ServletUtils
} }
/** /**
* 内容 * 内容
* *
* @param str 内容 * @param str 内容
* @return 码后的内容 * @return 码后的内容
*/ */
public static String urlDecode(String str) public static String urlEncode(String str)
{ {
try try
{ {
return URLDecoder.decode(str, Constants.UTF8); return URLEncoder.encode(str, Constants.UTF8);
} }
catch (UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {
...@@ -273,61 +268,6 @@ public class ServletUtils ...@@ -273,61 +268,6 @@ public class ServletUtils
} }
} }
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, Object value)
{
return webFluxResponseWriter(response, HttpStatus.OK, value, R.FAIL);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, Object value, int code)
{
return webFluxResponseWriter(response, HttpStatus.OK, value, code);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param status http状态码
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, HttpStatus status, Object value, int code)
{
return webFluxResponseWriter(response, MediaType.APPLICATION_JSON_VALUE, status, value, code);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param contentType content-type
* @param status http状态码
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, String contentType, HttpStatus status, Object value, int code)
{
response.setStatusCode(status);
response.getHeaders().add(HttpHeaders.CONTENT_TYPE, contentType);
R<?> result = R.fail(code, value.toString());
DataBuffer dataBuffer = response.bufferFactory().wrap(JSON.toJSONString(result).getBytes());
return response.writeWith(Mono.just(dataBuffer));
}
} }
package com.matchtech.common.core.utils.ip; package com.matchtech.common.servlet.utils.ip;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import com.matchtech.common.servlet.utils.ServletUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
/** /**
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common</artifactId>
<version>3.1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>matchtech-common-swagger</artifactId>
<description>
matchtech-common-swagger系统接口
</description>
<dependencies>
<!-- SpringBoot Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- SpringDoc webmvc -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<!-- knife4j -->
<dependency>
<groupId>io.springboot</groupId>
<artifactId>knife4j-openapi3-ui</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
</dependencies>
</project>
package com.matchtech.common.swagger.config;
import java.util.ArrayList;
import java.util.List;
import org.springdoc.core.configuration.SpringDocConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import com.matchtech.common.swagger.config.properties.SpringDocProperties;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
/**
* Swagger 文档配置
*
* @author matchtech
*/
@AutoConfiguration(before = SpringDocConfiguration.class)
@EnableConfigurationProperties(SpringDocProperties.class)
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true)
public class SpringDocAutoConfiguration
{
@Bean
@ConditionalOnMissingBean(OpenAPI.class)
public OpenAPI openApi(SpringDocProperties properties)
{
return new OpenAPI().components(new Components()
// 设置认证的请求头
.addSecuritySchemes("apikey", securityScheme()))
.addSecurityItem(new SecurityRequirement().addList("apikey"))
.info(convertInfo(properties.getInfo()))
.servers(servers(properties.getGatewayUrl()));
}
public SecurityScheme securityScheme()
{
return new SecurityScheme().type(SecurityScheme.Type.APIKEY)
.name("Authorization")
.in(SecurityScheme.In.HEADER)
.scheme("Bearer");
}
private Info convertInfo(SpringDocProperties.InfoProperties infoProperties)
{
Info info = new Info();
info.setTitle(infoProperties.getTitle());
info.setDescription(infoProperties.getDescription());
info.setContact(infoProperties.getContact());
info.setLicense(infoProperties.getLicense());
info.setVersion(infoProperties.getVersion());
return info;
}
public List<Server> servers(String gatewayUrl)
{
List<Server> serverList = new ArrayList<>();
serverList.add(new Server().url(gatewayUrl));
return serverList;
}
}
package com.matchtech.common.swagger.config.properties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.License;
/**
* Swagger 配置属性
*
* @author matchtech
*/
@ConfigurationProperties(prefix = "springdoc")
public class SpringDocProperties
{
/**
* 网关
*/
private String gatewayUrl;
/**
* 文档基本信息
*/
@NestedConfigurationProperty
private InfoProperties info = new InfoProperties();
/**
* <p>
* 文档的基础属性信息
* </p>
*
* @see io.swagger.v3.oas.models.info.Info
*
* 为了 springboot 自动生产配置提示信息,所以这里复制一个类出来
*/
public static class InfoProperties
{
/**
* 标题
*/
private String title = null;
/**
* 描述
*/
private String description = null;
/**
* 联系人信息
*/
@NestedConfigurationProperty
private Contact contact = null;
/**
* 许可证
*/
@NestedConfigurationProperty
private License license = null;
/**
* 版本
*/
private String version = null;
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public Contact getContact()
{
return contact;
}
public void setContact(Contact contact)
{
this.contact = contact;
}
public License getLicense()
{
return license;
}
public void setLicense(License license)
{
this.license = license;
}
public String getVersion()
{
return version;
}
public void setVersion(String version)
{
this.version = version;
}
}
public String getGatewayUrl()
{
return gatewayUrl;
}
public void setGatewayUrl(String gatewayUrl)
{
this.gatewayUrl = gatewayUrl;
}
public InfoProperties getInfo()
{
return info;
}
public void setInfo(InfoProperties info)
{
this.info = info;
}
}
...@@ -25,12 +25,13 @@ ...@@ -25,12 +25,13 @@
<module>matchtech-common-core</module> <module>matchtech-common-core</module>
<module>matchtech-common-redis</module> <module>matchtech-common-redis</module>
<module>matchtech-common-seata</module> <module>matchtech-common-seata</module>
<module>matchtech-common-swagger</module>
<module>matchtech-common-security</module> <module>matchtech-common-security</module>
<module>matchtech-common-sensitive</module> <module>matchtech-common-sensitive</module>
<module>matchtech-common-datascope</module> <module>matchtech-common-datascope</module>
<module>matchtech-common-datasource</module> <module>matchtech-common-datasource</module>
<module>matchtech-common-dto</module> <module>matchtech-common-dto</module>
<module>matchtech-common-mybatis</module>
<module>matchtech-common-servlet</module>
</modules> </modules>
<artifactId>matchtech-common</artifactId> <artifactId>matchtech-common</artifactId>
......
...@@ -93,11 +93,17 @@ ...@@ -93,11 +93,17 @@
<version>1.8.0</version> <version>1.8.0</version>
</dependency> </dependency>
<!--引入Knife4j的gateway包-->
<!-- knife4j -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-ui</artifactId>
<version>3.0.3</version>
</dependency>
<dependency> <dependency>
<groupId>com.github.xiaoymin</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-gateway-spring-boot-starter</artifactId> <artifactId>knife4j-spring-boot-starter</artifactId>
<version>4.5.0</version> <version>3.0.3</version>
</dependency> </dependency>
</dependencies> </dependencies>
......
package com.matchtech.gateway.filter; package com.matchtech.gateway.filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import com.matchtech.common.core.constants.CacheConstants; import com.matchtech.common.core.constants.CacheConstants;
import com.matchtech.common.core.constants.HttpStatus; import com.matchtech.common.core.constants.HttpStatus;
import com.matchtech.common.core.constants.SecurityConstants; import com.matchtech.common.core.constants.SecurityConstants;
import com.matchtech.common.core.constants.TokenConstants; import com.matchtech.common.core.constants.TokenConstants;
import com.matchtech.common.core.utils.JwtUtils; import com.matchtech.common.core.utils.JwtUtils;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.common.redis.service.RedisService; import com.matchtech.common.redis.service.RedisService;
import com.matchtech.gateway.config.properties.IgnoreWhiteProperties; import com.matchtech.gateway.config.properties.IgnoreWhiteProperties;
import com.matchtech.gateway.utils.WebFluxUtil;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
/** /**
...@@ -92,7 +92,7 @@ public class AuthFilter implements GlobalFilter, Ordered ...@@ -92,7 +92,7 @@ public class AuthFilter implements GlobalFilter, Ordered
return; return;
} }
String valueStr = value.toString(); String valueStr = value.toString();
String valueEncode = ServletUtils.urlEncode(valueStr); String valueEncode = WebFluxUtil.urlEncode(valueStr);
mutate.header(name, valueEncode); mutate.header(name, valueEncode);
} }
...@@ -104,7 +104,7 @@ public class AuthFilter implements GlobalFilter, Ordered ...@@ -104,7 +104,7 @@ public class AuthFilter implements GlobalFilter, Ordered
private Mono<Void> unauthorizedResponse(ServerWebExchange exchange, String msg) private Mono<Void> unauthorizedResponse(ServerWebExchange exchange, String msg)
{ {
log.error("[鉴权异常处理]请求路径:{},错误信息:{}", exchange.getRequest().getPath(), msg); log.error("[鉴权异常处理]请求路径:{},错误信息:{}", exchange.getRequest().getPath(), msg);
return ServletUtils.webFluxResponseWriter(exchange.getResponse(), msg, HttpStatus.UNAUTHORIZED); return WebFluxUtil.webFluxResponseWriter(exchange.getResponse(), msg, HttpStatus.UNAUTHORIZED);
} }
/** /**
......
package com.matchtech.gateway.filter; package com.matchtech.gateway.filter;
import java.util.ArrayList; import com.matchtech.gateway.utils.WebFluxUtil;
import java.util.List;
import java.util.regex.Pattern;
import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.matchtech.common.core.utils.ServletUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
/** /**
* 黑名单过滤器 * 黑名单过滤器
...@@ -24,7 +25,7 @@ public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUr ...@@ -24,7 +25,7 @@ public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUr
String url = exchange.getRequest().getURI().getPath(); String url = exchange.getRequest().getURI().getPath();
if (config.matchBlacklist(url)) if (config.matchBlacklist(url))
{ {
return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "请求地址不允许访问"); return WebFluxUtil.webFluxResponseWriter(exchange.getResponse(), "请求地址不允许访问");
} }
return chain.filter(exchange); return chain.filter(exchange);
......
package com.matchtech.gateway.filter; package com.matchtech.gateway.filter;
import java.nio.CharBuffer; import com.alibaba.fastjson2.JSON;
import java.nio.charset.StandardCharsets; import com.alibaba.fastjson2.JSONObject;
import java.util.concurrent.atomic.AtomicReference; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.gateway.config.properties.CaptchaProperties;
import com.matchtech.gateway.service.ValidateCodeService;
import com.matchtech.gateway.utils.WebFluxUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
...@@ -10,14 +13,12 @@ import org.springframework.core.io.buffer.DataBuffer; ...@@ -10,14 +13,12 @@ import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.matchtech.common.core.utils.ServletUtils;
import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.gateway.config.properties.CaptchaProperties;
import com.matchtech.gateway.service.ValidateCodeService;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import java.nio.CharBuffer;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.atomic.AtomicReference;
/** /**
* 验证码过滤器 * 验证码过滤器
* *
...@@ -58,7 +59,7 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object> ...@@ -58,7 +59,7 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
} }
catch (Exception e) catch (Exception e)
{ {
return ServletUtils.webFluxResponseWriter(exchange.getResponse(), e.getMessage()); return WebFluxUtil.webFluxResponseWriter(exchange.getResponse(), e.getMessage());
} }
return chain.filter(exchange); return chain.filter(exchange);
}; };
......
package com.matchtech.gateway.handler; package com.matchtech.gateway.handler;
import com.matchtech.gateway.utils.WebFluxUtil;
import org.springframework.cloud.gateway.support.NotFoundException; import org.springframework.cloud.gateway.support.NotFoundException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -9,7 +10,6 @@ import org.springframework.core.annotation.Order; ...@@ -9,7 +10,6 @@ import org.springframework.core.annotation.Order;
import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import com.matchtech.common.core.utils.ServletUtils;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
/** /**
...@@ -51,6 +51,6 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler ...@@ -51,6 +51,6 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler
log.error("[网关异常处理]请求路径:{},异常信息:{}", exchange.getRequest().getPath(), ex.getMessage()); log.error("[网关异常处理]请求路径:{},异常信息:{}", exchange.getRequest().getPath(), ex.getMessage());
return ServletUtils.webFluxResponseWriter(response, msg); return WebFluxUtil.webFluxResponseWriter(response, msg);
} }
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ package com.matchtech.gateway.handler; ...@@ -2,7 +2,7 @@ package com.matchtech.gateway.handler;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.GatewayCallbackManager; import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.GatewayCallbackManager;
import com.alibaba.csp.sentinel.slots.block.BlockException; import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.matchtech.common.core.utils.ServletUtils; import com.matchtech.gateway.utils.WebFluxUtil;
import org.springframework.web.reactive.function.server.ServerResponse; import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebExceptionHandler; import org.springframework.web.server.WebExceptionHandler;
...@@ -17,7 +17,7 @@ public class SentinelFallbackHandler implements WebExceptionHandler ...@@ -17,7 +17,7 @@ public class SentinelFallbackHandler implements WebExceptionHandler
{ {
private Mono<Void> writeResponse(ServerResponse response, ServerWebExchange exchange) private Mono<Void> writeResponse(ServerResponse response, ServerWebExchange exchange)
{ {
return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "请求超过最大数,请稍候再试"); return WebFluxUtil.webFluxResponseWriter(exchange.getResponse(), "请求超过最大数,请稍候再试");
} }
@Override @Override
......
...@@ -3,6 +3,8 @@ package com.matchtech.gateway.service.impl; ...@@ -3,6 +3,8 @@ package com.matchtech.gateway.service.impl;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.matchtech.common.core.web.domain.AjaxResult;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -15,7 +17,6 @@ import com.matchtech.common.core.exception.CaptchaException; ...@@ -15,7 +17,6 @@ import com.matchtech.common.core.exception.CaptchaException;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.common.core.utils.sign.Base64; import com.matchtech.common.core.utils.sign.Base64;
import com.matchtech.common.core.utils.uuid.IdUtils; import com.matchtech.common.core.utils.uuid.IdUtils;
import com.matchtech.common.core.web.domain.AjaxResult;
import com.matchtech.common.redis.service.RedisService; import com.matchtech.common.redis.service.RedisService;
import com.matchtech.gateway.config.properties.CaptchaProperties; import com.matchtech.gateway.config.properties.CaptchaProperties;
import com.matchtech.gateway.service.ValidateCodeService; import com.matchtech.gateway.service.ValidateCodeService;
......
package com.matchtech.gateway.utils;
import com.alibaba.fastjson2.JSON;
import com.matchtech.common.core.constants.Constants;
import com.matchtech.common.core.domain.R;
import com.matchtech.common.core.utils.StringUtils;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpResponse;
import reactor.core.publisher.Mono;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
public class WebFluxUtil {
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, Object value)
{
return webFluxResponseWriter(response, HttpStatus.OK, value, R.FAIL);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, Object value, int code)
{
return webFluxResponseWriter(response, HttpStatus.OK, value, code);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param status http状态码
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, HttpStatus status, Object value, int code)
{
return webFluxResponseWriter(response, MediaType.APPLICATION_JSON_VALUE, status, value, code);
}
/**
* 设置webflux模型响应
*
* @param response ServerHttpResponse
* @param contentType content-type
* @param status http状态码
* @param code 响应状态码
* @param value 响应内容
* @return Mono<Void>
*/
public static Mono<Void> webFluxResponseWriter(ServerHttpResponse response, String contentType, HttpStatus status, Object value, int code)
{
response.setStatusCode(status);
response.getHeaders().add(HttpHeaders.CONTENT_TYPE, contentType);
R<?> result = R.fail(code, value.toString());
DataBuffer dataBuffer = response.bufferFactory().wrap(JSON.toJSONString(result).getBytes());
return response.writeWith(Mono.just(dataBuffer));
}
/**
* 内容解码
*
* @param str 内容
* @return 解码后的内容
*/
public static String urlDecode(String str)
{
try
{
return URLDecoder.decode(str, Constants.UTF8);
}
catch (UnsupportedEncodingException e)
{
return StringUtils.EMPTY;
}
}
/**
* 内容编码
*
* @param str 内容
* @return 编码后的内容
*/
public static String urlEncode(String str)
{
try
{
return URLEncoder.encode(str, Constants.UTF8);
}
catch (UnsupportedEncodingException e)
{
return StringUtils.EMPTY;
}
}
}
...@@ -67,10 +67,12 @@ ...@@ -67,10 +67,12 @@
<!-- matchtech Common Swagger --> <!-- matchtech Common Swagger -->
<dependency> <dependency>
<groupId>com.matchtech</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>matchtech-common-swagger</artifactId> <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>4.3.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -2,7 +2,7 @@ package com.matchtech.job.domain; ...@@ -2,7 +2,7 @@ package com.matchtech.job.domain;
import java.util.Date; import java.util.Date;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
......
...@@ -2,7 +2,7 @@ package com.matchtech.job.domain; ...@@ -2,7 +2,7 @@ package com.matchtech.job.domain;
import java.util.Date; import java.util.Date;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.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;
import com.matchtech.common.core.annotation.Excel; import com.matchtech.common.core.annotation.Excel;
......
...@@ -66,9 +66,12 @@ ...@@ -66,9 +66,12 @@
</dependency> </dependency>
<!-- matchtech Common Swagger --> <!-- matchtech Common Swagger -->
<!-- knife4j -->
<dependency> <dependency>
<groupId>com.matchtech</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>matchtech-common-swagger</artifactId> <artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -2,15 +2,12 @@ package com.matchtech.system.controller; ...@@ -2,15 +2,12 @@ package com.matchtech.system.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.matchtech.common.core.constants.GlobalCodeMessageEnum; import com.matchtech.common.dto.constants.GlobalCodeMessageEnum;
import com.matchtech.common.core.domain.R; import com.matchtech.common.dto.page.resp.ApiResponseEntity;
import com.matchtech.common.core.page.resp.ApiResponseEntity; import com.matchtech.common.dto.page.resp.ApiResponseUtils;
import com.matchtech.common.core.page.resp.ApiResponseUtils;
import com.matchtech.common.core.utils.StringUtils; import com.matchtech.common.core.utils.StringUtils;
import com.matchtech.common.core.web.controller.BaseController; import com.matchtech.common.core.web.controller.BaseController;
import com.matchtech.common.dto.BaseIdDto; import com.matchtech.common.dto.BaseIdDto;
import com.matchtech.common.dto.login.SysUserDetailVo;
import com.matchtech.system.api.domain.SysUser;
import com.matchtech.system.api.model.LoginUser; import com.matchtech.system.api.model.LoginUser;
import com.matchtech.system.entity.SysUserEntity; import com.matchtech.system.entity.SysUserEntity;
import com.matchtech.system.service.SysUserService; import com.matchtech.system.service.SysUserService;
...@@ -24,8 +21,6 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -24,8 +21,6 @@ import org.springframework.web.bind.annotation.RequestBody;
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 java.util.Set;
@Tag(name = "系统用户管理") @Tag(name = "系统用户管理")
@RestController @RestController
@RequestMapping(value = "${matchtech.adminPath}/sys/user") @RequestMapping(value = "${matchtech.adminPath}/sys/user")
......
...@@ -2,17 +2,20 @@ package com.matchtech.system.entity; ...@@ -2,17 +2,20 @@ package com.matchtech.system.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.matchtech.common.core.constants.Constants; import com.matchtech.common.core.constants.Constants;
import com.matchtech.common.core.domain.BaseEntity; import com.matchtech.common.mybatis.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@TableName("sys_user") @TableName("sys_user")
@Schema(description = "系统用户",title = "系统用户")
public class SysUserEntity extends BaseEntity { public class SysUserEntity extends BaseEntity {
/** /**
* 租户ID * 租户ID
*/ */
@Schema(description = "租户ID")
private String tenantId; private String tenantId;
/** /**
......
package com.matchtech.system.mapper; package com.matchtech.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.matchtech.common.core.mybatis.BaseMapperX; import com.matchtech.common.mybatis.BaseMapperX;
import com.matchtech.system.entity.SysEmployeeEntity; import com.matchtech.system.entity.SysEmployeeEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
......
package com.matchtech.system.mapper; package com.matchtech.system.mapper;
import com.matchtech.common.core.mybatis.BaseMapperX; import com.matchtech.common.mybatis.BaseMapperX;
import com.matchtech.system.entity.SysUserEntity; import com.matchtech.system.entity.SysUserEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
......
...@@ -9,13 +9,13 @@ import com.matchtech.common.core.config.MatchtechProperties; ...@@ -9,13 +9,13 @@ import com.matchtech.common.core.config.MatchtechProperties;
import com.matchtech.common.core.constants.Constants; import com.matchtech.common.core.constants.Constants;
import com.matchtech.common.core.constants.GlobalCodeMessageEnum; import com.matchtech.common.core.constants.GlobalCodeMessageEnum;
import com.matchtech.common.core.exception.GlobalException; import com.matchtech.common.core.exception.GlobalException;
import com.matchtech.common.core.utils.ip.IpUtils;
import com.matchtech.common.core.utils.sign.DigestUtils; import com.matchtech.common.core.utils.sign.DigestUtils;
import com.matchtech.common.core.utils.sign.RsaUtil; import com.matchtech.common.core.utils.sign.RsaUtil;
import com.matchtech.common.dto.login.SysLoginVo; import com.matchtech.common.dto.login.SysLoginVo;
import com.matchtech.common.redis.constant.RedisConstants; import com.matchtech.common.redis.constant.RedisConstants;
import com.matchtech.common.redis.service.RedisUtils; import com.matchtech.common.redis.service.RedisUtils;
import com.matchtech.common.security.service.TokenService; import com.matchtech.common.security.service.TokenService;
import com.matchtech.common.servlet.utils.ip.IpUtils;
import com.matchtech.system.convertors.SysUserConvertor; import com.matchtech.system.convertors.SysUserConvertor;
import com.matchtech.common.dto.login.SysLoginDto; import com.matchtech.common.dto.login.SysLoginDto;
import com.matchtech.system.entity.SysUserEntity; import com.matchtech.system.entity.SysUserEntity;
......
...@@ -27,3 +27,20 @@ spring: ...@@ -27,3 +27,20 @@ spring:
extension-configs: extension-configs:
- data-id: matchtech-system-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - data-id: matchtech-system-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
refresh: true refresh: true
# springdoc配置
springdoc:
gatewayUrl: http://localhost:9999/${spring.application.name}
api-docs:
# 是否开启接口文档
enabled: true
info:
# 标题
title: '系统模块接口文档'
# 描述
description: '系统模块接口描述'
# 作者信息
contact:
name: matchtech
url: ${spring.application.name}
\ No newline at end of file
...@@ -202,12 +202,12 @@ ...@@ -202,12 +202,12 @@
<version>${matchtech.version}</version> <version>${matchtech.version}</version>
</dependency> </dependency>
<!-- 接口模块 --> <!-- &lt;!&ndash; 接口模块 &ndash;&gt;-->
<dependency> <!-- <dependency>-->
<groupId>com.matchtech</groupId> <!-- <groupId>com.matchtech</groupId>-->
<artifactId>matchtech-common-swagger</artifactId> <!-- <artifactId>matchtech-common-swagger</artifactId>-->
<version>${matchtech.version}</version> <!-- <version>${matchtech.version}</version>-->
</dependency> <!-- </dependency>-->
<!-- 安全模块 --> <!-- 安全模块 -->
<dependency> <dependency>
...@@ -283,6 +283,20 @@ ...@@ -283,6 +283,20 @@
<version>2.2.20</version> <version>2.2.20</version>
</dependency> </dependency>
<!-- 核心模块 -->
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-mybatis</artifactId>
<version>${matchtech.version}</version>
</dependency>
<!-- 核心模块 -->
<dependency>
<groupId>com.matchtech</groupId>
<artifactId>matchtech-common-servlet</artifactId>
<version>${matchtech.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
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 sign in to comment