添加项目增删改查接口,以及用户和项目关联增删改查接口
This commit is contained in:
		| @ -0,0 +1,31 @@ | ||||
| package org.dromara.common.core.common; | ||||
|  | ||||
| import lombok.Data; | ||||
| import org.dromara.common.core.constant.CommonConstant; | ||||
|  | ||||
| /** | ||||
|  * 分页请求 | ||||
|  */ | ||||
| @Data | ||||
| public class PageRequest { | ||||
|  | ||||
|     /** | ||||
|      * 当前页号 | ||||
|      */ | ||||
|     private int current = 1; | ||||
|  | ||||
|     /** | ||||
|      * 页面大小 | ||||
|      */ | ||||
|     private int pageSize = 10; | ||||
|  | ||||
|     /** | ||||
|      * 排序字段 | ||||
|      */ | ||||
|     private String sortField; | ||||
|  | ||||
|     /** | ||||
|      * 排序顺序(默认升序) | ||||
|      */ | ||||
|     private String sortOrder = CommonConstant.SORT_ORDER_ASC; | ||||
| } | ||||
| @ -0,0 +1,18 @@ | ||||
| package org.dromara.common.core.constant; | ||||
|  | ||||
| /** | ||||
|  * 通用常量 | ||||
|  */ | ||||
| public interface CommonConstant { | ||||
|  | ||||
|     /** | ||||
|      * 升序 | ||||
|      */ | ||||
|     String SORT_ORDER_ASC = "ascend"; | ||||
|  | ||||
|     /** | ||||
|      * 降序 | ||||
|      */ | ||||
|     String SORT_ORDER_DESC = " descend"; | ||||
|  | ||||
| } | ||||
| @ -53,4 +53,17 @@ public class SqlUtil { | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 校验排序字段是否合法(防止 SQL 注入) | ||||
|      * | ||||
|      * @param sortField 排序字段 | ||||
|      * @return 是否存在 SQL 注入 | ||||
|      */ | ||||
|     public static boolean validSortField(String sortField) { | ||||
|         if (StringUtils.isBlank(sortField)) { | ||||
|             return false; | ||||
|         } | ||||
|         return !StringUtils.containsAny(sortField, "=", "(", ")", " "); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user