mybatis-plus
parent
d943b7e849
commit
cb797fe4f9
|
@ -1,6 +1,7 @@
|
||||||
package com.february.system.domain;
|
package com.february.system.domain;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -18,7 +19,5 @@ public class Tadmin {
|
||||||
private String adminName;
|
private String adminName;
|
||||||
private String adminPhone;
|
private String adminPhone;
|
||||||
private String adminPassword;
|
private String adminPassword;
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
private Integer adminRole;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date adminRole;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|
||||||
public class TCarType {
|
public class TcarType {
|
||||||
private Integer carTypeId;
|
private Integer carTypeId;
|
||||||
private String carTypeName;
|
private String carTypeName;
|
||||||
}
|
}
|
|
@ -105,7 +105,11 @@
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
<version>5.3.29</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.kafka</groupId>
|
<groupId>org.springframework.kafka</groupId>
|
||||||
<artifactId>spring-kafka</artifactId>
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
@ -119,5 +123,19 @@
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
<version>3.0.5</version>
|
<version>3.0.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.february</groupId>
|
||||||
|
<artifactId>february-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.february.mybatisplus;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.february.mybatisplus.mapper")
|
||||||
|
public class CarApply {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CarApply.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.february.mybatisplus.controller;
|
||||||
|
|
||||||
|
import com.february.mybatisplus.demo.Tadmin;
|
||||||
|
import com.february.mybatisplus.service.AdminService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/login")
|
||||||
|
@Log4j2
|
||||||
|
public class AdminController {
|
||||||
|
@Autowired
|
||||||
|
private AdminService adminService;
|
||||||
|
|
||||||
|
@PostMapping("/loginAdmin")
|
||||||
|
public String loginAdmin(@RequestParam("adminName")String adminName,@RequestParam("adminPassword")String adminPassword){
|
||||||
|
Tadmin tadmin=adminService.loginAdmin(adminName,adminPassword);
|
||||||
|
if (tadmin!=null){
|
||||||
|
return "登陆成功";
|
||||||
|
}else {
|
||||||
|
return "登录失败";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,32 +1,36 @@
|
||||||
package com.february.mybatisplus.controller;
|
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 com.february.mybatisplus.demo.Tcar;
|
||||||
|
import com.february.mybatisplus.service.CarService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.http.impl.nio.bootstrap.HttpServer;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.xml.transform.Result;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("car")
|
@RequestMapping("car")
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class CarController {
|
public class CarController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServerRequest request;
|
private CarService carService;
|
||||||
|
|
||||||
@PostMapping("add")
|
/**
|
||||||
public Result aad(@RequestBody Tcar tcar){
|
* 企业入驻
|
||||||
log.info("功能名称:添加,请求URI:{},请求方式:{},请求参数:{}"
|
* @param tcar
|
||||||
,request.getParams(),request.getParams(), JSONObject.toJSONString(tcar));
|
* @return
|
||||||
|
*/
|
||||||
return null;
|
@PostMapping
|
||||||
|
public ResponseEntity<?> add(@RequestBody Tcar tcar){
|
||||||
|
carService.add(tcar);
|
||||||
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.february.mybatisplus.controller;
|
||||||
|
|
||||||
|
import com.february.mybatisplus.demo.Tuser;
|
||||||
|
import com.february.mybatisplus.service.UserService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/userLogin")
|
||||||
|
@Log4j2
|
||||||
|
public class UserController {
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
@PostMapping("/loginUser")
|
||||||
|
public String loginUser(@RequestParam("userName")String userName,@RequestParam("userPassword")String userPassword){
|
||||||
|
Tuser tuser=userService.loginUser(userName,userPassword);
|
||||||
|
if (tuser!=null){
|
||||||
|
return "登陆成功";
|
||||||
|
}else {
|
||||||
|
return "登录失败";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("t_admin")
|
||||||
|
public class Tadmin {
|
||||||
|
@TableId(value = "admin_id",type = IdType.AUTO)
|
||||||
|
private Integer adminId;
|
||||||
|
@TableField("admin_name")
|
||||||
|
private String adminName;
|
||||||
|
@TableField("admin_password")
|
||||||
|
private String adminPassword;
|
||||||
|
@TableField("admin_role")
|
||||||
|
private Integer adminRole;
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
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_user")
|
||||||
|
public class Tuser {
|
||||||
|
@TableId(value = "user_id",type = IdType.AUTO)
|
||||||
|
private Integer userId;
|
||||||
|
@TableField("user_name")
|
||||||
|
private String userName;
|
||||||
|
@TableField("user_phone")
|
||||||
|
private String userPhone;
|
||||||
|
@TableField("user_password")
|
||||||
|
private String userPassword;
|
||||||
|
@TableField("car_vin")
|
||||||
|
private String carVin;
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.february.mybatisplus.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.february.mybatisplus.demo.Tadmin;
|
||||||
|
|
||||||
|
public interface AdminMapper extends BaseMapper<Tadmin> {
|
||||||
|
}
|
|
@ -5,4 +5,5 @@ import com.february.mybatisplus.demo.Tcar;
|
||||||
|
|
||||||
public interface CarMapper extends BaseMapper<Tcar> {
|
public interface CarMapper extends BaseMapper<Tcar> {
|
||||||
|
|
||||||
|
void add(Tcar tcar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.february.mybatisplus.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.february.mybatisplus.demo.Tuser;
|
||||||
|
|
||||||
|
public interface UserMapper extends BaseMapper<Tuser> {
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.february.mybatisplus.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.february.mybatisplus.demo.Tadmin;
|
||||||
|
|
||||||
|
public interface AdminService extends IService<Tadmin> {
|
||||||
|
|
||||||
|
Tadmin loginAdmin(String adminName, String adminPassword);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.february.mybatisplus.service;
|
||||||
|
|
||||||
|
import com.february.mybatisplus.demo.Tcar;
|
||||||
|
import com.february.mybatisplus.mapper.CarMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CarService {
|
||||||
|
@Autowired
|
||||||
|
private CarMapper carMapper;
|
||||||
|
public void add(Tcar tcar){
|
||||||
|
carMapper.add(tcar);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.february.mybatisplus.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.february.mybatisplus.demo.Tuser;
|
||||||
|
|
||||||
|
public interface UserService extends IService<Tuser> {
|
||||||
|
Tuser loginUser(String userName, String userPassword);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.february.mybatisplus.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.february.mybatisplus.demo.Tadmin;
|
||||||
|
import com.february.mybatisplus.mapper.AdminMapper;
|
||||||
|
import com.february.mybatisplus.service.AdminService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Tadmin> implements AdminService {
|
||||||
|
@Override
|
||||||
|
public Tadmin loginAdmin(String adminName, String adminPassword) {
|
||||||
|
QueryWrapper<Tadmin> queryWrapper=new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(Tadmin::getAdminName,adminName).eq(Tadmin::getAdminPassword,adminPassword);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.february.mybatisplus.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.february.mybatisplus.demo.Tuser;
|
||||||
|
import com.february.mybatisplus.mapper.UserMapper;
|
||||||
|
import com.february.mybatisplus.service.UserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserServiceImpl extends ServiceImpl<UserMapper, Tuser> implements UserService {
|
||||||
|
@Override
|
||||||
|
public Tuser loginUser(String userName, String userPassword) {
|
||||||
|
QueryWrapper<Tuser> tuserQueryWrapper = new QueryWrapper<>();
|
||||||
|
tuserQueryWrapper.lambda().eq(Tuser::getUserName,userName).eq(Tuser::getUserPassword,userPassword);
|
||||||
|
return this.getOne(tuserQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9222
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: merchant-settlement
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 10.100.1.4:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 10.100.1.4:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -48,41 +48,52 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- <!– SpringBoot Web–>-->
|
<!-- SpringBoot Web-->
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
<groupId>org.springframework.boot</groupId>
|
||||||
<!-- <artifactId>spring-boot-starter-web</artifactId>-->
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
<!-- </dependency>-->
|
</dependency>
|
||||||
<!-- <!– Druid –>-->
|
<!-- Druid -->
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
<!-- <groupId>com.alibaba</groupId>-->
|
<groupId>com.alibaba</groupId>
|
||||||
<!-- <artifactId>druid-spring-boot-starter</artifactId>-->
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<!-- <version>1.2.8</version>-->
|
<version>1.2.8</version>
|
||||||
<!-- </dependency>-->
|
</dependency>
|
||||||
<!-- <!– Mysql Connector –>-->
|
<!-- Mysql Connector -->
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
<!-- <groupId>mysql</groupId>-->
|
<groupId>mysql</groupId>
|
||||||
<!-- <artifactId>mysql-connector-java</artifactId>-->
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<!-- </dependency>-->
|
<version>8.0.27</version>
|
||||||
<!-- <!– Mybatis 依赖配置 –>-->
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- Mybatis 依赖配置 -->
|
||||||
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
<dependency>
|
||||||
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<!-- <version>2.2.2</version>-->
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<!-- </dependency>-->
|
<version>2.2.2</version>
|
||||||
<!-- <!– Pagehelper –>-->
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- Pagehelper -->
|
||||||
<!-- <groupId>com.github.pagehelper</groupId>-->
|
<dependency>
|
||||||
<!-- <artifactId>pagehelper-spring-boot-starter</artifactId>-->
|
<groupId>com.github.pagehelper</groupId>
|
||||||
<!-- <version>1.4.1</version>-->
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
<!-- </dependency>-->
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 图片上传 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tobato</groupId>
|
||||||
|
<artifactId>fastdfs-client</artifactId>
|
||||||
|
<version>1.26.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- <!– 图片上传 –>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.github.tobato</groupId>-->
|
|
||||||
<!-- <artifactId>fastdfs-client</artifactId>-->
|
|
||||||
<!-- <version>1.26.5</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
|
|
Loading…
Reference in New Issue