Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
safe-campus-bbs
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
万成波
safe-campus-bbs
Commits
b82bb4a7
Commit
b82bb4a7
authored
Sep 02, 2025
by
万成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
efb37816
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
3 deletions
+78
-3
safe-campus-framework/src/main/java/com/tangguo/framework/config/MybatisPlusConfig.java
.../java/com/tangguo/framework/config/MybatisPlusConfig.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/controller/BbsGradeController.java
.../main/java/com/tangguo/controller/BbsGradeController.java
+13
-0
safe-campus-moment/src/main/java/com/tangguo/domain/BbsGrade.java
...pus-moment/src/main/java/com/tangguo/domain/BbsGrade.java
+5
-0
safe-campus-moment/src/main/java/com/tangguo/enums/IsInitialGrade.java
...oment/src/main/java/com/tangguo/enums/IsInitialGrade.java
+22
-0
safe-campus-moment/src/main/java/com/tangguo/service/IBbsGradeService.java
...t/src/main/java/com/tangguo/service/IBbsGradeService.java
+8
-0
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
...in/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
+29
-2
No files found.
safe-campus-framework/src/main/java/com/tangguo/framework/config/MybatisPlusConfig.java
View file @
b82bb4a7
...
@@ -28,7 +28,7 @@ public class MybatisPlusConfig {
...
@@ -28,7 +28,7 @@ public class MybatisPlusConfig {
// 乐观锁插件
// 乐观锁插件
interceptor
.
addInnerInterceptor
(
optimisticLockerInnerInterceptor
());
interceptor
.
addInnerInterceptor
(
optimisticLockerInnerInterceptor
());
// 阻断插件
// 阻断插件
interceptor
.
addInnerInterceptor
(
blockAttackInnerInterceptor
());
//
interceptor.addInnerInterceptor(blockAttackInnerInterceptor());
return
interceptor
;
return
interceptor
;
}
}
...
...
safe-campus-moment/src/main/java/com/tangguo/controller/BbsGradeController.java
View file @
b82bb4a7
...
@@ -80,6 +80,19 @@ public class BbsGradeController extends BaseController {
...
@@ -80,6 +80,19 @@ public class BbsGradeController extends BaseController {
}
}
/**
* 修改用户初始等级值
*/
@ApiOperation
(
"修改用户等级"
)
@PreAuthorize
(
"@ss.hasPermi('bbs:grade:edit')"
)
@Log
(
title
=
"用户等级"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/initial"
)
public
AjaxResult
editInitial
(
@RequestBody
BbsGrade
grade
)
{
this
.
bbsGradeService
.
editGradeInitial
(
grade
);
return
AjaxResult
.
success
();
}
/**
/**
* 删除用户等级
* 删除用户等级
*/
*/
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/BbsGrade.java
View file @
b82bb4a7
...
@@ -58,4 +58,9 @@ public class BbsGrade extends BaseEntity {
...
@@ -58,4 +58,9 @@ public class BbsGrade extends BaseEntity {
@ApiModelProperty
(
"排序值(升序)"
)
@ApiModelProperty
(
"排序值(升序)"
)
private
Integer
sort
;
private
Integer
sort
;
/** 是否初始等级:0 否、1 是 */
@Excel
(
name
=
"是否初始等级"
)
@ApiModelProperty
(
"是否初始等级"
)
private
Integer
isInitial
;
}
}
safe-campus-moment/src/main/java/com/tangguo/enums/IsInitialGrade.java
0 → 100644
View file @
b82bb4a7
package
com
.
tangguo
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 是否初始等级
*
* @author 谈笑
* @createTime 2025-09-02 09:33:33 星期二
*/
@Getter
@AllArgsConstructor
public
enum
IsInitialGrade
{
YES
(
1
,
"初始等级"
),
NO
(
0
,
"非初始等级"
);
private
final
int
value
;
private
final
String
desc
;
}
safe-campus-moment/src/main/java/com/tangguo/service/IBbsGradeService.java
View file @
b82bb4a7
...
@@ -38,6 +38,14 @@ public interface IBbsGradeService extends IService<BbsGrade> {
...
@@ -38,6 +38,14 @@ public interface IBbsGradeService extends IService<BbsGrade> {
void
editGrade
(
BbsGrade
grade
);
void
editGrade
(
BbsGrade
grade
);
/**
* 修改等级初始值
*
* @param grade 等级
*/
void
editGradeInitial
(
BbsGrade
grade
);
/**
/**
* 删除等级
* 删除等级
*
*
...
...
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
View file @
b82bb4a7
...
@@ -7,9 +7,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -7,9 +7,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.utils.StringUtils
;
import
com.tangguo.common.utils.StringUtils
;
import
com.tangguo.domain.BbsGrade
;
import
com.tangguo.domain.BbsGrade
;
import
com.tangguo.enums.IsInitialGrade
;
import
com.tangguo.mapper.BbsGradeMapper
;
import
com.tangguo.mapper.BbsGradeMapper
;
import
com.tangguo.service.IBbsGradeService
;
import
com.tangguo.service.IBbsGradeService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
...
@@ -37,10 +39,9 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
...
@@ -37,10 +39,9 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
@Override
@Override
public
List
<
BbsGrade
>
selectBbsGradeList
(
BbsGrade
grade
)
{
public
List
<
BbsGrade
>
selectBbsGradeList
(
BbsGrade
grade
)
{
LambdaQueryWrapper
<
BbsGrade
>
lqw
=
Wrappers
.
lambdaQuery
();
LambdaQueryWrapper
<
BbsGrade
>
lqw
=
Wrappers
.
lambdaQuery
();
lqw
.
orderByDesc
(
BbsGrade:
:
getCreateTime
);
lqw
.
like
(
StringUtils
.
isNotBlank
(
grade
.
getName
()),
BbsGrade:
:
getName
,
grade
.
getName
());
lqw
.
like
(
StringUtils
.
isNotBlank
(
grade
.
getName
()),
BbsGrade:
:
getName
,
grade
.
getName
());
lqw
.
eq
(
StringUtils
.
isNotBlank
(
grade
.
getCode
()),
BbsGrade:
:
getCode
,
grade
.
getCode
());
lqw
.
eq
(
StringUtils
.
isNotBlank
(
grade
.
getCode
()),
BbsGrade:
:
getCode
,
grade
.
getCode
());
lqw
.
eq
(
grade
.
getSort
()
!=
null
,
BbsGrade:
:
getSort
,
grade
.
getSort
()
);
lqw
.
orderByAsc
(
BbsGrade:
:
getCreateTime
);
return
bbsGradeMapper
.
selectList
(
lqw
);
return
bbsGradeMapper
.
selectList
(
lqw
);
}
}
...
@@ -129,6 +130,32 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
...
@@ -129,6 +130,32 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
}
}
/**
* 修改等级初始值
*
* @param grade 等级
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
editGradeInitial
(
BbsGrade
grade
)
{
BbsGrade
dbGrade
=
this
.
getById
(
grade
.
getId
());
if
(
Objects
.
isNull
(
dbGrade
))
{
throw
new
ServiceException
(
"修改失败,未查询到当前等级数据。"
);
}
Integer
isInitial
=
grade
.
getIsInitial
();
if
(!
dbGrade
.
getIsInitial
().
equals
(
isInitial
))
{
if
(
IsInitialGrade
.
YES
.
getValue
()
==
isInitial
)
{
this
.
update
(
Wrappers
.
lambdaUpdate
(
BbsGrade
.
class
)
.
set
(
BbsGrade:
:
getIsInitial
,
IsInitialGrade
.
NO
.
getValue
()));
}
this
.
update
(
Wrappers
.
lambdaUpdate
(
BbsGrade
.
class
)
.
set
(
BbsGrade:
:
getIsInitial
,
isInitial
)
.
eq
(
BbsGrade:
:
getId
,
dbGrade
.
getId
()));
}
}
/**
/**
* 删除等级
* 删除等级
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment