refactor(system): 重构系统模块的数据查询和分页功能
This commit is contained in:
@@ -151,7 +151,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudRoles, {getCurrentUserRoleLevel} from '@/api/system/role'
|
||||
import crudRoles from '@/api/system/role'
|
||||
import { searchDept, searchDeptTree } from '@/api/system/dept'
|
||||
import { listChildMenuSetByMenuId, listMenuByPid } from '@/api/system/menu'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
+3
-5
@@ -13,12 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
@@ -29,8 +28,7 @@ import lombok.Setter;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class KitBaseCreateTimeTb extends KitObject {
|
||||
|
||||
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date
|
||||
createTime;
|
||||
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date createTime;
|
||||
}
|
||||
|
||||
+4
-7
@@ -13,12 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
@@ -30,11 +29,9 @@ import lombok.Setter;
|
||||
public class KitBaseTimeTb extends KitObject {
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date
|
||||
createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date createTime;
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(name = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date updateTime;
|
||||
}
|
||||
|
||||
+2
-3
@@ -13,12 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
@@ -29,7 +28,7 @@ import lombok.Setter;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class KitBaseUpdateTimeTb extends KitObject {
|
||||
|
||||
@Schema(name = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date updateTime;
|
||||
}
|
||||
|
||||
+6
-8
@@ -13,12 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -34,13 +33,12 @@ public class KitBaseUserCreateTimeTb extends KitObject {
|
||||
|
||||
@CreatedBy
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建人", hidden = true)
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "创建人", hidden = true)
|
||||
private String
|
||||
createBy;
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date
|
||||
createTime;
|
||||
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date createTime;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
+9
-10
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -38,21 +37,21 @@ public class KitBaseUserTimeLogicTb extends KitObject {
|
||||
|
||||
@CreatedBy
|
||||
@TableField(value = "create_by", fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建人", hidden = true)
|
||||
@ApiModelProperty(value = "创建人", hidden = true)
|
||||
private String createBy;
|
||||
@LastModifiedBy
|
||||
@TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(name = "更新人", hidden = true)
|
||||
@ApiModelProperty(value = "更新人", hidden = true)
|
||||
private String updateBy;
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建时间", hidden = true)
|
||||
private Date
|
||||
createTime;
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
private Date createTime;
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(name = "更新时间", hidden = true)
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
private Date updateTime;
|
||||
@Schema(name = "数据有效性", hidden = true)
|
||||
@ApiModelProperty(value = "数据有效性", hidden = true)
|
||||
@TableLogic
|
||||
@TableField("available")
|
||||
private Integer available;
|
||||
private Integer
|
||||
available;
|
||||
}
|
||||
|
||||
+9
-14
@@ -13,12 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -35,22 +34,18 @@ public class KitBaseUserTimeTb extends KitObject {
|
||||
|
||||
@CreatedBy
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建人", hidden = true)
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "创建人", hidden = true)
|
||||
private String
|
||||
createBy;
|
||||
@LastModifiedBy
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(name = "更新人", hidden = true)
|
||||
private String
|
||||
updateBy;
|
||||
|
||||
@ApiModelProperty(value = "更新人", hidden = true)
|
||||
private String updateBy;
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date
|
||||
createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date createTime;
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(name = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date updateTime;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,10 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -27,6 +25,5 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class KitObject implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
+4
-5
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -37,11 +36,11 @@ public class KitPageArgs<T> implements Serializable {
|
||||
|
||||
@NotNull(message = "参数page不能为空")
|
||||
@Min(value = 1, message = "参数page最小值为1")
|
||||
@Schema(name = "页码", example = "1")
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page;
|
||||
@NotNull(message = "参数size不能为空")
|
||||
@Min(value = 1, message = "参数size最小值为1")
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size;
|
||||
private T args;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.base;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.constant;
|
||||
|
||||
/**
|
||||
|
||||
-2
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -24,7 +23,6 @@ import lombok.Getter;
|
||||
public enum FileTypeEnum {
|
||||
/* 文件类型 */
|
||||
IMAGE("image", "图片"), DOC("doc", "文档"), VOICE("voice", "音频"), VIDEO("video", "视频"), OTHER("other", "其他");
|
||||
|
||||
private final String code;
|
||||
private final String description;
|
||||
}
|
||||
|
||||
-8
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -22,37 +21,30 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum RequestMethodEnum {
|
||||
|
||||
/**
|
||||
* 搜寻 @AnonymousGetMapping
|
||||
*/
|
||||
GET("GET"),
|
||||
|
||||
/**
|
||||
* 搜寻 @AnonymousPostMapping
|
||||
*/
|
||||
POST("POST"),
|
||||
|
||||
/**
|
||||
* 搜寻 @AnonymousPutMapping
|
||||
*/
|
||||
PUT("PUT"),
|
||||
|
||||
/**
|
||||
* 搜寻 @AnonymousPatchMapping
|
||||
*/
|
||||
PATCH("PATCH"),
|
||||
|
||||
/**
|
||||
* 搜寻 @AnonymousDeleteMapping
|
||||
*/
|
||||
DELETE("DELETE"),
|
||||
|
||||
/**
|
||||
* 否则就是所有 Request 接口都放行
|
||||
*/
|
||||
ALL("All");
|
||||
|
||||
/**
|
||||
* Request 类型
|
||||
*/
|
||||
|
||||
-5
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.constant;
|
||||
|
||||
/**
|
||||
@@ -25,22 +24,18 @@ public interface SystemConst {
|
||||
* win 系统
|
||||
*/
|
||||
String WIN = "win";
|
||||
|
||||
/**
|
||||
* mac 系统
|
||||
*/
|
||||
String MAC = "mac";
|
||||
|
||||
/**
|
||||
* 请求头名称
|
||||
*/
|
||||
String HEADER_NAME = "Authorization";
|
||||
|
||||
/**
|
||||
* Token前缀
|
||||
*/
|
||||
String TOKEN_PREFIX = "Bearer";
|
||||
|
||||
/**
|
||||
* 小数点
|
||||
*/
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class KitAnonTagUtil {
|
||||
RequestMappingHandlerMapping requestMappingHandlerMapping =
|
||||
(RequestMappingHandlerMapping) applicationContext.getBean("requestMappingHandlerMapping");
|
||||
Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = requestMappingHandlerMapping.getHandlerMethods();
|
||||
Map<String, Set<String>> anonymousUrls = new HashMap<>(8);
|
||||
Map<String, java.util.Set<String>> anonymousUrls = new HashMap<>(8);
|
||||
// 获取匿名标记
|
||||
Set<String> get = new HashSet<>();
|
||||
Set<String> post = new HashSet<>();
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitSelectOptionVo;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
@@ -39,7 +40,7 @@ import lombok.experimental.UtilityClass;
|
||||
* @date 2022-11-09
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class KitCollUtil extends CollUtil {
|
||||
public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
|
||||
private static <T, K> Predicate<T> distinctPredicate(Function<? super T, ? extends K> keyMapper) {
|
||||
Map<Object, Boolean> map = new HashMap<>(3);
|
||||
|
||||
+3
-3
@@ -28,9 +28,6 @@ import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.odboy.constant.FileTypeEnum;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -45,6 +42,9 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
|
||||
+2
-3
@@ -72,9 +72,8 @@ public class SystemRoleController {
|
||||
@ApiOperation("查询角色")
|
||||
@PostMapping(value = "/searchRole")
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
public ResponseEntity<KitPageResult<SystemRoleVo>> queryRoleByArgs(
|
||||
@Validated @RequestBody KitPageArgs<SystemQueryRoleArgs> pageArgs) {
|
||||
Page<Object> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||
public ResponseEntity<KitPageResult<SystemRoleVo>> queryRoleByArgs(@Validated @RequestBody KitPageArgs<SystemQueryRoleArgs> pageArgs) {
|
||||
Page<SystemRoleTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||
return ResponseEntity.ok(systemRoleService.searchRoleByArgs(pageArgs.getArgs(), page));
|
||||
}
|
||||
|
||||
|
||||
-4
@@ -23,8 +23,4 @@ public class SystemQueryDictArgs {
|
||||
|
||||
@ApiModelProperty(value = "模糊查询")
|
||||
private String blurry;
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
}
|
||||
|
||||
-4
@@ -31,8 +31,4 @@ public class SystemQueryJobArgs {
|
||||
private Boolean enabled;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
}
|
||||
|
||||
-6
@@ -27,10 +27,4 @@ public class SystemQueryRoleArgs {
|
||||
private String blurry;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
@ApiModelProperty(value = "偏移量", hidden = true)
|
||||
private long offset;
|
||||
}
|
||||
|
||||
-4
@@ -40,8 +40,4 @@ public class SystemQueryUserArgs extends KitObject {
|
||||
private Long deptId;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
}
|
||||
|
||||
-5
@@ -18,7 +18,6 @@ package cn.odboy.system.dal.mysql;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -29,10 +28,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SystemDictMapper extends BaseMapper<SystemDictTb> {
|
||||
|
||||
default List<SystemDictTb> listAll() {
|
||||
return selectList(null);
|
||||
}
|
||||
|
||||
default SystemDictTb getByName(String dictName) {
|
||||
LambdaQueryWrapper<SystemDictTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDictTb::getName, dictName);
|
||||
|
||||
+2
-2
@@ -43,8 +43,8 @@ public class BizLockAspect {
|
||||
public Object around(ProceedingJoinPoint joinPoint, BizLock bizLock) throws Throwable {
|
||||
// 解析SpEL表达式生成最终的lockKey
|
||||
String lockKey = parseLockKey(joinPoint, bizLock);
|
||||
Boolean success = redisHelper.setIfAbsent(lockKey, lockKey, bizLock.leaseTime(), bizLock.timeUnit());
|
||||
if (success == null || !success) {
|
||||
boolean success = redisHelper.setIfAbsent(lockKey, lockKey, bizLock.leaseTime(), bizLock.timeUnit());
|
||||
if (!success) {
|
||||
throw new BadRequestException(bizLock.errorMessage());
|
||||
}
|
||||
try {
|
||||
|
||||
-2
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.framework.mybatisplus;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
@@ -55,4 +54,3 @@ public class MpMetaObjectHandler implements MetaObjectHandler {
|
||||
this.strictUpdateFill(metaObject, "updateBy", String.class, username);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ import cn.odboy.util.KitBrowserUtil;
|
||||
import cn.odboy.util.KitIPUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
@@ -96,7 +96,7 @@ public class OperationLogAspect {
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(bizName)) {
|
||||
bizName = "Default";
|
||||
bizName = "默认业务";
|
||||
}
|
||||
String method = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||
Object[] args = joinPoint.getArgs();
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.framework.storage;
|
||||
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
|
||||
+1
-2
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.framework.storage.local;
|
||||
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import jakarta.servlet.MultipartConfigElement;
|
||||
import java.io.File;
|
||||
import jakarta.servlet.MultipartConfigElement;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
+2
-15
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.framework.storage.minio;
|
||||
|
||||
import cn.hutool.core.io.FastByteArrayOutputStream;
|
||||
@@ -44,13 +43,13 @@ import io.minio.Result;
|
||||
import io.minio.http.Method;
|
||||
import io.minio.messages.Bucket;
|
||||
import io.minio.messages.Item;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -153,13 +152,11 @@ public class MinioRepository {
|
||||
String type = FileTypeUtil.getType(tempFile);
|
||||
String prefix = KitFileUtil.getPrefix(tempFile);
|
||||
String suffix = KitFileUtil.getSuffix(tempFile);
|
||||
|
||||
String fileCode = IdUtil.fastSimpleUUID();
|
||||
String fileName = fileCode + FileUtil.getSuffix(originalFilename);
|
||||
String objectName = KitDateUtil.getNowDateStr() + "/" + fileName;
|
||||
log.info("上传文件,原文件名:{},上传后文件名:{}", originalFilename, fileName);
|
||||
String fileUrl = ossMinioConfig.getEndpoint() + "/" + ossMinioConfig.getBucketName() + "/" + objectName;
|
||||
|
||||
SystemOssStorageTb systemOssStorageTb = new SystemOssStorageTb();
|
||||
systemOssStorageTb.setServiceType("minio");
|
||||
systemOssStorageTb.setEndpoint(ossMinioConfig.getEndpoint());
|
||||
@@ -173,7 +170,6 @@ public class MinioRepository {
|
||||
systemOssStorageTb.setFileUrl(fileUrl);
|
||||
systemOssStorageTb.setFileCode(fileCode);
|
||||
systemOssStorageTb.setObjectName(objectName);
|
||||
|
||||
try (InputStream fileInputStream = KitFileUtil.getInputStream(tempFile)) {
|
||||
PutObjectArgs objectArgs = PutObjectArgs.builder().bucket(ossMinioConfig.getBucketName()).object(objectName)
|
||||
.stream(fileInputStream, fileSize, -1).contentType(contentType).build();
|
||||
@@ -203,14 +199,11 @@ public class MinioRepository {
|
||||
if (StrUtil.isBlank(originalFilename)) {
|
||||
throw new BadRequestException("文件名不能为空");
|
||||
}
|
||||
|
||||
long size = file.getSize();
|
||||
KitFileUtil.checkSize(properties.getOss().getMaxSize(), size);
|
||||
|
||||
String fileName = UUID.randomUUID() + FileUtil.getSuffix(originalFilename);
|
||||
// yyyy/MM/dd/fileName.xxx
|
||||
String objectName = KitDateUtil.getNowDateTimeStr() + "/" + fileName;
|
||||
|
||||
log.info("准备上传文件,原文件名:{},上传后文件名:{}", originalFilename, fileName);
|
||||
try (InputStream fileInputStream = file.getInputStream()) {
|
||||
PutObjectArgs objectArgs =
|
||||
@@ -286,17 +279,14 @@ public class MinioRepository {
|
||||
public void download(String fileName, HttpServletResponse res) {
|
||||
GetObjectArgs objectArgs =
|
||||
GetObjectArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(fileName).build();
|
||||
|
||||
try (GetObjectResponse response = minioClient.getObject(objectArgs);
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream()) {
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = response.read(buf)) != -1) {
|
||||
os.write(buf, 0, len);
|
||||
}
|
||||
os.flush();
|
||||
|
||||
byte[] bytes = os.toByteArray();
|
||||
res.setCharacterEncoding("utf-8");
|
||||
res.addHeader("Content-Disposition", "attachment;fileName=" + fileName);
|
||||
@@ -318,12 +308,10 @@ public class MinioRepository {
|
||||
public void downloadOptimizedVersion(String fileName, HttpServletResponse res) {
|
||||
GetObjectArgs objectArgs =
|
||||
GetObjectArgs.builder().bucket(properties.getOss().getMinio().getBucketName()).object(fileName).build();
|
||||
|
||||
try (GetObjectResponse response = minioClient.getObject(objectArgs)) {
|
||||
// 增大缓冲区
|
||||
byte[] buf = new byte[1024 * 4];
|
||||
int len;
|
||||
|
||||
// 分块下载并输出到响应流
|
||||
try (ServletOutputStream stream = res.getOutputStream()) {
|
||||
res.setCharacterEncoding("utf-8");
|
||||
@@ -331,7 +319,6 @@ public class MinioRepository {
|
||||
res.setHeader("Cache-Control", "no-store");
|
||||
res.setHeader("Pragma", "no-cache");
|
||||
res.setHeader("Expires", "0");
|
||||
|
||||
while ((len = response.read(buf)) != -1) {
|
||||
stream.write(buf, 0, len);
|
||||
// 确保实时写入
|
||||
|
||||
+2
-2
@@ -92,7 +92,7 @@ public class SystemDictService {
|
||||
*/
|
||||
public KitPageResult<SystemDictTb> searchDict(SystemQueryDictArgs args, Page<SystemDictTb> page) {
|
||||
LambdaQueryWrapper<SystemDictTb> wrapper = new LambdaQueryWrapper<>();
|
||||
injectQueryParams(args, wrapper);
|
||||
this.injectQueryParams(args, wrapper);
|
||||
Page<SystemDictTb> selectPage = systemDictMapper.selectPage(page, wrapper);
|
||||
return KitPageUtil.toPage(selectPage);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class SystemDictService {
|
||||
|
||||
public List<SystemDictTb> queryDictByArgs(SystemQueryDictArgs args) {
|
||||
LambdaQueryWrapper<SystemDictTb> wrapper = new LambdaQueryWrapper<>();
|
||||
injectQueryParams(args, wrapper);
|
||||
this.injectQueryParams(args, wrapper);
|
||||
return systemDictMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.logging.ExecutionTimeStatisticsFace;
|
||||
import cn.odboy.system.constant.SystemTransferProtocolConst;
|
||||
import cn.odboy.system.constant.SystemYesOrNoChConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
|
||||
+19
-14
@@ -68,7 +68,7 @@ public class SystemRoleService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveRole(SystemCreateRoleArgs args) {
|
||||
checkRoleLevels(args.getLevel());
|
||||
if (this.getRoleByName(args.getName()) != null) {
|
||||
if (this.countRoleByName(args.getName()) > 0) {
|
||||
throw new BadRequestException("角色名称已存在");
|
||||
}
|
||||
SystemRoleTb roleTb = KitBeanUtil.copyToClass(args, SystemRoleTb.class);
|
||||
@@ -85,6 +85,12 @@ public class SystemRoleService {
|
||||
return systemRoleMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
private long countRoleByName(String name) {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemRoleTb::getName, name);
|
||||
return systemRoleMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
@@ -167,9 +173,10 @@ public class SystemRoleService {
|
||||
* 根据条件查询全部角色
|
||||
*
|
||||
* @param args 条件
|
||||
* @param rolePage 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemRoleVo> queryRoleByArgs(SystemQueryRoleArgs args) {
|
||||
public List<SystemRoleVo> queryRoleByArgs(SystemQueryRoleArgs args, Page<SystemRoleTb> rolePage) {
|
||||
KitValidUtil.notNull(args);
|
||||
// 查询角色基本信息
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -181,27 +188,25 @@ public class SystemRoleService {
|
||||
args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemRoleTb::getLevel);
|
||||
if (args.getSize() != null) {
|
||||
Page<SystemRoleTb> rolePage = new Page<>(args.getPage(), args.getSize());
|
||||
Page<SystemRoleTb> page = systemRoleMapper.selectPage(rolePage, wrapper);
|
||||
List<SystemRoleTb> roles = page.getRecords();
|
||||
return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList());
|
||||
List<SystemRoleTb> roles;
|
||||
if (rolePage == null) {
|
||||
roles = systemRoleMapper.selectList(wrapper);
|
||||
} else {
|
||||
List<SystemRoleTb> roles = systemRoleMapper.selectList(wrapper);
|
||||
return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList());
|
||||
Page<SystemRoleTb> page = systemRoleMapper.selectPage(rolePage, wrapper);
|
||||
roles = page.getRecords();
|
||||
}
|
||||
return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询角色
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
* @param page 分页条件
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemRoleVo> searchRoleByArgs(SystemQueryRoleArgs args, Page<Object> page) {
|
||||
args.setOffset(page.offset());
|
||||
List<SystemRoleVo> roles = this.queryRoleByArgs(args);
|
||||
public KitPageResult<SystemRoleVo> searchRoleByArgs(SystemQueryRoleArgs args, Page<SystemRoleTb> page) {
|
||||
List<SystemRoleVo> roles = this.queryRoleByArgs(args, page);
|
||||
Long total = this.countRoleByArgs(args);
|
||||
return KitPageUtil.toPage(roles, total);
|
||||
}
|
||||
@@ -280,7 +285,7 @@ public class SystemRoleService {
|
||||
}
|
||||
|
||||
public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) {
|
||||
List<SystemRoleVo> systemRoleVos = this.queryRoleByArgs(args);
|
||||
List<SystemRoleVo> systemRoleVos = this.queryRoleByArgs(args, null);
|
||||
List<SystemRoleExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemRoleVo dataObject : systemRoleVos) {
|
||||
SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
|
||||
+1
-15
@@ -343,20 +343,6 @@ public class SystemUserService {
|
||||
return KitPageUtil.toPage(userVos, userPage.getTotal());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 查询全部不分页
|
||||
// *
|
||||
// * @param args 条件
|
||||
// * @return /
|
||||
// */
|
||||
// public List<SystemUserVo> queryUserVoByArgs(SystemQueryUserArgs args) {
|
||||
// // 查询用户基本信息
|
||||
// LambdaQueryWrapper<SystemUserTb> wrapper = buildUserQueryWrapper(args);
|
||||
// List<SystemUserTb> users = systemUserMapper.selectList(wrapper);
|
||||
// // 转换为SystemUserVo并关联查询
|
||||
// return users.stream().map(this::convertToUserVo).collect(Collectors.toList());
|
||||
// }
|
||||
|
||||
public long countUserByArgs(SystemQueryUserArgs args) {
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = buildUserQueryWrapper(args);
|
||||
return systemUserMapper.selectCount(wrapper);
|
||||
@@ -385,7 +371,7 @@ public class SystemUserService {
|
||||
c.or();
|
||||
c.like(SystemUserTb::getNickName, args.getBlurry());
|
||||
});
|
||||
return systemUserMapper.selectPage(new Page<>(args.getPage(), 50), wrapper).getRecords().stream().map(m -> {
|
||||
return systemUserMapper.selectPage(new Page<>(pageArgs.getPage(), 50), wrapper).getRecords().stream().map(m -> {
|
||||
Map<String, Object> ext = new HashMap<>(1);
|
||||
ext.put("id", m.getId());
|
||||
ext.put("deptId", m.getDeptId());
|
||||
|
||||
+2
-3
@@ -72,9 +72,8 @@ public class SystemRoleController {
|
||||
@ApiOperation("查询角色")
|
||||
@PostMapping(value = "/searchRole")
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
public ResponseEntity<KitPageResult<SystemRoleVo>> queryRoleByArgs(
|
||||
@Validated @RequestBody KitPageArgs<SystemQueryRoleArgs> pageArgs) {
|
||||
Page<Object> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||
public ResponseEntity<KitPageResult<SystemRoleVo>> queryRoleByArgs(@Validated @RequestBody KitPageArgs<SystemQueryRoleArgs> pageArgs) {
|
||||
Page<SystemRoleTb> page = new Page<>(pageArgs.getPage(), pageArgs.getSize());
|
||||
return ResponseEntity.ok(systemRoleService.searchRoleByArgs(pageArgs.getArgs(), page));
|
||||
}
|
||||
|
||||
|
||||
-4
@@ -23,8 +23,4 @@ public class SystemQueryDictArgs {
|
||||
|
||||
@ApiModelProperty(value = "模糊查询")
|
||||
private String blurry;
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
}
|
||||
|
||||
-4
@@ -31,8 +31,4 @@ public class SystemQueryJobArgs {
|
||||
private Boolean enabled;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
}
|
||||
|
||||
-6
@@ -27,10 +27,4 @@ public class SystemQueryRoleArgs {
|
||||
private String blurry;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
@ApiModelProperty(value = "偏移量", hidden = true)
|
||||
private long offset;
|
||||
}
|
||||
|
||||
-4
@@ -40,8 +40,4 @@ public class SystemQueryUserArgs extends KitObject {
|
||||
private Long deptId;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
}
|
||||
|
||||
-5
@@ -18,7 +18,6 @@ package cn.odboy.system.dal.mysql;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -29,10 +28,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SystemDictMapper extends BaseMapper<SystemDictTb> {
|
||||
|
||||
default List<SystemDictTb> listAll() {
|
||||
return selectList(null);
|
||||
}
|
||||
|
||||
default SystemDictTb getByName(String dictName) {
|
||||
LambdaQueryWrapper<SystemDictTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDictTb::getName, dictName);
|
||||
|
||||
+2
-2
@@ -92,7 +92,7 @@ public class SystemDictService {
|
||||
*/
|
||||
public KitPageResult<SystemDictTb> searchDict(SystemQueryDictArgs args, Page<SystemDictTb> page) {
|
||||
LambdaQueryWrapper<SystemDictTb> wrapper = new LambdaQueryWrapper<>();
|
||||
injectQueryParams(args, wrapper);
|
||||
this.injectQueryParams(args, wrapper);
|
||||
Page<SystemDictTb> selectPage = systemDictMapper.selectPage(page, wrapper);
|
||||
return KitPageUtil.toPage(selectPage);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class SystemDictService {
|
||||
|
||||
public List<SystemDictTb> queryDictByArgs(SystemQueryDictArgs args) {
|
||||
LambdaQueryWrapper<SystemDictTb> wrapper = new LambdaQueryWrapper<>();
|
||||
injectQueryParams(args, wrapper);
|
||||
this.injectQueryParams(args, wrapper);
|
||||
return systemDictMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
|
||||
+19
-14
@@ -68,7 +68,7 @@ public class SystemRoleService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveRole(SystemCreateRoleArgs args) {
|
||||
checkRoleLevels(args.getLevel());
|
||||
if (this.getRoleByName(args.getName()) != null) {
|
||||
if (this.countRoleByName(args.getName()) > 0) {
|
||||
throw new BadRequestException("角色名称已存在");
|
||||
}
|
||||
SystemRoleTb roleTb = KitBeanUtil.copyToClass(args, SystemRoleTb.class);
|
||||
@@ -85,6 +85,12 @@ public class SystemRoleService {
|
||||
return systemRoleMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
private long countRoleByName(String name) {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemRoleTb::getName, name);
|
||||
return systemRoleMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
@@ -167,9 +173,10 @@ public class SystemRoleService {
|
||||
* 根据条件查询全部角色
|
||||
*
|
||||
* @param args 条件
|
||||
* @param rolePage 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemRoleVo> queryRoleByArgs(SystemQueryRoleArgs args) {
|
||||
public List<SystemRoleVo> queryRoleByArgs(SystemQueryRoleArgs args, Page<SystemRoleTb> rolePage) {
|
||||
KitValidUtil.notNull(args);
|
||||
// 查询角色基本信息
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -181,27 +188,25 @@ public class SystemRoleService {
|
||||
args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemRoleTb::getLevel);
|
||||
if (args.getSize() != null) {
|
||||
Page<SystemRoleTb> rolePage = new Page<>(args.getPage(), args.getSize());
|
||||
Page<SystemRoleTb> page = systemRoleMapper.selectPage(rolePage, wrapper);
|
||||
List<SystemRoleTb> roles = page.getRecords();
|
||||
return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList());
|
||||
List<SystemRoleTb> roles;
|
||||
if (rolePage == null) {
|
||||
roles = systemRoleMapper.selectList(wrapper);
|
||||
} else {
|
||||
List<SystemRoleTb> roles = systemRoleMapper.selectList(wrapper);
|
||||
return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList());
|
||||
Page<SystemRoleTb> page = systemRoleMapper.selectPage(rolePage, wrapper);
|
||||
roles = page.getRecords();
|
||||
}
|
||||
return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询角色
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
* @param page 分页条件
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemRoleVo> searchRoleByArgs(SystemQueryRoleArgs args, Page<Object> page) {
|
||||
args.setOffset(page.offset());
|
||||
List<SystemRoleVo> roles = this.queryRoleByArgs(args);
|
||||
public KitPageResult<SystemRoleVo> searchRoleByArgs(SystemQueryRoleArgs args, Page<SystemRoleTb> page) {
|
||||
List<SystemRoleVo> roles = this.queryRoleByArgs(args, page);
|
||||
Long total = this.countRoleByArgs(args);
|
||||
return KitPageUtil.toPage(roles, total);
|
||||
}
|
||||
@@ -280,7 +285,7 @@ public class SystemRoleService {
|
||||
}
|
||||
|
||||
public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) {
|
||||
List<SystemRoleVo> systemRoleVos = this.queryRoleByArgs(args);
|
||||
List<SystemRoleVo> systemRoleVos = this.queryRoleByArgs(args, null);
|
||||
List<SystemRoleExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemRoleVo dataObject : systemRoleVos) {
|
||||
SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ public class SystemUserService {
|
||||
c.or();
|
||||
c.like(SystemUserTb::getNickName, args.getBlurry());
|
||||
});
|
||||
return systemUserMapper.selectPage(new Page<>(args.getPage(), 50), wrapper).getRecords().stream().map(m -> {
|
||||
return systemUserMapper.selectPage(new Page<>(pageArgs.getPage(), 50), wrapper).getRecords().stream().map(m -> {
|
||||
Map<String, Object> ext = new HashMap<>(1);
|
||||
ext.put("id", m.getId());
|
||||
ext.put("deptId", m.getDeptId());
|
||||
|
||||
Reference in New Issue
Block a user