Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
SpringCloud2020
提交
859b7511
S
SpringCloud2020
项目概览
梦中观雨
/
SpringCloud2020
与 Fork 源项目一致
Fork自
Lcry / SpringCloud2020
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringCloud2020
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
859b7511
编写于
3月 14, 2020
作者:
Lcry
🖥
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
第一天:P1-P11
上级
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
538 addition
and
0 deletion
+538
-0
.gitignore
.gitignore
+101
-0
cloud-provider-payment8001/pom.xml
cloud-provider-payment8001/pom.xml
+63
-0
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/PaymentMain8001.java
...1/src/main/java/com/lcry/springcloud/PaymentMain8001.java
+17
-0
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/controller/PaymentController.java
...va/com/lcry/springcloud/controller/PaymentController.java
+50
-0
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/dao/PaymentDao.java
...01/src/main/java/com/lcry/springcloud/dao/PaymentDao.java
+19
-0
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/entities/CommonResult.java
...main/java/com/lcry/springcloud/entities/CommonResult.java
+35
-0
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/entities/Payment.java
.../src/main/java/com/lcry/springcloud/entities/Payment.java
+28
-0
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/service/PaymentService.java
...ain/java/com/lcry/springcloud/service/PaymentService.java
+16
-0
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/service/impl/PaymentServiceImpl.java
...com/lcry/springcloud/service/impl/PaymentServiceImpl.java
+31
-0
cloud-provider-payment8001/src/main/resources/application.yml
...d-provider-payment8001/src/main/resources/application.yml
+17
-0
cloud-provider-payment8001/src/main/resources/db/payment.sql
cloud-provider-payment8001/src/main/resources/db/payment.sql
+37
-0
cloud-provider-payment8001/src/main/resources/mapper/PaymentMapper.xml
...r-payment8001/src/main/resources/mapper/PaymentMapper.xml
+21
-0
pom.xml
pom.xml
+103
-0
未找到文件。
.gitignore
0 → 100644
浏览文件 @
859b7511
# Created by .ignore support plugin (hsz.mobi)
### Java template
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
.idea/
cloud-provider-payment8001/src/test/
cloud-provider-payment8001/target/
cloud-provider-payment8001/pom.xml
0 → 100644
浏览文件 @
859b7511
<?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"
>
<parent>
<artifactId>
2020SpringCloud
</artifactId>
<groupId>
com.lcry
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<!-- 支付模块-->
<artifactId>
cloud-provider-payment8001
</artifactId>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
1.1.10
</version>
</dependency>
<!--mysql-connector-java-->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!--jdbc-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-jdbc
</artifactId>
</dependency>
<!-- 热部署插件-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<scope>
runtime
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/PaymentMain8001.java
0 → 100644
浏览文件 @
859b7511
package
com.lcry.springcloud
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
/**
* PaymentMain8001
*
* @author lcry
* @date 2020/03/13 20:54
*/
@SpringBootApplication
public
class
PaymentMain8001
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
PaymentMain8001
.
class
,
args
);
}
}
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/controller/PaymentController.java
0 → 100644
浏览文件 @
859b7511
package
com.lcry.springcloud.controller
;
import
com.lcry.springcloud.entities.CommonResult
;
import
com.lcry.springcloud.entities.Payment
;
import
com.lcry.springcloud.service.PaymentService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
/**
* PaymentController
*
* @author lcry
* @date 2020/03/13 21:39
* 控制器
*/
@RestController
@Slf4j
public
class
PaymentController
{
@Resource
private
PaymentService
paymentService
;
@PostMapping
(
value
=
"/payment/create"
)
public
CommonResult
create
(
Payment
payment
)
{
int
result
=
paymentService
.
create
(
payment
);
log
.
info
(
"插入结果:"
+
result
);
if
(
result
>
0
)
{
return
new
CommonResult
(
200
,
"插入数据成功"
,
result
);
}
else
{
return
new
CommonResult
(
444
,
"插入数据失败"
,
null
);
}
}
@GetMapping
(
value
=
"/payment/get/{id}"
)
public
CommonResult
getPaymentById
(
@PathVariable
(
"id"
)
Long
id
)
{
Payment
payment
=
paymentService
.
getPaymentById
(
id
);
log
.
info
(
"查询结果:"
+
payment
);
if
(
payment
!=
null
)
{
return
new
CommonResult
(
200
,
"查询成功"
,
payment
);
}
else
{
return
new
CommonResult
(
444
,
"没有对应记录,查询ID:"
+
id
,
null
);
}
}
}
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/dao/PaymentDao.java
0 → 100644
浏览文件 @
859b7511
package
com.lcry.springcloud.dao
;
import
com.lcry.springcloud.entities.Payment
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* PaymentDao
*
* @author lcry
* @date 2020/03/13 21:30
* Dao层
*/
@Mapper
public
interface
PaymentDao
{
int
create
(
Payment
payment
);
//增
Payment
getPaymentById
(
@Param
(
"id"
)
Long
id
);
//根据id查询
}
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/entities/CommonResult.java
0 → 100644
浏览文件 @
859b7511
package
com.lcry.springcloud.entities
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* CommonResult
*
* @author lcry
* @date 2020/03/13 21:31
* 公共返回结果集
*/
@Data
@AllArgsConstructor
//全参构造器
@NoArgsConstructor
//空参构造器
public
class
CommonResult
<
T
>
{
/**
* 状态码:200成功
*/
private
Integer
code
;
/**
* 响应信息
*/
private
String
message
;
/**
* 响应数据
*/
private
T
data
;
public
CommonResult
(
Integer
code
,
String
message
)
{
this
(
code
,
message
,
null
);
}
}
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/entities/Payment.java
0 → 100644
浏览文件 @
859b7511
package
com.lcry.springcloud.entities
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* Payment
*
* @author lcry
* @date 2020/03/13 21:26
* 支付实体类
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
Payment
implements
Serializable
{
/**
* 主键id
*/
private
Long
id
;
/**
* 流水号
*/
private
String
serial
;
}
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/service/PaymentService.java
0 → 100644
浏览文件 @
859b7511
package
com.lcry.springcloud.service
;
import
com.lcry.springcloud.entities.Payment
;
import
org.apache.ibatis.annotations.Param
;
/**
* PaymentService
*
* @author lcry
* @date 2020/03/13 21:28
*/
public
interface
PaymentService
{
int
create
(
Payment
payment
);
//增
Payment
getPaymentById
(
@Param
(
"id"
)
Long
id
);
//根据id查询
}
cloud-provider-payment8001/src/main/java/com/lcry/springcloud/service/impl/PaymentServiceImpl.java
0 → 100644
浏览文件 @
859b7511
package
com.lcry.springcloud.service.impl
;
import
com.lcry.springcloud.dao.PaymentDao
;
import
com.lcry.springcloud.entities.Payment
;
import
com.lcry.springcloud.service.PaymentService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
/**
* PaymentServiceImpl
*
* @author lcry
* @date 2020/03/13 21:29
* service实现类
*/
@Service
public
class
PaymentServiceImpl
implements
PaymentService
{
@Resource
private
PaymentDao
paymentDao
;
@Override
public
int
create
(
Payment
payment
)
{
return
paymentDao
.
create
(
payment
);
}
@Override
public
Payment
getPaymentById
(
Long
id
)
{
return
paymentDao
.
getPaymentById
(
id
);
}
}
cloud-provider-payment8001/src/main/resources/application.yml
0 → 100644
浏览文件 @
859b7511
server
:
port
:
8001
spring
:
application
:
name
:
cloud-payment-service
datasource
:
type
:
com.alibaba.druid.pool.DruidDataSource
# 当前数据源操作类型
driver-class-name
:
org.gjt.mm.mysql.Driver
# mysql驱动包
url
:
jdbc:mysql://localhost:3306/db2020?useUnicode=true&characterEncoding=utf-8&useSSL=false
username
:
root
password
:
lcry
mybatis
:
mapperLocations
:
classpath:mapper/*.xml
type-aliases-package
:
com.lcry.springcloud.entities
# 所有Entity别名类所在包
\ No newline at end of file
cloud-provider-payment8001/src/main/resources/db/payment.sql
0 → 100644
浏览文件 @
859b7511
/*
Navicat Premium Data Transfer
Source Server : 本地mysql
Source Server Type : MySQL
Source Server Version : 50717
Source Host : localhost:3306
Source Schema : db2020
Target Server Type : MySQL
Target Server Version : 50717
File Encoding : 65001
Date: 13/03/2020 22:40:33
*/
SET
NAMES
utf8mb4
;
SET
FOREIGN_KEY_CHECKS
=
0
;
-- ----------------------------
-- Table structure for payment
-- ----------------------------
DROP
TABLE
IF
EXISTS
`payment`
;
CREATE
TABLE
`payment`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'ID'
,
`serial`
varchar
(
200
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NULL
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
25
CHARACTER
SET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
ROW_FORMAT
=
Dynamic
;
-- ----------------------------
-- Records of payment
-- ----------------------------
INSERT
INTO
`payment`
VALUES
(
1
,
'aaa'
);
INSERT
INTO
`payment`
VALUES
(
22
,
'bbbb'
);
INSERT
INTO
`payment`
VALUES
(
24
,
'123'
);
SET
FOREIGN_KEY_CHECKS
=
1
;
cloud-provider-payment8001/src/main/resources/mapper/PaymentMapper.xml
0 → 100644
浏览文件 @
859b7511
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.lcry.springcloud.dao.PaymentDao"
>
<insert
id=
"create"
parameterType=
"Payment"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into payment(serial) values(#{serial});
</insert>
<resultMap
id=
"BaseResultMap"
type=
"com.lcry.springcloud.entities.Payment"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<id
column=
"serial"
property=
"serial"
jdbcType=
"VARCHAR"
/>
</resultMap>
<select
id=
"getPaymentById"
parameterType=
"Long"
resultMap=
"BaseResultMap"
>
select * from payment where id=#{id};
</select>
</mapper>
pom.xml
0 → 100644
浏览文件 @
859b7511
<?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>
<groupId>
com.lcry
</groupId>
<artifactId>
2020SpringCloud
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<modules>
<module>
cloud-provider-payment8001
</module>
</modules>
<packaging>
pom
</packaging>
<!-- 统一管理jar包版本 -->
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
<junit.version>
4.12
</junit.version>
<log4j.version>
1.2.17
</log4j.version>
<lombok.version>
1.16.20
</lombok.version>
<mysql.version>
5.1.47
</mysql.version>
<druid.version>
1.1.16
</druid.version>
<mybatis.spring.boot.version>
1.3.0
</mybatis.spring.boot.version>
</properties>
<!-- 子模块继承之后,提供作用:锁定版本+子modlue不用写groupId和version -->
<dependencyManagement>
<dependencies>
<!--spring boot 2.2.2-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
<version>
2.2.2.RELEASE
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<!--spring cloud Hoxton.SR1-->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
Hoxton.SR1
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<!--spring cloud alibaba 2.1.0.RELEASE-->
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-alibaba-dependencies
</artifactId>
<version>
2.1.0.RELEASE
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
${mysql.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
<version>
${druid.version}
</version>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<version>
${mybatis.spring.boot.version}
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
${junit.version}
</version>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
${log4j.version}
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
${lombok.version}
</version>
<optional>
true
</optional>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<fork>
true
</fork>
<addResources>
true
</addResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录