Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
e4b3b1e3
S
SpringBoot-kwan
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringBoot-kwan
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot-kwan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e4b3b1e3
编写于
9月 08, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:添加面试题
上级
a9f2bf58
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
206 addition
and
14 deletion
+206
-14
src/main/java/com/kwan/springbootkwan/controller/InterviewQuestionController.java
...pringbootkwan/controller/InterviewQuestionController.java
+22
-10
src/main/java/com/kwan/springbootkwan/entity/InterviewQuestion.java
...ava/com/kwan/springbootkwan/entity/InterviewQuestion.java
+1
-1
src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionDTO.java
.../kwan/springbootkwan/entity/dto/InterviewQuestionDTO.java
+1
-1
src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionTypeDTO.java
...n/springbootkwan/entity/dto/InterviewQuestionTypeDTO.java
+16
-0
src/main/java/com/kwan/springbootkwan/entity/query/InterviewQuestionAddQuery.java
...pringbootkwan/entity/query/InterviewQuestionAddQuery.java
+9
-0
src/main/java/com/kwan/springbootkwan/enums/InterviewQuestionTypeEnum.java
.../kwan/springbootkwan/enums/InterviewQuestionTypeEnum.java
+103
-0
src/main/java/com/kwan/springbootkwan/mapper/InterviewQuestionMapper.java
...m/kwan/springbootkwan/mapper/InterviewQuestionMapper.java
+9
-0
src/main/java/com/kwan/springbootkwan/service/InterviewQuestionService.java
...kwan/springbootkwan/service/InterviewQuestionService.java
+16
-2
src/main/java/com/kwan/springbootkwan/service/impl/InterviewQuestionServiceImpl.java
...ngbootkwan/service/impl/InterviewQuestionServiceImpl.java
+15
-0
src/main/resources/mapper/InterviewQuestionMapper.xml
src/main/resources/mapper/InterviewQuestionMapper.xml
+14
-0
未找到文件。
src/main/java/com/kwan/springbootkwan/controller/InterviewQuestionController.java
浏览文件 @
e4b3b1e3
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.Result
;
import
com.kwan.springbootkwan.entity.Result
;
import
com.kwan.springbootkwan.entity.dto.InterviewQuestionDTO
;
import
com.kwan.springbootkwan.entity.dto.InterviewQuestionDTO
;
import
com.kwan.springbootkwan.entity.query.InterviewQuestionAddQuery
;
import
com.kwan.springbootkwan.service.InterviewQuestionService
;
import
com.kwan.springbootkwan.service.InterviewQuestionService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
...
@@ -48,7 +49,7 @@ public class InterviewQuestionController {
...
@@ -48,7 +49,7 @@ public class InterviewQuestionController {
}
}
/**
/**
* 分页查询所有数据
,本地缓存的使用
* 分页查询所有数据
*
*
* @return 所有数据
* @return 所有数据
*/
*/
...
@@ -56,14 +57,14 @@ public class InterviewQuestionController {
...
@@ -56,14 +57,14 @@ public class InterviewQuestionController {
public
Result
selectAll
(
@RequestParam
Integer
page
public
Result
selectAll
(
@RequestParam
Integer
page
,
@RequestParam
Integer
pageSize
,
@RequestParam
Integer
pageSize
,
@RequestParam
String
question
,
@RequestParam
String
question
,
@RequestParam
Integer
t
ype
)
{
,
@RequestParam
Integer
questionT
ype
)
{
Page
<
InterviewQuestion
>
pageParm
=
new
Page
<>();
Page
<
InterviewQuestion
>
pageParm
=
new
Page
<>();
pageParm
.
setCurrent
(
page
);
pageParm
.
setCurrent
(
page
);
pageParm
.
setSize
(
pageSize
);
pageParm
.
setSize
(
pageSize
);
QueryWrapper
<
InterviewQuestion
>
wrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
InterviewQuestion
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
orderByDesc
(
"id"
);
wrapper
.
orderByDesc
(
"id"
);
if
(
t
ype
!=
0
)
{
if
(
questionT
ype
!=
0
)
{
wrapper
.
eq
(
"
type"
,
t
ype
);
wrapper
.
eq
(
"
question_type"
,
questionT
ype
);
}
}
wrapper
.
eq
(
"is_delete"
,
0
);
wrapper
.
eq
(
"is_delete"
,
0
);
if
(
StringUtils
.
isNotEmpty
(
question
))
{
if
(
StringUtils
.
isNotEmpty
(
question
))
{
...
@@ -73,15 +74,26 @@ public class InterviewQuestionController {
...
@@ -73,15 +74,26 @@ public class InterviewQuestionController {
}
}
/**
/**
*
分页查询所有数据
*
新增问题
*
*
* @param page 分页对象
* @param interviewQuestion 查询实体
* @return 所有数据
* @return 所有数据
*/
*/
@GetMapping
@PostMapping
(
"/add"
)
public
Result
selectAll
(
Page
<
InterviewQuestion
>
page
,
InterviewQuestion
interviewQuestion
)
{
public
Result
add
(
@RequestBody
InterviewQuestionAddQuery
addInfo
)
{
return
Result
.
ok
(
this
.
interviewQuestionService
.
page
(
page
,
new
QueryWrapper
<>(
interviewQuestion
)));
InterviewQuestion
interviewQuestion
=
new
InterviewQuestion
();
interviewQuestion
.
setQuestion
(
addInfo
.
getQuestion
());
interviewQuestion
.
setQuestionType
(
addInfo
.
getQuestionType
());
return
Result
.
ok
(
this
.
interviewQuestionService
.
save
(
interviewQuestion
));
}
/**
* 获取面试题的种类的数量
*
* @return
*/
@GetMapping
(
"/questionType"
)
public
Result
questionType
()
{
return
Result
.
ok
(
interviewQuestionService
.
questionType
());
}
}
/**
/**
...
...
src/main/java/com/kwan/springbootkwan/entity/InterviewQuestion.java
浏览文件 @
e4b3b1e3
...
@@ -21,7 +21,7 @@ public class InterviewQuestion extends Model<InterviewQuestion> {
...
@@ -21,7 +21,7 @@ public class InterviewQuestion extends Model<InterviewQuestion> {
//问题回答
//问题回答
private
String
response
;
private
String
response
;
//知识类型,先默认0,后面再区分
//知识类型,先默认0,后面再区分
private
Integer
t
ype
;
private
Integer
questionT
ype
;
//创建时间
//创建时间
private
Date
createTime
;
private
Date
createTime
;
//逻辑删除,0未删除,1已删除
//逻辑删除,0未删除,1已删除
...
...
src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionDTO.java
浏览文件 @
e4b3b1e3
...
@@ -26,7 +26,7 @@ public class InterviewQuestionDTO extends Model<InterviewQuestionDTO> {
...
@@ -26,7 +26,7 @@ public class InterviewQuestionDTO extends Model<InterviewQuestionDTO> {
//问题回答
//问题回答
private
String
response
;
private
String
response
;
//知识类型,先默认0,后面再区分
//知识类型,先默认0,后面再区分
private
Integer
t
ype
;
private
Integer
questionT
ype
;
//创建时间
//创建时间
private
Date
createTime
;
private
Date
createTime
;
//逻辑删除,0未删除,1已删除
//逻辑删除,0未删除,1已删除
...
...
src/main/java/com/kwan/springbootkwan/entity/dto/InterviewQuestionTypeDTO.java
0 → 100644
浏览文件 @
e4b3b1e3
package
com.kwan.springbootkwan.entity.dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
InterviewQuestionTypeDTO
{
private
Integer
questionType
;
private
String
name
;
private
Integer
typeSize
;
}
src/main/java/com/kwan/springbootkwan/entity/query/InterviewQuestionAddQuery.java
0 → 100644
浏览文件 @
e4b3b1e3
package
com.kwan.springbootkwan.entity.query
;
import
lombok.Data
;
@Data
public
class
InterviewQuestionAddQuery
{
private
String
question
;
private
Integer
questionType
;
}
src/main/java/com/kwan/springbootkwan/enums/InterviewQuestionTypeEnum.java
0 → 100644
浏览文件 @
e4b3b1e3
package
com.kwan.springbootkwan.enums
;
import
lombok.Getter
;
import
lombok.ToString
;
@Getter
@ToString
public
enum
InterviewQuestionTypeEnum
{
/**
* 全部
*/
type_00
(
0
,
"全部"
),
/**
* 基础知识
*/
type_01
(
1
,
"基础知识"
),
/**
* 集合
*/
type_02
(
2
,
"集合"
),
/**
* JVM
*/
type_03
(
3
,
"JVM"
),
/**
* 并发编程
*/
type_04
(
4
,
"并发编程"
),
/**
* MySql
*/
type_05
(
5
,
"MySql"
),
/**
* Redis
*/
type_06
(
6
,
"Redis"
),
/**
* 中间件
*/
type_07
(
7
,
"中间件"
),
/**
* Spring
*/
type_08
(
8
,
"Spring"
),
/**
* 微服务
*/
type_09
(
9
,
"微服务"
),
/**
* 分布式
*/
type_10
(
10
,
"分布式"
),
/**
* 项目
*/
type_11
(
11
,
"项目"
),
/**
* 其他
*/
type_99
(
99
,
"其他"
);
private
Integer
code
;
private
String
name
;
InterviewQuestionTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
/**
* 通过code获取name
*
* @param code
* @return
*/
public
static
String
getNameByCode
(
Integer
code
)
{
for
(
InterviewQuestionTypeEnum
enums
:
InterviewQuestionTypeEnum
.
values
())
{
if
(
enums
.
getCode
().
equals
(
code
))
{
return
enums
.
getName
();
}
}
return
null
;
}
/**
* 通过value取枚举
*
* @param value
* @return
*/
public
static
InterviewQuestionTypeEnum
getBrandDetailNoByValue
(
String
value
)
{
if
(
null
==
value
)
{
return
null
;
}
for
(
InterviewQuestionTypeEnum
enums
:
InterviewQuestionTypeEnum
.
values
())
{
if
(
enums
.
getCode
().
equals
(
value
))
{
return
enums
;
}
}
return
null
;
}
}
src/main/java/com/kwan/springbootkwan/mapper/InterviewQuestionMapper.java
浏览文件 @
e4b3b1e3
...
@@ -2,6 +2,9 @@ package com.kwan.springbootkwan.mapper;
...
@@ -2,6 +2,9 @@ package com.kwan.springbootkwan.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.dto.InterviewQuestionTypeDTO
;
import
java.util.LinkedList
;
/**
/**
* 面试题(InterviewQuestion)表数据库访问层
* 面试题(InterviewQuestion)表数据库访问层
...
@@ -11,5 +14,11 @@ import com.kwan.springbootkwan.entity.InterviewQuestion;
...
@@ -11,5 +14,11 @@ import com.kwan.springbootkwan.entity.InterviewQuestion;
*/
*/
public
interface
InterviewQuestionMapper
extends
BaseMapper
<
InterviewQuestion
>
{
public
interface
InterviewQuestionMapper
extends
BaseMapper
<
InterviewQuestion
>
{
/**
* 获取面试题的种类
*
* @return
*/
LinkedList
<
InterviewQuestionTypeDTO
>
questionType
();
}
}
src/main/java/com/kwan/springbootkwan/service/InterviewQuestionService.java
浏览文件 @
e4b3b1e3
...
@@ -2,6 +2,9 @@ package com.kwan.springbootkwan.service;
...
@@ -2,6 +2,9 @@ package com.kwan.springbootkwan.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.dto.InterviewQuestionTypeDTO
;
import
java.util.List
;
/**
/**
* 面试题(InterviewQuestion)表服务接口
* 面试题(InterviewQuestion)表服务接口
...
@@ -10,7 +13,18 @@ import com.kwan.springbootkwan.entity.InterviewQuestion;
...
@@ -10,7 +13,18 @@ import com.kwan.springbootkwan.entity.InterviewQuestion;
* @since 2023-09-08 16:31:53
* @since 2023-09-08 16:31:53
*/
*/
public
interface
InterviewQuestionService
extends
IService
<
InterviewQuestion
>
{
public
interface
InterviewQuestionService
extends
IService
<
InterviewQuestion
>
{
/**
* 上传面试题
*
* @param path
* @return
*/
boolean
uploadFile
(
String
path
);
boolean
uploadFile
(
String
path
);
}
/**
* 获取面试题的种类
*
* @return
*/
List
<
InterviewQuestionTypeDTO
>
questionType
();
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/service/impl/InterviewQuestionServiceImpl.java
浏览文件 @
e4b3b1e3
...
@@ -3,6 +3,8 @@ package com.kwan.springbootkwan.service.impl;
...
@@ -3,6 +3,8 @@ package com.kwan.springbootkwan.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.InterviewQuestion
;
import
com.kwan.springbootkwan.entity.dto.InterviewQuestionTypeDTO
;
import
com.kwan.springbootkwan.enums.InterviewQuestionTypeEnum
;
import
com.kwan.springbootkwan.mapper.InterviewQuestionMapper
;
import
com.kwan.springbootkwan.mapper.InterviewQuestionMapper
;
import
com.kwan.springbootkwan.service.InterviewQuestionService
;
import
com.kwan.springbootkwan.service.InterviewQuestionService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -13,6 +15,7 @@ import java.io.IOException;
...
@@ -13,6 +15,7 @@ import java.io.IOException;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -24,6 +27,7 @@ import java.util.List;
...
@@ -24,6 +27,7 @@ import java.util.List;
@Slf4j
@Slf4j
@Service
(
"interviewQuestionService"
)
@Service
(
"interviewQuestionService"
)
public
class
InterviewQuestionServiceImpl
extends
ServiceImpl
<
InterviewQuestionMapper
,
InterviewQuestion
>
implements
InterviewQuestionService
{
public
class
InterviewQuestionServiceImpl
extends
ServiceImpl
<
InterviewQuestionMapper
,
InterviewQuestion
>
implements
InterviewQuestionService
{
@Resource
@Resource
private
InterviewQuestionMapper
interviewQuestionMapper
;
private
InterviewQuestionMapper
interviewQuestionMapper
;
...
@@ -53,4 +57,15 @@ public class InterviewQuestionServiceImpl extends ServiceImpl<InterviewQuestionM
...
@@ -53,4 +57,15 @@ public class InterviewQuestionServiceImpl extends ServiceImpl<InterviewQuestionM
}
}
return
true
;
return
true
;
}
}
@Override
public
List
<
InterviewQuestionTypeDTO
>
questionType
()
{
//获取种类,并按数量排序
LinkedList
<
InterviewQuestionTypeDTO
>
types
=
interviewQuestionMapper
.
questionType
();
types
.
addFirst
(
new
InterviewQuestionTypeDTO
(
0
,
"全部"
,
0
));
for
(
InterviewQuestionTypeDTO
interviewQuestionTypeDTO
:
types
)
{
interviewQuestionTypeDTO
.
setName
(
InterviewQuestionTypeEnum
.
getNameByCode
(
interviewQuestionTypeDTO
.
getQuestionType
()));
}
return
types
;
}
}
}
\ No newline at end of file
src/main/resources/mapper/InterviewQuestionMapper.xml
0 → 100644
浏览文件 @
e4b3b1e3
<?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.kwan.springbootkwan.mapper.InterviewQuestionMapper"
>
<select
id=
"questionType"
resultType=
"com.kwan.springbootkwan.entity.dto.InterviewQuestionTypeDTO"
>
SELECT DISTINCT question_type AS questionType, COUNT(*) AS typeSize
FROM interview_question
WHERE 1 = 1
AND is_delete = 0
AND question_type != 0
GROUP BY question_type
ORDER BY typeSize DESC
</select>
</mapper>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录