Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
18ec6bcc
提交
18ec6bcc
authored
11月 20, 2020
作者:
Whispa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
1b6a3fa6
fddaf740
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
40 行增加
和
11 行删除
+40
-11
ProblemController.java
...om/example/afrishop_v3/controllers/ProblemController.java
+19
-6
TbCfProblem.java
...main/java/com/example/afrishop_v3/models/TbCfProblem.java
+14
-0
TbCfProblemRepository.java
...example/afrishop_v3/repository/TbCfProblemRepository.java
+3
-1
application-test.yml
src/main/resources/application-test.yml
+2
-2
application.properties
src/main/resources/application.properties
+2
-2
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/ProblemController.java
浏览文件 @
18ec6bcc
package
com
.
example
.
afrishop_v3
.
controllers
;
import
com.example.afrishop_v3.base.Result
;
import
com.example.afrishop_v3.models.TbCfProblem
;
import
com.example.afrishop_v3.repository.TbCfProblemRepository
;
import
org.springframework.beans.factory.parsing.Problem
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.net.URLDecoder
;
@RestController
@RequestMapping
(
"/problem"
)
...
...
@@ -17,12 +18,24 @@ public class ProblemController {
this
.
repository
=
repository
;
}
// type 0:Problem 1:ShippingClause
@GetMapping
public
Result
getProblemList
(
@RequestParam
(
required
=
false
)
Integer
pageNum
,
@RequestParam
(
required
=
false
)
Integer
pageSize
)
{
pageNum
=
pageNum
==
null
?
1
:
pageNum
;
pageSize
=
pageSize
==
null
?
10
:
pageSize
;
return
new
Result
<>(
repository
.
findAll
(
PageRequest
.
of
(
pageNum
,
pageSize
)));
return
new
Result
<>(
repository
.
findAll
(
PageRequest
.
of
(
pageNum
,
pageSize
)));
}
@GetMapping
(
"/{type}"
)
public
Result
getShippingClause
(
@PathVariable
Integer
type
)
throws
Exception
{
TbCfProblem
clause
=
repository
.
findFirstByType
(
type
);
String
shippingClause
=
URLDecoder
.
decode
(
clause
.
getAnswer
(),
"utf-8"
);
TbCfProblem
problem
=
new
TbCfProblem
();
problem
.
setQuestion
(
clause
.
getQuestion
());
problem
.
setAnswer
(
shippingClause
);
return
new
Result
(
problem
);
}
}
src/main/java/com/example/afrishop_v3/models/TbCfProblem.java
浏览文件 @
18ec6bcc
...
...
@@ -37,6 +37,16 @@ public class TbCfProblem {
*/
private
Date
createTime
;
private
Integer
type
;
public
Integer
getType
()
{
return
type
;
}
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
/**
* 设置:问题id
*/
...
...
@@ -50,6 +60,7 @@ public class TbCfProblem {
public
String
getProblemId
()
{
return
problemId
;
}
/**
* 设置:问题明细
*/
...
...
@@ -63,6 +74,7 @@ public class TbCfProblem {
public
String
getQuestion
()
{
return
question
;
}
/**
* 设置:答案
*/
...
...
@@ -76,6 +88,7 @@ public class TbCfProblem {
public
String
getAnswer
()
{
return
answer
;
}
/**
* 设置:是否展示
*/
...
...
@@ -89,6 +102,7 @@ public class TbCfProblem {
public
Integer
getEnableFlag
()
{
return
enableFlag
;
}
/**
* 设置:创建时间
*/
...
...
src/main/java/com/example/afrishop_v3/repository/TbCfProblemRepository.java
浏览文件 @
18ec6bcc
...
...
@@ -3,5 +3,7 @@ package com.example.afrishop_v3.repository;
import
com.example.afrishop_v3.models.TbCfProblem
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
public
interface
TbCfProblemRepository
extends
PagingAndSortingRepository
<
TbCfProblem
,
String
>
{
public
interface
TbCfProblemRepository
extends
PagingAndSortingRepository
<
TbCfProblem
,
String
>
{
TbCfProblem
findFirstByType
(
Integer
type
);
}
src/main/resources/application-test.yml
浏览文件 @
18ec6bcc
spring
:
datasource
:
url
:
jdbc:mysql://
47.106.242.175:3306/afrishop_test
?useUnicode=true&connectionCollation=utf8mb4_general_ci&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
url
:
jdbc:mysql://
159.138.48.71:3306/chinafrica_ref
?useUnicode=true&connectionCollation=utf8mb4_general_ci&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
username
:
root
driver-class-name
:
com.mysql.cj.jdbc.Driver
password
:
diaoyun666
password
:
Diaoyunnuli.8
redis
:
#Redis数据库分片索引(默认为0)
...
...
src/main/resources/application.properties
浏览文件 @
18ec6bcc
server.servlet.context-path
=
/
zion
server.servlet.context-path
=
/
afrishop
spring.jpa.hibernate.ddl-auto
=
update
server.port
=
7000
server.port
=
8099
#spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/afrishop_test?useUnicode=true&connectionCollation=utf8mb4_general_ci&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
#spring.datasource.username=root
#spring.datasource.password=Diaoyunnuli.8
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论