初始化仓库
This commit is contained in:
commit
2d0b4a37d7
|
@ -0,0 +1,33 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
|
@ -0,0 +1,77 @@
|
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.17</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.bigdata</groupId>
|
||||
<artifactId>wxapp-server</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>wxapp-server</name>
|
||||
<description>wxapp-server</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.8.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.26</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.3.1</version>
|
||||
</dependency>
|
||||
<!--json-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.83</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,15 @@
|
|||
package com.bigdata.wxappserver;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@MapperScan("com.bigdata.wxappserver.mapper")
|
||||
@SpringBootApplication
|
||||
public class WxappServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WxappServerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.bigdata.wxappserver.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/08/28/20:18
|
||||
* @Description:
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig implements MetaObjectHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("createTime", new Date(), metaObject);
|
||||
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.bigdata.wxappserver.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bigdata.wxappserver.service.OrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/08/28/20:28
|
||||
* @Description:
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("order")
|
||||
public class OrderController {
|
||||
|
||||
@Autowired
|
||||
OrderService orderService;
|
||||
|
||||
@RequestMapping("addOrUpdate")
|
||||
public JSONObject addOrUpdate(@RequestBody JSONObject jsonObject){
|
||||
return orderService.addOrUpdate(jsonObject);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.bigdata.wxappserver.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/08/28/20:22
|
||||
* @Description:
|
||||
*/
|
||||
@TableName("order")
|
||||
public class Order {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String username;
|
||||
private String phone;
|
||||
|
||||
private Integer goodId;
|
||||
private String address;
|
||||
private Date deliveryTime;
|
||||
|
||||
@TableField(fill= FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
@TableField(fill= FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
@TableLogic
|
||||
private Integer isDelete;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bigdata.wxappserver.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bigdata.wxappserver.entity.Order;
|
||||
|
||||
public interface OrderMapper extends BaseMapper<Order> {
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.bigdata.wxappserver.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bigdata.wxappserver.entity.Order;
|
||||
import com.bigdata.wxappserver.mapper.OrderMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/08/28/20:28
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
public class OrderService extends ServiceImpl<OrderMapper, Order> {
|
||||
|
||||
|
||||
public JSONObject addOrUpdate(JSONObject jsonObject) {
|
||||
Order order = jsonObject.toJavaObject(Order.class);
|
||||
if (order==null){
|
||||
return new JSONObject().fluentPut("success",false).fluentPut("message","参数错误");
|
||||
}
|
||||
// TODO 判空
|
||||
boolean success = saveOrUpdate(order);
|
||||
return new JSONObject().fluentPut("message","success").fluentPut("success",success);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
spring:
|
||||
application:
|
||||
name: wxapp-server
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://62.234.217.137:3306/wxapp?useUnicode=true&characterEncoding=UTF-8
|
||||
username: root
|
||||
password: nWZpHMb8mNxWE5Xk
|
||||
server:
|
||||
port: 8088
|
||||
|
||||
# Mybatis-plus??
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:/mapper/*Mapper.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
|
@ -0,0 +1,13 @@
|
|||
package com.bigdata.wxappserver;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class WxappServerApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue