前后端调通
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package com.aos.fileidentify.common;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
public class ResultDTO<T> {
|
||||
|
||||
|
||||
private boolean success;
|
||||
private int code;
|
||||
private T data;
|
||||
private String msg;
|
||||
|
||||
public ResultDTO() {
|
||||
}
|
||||
|
||||
public ResultDTO(boolean success, T data) {
|
||||
this.success = success;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ResultDTO(boolean success, int code, T data, String msg) {
|
||||
this.success = success;
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public ResultDTO(boolean success, int code, String msg) {
|
||||
this.success = success;
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public ResultDTO(boolean success, String msg) {
|
||||
this.success = success;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aos.fileidentify.controller;
|
||||
|
||||
import com.aos.fileidentify.common.ResultDTO;
|
||||
import com.aos.fileidentify.entity.Employee;
|
||||
import com.aos.fileidentify.service.EmployeeService;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class EmployeeController {
|
||||
*/
|
||||
@ApiOperation(value = "员工所有数据查询")
|
||||
@GetMapping(value = "/list")
|
||||
public List<Employee> getAllEmployee() {
|
||||
public ResultDTO<List<Employee>> getAllEmployee() {
|
||||
return this.employeeService.getAllEmployee();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.aos.fileidentify.service;
|
||||
|
||||
import com.aos.fileidentify.common.ResultDTO;
|
||||
import com.aos.fileidentify.entity.Employee;
|
||||
|
||||
import java.util.List;
|
||||
@@ -21,5 +22,5 @@ public interface EmployeeService {
|
||||
* @return the all employee
|
||||
* @since 0.0.1
|
||||
*/
|
||||
List<Employee> getAllEmployee();
|
||||
ResultDTO<List<Employee>> getAllEmployee();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.aos.fileidentify.service.impl;
|
||||
|
||||
import com.aos.fileidentify.common.ResultDTO;
|
||||
import com.aos.fileidentify.entity.Employee;
|
||||
import com.aos.fileidentify.mapper.EmployeeMapper;
|
||||
import com.aos.fileidentify.service.EmployeeService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import com.sun.net.httpserver.Authenticator;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -30,8 +32,7 @@ public class EmployeeServiceImpl implements EmployeeService {
|
||||
private final EmployeeMapper employeeMapper;
|
||||
|
||||
@Override
|
||||
public List<Employee> getAllEmployee() {
|
||||
QueryWrapper<Employee> queryWrapper = new QueryWrapper<>();
|
||||
return employeeMapper.selectList(queryWrapper.lambda().eq(Employee::getEmployeeKey, "1f1c8258ba2226e6a6851e62741418d7"));
|
||||
public ResultDTO<List<Employee>> getAllEmployee() {
|
||||
return new ResultDTO<>(true, 20000, employeeMapper.selectList(new QueryWrapper<>()), null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user