Procházet zdrojové kódy

add 添加注册日志查询

Your Name před 1 rokem
rodič
revize
5951f3544a

+ 56 - 0
src/main/java/com/tuoren/forward/controller/RegistLogController.java

@@ -0,0 +1,56 @@
+package com.tuoren.forward.controller;
+
+import com.tuoren.forward.entity.Log;
+import com.tuoren.forward.entity.RegistLog;
+import com.tuoren.forward.entity.UserConfig;
+import com.tuoren.forward.entity.req.LogSearchReq;
+import com.tuoren.forward.entity.req.RegistLogSearchReq;
+import com.tuoren.forward.service.RegistLogService;
+import com.tuoren.forward.util.Result;
+import com.tuoren.forward.util.ResultPage;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+/**
+ * @Author zzy
+ * @Data 2024/9/24
+ * @Version 1.0
+ * @Description XXX
+ */
+@Slf4j
+@Controller
+@RequestMapping("RegistLog")
+@Tag(name= "注册日志接口")
+public class RegistLogController {
+    @Autowired
+    RegistLogService registLogService;
+
+
+    /**
+     * 查询
+     * @param req
+     * @return
+     */
+    @PostMapping("search")
+    @ResponseBody
+    @Operation(summary = "注册日志")
+    @Parameter(name="token",description = "token",required = true,in = ParameterIn.HEADER)
+    public ResultPage<RegistLog> search(@RequestBody RegistLogSearchReq req){
+        log.info("registLogSearch>>:{}",req);
+        return registLogService.search(req);
+    }
+
+
+
+
+}

+ 24 - 0
src/main/java/com/tuoren/forward/entity/dto/RegistLogDto.java

@@ -0,0 +1,24 @@
+package com.tuoren.forward.entity.dto;
+
+import com.tuoren.forward.entity.Log;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+
+@Data
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class RegistLogDto extends Log{
+	
+	private String sort;  //排序字段
+	
+	private String order; //排序方式, 'asc':升序, 'desc':降序
+	
+	private String keyWord; //搜索内容
+	
+	private Date startTime; //开始时间
+	
+	private Date endTime; //结束时间
+}

+ 40 - 0
src/main/java/com/tuoren/forward/entity/req/RegistLogSearchReq.java

@@ -0,0 +1,40 @@
+package com.tuoren.forward.entity.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+
+/**
+ * @Author zzy
+ * @Data 2024/9/24
+ * @Version 1.0
+ * @Description XXX
+ */
+@Data
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+@Schema(description="注册日志查询请求")
+public class RegistLogSearchReq extends PageReq{
+
+    @Schema(description = "设备MAC")
+    private String mac;
+
+    @Schema(description = "参数")
+    private String param;
+
+    @Schema(description = "注册结果")
+    private String result;
+
+    @Schema(description = "操作结果,0:成功,1:失败,2:异常")
+    private String status;
+
+    @Schema(description = "创建时间")
+    private Date createtime;
+
+
+
+
+}

+ 43 - 0
src/main/java/com/tuoren/forward/service/RegistLogService.java

@@ -0,0 +1,43 @@
+package com.tuoren.forward.service;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.tuoren.forward.entity.RegistLog;
+import com.tuoren.forward.entity.dto.RegistLogDto;
+import com.tuoren.forward.entity.req.RegistLogSearchReq;
+import com.tuoren.forward.mapper.RegistLogMapper;
+import com.tuoren.forward.util.Result;
+import com.tuoren.forward.util.ResultPage;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author zzy
+ * @Data 2024/9/24
+ * @Version 1.0
+ * @Description XXX
+ */
+@Service
+public class RegistLogService {
+
+    @Autowired
+    RegistLogMapper registLogMapper;
+    @Autowired
+    ObjectMapper objectMapper;
+
+
+    public ResultPage<RegistLog> search(RegistLogSearchReq req) {
+        Page<Object> page = PageHelper.startPage(req.getPage(), req.getSize());
+//        RegistLogDto RegistLogDto = new RegistLogDto();
+//        BeanUtils.copyProperties(req, RegistLogDto);
+        List<RegistLog> registLogs = registLogMapper.QueryCondition(req);
+
+        return ResultPage.success(registLogs,page.getTotal());
+    }
+
+}