Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
1cf2bc72
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看板
提交
1cf2bc72
编写于
10月 07, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:删掉枚举类
上级
361d64ca
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
97 addition
and
79 deletion
+97
-79
src/main/java/com/kwan/springbootkwan/entity/DictionaryManagement.java
.../com/kwan/springbootkwan/entity/DictionaryManagement.java
+28
-0
src/main/java/com/kwan/springbootkwan/enums/AlgorithmicProblemTypeEnum.java
...kwan/springbootkwan/enums/AlgorithmicProblemTypeEnum.java
+0
-76
src/main/java/com/kwan/springbootkwan/mapper/DictionaryManagementMapper.java
...wan/springbootkwan/mapper/DictionaryManagementMapper.java
+15
-0
src/main/java/com/kwan/springbootkwan/service/DictionaryManagementService.java
...n/springbootkwan/service/DictionaryManagementService.java
+15
-0
src/main/java/com/kwan/springbootkwan/service/impl/AlgorithmicProblemServiceImpl.java
...gbootkwan/service/impl/AlgorithmicProblemServiceImpl.java
+20
-3
src/main/java/com/kwan/springbootkwan/service/impl/DictionaryManagementServiceImpl.java
...ootkwan/service/impl/DictionaryManagementServiceImpl.java
+19
-0
未找到文件。
src/main/java/com/kwan/springbootkwan/entity/DictionaryManagement.java
0 → 100644
浏览文件 @
1cf2bc72
package
com.kwan.springbootkwan.entity
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 字典表(DictionaryManagement)表实体类
*
* @author makejava
* @since 2023-10-07 17:54:39
*/
@Data
public
class
DictionaryManagement
extends
Model
<
DictionaryManagement
>
{
//主键id
private
Integer
id
;
//字典类型
private
Integer
dictType
;
//字典code
private
Integer
code
;
//字典名称
private
String
name
;
//创建时间
private
Date
createTime
;
//逻辑删除,0未删除,1已删除
private
Integer
isDelete
;
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/enums/AlgorithmicProblemTypeEnum.java
已删除
100644 → 0
浏览文件 @
361d64ca
package
com.kwan.springbootkwan.enums
;
import
com.kwan.springbootkwan.entity.dto.AlgorithmicQuestionTypeDTO
;
import
lombok.Getter
;
import
lombok.ToString
;
import
java.util.LinkedList
;
@Getter
@ToString
public
enum
AlgorithmicProblemTypeEnum
{
/**
* 全部
*/
type_00
(
0
,
"全部"
),
/**
* 链表
*/
type_01
(
1
,
"链表"
),
/**
* 数组
*/
type_02
(
2
,
"数组"
),
/**
* 二叉树
*/
type_03
(
3
,
"二叉树"
),
/**
* 贪心
*/
type_04
(
4
,
"贪心"
),
/**
* 动态规划
*/
type_05
(
5
,
"动态规划"
),
/**
* 其他
*/
type_99
(
99
,
"其他"
);
private
Integer
code
;
private
String
name
;
AlgorithmicProblemTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
/**
* 通过code获取name
*
* @param code
* @return
*/
public
static
String
getNameByCode
(
Integer
code
)
{
for
(
AlgorithmicProblemTypeEnum
enums
:
AlgorithmicProblemTypeEnum
.
values
())
{
if
(
enums
.
getCode
().
equals
(
code
))
{
return
enums
.
getName
();
}
}
return
null
;
}
/**
* 获取所有枚举
*
* @return
*/
public
static
LinkedList
<
AlgorithmicQuestionTypeDTO
>
getAll
()
{
LinkedList
<
AlgorithmicQuestionTypeDTO
>
list
=
new
LinkedList
<>();
for
(
AlgorithmicProblemTypeEnum
enums
:
AlgorithmicProblemTypeEnum
.
values
())
{
AlgorithmicQuestionTypeDTO
algorithmicQuestionTypeDTO
=
new
AlgorithmicQuestionTypeDTO
(
enums
.
getCode
(),
enums
.
getName
(),
0
);
list
.
add
(
algorithmicQuestionTypeDTO
);
}
return
list
;
}
}
src/main/java/com/kwan/springbootkwan/mapper/DictionaryManagementMapper.java
0 → 100644
浏览文件 @
1cf2bc72
package
com.kwan.springbootkwan.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.kwan.springbootkwan.entity.DictionaryManagement
;
/**
* 字典表(DictionaryManagement)表数据库访问层
*
* @author makejava
* @since 2023-10-07 17:54:37
*/
public
interface
DictionaryManagementMapper
extends
BaseMapper
<
DictionaryManagement
>
{
}
src/main/java/com/kwan/springbootkwan/service/DictionaryManagementService.java
0 → 100644
浏览文件 @
1cf2bc72
package
com.kwan.springbootkwan.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.kwan.springbootkwan.entity.DictionaryManagement
;
/**
* 字典表(DictionaryManagement)表服务接口
*
* @author makejava
* @since 2023-10-07 17:54:39
*/
public
interface
DictionaryManagementService
extends
IService
<
DictionaryManagement
>
{
}
src/main/java/com/kwan/springbootkwan/service/impl/AlgorithmicProblemServiceImpl.java
浏览文件 @
1cf2bc72
package
com.kwan.springbootkwan.service.impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.kwan.springbootkwan.entity.AlgorithmicProblem
;
import
com.kwan.springbootkwan.entity.DictionaryManagement
;
import
com.kwan.springbootkwan.entity.dto.AlgorithmicQuestionTypeDTO
;
import
com.kwan.springbootkwan.enums.AlgorithmicProblemTypeEnum
;
import
com.kwan.springbootkwan.mapper.AlgorithmicProblemMapper
;
import
com.kwan.springbootkwan.service.AlgorithmicProblemService
;
import
com.kwan.springbootkwan.service.DictionaryManagementService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 算法题(AlgorithmicProblem)表服务实现类
...
...
@@ -23,22 +26,36 @@ public class AlgorithmicProblemServiceImpl extends ServiceImpl<AlgorithmicProble
@Autowired
private
AlgorithmicProblemMapper
interviewQuestionMapper
;
@Autowired
private
DictionaryManagementService
dictionaryManagementService
;
@Override
public
List
<
AlgorithmicQuestionTypeDTO
>
questionType
()
{
final
List
<
AlgorithmicQuestionTypeDTO
>
algorithmicQuestionTypeDTOS
=
this
.
allQuestionType
();
//获取种类,并按数量排序
LinkedList
<
AlgorithmicQuestionTypeDTO
>
types
=
interviewQuestionMapper
.
questionType
();
types
.
addFirst
(
new
AlgorithmicQuestionTypeDTO
(
0
,
"全部"
,
0
));
for
(
AlgorithmicQuestionTypeDTO
algorithmicQuestionTypeDTO
:
types
)
{
//数据库存的是问题类型的编码
algorithmicQuestionTypeDTO
.
setName
(
AlgorithmicProblemTypeEnum
.
getNameByCode
(
algorithmicQuestionTypeDTO
.
getQuestionType
()));
final
AlgorithmicQuestionTypeDTO
item
=
algorithmicQuestionTypeDTOS
.
stream
().
filter
(
x
->
x
.
getQuestionType
().
equals
(
algorithmicQuestionTypeDTO
.
getQuestionType
())).
findFirst
().
get
();
algorithmicQuestionTypeDTO
.
setName
(
item
.
getName
());
}
return
types
;
}
@Override
public
List
<
AlgorithmicQuestionTypeDTO
>
allQuestionType
()
{
return
AlgorithmicProblemTypeEnum
.
getAll
();
QueryWrapper
<
DictionaryManagement
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"dict_type"
,
2
);
wrapper
.
eq
(
"is_delete"
,
0
);
final
List
<
DictionaryManagement
>
list
=
dictionaryManagementService
.
list
(
wrapper
);
return
list
.
stream
()
.
map
(
item
->
{
AlgorithmicQuestionTypeDTO
algorithmicQuestionTypeDTO
=
new
AlgorithmicQuestionTypeDTO
();
algorithmicQuestionTypeDTO
.
setQuestionType
(
item
.
getCode
());
algorithmicQuestionTypeDTO
.
setName
(
item
.
getName
());
return
algorithmicQuestionTypeDTO
;
}).
collect
(
Collectors
.
toList
());
}
}
src/main/java/com/kwan/springbootkwan/service/impl/DictionaryManagementServiceImpl.java
0 → 100644
浏览文件 @
1cf2bc72
package
com.kwan.springbootkwan.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.kwan.springbootkwan.entity.DictionaryManagement
;
import
com.kwan.springbootkwan.mapper.DictionaryManagementMapper
;
import
com.kwan.springbootkwan.service.DictionaryManagementService
;
import
org.springframework.stereotype.Service
;
/**
* 字典表(DictionaryManagement)表服务实现类
*
* @author makejava
* @since 2023-10-07 17:54:39
*/
@Service
(
"dictionaryManagementService"
)
public
class
DictionaryManagementServiceImpl
extends
ServiceImpl
<
DictionaryManagementMapper
,
DictionaryManagement
>
implements
DictionaryManagementService
{
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录