From d943b7e849252ad15450870ed090dae24cc924cb Mon Sep 17 00:00:00 2001 From: liujiaxin <3056600683@qq.com> Date: Tue, 21 Nov 2023 08:24:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=BC=95=E5=85=A5Result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- february-merchant-common/pom.xml | 4 + .../com/february/system/domain/TCarType.java | 7 + .../com/february/system/domain/Tadmin.java | 6 + .../java/com/february/system/domain/Tcar.java | 6 + .../com/february/system/domain/Tuser.java | 6 + .../system/domain/result/PageResult.java | 1 + .../february/system/domain/result/Result.java | 76 ----------- february-merchant-mybatis-plus/.gitignore | 38 ++++++ february-merchant-mybatis-plus/pom.xml | 123 ++++++++++++++++++ .../mybatisplus/controller/CarController.java | 32 +++++ .../com/february/mybatisplus/demo/Tcar.java | 48 +++++++ .../mybatisplus/mapper/CarMapper.java | 8 ++ february-merchant-remote/pom.xml | 8 +- february-merchant-server/pom.xml | 12 +- .../merchant/controller/AddCarController.java | 6 +- .../merchant/mapper/AddCarMapper.java | 1 + .../merchant/service/AddCarService.java | 1 + .../service/impl/AddCarServiceImpl.java | 1 + pom.xml | 1 + 19 files changed, 295 insertions(+), 90 deletions(-) delete mode 100644 february-merchant-common/src/main/java/com/february/system/domain/result/Result.java create mode 100644 february-merchant-mybatis-plus/.gitignore create mode 100644 february-merchant-mybatis-plus/pom.xml create mode 100644 february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/controller/CarController.java create mode 100644 february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/demo/Tcar.java create mode 100644 february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/mapper/CarMapper.java diff --git a/february-merchant-common/pom.xml b/february-merchant-common/pom.xml index 3966e22..ace14f9 100644 --- a/february-merchant-common/pom.xml +++ b/february-merchant-common/pom.xml @@ -61,6 +61,10 @@ com.february february-common-swagger 3.6.3 + + com.february + february-common-core + 3.6.3 diff --git a/february-merchant-common/src/main/java/com/february/system/domain/TCarType.java b/february-merchant-common/src/main/java/com/february/system/domain/TCarType.java index 714d88d..0d5b595 100644 --- a/february-merchant-common/src/main/java/com/february/system/domain/TCarType.java +++ b/february-merchant-common/src/main/java/com/february/system/domain/TCarType.java @@ -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; diff --git a/february-merchant-common/src/main/java/com/february/system/domain/Tadmin.java b/february-merchant-common/src/main/java/com/february/system/domain/Tadmin.java index f3003d3..d2a2648 100644 --- a/february-merchant-common/src/main/java/com/february/system/domain/Tadmin.java +++ b/february-merchant-common/src/main/java/com/february/system/domain/Tadmin.java @@ -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; diff --git a/february-merchant-common/src/main/java/com/february/system/domain/Tcar.java b/february-merchant-common/src/main/java/com/february/system/domain/Tcar.java index 70820fa..7e071be 100644 --- a/february-merchant-common/src/main/java/com/february/system/domain/Tcar.java +++ b/february-merchant-common/src/main/java/com/february/system/domain/Tcar.java @@ -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 diff --git a/february-merchant-common/src/main/java/com/february/system/domain/Tuser.java b/february-merchant-common/src/main/java/com/february/system/domain/Tuser.java index f99bf51..35b1626 100644 --- a/february-merchant-common/src/main/java/com/february/system/domain/Tuser.java +++ b/february-merchant-common/src/main/java/com/february/system/domain/Tuser.java @@ -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; diff --git a/february-merchant-common/src/main/java/com/february/system/domain/result/PageResult.java b/february-merchant-common/src/main/java/com/february/system/domain/result/PageResult.java index 9993abb..e2614e7 100644 --- a/february-merchant-common/src/main/java/com/february/system/domain/result/PageResult.java +++ b/february-merchant-common/src/main/java/com/february/system/domain/result/PageResult.java @@ -1,5 +1,6 @@ package com.february.system.domain.result; +import com.february.common.core.domain.Result; import lombok.Data; import java.io.Serializable; diff --git a/february-merchant-common/src/main/java/com/february/system/domain/result/Result.java b/february-merchant-common/src/main/java/com/february/system/domain/result/Result.java deleted file mode 100644 index 8f129be..0000000 --- a/february-merchant-common/src/main/java/com/february/system/domain/result/Result.java +++ /dev/null @@ -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 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 Result success() { - return restResult(null, SUCCESS, Constants.SUCCESS_MSG); - } - - public static Result success(T data) { - return restResult(data, SUCCESS, Constants.SUCCESS_MSG); - } - - public static Result success(T data, String msg) { - return restResult(data, SUCCESS, msg); - } - - public static Result error() { - return restResult(null, FAIL, Constants.ERROR_MSG); - } - - public static Result error(String msg) { - return restResult(null, FAIL, msg); - } - - public static Result error(T data) { - return restResult(data, FAIL, Constants.ERROR_MSG); - } - - public static Result error(T data, String msg) { - return restResult(data, FAIL, msg); - } - - public static Result error(int code, String msg) { - return restResult(null, code, msg); - } - - private static Result restResult(T data, int code, String msg) { - Result apiResult = new Result<>(); - apiResult.setCode(code); - apiResult.setData(data); - apiResult.setMsg(msg); - return apiResult; - } -} diff --git a/february-merchant-mybatis-plus/.gitignore b/february-merchant-mybatis-plus/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/february-merchant-mybatis-plus/.gitignore @@ -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 \ No newline at end of file diff --git a/february-merchant-mybatis-plus/pom.xml b/february-merchant-mybatis-plus/pom.xml new file mode 100644 index 0000000..cdb07b6 --- /dev/null +++ b/february-merchant-mybatis-plus/pom.xml @@ -0,0 +1,123 @@ + + + 4.0.0 + + com.february + february-merchant-settlement + 3.6.3 + + + com.bwie + february-merchant-mybatis-plus + + + 17 + 17 + UTF-8 + + + + + org.springframework.cloud + spring-cloud-starter-bootstrap + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + org.springframework.cloud + spring-cloud-starter-loadbalancer + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + io.jsonwebtoken + jjwt + 0.9.1 + + + + com.alibaba + fastjson + 1.2.80 + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + org.springframework.boot + spring-boot-starter-validation + + + + org.apache.commons + commons-lang3 + + + + org.projectlombok + lombok + + + + cn.hutool + hutool-all + 5.8.3 + + + + com.aliyun + dysmsapi20170525 + 2.0.1 + + + + com.aliyun.oss + aliyun-sdk-oss + 3.12.0 + + + + + org.springframework.boot + spring-boot-starter-amqp + + + + + org.springframework.kafka + spring-kafka + + + org.apache.kafka + kafka-clients + + + com.baomidou + mybatis-plus-boot-starter + 3.0.5 + + + diff --git a/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/controller/CarController.java b/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/controller/CarController.java new file mode 100644 index 0000000..5c693d9 --- /dev/null +++ b/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/controller/CarController.java @@ -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; + } + +} diff --git a/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/demo/Tcar.java b/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/demo/Tcar.java new file mode 100644 index 0000000..2cd411e --- /dev/null +++ b/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/demo/Tcar.java @@ -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; +} diff --git a/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/mapper/CarMapper.java b/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/mapper/CarMapper.java new file mode 100644 index 0000000..86e9527 --- /dev/null +++ b/february-merchant-mybatis-plus/src/main/java/com/february/mybatisplus/mapper/CarMapper.java @@ -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 { + +} diff --git a/february-merchant-remote/pom.xml b/february-merchant-remote/pom.xml index faef62a..768678d 100644 --- a/february-merchant-remote/pom.xml +++ b/february-merchant-remote/pom.xml @@ -16,18 +16,12 @@ 20 UTF-8 + com.february february-merchant-common 3.6.3 - - - com.february - february-common-core - 3.6.3 - compile - diff --git a/february-merchant-server/pom.xml b/february-merchant-server/pom.xml index f55e73c..f7a2022 100644 --- a/february-merchant-server/pom.xml +++ b/february-merchant-server/pom.xml @@ -27,12 +27,6 @@ compile - - com.february - february-merchant-remote - 3.6.3 - compile - @@ -47,6 +41,12 @@ february-common-datasource 3.6.3 + + com.february + february-common-core + 3.6.3 + + diff --git a/february-merchant-server/src/main/java/com/february/merchant/controller/AddCarController.java b/february-merchant-server/src/main/java/com/february/merchant/controller/AddCarController.java index db3587b..8eb6354 100644 --- a/february-merchant-server/src/main/java/com/february/merchant/controller/AddCarController.java +++ b/february-merchant-server/src/main/java/com/february/merchant/controller/AddCarController.java @@ -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; } + } diff --git a/february-merchant-server/src/main/java/com/february/merchant/mapper/AddCarMapper.java b/february-merchant-server/src/main/java/com/february/merchant/mapper/AddCarMapper.java index 260da1b..b1ffaea 100644 --- a/february-merchant-server/src/main/java/com/february/merchant/mapper/AddCarMapper.java +++ b/february-merchant-server/src/main/java/com/february/merchant/mapper/AddCarMapper.java @@ -11,4 +11,5 @@ public interface AddCarMapper { Tadmin findByadminName(String adminName); Tuser findByuserName(String userName); + } diff --git a/february-merchant-server/src/main/java/com/february/merchant/service/AddCarService.java b/february-merchant-server/src/main/java/com/february/merchant/service/AddCarService.java index d533694..216302a 100644 --- a/february-merchant-server/src/main/java/com/february/merchant/service/AddCarService.java +++ b/february-merchant-server/src/main/java/com/february/merchant/service/AddCarService.java @@ -13,3 +13,4 @@ public interface AddCarService { Tuser findByuserName(String userName); } + diff --git a/february-merchant-server/src/main/java/com/february/merchant/service/impl/AddCarServiceImpl.java b/february-merchant-server/src/main/java/com/february/merchant/service/impl/AddCarServiceImpl.java index eaedb0c..ab33893 100644 --- a/february-merchant-server/src/main/java/com/february/merchant/service/impl/AddCarServiceImpl.java +++ b/february-merchant-server/src/main/java/com/february/merchant/service/impl/AddCarServiceImpl.java @@ -28,4 +28,5 @@ public class AddCarServiceImpl implements AddCarService { return addCarMapper.findByuserName(userName); } + } diff --git a/pom.xml b/pom.xml index dd4fec4..d03f1d3 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ february-merchant-common february-merchant-remote february-merchant-server + february-merchant-mybatis-plus february-merchant-settlement pom