From 75d8928eefd2ef876c02d32604b2e838b325aaba Mon Sep 17 00:00:00 2001 From: zhangyeguang Date: Fri, 29 Nov 2024 17:40:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E6=9E=9C=E8=AF=86=E5=88=AB=E5=90=8E?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/RecognitionModelClient.java | 5 +- .../jiagutech/common/exception/BizCode.java | 2 +- .../common/exception/BusinessException.java | 3 +- .../jiagutech/common/sa/SaPermissionImpl.java | 2 +- .../jiagutech/common/sa/SaTokenConfigure.java | 8 +-- .../controller/RecordController.java | 29 +++++++- .../jiagutech/controller/UserController.java | 23 ++++++- src/main/java/com/jiagutech/dto/Scale.java | 9 +++ .../com/jiagutech/dto/UpdateScaleRequest.java | 19 ------ .../jiagutech/dto/{ => common}/LoginUser.java | 15 ++++- src/main/java/com/jiagutech/dto/common/R.java | 8 +-- .../jiagutech/dto/mapping/UserMapping.java | 20 ++++++ .../{ => request}/CreateRecordRequest.java | 2 +- .../dto/{ => request}/LoginRequest.java | 2 +- .../dto/request/RecordUpdateRequest.java | 22 +++++++ .../dto/request/UpdateScaleRequest.java | 20 ++++++ .../dto/{ => request}/UserRequest.java | 8 ++- .../dto/{ => response}/LoginResponse.java | 6 +- .../dto/{ => response}/ModelPredictData.java | 2 +- .../{ => response}/ModelPredictResponse.java | 4 +- .../dto/{ => response}/RecordDetail.java | 2 +- .../dto/{ => response}/RecordItem.java | 2 +- .../com/jiagutech/dto/response/TaskItem.java | 13 ++++ .../com/jiagutech/dto/response/UserItem.java | 23 +++++++ .../jiagutech/entity/RecordContentEntity.java | 14 ++-- .../com/jiagutech/entity/RecordEntity.java | 2 +- .../java/com/jiagutech/entity/UserEntity.java | 2 + .../ModelPredictResponseListTypeHandler.java | 2 +- .../com/jiagutech/mapper/RecordMapper.java | 8 ++- .../java/com/jiagutech/mapper/UserMapper.java | 3 +- .../jiagutech/record/RecordTaskHandler.java | 17 +++-- .../jiagutech/record/RecordTaskManager.java | 20 ++++++ .../jiagutech/record/RecordTaskProcessor.java | 8 ++- .../com/jiagutech/service/RecordService.java | 14 ++++ .../jiagutech/service/RecordServiceImpl.java | 66 ++++++++++++++++--- .../com/jiagutech/service/UserService.java | 11 +++- .../jiagutech/service/UserServiceImpl.java | 21 ++++-- .../java/com/jiagutech/utils/LoginUtil.java | 2 +- src/main/resources/application.yml | 2 + src/main/resources/mapper/RecordMapper.xml | 5 +- src/main/resources/mapper/UserMapper.xml | 5 +- 41 files changed, 355 insertions(+), 96 deletions(-) delete mode 100644 src/main/java/com/jiagutech/dto/UpdateScaleRequest.java rename src/main/java/com/jiagutech/dto/{ => common}/LoginUser.java (78%) create mode 100644 src/main/java/com/jiagutech/dto/mapping/UserMapping.java rename src/main/java/com/jiagutech/dto/{ => request}/CreateRecordRequest.java (97%) rename src/main/java/com/jiagutech/dto/{ => request}/LoginRequest.java (94%) create mode 100644 src/main/java/com/jiagutech/dto/request/RecordUpdateRequest.java create mode 100644 src/main/java/com/jiagutech/dto/request/UpdateScaleRequest.java rename src/main/java/com/jiagutech/dto/{ => request}/UserRequest.java (58%) rename src/main/java/com/jiagutech/dto/{ => response}/LoginResponse.java (84%) rename src/main/java/com/jiagutech/dto/{ => response}/ModelPredictData.java (79%) rename src/main/java/com/jiagutech/dto/{ => response}/ModelPredictResponse.java (77%) rename src/main/java/com/jiagutech/dto/{ => response}/RecordDetail.java (94%) rename src/main/java/com/jiagutech/dto/{ => response}/RecordItem.java (93%) create mode 100644 src/main/java/com/jiagutech/dto/response/TaskItem.java create mode 100644 src/main/java/com/jiagutech/dto/response/UserItem.java diff --git a/src/main/java/com/jiagutech/client/RecognitionModelClient.java b/src/main/java/com/jiagutech/client/RecognitionModelClient.java index 0be6b68..1439e80 100644 --- a/src/main/java/com/jiagutech/client/RecognitionModelClient.java +++ b/src/main/java/com/jiagutech/client/RecognitionModelClient.java @@ -1,8 +1,7 @@ package com.jiagutech.client; import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONObject; -import com.jiagutech.dto.ModelPredictResponse; +import com.jiagutech.dto.response.ModelPredictResponse; import com.jiagutech.dto.RecordModel; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -10,11 +9,9 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.FileSystemResource; import org.springframework.http.*; import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; -import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.util.Collections; diff --git a/src/main/java/com/jiagutech/common/exception/BizCode.java b/src/main/java/com/jiagutech/common/exception/BizCode.java index f52eb80..d3f04c4 100644 --- a/src/main/java/com/jiagutech/common/exception/BizCode.java +++ b/src/main/java/com/jiagutech/common/exception/BizCode.java @@ -3,7 +3,7 @@ package com.jiagutech.common.exception; import lombok.Getter; @Getter -public enum BizCode implements CodeInterface { +public enum BizCode { General_Success(200, "接口调用成功"), ServerError(10001, "服务器异常"), General_Failure(10004, "接口调用失败"), diff --git a/src/main/java/com/jiagutech/common/exception/BusinessException.java b/src/main/java/com/jiagutech/common/exception/BusinessException.java index ac9e0a7..1356bd1 100644 --- a/src/main/java/com/jiagutech/common/exception/BusinessException.java +++ b/src/main/java/com/jiagutech/common/exception/BusinessException.java @@ -33,12 +33,13 @@ public class BusinessException extends RuntimeException { this.message = message1; } - public BusinessException(CodeInterface biz) { + public BusinessException(BizCode biz) { super(); this.code = biz.getCode(); this.message = biz.getMsg(); } + public BusinessException(String message) { super(message); this.code= BizCode.General_ParameterInvalid.getCode(); diff --git a/src/main/java/com/jiagutech/common/sa/SaPermissionImpl.java b/src/main/java/com/jiagutech/common/sa/SaPermissionImpl.java index b2014a2..66db0ef 100644 --- a/src/main/java/com/jiagutech/common/sa/SaPermissionImpl.java +++ b/src/main/java/com/jiagutech/common/sa/SaPermissionImpl.java @@ -1,7 +1,7 @@ package com.jiagutech.common.sa; import cn.dev33.satoken.stp.StpInterface; -import com.jiagutech.dto.LoginUser; +import com.jiagutech.dto.common.LoginUser; import com.jiagutech.utils.LoginUtil; import java.util.ArrayList; diff --git a/src/main/java/com/jiagutech/common/sa/SaTokenConfigure.java b/src/main/java/com/jiagutech/common/sa/SaTokenConfigure.java index 3436490..d47f2dd 100644 --- a/src/main/java/com/jiagutech/common/sa/SaTokenConfigure.java +++ b/src/main/java/com/jiagutech/common/sa/SaTokenConfigure.java @@ -16,18 +16,18 @@ public class SaTokenConfigure implements WebMvcConfigurer { public void addInterceptors(InterceptorRegistry registry) { // 注册 Sa-Token 拦截器,打开注解式鉴权功能 registry.addInterceptor(new SaInterceptor(handle -> { + String url = SaHolder.getRequest().getRequestPath(); try { - log.info("-------- 前端访问path:" + SaHolder.getRequest().getRequestPath()); + log.info("request url :{}:", url); StpUtil.checkLogin(); - log.info("-------- 此 path 校验成功:" + SaHolder.getRequest().getRequestPath()); } catch (Exception e) { - log.info("-------- 此 path 校验失败:" + SaHolder.getRequest().getRequestPath()); + log.info("url:{} --- 校验失败:", url); throw e; } })) .addPathPatterns("/**") .excludePathPatterns("/user/login", "user/logout", - "/user/register", "/record/export/**", "/favicon.ico","/error", + "/user/register", "/record/export/**", "/favicon.ico", "/error", "/swagger-ui/**", "/swagger-resources/**", "/v2/api-docs/**", "/doc.html/**", "/webjars/**" ); } diff --git a/src/main/java/com/jiagutech/controller/RecordController.java b/src/main/java/com/jiagutech/controller/RecordController.java index 38d99b3..aa828a1 100644 --- a/src/main/java/com/jiagutech/controller/RecordController.java +++ b/src/main/java/com/jiagutech/controller/RecordController.java @@ -5,6 +5,12 @@ import com.jiagutech.dto.*; import com.jiagutech.dto.common.PageRequest; import com.jiagutech.dto.common.PageResult; import com.jiagutech.dto.common.R; +import com.jiagutech.dto.request.CreateRecordRequest; +import com.jiagutech.dto.request.RecordUpdateRequest; +import com.jiagutech.dto.request.UpdateScaleRequest; +import com.jiagutech.dto.response.RecordDetail; +import com.jiagutech.dto.response.RecordItem; +import com.jiagutech.dto.response.TaskItem; import com.jiagutech.entity.RecordContentEntity; import com.jiagutech.service.RecordService; import io.swagger.annotations.Api; @@ -12,6 +18,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -73,8 +80,28 @@ public class RecordController { @ApiOperation(value = "比例尺设置") @PutMapping("/scale") - public void updateScale( @RequestBody UpdateScaleRequest request) { + public void updateScale(@RequestBody UpdateScaleRequest request) { recordService.updateScale(request); } + @ApiOperation(value = "删除记录") + @DeleteMapping(value = "/delete/{recordId}") + public R deleteRecord(Long recordId) { + boolean res = recordService.deleteRecord(recordId); + return res ? R.ok() : R.fail(); + } + + @ApiOperation(value = "更新记录") + @PutMapping(value = "/update") + public R updateRecord(@Validated @RequestBody RecordUpdateRequest updateRequest) { + boolean res = recordService.updateRecord(updateRequest); + return res ? R.ok() : R.fail("更新失败或记录不存在"); + } + + @ApiOperation(value = "获取任务列表") + @GetMapping(value = "/tasks") + public R> getTasks() { + return R.ok(recordService.getTasks()); + } + } diff --git a/src/main/java/com/jiagutech/controller/UserController.java b/src/main/java/com/jiagutech/controller/UserController.java index 5deb9c0..7b72729 100644 --- a/src/main/java/com/jiagutech/controller/UserController.java +++ b/src/main/java/com/jiagutech/controller/UserController.java @@ -1,11 +1,14 @@ package com.jiagutech.controller; import cn.dev33.satoken.stp.StpUtil; -import com.jiagutech.dto.LoginRequest; -import com.jiagutech.dto.LoginResponse; +import com.jiagutech.dto.common.LoginUser; import com.jiagutech.dto.common.R; -import com.jiagutech.dto.UserRequest; +import com.jiagutech.dto.request.LoginRequest; +import com.jiagutech.dto.request.UserRequest; +import com.jiagutech.dto.response.LoginResponse; +import com.jiagutech.dto.response.UserItem; import com.jiagutech.service.UserService; +import com.jiagutech.utils.LoginUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -13,6 +16,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.List; + @Api(tags = "用户") @Slf4j @RestController @@ -58,4 +63,16 @@ public class UserController { return R.ok(); } + + @ApiOperation(value = "用户信息") + @GetMapping(value = "/userInfo") + public R getUserInfo() { + return R.ok(LoginUtil.getLoginUser()); + } + + @ApiOperation(value = "待审核用户列表") + @GetMapping(value = "/userList") + public R> approvalUserList() { + return R.ok(userService.approvalUserList()); + } } diff --git a/src/main/java/com/jiagutech/dto/Scale.java b/src/main/java/com/jiagutech/dto/Scale.java index 4f4abaa..45810a6 100644 --- a/src/main/java/com/jiagutech/dto/Scale.java +++ b/src/main/java/com/jiagutech/dto/Scale.java @@ -1,10 +1,19 @@ package com.jiagutech.dto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.Size; + @Data +@ApiModel(description = "缩放比例") public class Scale { + @ApiModelProperty(value = "缩放比例", required = true) private int scale; + @ApiModelProperty(value = "实际大小", required = true) private float size; + @ApiModelProperty(value = "坐标", required = true) + @Size(min = 2, max = 2, message = "坐标必须是2个") private int[][] points; } diff --git a/src/main/java/com/jiagutech/dto/UpdateScaleRequest.java b/src/main/java/com/jiagutech/dto/UpdateScaleRequest.java deleted file mode 100644 index 1f89b11..0000000 --- a/src/main/java/com/jiagutech/dto/UpdateScaleRequest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.jiagutech.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -@ApiModel("更新比例尺") -public class UpdateScaleRequest { - @ApiModelProperty("记录id") - private long recordId; - @ApiModelProperty("记录内容id") - private long recordContentId; - @ApiModelProperty("比例尺类型,1=统一、2=自用、3=延用") - private int scaleType; - @ApiModelProperty("比例尺") - private Scale scale; - -} diff --git a/src/main/java/com/jiagutech/dto/LoginUser.java b/src/main/java/com/jiagutech/dto/common/LoginUser.java similarity index 78% rename from src/main/java/com/jiagutech/dto/LoginUser.java rename to src/main/java/com/jiagutech/dto/common/LoginUser.java index e841a5a..2fda3ac 100644 --- a/src/main/java/com/jiagutech/dto/LoginUser.java +++ b/src/main/java/com/jiagutech/dto/common/LoginUser.java @@ -1,14 +1,15 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.common; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; import java.time.LocalDateTime; -import java.util.List; /** * @ClassName LoginUser @@ -19,6 +20,7 @@ import java.util.List; **/ @Data @NoArgsConstructor +@ApiModel("登陆用户") public class LoginUser implements Serializable { private static final long serialVersionUID = 1L; @@ -33,6 +35,7 @@ public class LoginUser implements Serializable { /** * 部门 */ + @ApiModelProperty("部门") private String unitName; /** @@ -44,6 +47,7 @@ public class LoginUser implements Serializable { /** * 登录时间 */ + @ApiModelProperty("登录时间") private Long loginTime; /** @@ -60,15 +64,18 @@ public class LoginUser implements Serializable { /** * 用户名 */ + @ApiModelProperty("用户名") private String username; /** - * 用户昵称 + * 用户姓名 */ + @ApiModelProperty("用户姓名") private String realName; /** * 手机号 */ + @ApiModelProperty("手机号") private String phone; @JsonIgnore private String password; @@ -83,4 +90,6 @@ public class LoginUser implements Serializable { private Integer status; + private int role; + } diff --git a/src/main/java/com/jiagutech/dto/common/R.java b/src/main/java/com/jiagutech/dto/common/R.java index d7a0f34..55bc01c 100644 --- a/src/main/java/com/jiagutech/dto/common/R.java +++ b/src/main/java/com/jiagutech/dto/common/R.java @@ -1,10 +1,10 @@ package com.jiagutech.dto.common; - import com.jiagutech.common.HttpStatus; import lombok.Data; import lombok.NoArgsConstructor; + import java.io.Serializable; /** @@ -31,7 +31,7 @@ public class R implements Serializable { private int code; - private String msg; + private String description; private T data; @@ -84,7 +84,7 @@ public class R implements Serializable { /** * 返回警告消息 * - * @param msg 返回内容 + * @param msg 返回内容 * @param data 数据对象 * @return 警告消息 */ @@ -96,7 +96,7 @@ public class R implements Serializable { R r = new R<>(); r.setCode(code); r.setData(data); - r.setMsg(msg); + r.setDescription(msg); return r; } diff --git a/src/main/java/com/jiagutech/dto/mapping/UserMapping.java b/src/main/java/com/jiagutech/dto/mapping/UserMapping.java new file mode 100644 index 0000000..b1a94be --- /dev/null +++ b/src/main/java/com/jiagutech/dto/mapping/UserMapping.java @@ -0,0 +1,20 @@ +package com.jiagutech.dto.mapping; + + + +import com.jiagutech.dto.response.UserItem; +import com.jiagutech.entity.UserEntity; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface UserMapping { + UserMapping INSTANCE = Mappers.getMapper(UserMapping.class); + + UserItem convertToUserItem(UserEntity userEntity); + + List convertToUserItems(List userEntities); + +} diff --git a/src/main/java/com/jiagutech/dto/CreateRecordRequest.java b/src/main/java/com/jiagutech/dto/request/CreateRecordRequest.java similarity index 97% rename from src/main/java/com/jiagutech/dto/CreateRecordRequest.java rename to src/main/java/com/jiagutech/dto/request/CreateRecordRequest.java index 812083e..ddcbda0 100644 --- a/src/main/java/com/jiagutech/dto/CreateRecordRequest.java +++ b/src/main/java/com/jiagutech/dto/request/CreateRecordRequest.java @@ -1,4 +1,4 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.request; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/src/main/java/com/jiagutech/dto/LoginRequest.java b/src/main/java/com/jiagutech/dto/request/LoginRequest.java similarity index 94% rename from src/main/java/com/jiagutech/dto/LoginRequest.java rename to src/main/java/com/jiagutech/dto/request/LoginRequest.java index 3210b3b..01c02b3 100644 --- a/src/main/java/com/jiagutech/dto/LoginRequest.java +++ b/src/main/java/com/jiagutech/dto/request/LoginRequest.java @@ -1,4 +1,4 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.request; import com.jiagutech.common.UserConstants; diff --git a/src/main/java/com/jiagutech/dto/request/RecordUpdateRequest.java b/src/main/java/com/jiagutech/dto/request/RecordUpdateRequest.java new file mode 100644 index 0000000..dadd67d --- /dev/null +++ b/src/main/java/com/jiagutech/dto/request/RecordUpdateRequest.java @@ -0,0 +1,22 @@ +package com.jiagutech.dto.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotNull; + +@Data +@ApiModel(value = "记录更新请求", description = "记录更新请求") +public class RecordUpdateRequest { + @NotNull + @ApiModelProperty(value = "记录ID", required = true) + private Long recordId; + + @NotNull + @Length(min = 2, max = 100, message = "记录名称长度在2-100个字符之间") + @ApiModelProperty(value = "记录名称", required = true) + private String recordName; + +} diff --git a/src/main/java/com/jiagutech/dto/request/UpdateScaleRequest.java b/src/main/java/com/jiagutech/dto/request/UpdateScaleRequest.java new file mode 100644 index 0000000..228ea64 --- /dev/null +++ b/src/main/java/com/jiagutech/dto/request/UpdateScaleRequest.java @@ -0,0 +1,20 @@ +package com.jiagutech.dto.request; + +import com.jiagutech.dto.Scale; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("更新比例尺") +public class UpdateScaleRequest { + @ApiModelProperty(value = "记录id", required = true) + private long recordId; + @ApiModelProperty(value = "记录内容id", required = true) + private long recordContentId; + @ApiModelProperty(value = "比例尺类型,1=统一、2=自用、3=延用", required = true) + private int scaleType; + @ApiModelProperty(value = "比例尺") + private Scale scale; + +} diff --git a/src/main/java/com/jiagutech/dto/UserRequest.java b/src/main/java/com/jiagutech/dto/request/UserRequest.java similarity index 58% rename from src/main/java/com/jiagutech/dto/UserRequest.java rename to src/main/java/com/jiagutech/dto/request/UserRequest.java index 6cb2188..0790299 100644 --- a/src/main/java/com/jiagutech/dto/UserRequest.java +++ b/src/main/java/com/jiagutech/dto/request/UserRequest.java @@ -1,11 +1,12 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.request; +import com.jiagutech.common.UserConstants; import lombok.Data; import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; /** * @ClassName UserRequest @@ -21,7 +22,7 @@ public class UserRequest { /** * 用户昵称 */ - @Size(min = 2, max = 30, message = "用户姓名长度不能超过{max}个字符") + @Length(min = UserConstants.USERNAME_MIN_LENGTH, max = UserConstants.USERNAME_MAX_LENGTH, message = "姓名长度必须在2-20个字之间") private String realName; /** @@ -34,6 +35,7 @@ public class UserRequest { /** * 密码 */ + @Length(min = UserConstants.PASSWORD_MIN_LENGTH, max = UserConstants.PASSWORD_MAX_LENGTH, message = "密码长度必须在5-20位之间") private String password; diff --git a/src/main/java/com/jiagutech/dto/LoginResponse.java b/src/main/java/com/jiagutech/dto/response/LoginResponse.java similarity index 84% rename from src/main/java/com/jiagutech/dto/LoginResponse.java rename to src/main/java/com/jiagutech/dto/response/LoginResponse.java index 536dd54..f77b92f 100644 --- a/src/main/java/com/jiagutech/dto/LoginResponse.java +++ b/src/main/java/com/jiagutech/dto/response/LoginResponse.java @@ -1,4 +1,4 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.response; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; @@ -12,13 +12,13 @@ public class LoginResponse { /** * 授权令牌 */ - @JsonProperty("access_token") + @JsonProperty("accessToken") private String accessToken; /** * 刷新令牌 */ - @JsonProperty("refresh_token") + @JsonProperty("refreshToken") private String refreshToken; /** diff --git a/src/main/java/com/jiagutech/dto/ModelPredictData.java b/src/main/java/com/jiagutech/dto/response/ModelPredictData.java similarity index 79% rename from src/main/java/com/jiagutech/dto/ModelPredictData.java rename to src/main/java/com/jiagutech/dto/response/ModelPredictData.java index bf05656..c616a96 100644 --- a/src/main/java/com/jiagutech/dto/ModelPredictData.java +++ b/src/main/java/com/jiagutech/dto/response/ModelPredictData.java @@ -1,4 +1,4 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.response; import lombok.Data; diff --git a/src/main/java/com/jiagutech/dto/ModelPredictResponse.java b/src/main/java/com/jiagutech/dto/response/ModelPredictResponse.java similarity index 77% rename from src/main/java/com/jiagutech/dto/ModelPredictResponse.java rename to src/main/java/com/jiagutech/dto/response/ModelPredictResponse.java index 514387c..07c6d69 100644 --- a/src/main/java/com/jiagutech/dto/ModelPredictResponse.java +++ b/src/main/java/com/jiagutech/dto/response/ModelPredictResponse.java @@ -1,9 +1,7 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.response; import lombok.Data; -import java.util.List; - @Data public class ModelPredictResponse { private Integer classify; diff --git a/src/main/java/com/jiagutech/dto/RecordDetail.java b/src/main/java/com/jiagutech/dto/response/RecordDetail.java similarity index 94% rename from src/main/java/com/jiagutech/dto/RecordDetail.java rename to src/main/java/com/jiagutech/dto/response/RecordDetail.java index a3988cd..0eb7bd7 100644 --- a/src/main/java/com/jiagutech/dto/RecordDetail.java +++ b/src/main/java/com/jiagutech/dto/response/RecordDetail.java @@ -1,4 +1,4 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.response; import com.fasterxml.jackson.annotation.JsonFormat; import com.jiagutech.entity.RecordContentEntity; diff --git a/src/main/java/com/jiagutech/dto/RecordItem.java b/src/main/java/com/jiagutech/dto/response/RecordItem.java similarity index 93% rename from src/main/java/com/jiagutech/dto/RecordItem.java rename to src/main/java/com/jiagutech/dto/response/RecordItem.java index 4162674..f4f5e90 100644 --- a/src/main/java/com/jiagutech/dto/RecordItem.java +++ b/src/main/java/com/jiagutech/dto/response/RecordItem.java @@ -1,4 +1,4 @@ -package com.jiagutech.dto; +package com.jiagutech.dto.response; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; diff --git a/src/main/java/com/jiagutech/dto/response/TaskItem.java b/src/main/java/com/jiagutech/dto/response/TaskItem.java new file mode 100644 index 0000000..65a50f1 --- /dev/null +++ b/src/main/java/com/jiagutech/dto/response/TaskItem.java @@ -0,0 +1,13 @@ +package com.jiagutech.dto.response; + +import lombok.Data; + +@Data +public class TaskItem { + + private String taskId; + + private String taskName; + + private Float progress; +} diff --git a/src/main/java/com/jiagutech/dto/response/UserItem.java b/src/main/java/com/jiagutech/dto/response/UserItem.java new file mode 100644 index 0000000..a9cd08c --- /dev/null +++ b/src/main/java/com/jiagutech/dto/response/UserItem.java @@ -0,0 +1,23 @@ +package com.jiagutech.dto.response; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class UserItem { + + private Long id; + + private String phone; + + private String realName; + + private String unitName; + + private int status; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; +} diff --git a/src/main/java/com/jiagutech/entity/RecordContentEntity.java b/src/main/java/com/jiagutech/entity/RecordContentEntity.java index b7bb7b9..43aed37 100644 --- a/src/main/java/com/jiagutech/entity/RecordContentEntity.java +++ b/src/main/java/com/jiagutech/entity/RecordContentEntity.java @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import com.jiagutech.dto.ModelPredictResponse; +import com.jiagutech.dto.response.ModelPredictResponse; import com.jiagutech.dto.Scale; import lombok.Data; import lombok.experimental.Accessors; @@ -27,18 +27,18 @@ public class RecordContentEntity { @TableField(typeHandler = JacksonTypeHandler.class) private List recognitionData; - private int siliquaNum; + private Integer siliquaNum; - private int handleNum; + private Integer handleNum; - private int beakNum; + private Integer beakNum; //比例尺类型 ,1=统一/2=自用/3=延用/0=无 - private int scaleType; + private Integer scaleType; //比例 @TableField(typeHandler = JacksonTypeHandler.class) private Scale scale; - private float conf; + private Float conf; - private float iou; + private Float iou; } diff --git a/src/main/java/com/jiagutech/entity/RecordEntity.java b/src/main/java/com/jiagutech/entity/RecordEntity.java index 0d5aefd..7c3b28b 100644 --- a/src/main/java/com/jiagutech/entity/RecordEntity.java +++ b/src/main/java/com/jiagutech/entity/RecordEntity.java @@ -20,7 +20,7 @@ public class RecordEntity { private Long userId; - private int imageNum; + private Integer imageNum; private LocalDateTime createTime; diff --git a/src/main/java/com/jiagutech/entity/UserEntity.java b/src/main/java/com/jiagutech/entity/UserEntity.java index 4063f7c..ba3b5bd 100644 --- a/src/main/java/com/jiagutech/entity/UserEntity.java +++ b/src/main/java/com/jiagutech/entity/UserEntity.java @@ -24,5 +24,7 @@ public class UserEntity { private int status; + private int role; + } diff --git a/src/main/java/com/jiagutech/handler/ModelPredictResponseListTypeHandler.java b/src/main/java/com/jiagutech/handler/ModelPredictResponseListTypeHandler.java index d77d2a8..fb7dd6e 100644 --- a/src/main/java/com/jiagutech/handler/ModelPredictResponseListTypeHandler.java +++ b/src/main/java/com/jiagutech/handler/ModelPredictResponseListTypeHandler.java @@ -2,7 +2,7 @@ package com.jiagutech.handler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.fasterxml.jackson.core.type.TypeReference; -import com.jiagutech.dto.ModelPredictResponse; +import com.jiagutech.dto.response.ModelPredictResponse; import com.fasterxml.jackson.databind.ObjectMapper; import java.sql.ResultSet; diff --git a/src/main/java/com/jiagutech/mapper/RecordMapper.java b/src/main/java/com/jiagutech/mapper/RecordMapper.java index 4fbbde0..29195f4 100644 --- a/src/main/java/com/jiagutech/mapper/RecordMapper.java +++ b/src/main/java/com/jiagutech/mapper/RecordMapper.java @@ -1,14 +1,16 @@ package com.jiagutech.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.jiagutech.dto.RecordDetail; -import com.jiagutech.dto.RecordItem; +import com.jiagutech.dto.response.RecordDetail; +import com.jiagutech.dto.response.RecordItem; import com.jiagutech.entity.RecordEntity; +import org.apache.ibatis.annotations.Param; public interface RecordMapper extends BaseMapper { RecordDetail getRecordDetail(long id); - Page pageList(Page page, Object o); + Page pageList(Page page, @Param("ew") QueryWrapper queryWrapper); } diff --git a/src/main/java/com/jiagutech/mapper/UserMapper.java b/src/main/java/com/jiagutech/mapper/UserMapper.java index 7259442..53851eb 100644 --- a/src/main/java/com/jiagutech/mapper/UserMapper.java +++ b/src/main/java/com/jiagutech/mapper/UserMapper.java @@ -1,8 +1,7 @@ package com.jiagutech.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.jiagutech.dto.LoginUser; -import com.jiagutech.entity.RecordContentEntity; +import com.jiagutech.dto.common.LoginUser; import com.jiagutech.entity.UserEntity; public interface UserMapper extends BaseMapper { diff --git a/src/main/java/com/jiagutech/record/RecordTaskHandler.java b/src/main/java/com/jiagutech/record/RecordTaskHandler.java index 9dae20d..f04ff7a 100644 --- a/src/main/java/com/jiagutech/record/RecordTaskHandler.java +++ b/src/main/java/com/jiagutech/record/RecordTaskHandler.java @@ -1,8 +1,9 @@ package com.jiagutech.record; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.jiagutech.common.thread.MonitoredRunnable; -import com.jiagutech.dto.CreateRecordRequest; -import com.jiagutech.dto.LoginUser; +import com.jiagutech.dto.request.CreateRecordRequest; +import com.jiagutech.dto.common.LoginUser; import com.jiagutech.utils.LoginUtil; import lombok.Data; import lombok.SneakyThrows; @@ -23,11 +24,13 @@ public class RecordTaskHandler { private ThreadPoolExecutor theadPoolExecutor; private RecordTaskProcessor processor; + private final String tmpPath; - public RecordTaskHandler(ThreadPoolExecutor threadPoolExecutor, RecordTaskProcessor processor) { + public RecordTaskHandler(ThreadPoolExecutor threadPoolExecutor, RecordTaskProcessor processor, String tmpPath) { this.theadPoolExecutor = threadPoolExecutor; this.processor = processor; + this.tmpPath = tmpPath; } protected void processTask() { @@ -52,9 +55,15 @@ public class RecordTaskHandler { @SneakyThrows public void createTask(CreateRecordRequest request, String taskId) { + log.info("用户【{}】创建识别任务,任务ID:{},", LoginUtil.getLoginUser().getRealName(), taskId); URL resource = RecordTaskHandler.class.getClassLoader().getResource(""); assert resource != null; - String path = resource.getPath(); + String path; + if (StringUtils.isEmpty(tmpPath)) { + path = resource.getPath(); + } else { + path = tmpPath; + } File[] files = new File[request.getFiles().length]; for (int i = 0; i < request.getFiles().length; i++) { MultipartFile file = request.getFiles()[i]; diff --git a/src/main/java/com/jiagutech/record/RecordTaskManager.java b/src/main/java/com/jiagutech/record/RecordTaskManager.java index 4352fdb..9bca3f4 100644 --- a/src/main/java/com/jiagutech/record/RecordTaskManager.java +++ b/src/main/java/com/jiagutech/record/RecordTaskManager.java @@ -1,5 +1,10 @@ package com.jiagutech.record; +import com.jiagutech.dto.response.TaskItem; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; public class RecordTaskManager { @@ -18,4 +23,19 @@ public class RecordTaskManager { recordTasks.remove(taskId); } + public static List getTasks(Long userId) { + List taskItems = new ArrayList<>(); + for (RecordTaskHandler recordTaskHandler : recordTasks.values()) { + RecordTaskHandler.RecordTask recordTask = recordTaskHandler.getRecordTask(); + if (recordTask != null && recordTask.getProgress() < 100 && Objects.equals(recordTask.getLoginUser().getUserId(), userId)) { + TaskItem taskItem = new TaskItem(); + taskItem.setTaskId(recordTask.getTaskId()); + taskItem.setProgress(recordTask.getProgress()); + taskItem.setTaskName(recordTask.getTaskName()); + taskItems.add(taskItem); + } + } + return taskItems; + } + } diff --git a/src/main/java/com/jiagutech/record/RecordTaskProcessor.java b/src/main/java/com/jiagutech/record/RecordTaskProcessor.java index 234325f..1481879 100644 --- a/src/main/java/com/jiagutech/record/RecordTaskProcessor.java +++ b/src/main/java/com/jiagutech/record/RecordTaskProcessor.java @@ -1,7 +1,7 @@ package com.jiagutech.record; import com.jiagutech.client.RecognitionModelClient; -import com.jiagutech.dto.ModelPredictResponse; +import com.jiagutech.dto.response.ModelPredictResponse; import com.jiagutech.entity.RecordContentEntity; import com.jiagutech.entity.RecordEntity; import com.jiagutech.mapper.RecordContentMapper; @@ -44,6 +44,7 @@ public class RecordTaskProcessor { recordMapper.insert(recordEntity); recordTask.setProgress(progress); for (File file : recordTask.getFiles()) { + log.info("调用模型进行分析,file:{}", file.getName()); List predict = modelClient.predict(file, recordTask.getModelName(), recordTask.getIou(), recordTask.getConf()); int handleNum = 0; int rapeNum = 0; @@ -66,7 +67,9 @@ public class RecordTaskProcessor { if (!CollectionUtils.isEmpty(predict)) { String imageUrl; try { - imageUrl = huaweiObs.uploadFile(file); + log.info("存储图片到oss,file:{}", file.getName()); +// imageUrl = huaweiObs.uploadFile(file); + imageUrl = ""; progress += 2f; } catch (Exception e) { throw new RuntimeException(e); @@ -83,6 +86,7 @@ public class RecordTaskProcessor { .setBeakNum(beakNum) .setSiliquaNum(rapeNum); recordContentMapper.insert(recordContentEntity); + log.info("保存处理结果,file:{}", file.getName()); progress += 3f; } diff --git a/src/main/java/com/jiagutech/service/RecordService.java b/src/main/java/com/jiagutech/service/RecordService.java index 49223d3..54c1903 100644 --- a/src/main/java/com/jiagutech/service/RecordService.java +++ b/src/main/java/com/jiagutech/service/RecordService.java @@ -3,11 +3,18 @@ package com.jiagutech.service; import com.jiagutech.dto.*; import com.jiagutech.dto.common.PageRequest; import com.jiagutech.dto.common.PageResult; +import com.jiagutech.dto.request.CreateRecordRequest; +import com.jiagutech.dto.request.RecordUpdateRequest; +import com.jiagutech.dto.request.UpdateScaleRequest; +import com.jiagutech.dto.response.RecordDetail; +import com.jiagutech.dto.response.RecordItem; +import com.jiagutech.dto.response.TaskItem; import com.jiagutech.entity.RecordContentEntity; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import javax.servlet.http.HttpServletResponse; +import java.util.List; public interface RecordService { @@ -28,4 +35,11 @@ public interface RecordService { RecordModel getModels(); void updateScale(UpdateScaleRequest request); + + + boolean deleteRecord(Long recordId); + + boolean updateRecord(RecordUpdateRequest updateRequest); + + List getTasks(); } diff --git a/src/main/java/com/jiagutech/service/RecordServiceImpl.java b/src/main/java/com/jiagutech/service/RecordServiceImpl.java index b1d9060..e618d1e 100644 --- a/src/main/java/com/jiagutech/service/RecordServiceImpl.java +++ b/src/main/java/com/jiagutech/service/RecordServiceImpl.java @@ -1,5 +1,6 @@ package com.jiagutech.service; +import cn.dev33.satoken.stp.StpUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.util.MapUtils; @@ -10,43 +11,48 @@ import com.alibaba.excel.write.metadata.style.WriteCellStyle; import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.fastjson2.JSON; -import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jiagutech.client.RecognitionModelClient; import com.jiagutech.dto.*; +import com.jiagutech.dto.common.LoginUser; import com.jiagutech.dto.common.PageRequest; import com.jiagutech.dto.common.PageResult; +import com.jiagutech.dto.request.CreateRecordRequest; +import com.jiagutech.dto.request.RecordUpdateRequest; +import com.jiagutech.dto.request.UpdateScaleRequest; +import com.jiagutech.dto.response.ModelPredictResponse; +import com.jiagutech.dto.response.RecordDetail; +import com.jiagutech.dto.response.RecordItem; +import com.jiagutech.dto.response.TaskItem; import com.jiagutech.entity.RecordContentEntity; -import com.jiagutech.handler.ExcelFillCellMergeStrategy; +import com.jiagutech.entity.RecordEntity; import com.jiagutech.mapper.RecordContentMapper; import com.jiagutech.mapper.RecordMapper; import com.jiagutech.record.RecordTaskHandler; import com.jiagutech.record.RecordTaskManager; import com.jiagutech.record.RecordTaskProcessor; -import com.sun.xml.bind.v2.TODO; +import com.jiagutech.utils.LoginUtil; import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.math3.analysis.function.Max; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindException; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.math.RoundingMode; import java.net.URLEncoder; import java.text.DecimalFormat; +import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.ThreadPoolExecutor; @@ -62,6 +68,9 @@ public class RecordServiceImpl implements RecordService { private final RecordContentMapper recordContentMapper; private final RecognitionModelClient recognitionModelClient; + @Value("${tmp.path}") + private String tmpPath; + @Override public SseEmitter createRecord(MultipartFile[] files, String modelName, Float lou, Float conf) { return null; @@ -70,7 +79,7 @@ public class RecordServiceImpl implements RecordService { @Override public String createRecordAsync(CreateRecordRequest request) { String taskId = UUID.randomUUID().toString(); - RecordTaskHandler recordTaskHandler = new RecordTaskHandler(customThreadPool, taskProcessor); + RecordTaskHandler recordTaskHandler = new RecordTaskHandler(customThreadPool, taskProcessor, tmpPath); recordTaskHandler.createTask(request, taskId); RecordTaskManager.addRecordTask(taskId, recordTaskHandler); return taskId; @@ -272,7 +281,12 @@ public class RecordServiceImpl implements RecordService { @Override public PageResult getPages(PageRequest pageRequest) { Page page = new Page(pageRequest.getPageNum(), pageRequest.getPageSize()); - Page result = recordMapper.pageList(page, null); + LoginUser loginUser = LoginUtil.getLoginUser(); + QueryWrapper queryWrapper = Wrappers.query(); + if (loginUser.getRole() == 1) { + queryWrapper.eq("r.user_id", loginUser.getUserId()); + } + Page result = recordMapper.pageList(page, queryWrapper); return PageResult.of((int) result.getTotal(), (int) result.getSize(), (int) result.getCurrent(), result.getRecords()); } @@ -332,4 +346,38 @@ public class RecordServiceImpl implements RecordService { } } + + + @Transactional + @Override + public boolean deleteRecord(Long recordId) { + int row = recordMapper.deleteById(recordId); + QueryWrapper queryWrapper = Wrappers.query(); + queryWrapper.eq("record_id", recordId); + recordContentMapper.delete(queryWrapper); + return row > 0; + + } + + @Transactional + @Override + public boolean updateRecord(RecordUpdateRequest updateRequest) { + RecordEntity recordEntity = new RecordEntity(); + recordEntity.setId(updateRequest.getRecordId()); + recordEntity.setName(updateRequest.getRecordName()); + recordEntity.setUpdateTime(LocalDateTime.now()); + return recordMapper.updateById(recordEntity) > 0; + } + + @Override + public List getTasks() { + try { + return RecordTaskManager.getTasks(StpUtil.getLoginIdAsLong()); + } catch (Exception e) { + log.error("获取任务失败", e); + } + return Collections.emptyList(); + + } + } diff --git a/src/main/java/com/jiagutech/service/UserService.java b/src/main/java/com/jiagutech/service/UserService.java index 2292e55..59cc7d7 100644 --- a/src/main/java/com/jiagutech/service/UserService.java +++ b/src/main/java/com/jiagutech/service/UserService.java @@ -1,8 +1,11 @@ package com.jiagutech.service; -import com.jiagutech.dto.LoginRequest; -import com.jiagutech.dto.LoginResponse; -import com.jiagutech.dto.UserRequest; +import com.jiagutech.dto.request.LoginRequest; +import com.jiagutech.dto.response.LoginResponse; +import com.jiagutech.dto.response.UserItem; +import com.jiagutech.dto.request.UserRequest; + +import java.util.List; public interface UserService { LoginResponse login(LoginRequest loginBody); @@ -10,4 +13,6 @@ public interface UserService { void register(UserRequest user); void approval(Long userId); + + List approvalUserList(); } diff --git a/src/main/java/com/jiagutech/service/UserServiceImpl.java b/src/main/java/com/jiagutech/service/UserServiceImpl.java index 2543568..7a966ab 100644 --- a/src/main/java/com/jiagutech/service/UserServiceImpl.java +++ b/src/main/java/com/jiagutech/service/UserServiceImpl.java @@ -2,13 +2,17 @@ package com.jiagutech.service; import cn.dev33.satoken.secure.BCrypt; import cn.dev33.satoken.stp.StpUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.jiagutech.common.UserConstants; import com.jiagutech.common.exception.BizCode; import com.jiagutech.common.exception.BusinessException; -import com.jiagutech.dto.LoginRequest; -import com.jiagutech.dto.LoginResponse; -import com.jiagutech.dto.LoginUser; -import com.jiagutech.dto.UserRequest; +import com.jiagutech.dto.common.LoginUser; +import com.jiagutech.dto.mapping.UserMapping; +import com.jiagutech.dto.request.LoginRequest; +import com.jiagutech.dto.request.UserRequest; +import com.jiagutech.dto.response.LoginResponse; +import com.jiagutech.dto.response.UserItem; import com.jiagutech.entity.UserEntity; import com.jiagutech.mapper.UserMapper; import com.jiagutech.utils.EmailUtil; @@ -16,6 +20,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import java.time.LocalDateTime; +import java.util.List; @Service @RequiredArgsConstructor @@ -68,4 +73,12 @@ public class UserServiceImpl implements UserService { userEntity.setStatus(1); userMapper.updateById(userEntity); } + + @Override + public List approvalUserList() { + QueryWrapper wrapper = Wrappers.query(); + wrapper.eq("status", 2); + List userEntities = userMapper.selectList(wrapper); + return UserMapping.INSTANCE.convertToUserItems(userEntities); + } } diff --git a/src/main/java/com/jiagutech/utils/LoginUtil.java b/src/main/java/com/jiagutech/utils/LoginUtil.java index f226e57..a4834ba 100644 --- a/src/main/java/com/jiagutech/utils/LoginUtil.java +++ b/src/main/java/com/jiagutech/utils/LoginUtil.java @@ -2,7 +2,7 @@ package com.jiagutech.utils; import cn.dev33.satoken.stp.StpUtil; import com.jiagutech.common.UserConstants; -import com.jiagutech.dto.LoginUser; +import com.jiagutech.dto.common.LoginUser; public class LoginUtil { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 40152b5..73e165e 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -102,3 +102,5 @@ logging: level: com.jiagutech.mapper: debug root: info +tmp: + path: /tmp/ \ No newline at end of file diff --git a/src/main/resources/mapper/RecordMapper.xml b/src/main/resources/mapper/RecordMapper.xml index 55aae55..2a40fc4 100644 --- a/src/main/resources/mapper/RecordMapper.xml +++ b/src/main/resources/mapper/RecordMapper.xml @@ -1,7 +1,7 @@ - + @@ -13,7 +13,7 @@ from record_info where id = #{id} - select r.id as recordId, r.name as recordName, r.user_id, @@ -24,6 +24,7 @@ u.phone from record_info r left join siliqua_user u on r.user_id = u.id + ${ew.getCustomSqlSegment} order by r.create_time desc diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml index f51b2ec..bc088ca 100644 --- a/src/main/resources/mapper/UserMapper.xml +++ b/src/main/resources/mapper/UserMapper.xml @@ -3,14 +3,15 @@ - select id as user_id, real_name, phone, create_time, password, unit_name, - status + status, + role from siliqua_user where phone = #{phone} and status != 0