重新引入Result
parent
44f2aff05e
commit
d943b7e849
|
@ -61,6 +61,10 @@
|
|||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-swagger</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency> <dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
package com.february.system.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
||||
public class TCarType {
|
||||
private Integer carTypeId;
|
||||
private String carTypeName;
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
package com.february.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Tadmin {
|
||||
private Integer adminId;
|
||||
private String adminName;
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package com.february.system.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Tcar {
|
||||
|
||||
private Integer carId;//主键id
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package com.february.system.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Tuser {
|
||||
private Integer userId;
|
||||
private String userName;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.february.system.domain.result;
|
||||
|
||||
import com.february.common.core.domain.Result;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
package com.february.system.domain.result;
|
||||
|
||||
import com.february.system.domain.constants.Constants;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @description: 响应信息主体
|
||||
*/
|
||||
@Data
|
||||
public class Result<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final int SUCCESS = Constants.SUCCESS;
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final int FAIL = Constants.ERROR;
|
||||
/**
|
||||
* 返回状态码
|
||||
*/
|
||||
private int code;
|
||||
/**
|
||||
* 响应信息
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
public static <T> Result<T> success() {
|
||||
return restResult(null, SUCCESS, Constants.SUCCESS_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> success(T data) {
|
||||
return restResult(data, SUCCESS, Constants.SUCCESS_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> success(T data, String msg) {
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error() {
|
||||
return restResult(null, FAIL, Constants.ERROR_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg) {
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(T data) {
|
||||
return restResult(data, FAIL, Constants.ERROR_MSG);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(T data, String msg) {
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(int code, String msg) {
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
private static <T> Result<T> restResult(T data, int code, String msg) {
|
||||
Result<T> apiResult = new Result<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-merchant-settlement</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>february-merchant-mybatis-plus</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- bootstrap 启动器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!-- 负载均衡-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringCloud Openfeign -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<!-- JWT -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.1</version>
|
||||
</dependency>
|
||||
<!-- Alibaba Fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.80</version>
|
||||
</dependency>
|
||||
<!-- SpringBoot Boot Redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- Hibernate Validator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<!-- Apache Lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<!-- lombok依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<!-- hutool -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.3</version>
|
||||
</dependency>
|
||||
<!-- 阿里大鱼 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<!-- oss 图片上传 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.0.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,32 @@
|
|||
package com.february.mybatisplus.controller;
|
||||
|
||||
import cn.hutool.http.server.HttpServerRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.february.mybatisplus.demo.Tcar;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.http.impl.nio.bootstrap.HttpServer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RestController;
|
||||
|
||||
import javax.xml.transform.Result;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("car")
|
||||
@Log4j2
|
||||
public class CarController {
|
||||
@Autowired
|
||||
private HttpServerRequest request;
|
||||
|
||||
@PostMapping("add")
|
||||
public Result aad(@RequestBody Tcar tcar){
|
||||
log.info("功能名称:添加,请求URI:{},请求方式:{},请求参数:{}"
|
||||
,request.getParams(),request.getParams(), JSONObject.toJSONString(tcar));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.february.mybatisplus.demo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("t_car")
|
||||
public class Tcar {
|
||||
//主键id
|
||||
@TableId(value = "car_id", type = IdType.AUTO)
|
||||
private Integer carId;
|
||||
//vin
|
||||
@TableField("`car_vin`")
|
||||
private String carVin;
|
||||
//车牌号
|
||||
@TableField("`car_bh`")
|
||||
private String carBh;
|
||||
//车型id
|
||||
@TableField("car_type_id")
|
||||
private Integer carTypeId;
|
||||
//驱动编号
|
||||
@TableField("actuate_id")
|
||||
private Integer actuateId;
|
||||
//电池编号
|
||||
@TableField("battery_id")
|
||||
private Integer batteryId;
|
||||
//电池厂家id
|
||||
@TableField("battery_maker_id")
|
||||
private Integer batteryMakerId;
|
||||
///电机厂家id
|
||||
@TableField("motor_manufacture_id")
|
||||
private Integer motorManufactuerId;
|
||||
//车辆状态
|
||||
@TableField("cta_status")
|
||||
private Integer carStatus;
|
||||
//运行区域
|
||||
@TableField("`operating_area`")
|
||||
private String operatingArea;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.february.mybatisplus.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.february.mybatisplus.demo.Tcar;
|
||||
|
||||
public interface CarMapper extends BaseMapper<Tcar> {
|
||||
|
||||
}
|
|
@ -16,18 +16,12 @@
|
|||
<maven.compiler.target>20</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-merchant-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-merchant-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- RuoYi Common Log -->
|
||||
|
||||
<!-- RuoYi Common DataScope -->
|
||||
|
@ -47,6 +41,12 @@
|
|||
<artifactId>february-common-datasource</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- <!– SpringBoot Web–>-->
|
||||
<!-- <dependency>-->
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.february.merchant.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.february.common.core.domain.Result;
|
||||
import com.february.merchant.service.AddCarService;
|
||||
import com.february.system.domain.Tadmin;
|
||||
import com.february.system.domain.Tcar;
|
||||
|
@ -8,7 +10,7 @@ import com.february.system.domain.Tuser;
|
|||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.february.system.domain.result.Result;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
|
@ -47,6 +49,7 @@ public class AddCarController {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据客户名获取用户信息
|
||||
*/
|
||||
|
@ -60,4 +63,5 @@ public class AddCarController {
|
|||
,request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,4 +11,5 @@ public interface AddCarMapper {
|
|||
Tadmin findByadminName(String adminName);
|
||||
|
||||
Tuser findByuserName(String userName);
|
||||
|
||||
}
|
||||
|
|
|
@ -13,3 +13,4 @@ public interface AddCarService {
|
|||
|
||||
Tuser findByuserName(String userName);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,4 +28,5 @@ public class AddCarServiceImpl implements AddCarService {
|
|||
return addCarMapper.findByuserName(userName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
1
pom.xml
1
pom.xml
|
@ -16,6 +16,7 @@
|
|||
<module>february-merchant-common</module>
|
||||
<module>february-merchant-remote</module>
|
||||
<module>february-merchant-server</module>
|
||||
<module>february-merchant-mybatis-plus</module>
|
||||
</modules>
|
||||
<artifactId>february-merchant-settlement</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
|
Loading…
Reference in New Issue