Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
李伟
cust-api
Commits
4c4b2d16
Commit
4c4b2d16
authored
Feb 10, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增了黑明单的新增和分页查询
parent
a894b60b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
145 additions
and
41 deletions
+145
-41
AppOpmBlackListController.java
...appOpmBlackList/controller/AppOpmBlackListController.java
+76
-0
OpmBlackListController.java
...iness/opmBlacklist/controller/OpmBlackListController.java
+11
-9
OpmBlackList.java
...rg/rcisoft/business/opmBlacklist/entity/OpmBlackList.java
+24
-4
OpmBlackListServiceImpl.java
...ss/opmBlacklist/service/impl/OpmBlackListServiceImpl.java
+7
-0
OpmBlackListMapper.xml
...apper/business/opmBlacklist/mapper/OpmBlackListMapper.xml
+27
-28
No files found.
src/main/java/org/rcisoft/app/appOpmBlackList/controller/AppOpmBlackListController.java
0 → 100644
View file @
4c4b2d16
package
org
.
rcisoft
.
app
.
appOpmBlackList
.
controller
;
/*固定导入*/
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.Parameters
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.servlet.http.HttpServletResponse
;
import
org.rcisoft.business.opmBlacklist.entity.OpmBlackList
;
import
org.rcisoft.business.opmBlacklist.service.OpmBlackListService
;
import
org.rcisoft.core.anno.CyOpeLogAnno
;
import
org.rcisoft.core.constant.CyMessCons
;
import
org.rcisoft.core.controller.CyPaginationController
;
import
org.rcisoft.core.model.CyGridModel
;
import
org.rcisoft.core.model.CyPersistModel
;
import
org.rcisoft.core.operlog.enums.CyLogTypeEnum
;
import
org.rcisoft.core.result.CyResult
;
import
org.rcisoft.core.util.CyEpExcelUtil
;
import
org.rcisoft.core.util.CyResultGenUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
* Created by cy on 2025年2月10日 上午9:46:37.
*/
@RestController
@RequestMapping
(
"/app"
)
public
class
AppOpmBlackListController
extends
CyPaginationController
<
OpmBlackList
>
{
@Autowired
private
OpmBlackListService
opmBlackListServiceImpl
;
@PreAuthorize
(
"@cyPerm.hasPerm('app:blackList:add')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-新增黑名单表"
,
businessType
=
CyLogTypeEnum
.
INSERT
)
@Operation
(
summary
=
"添加黑名单表"
,
description
=
"添加黑名单表"
)
@PostMapping
(
value
=
"/opmBlackList/add"
)
public
CyResult
add
(
@Valid
@RequestBody
OpmBlackList
opmBlackList
,
BindingResult
bindingResult
)
{
CyPersistModel
data
=
opmBlackListServiceImpl
.
persist
(
opmBlackList
);
return
CyResultGenUtil
.
builder
(
data
,
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
CyMessCons
.
MESSAGE_ALERT_ERROR
,
opmBlackList
);
}
@PreAuthorize
(
"@cyPerm.hasPerm('app:blackList:list')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-查询黑名单表"
,
businessType
=
CyLogTypeEnum
.
QUERY
)
@Operation
(
summary
=
"分页查询黑名单表集合"
,
description
=
"分页查询黑名单表集合"
)
@GetMapping
(
value
=
"/opmBlackList/list"
)
public
CyGridModel
listByPagination
(
OpmBlackList
opmBlackList
)
{
opmBlackListServiceImpl
.
findAllByPagination
(
getPaginationUtility
(),
opmBlackList
);
return
getGridModelResponse
();
}
@PreAuthorize
(
"@cyPerm.hasPerm('app:blackList:delete')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-删除黑名单表"
,
businessType
=
CyLogTypeEnum
.
DELETE
)
@Operation
(
summary
=
"删除黑名单表"
,
description
=
"删除黑名单表"
)
@Parameters
({
@Parameter
(
name
=
"businessId"
,
description
=
"businessId"
,
required
=
true
,
schema
=
@Schema
(
type
=
"string"
))})
@DeleteMapping
(
"/opmBlackList/delete/{businessId:\\w+}"
)
public
CyResult
delete
(
@PathVariable
int
businessId
,
OpmBlackList
opmBlackList
)
{
opmBlackList
.
setBusinessId
(
businessId
);
CyPersistModel
data
=
opmBlackListServiceImpl
.
remove
(
opmBlackList
);
return
CyResultGenUtil
.
builder
(
data
,
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
CyMessCons
.
MESSAGE_ALERT_ERROR
,
businessId
);
}
}
src/main/java/org/rcisoft/business/opmBlacklist/controller/OpmBlackListController.java
View file @
4c4b2d16
...
...
@@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.Operation;
import
org.rcisoft.core.anno.CyOpeLogAnno
;
import
org.rcisoft.core.operlog.enums.CyLogTypeEnum
;
import
org.rcisoft.core.util.CyEpExcelUtil
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -34,14 +35,14 @@ import java.util.List;
* Created by cy on 2025年2月10日 上午9:46:37.
*/
@RestController
@RequestMapping
(
"/opm
blackl
ist"
)
@RequestMapping
(
"/opm
BlackL
ist"
)
public
class
OpmBlackListController
extends
CyPaginationController
<
OpmBlackList
>
{
@Autowired
private
OpmBlackListService
opmBlackListServiceImpl
;
//
@PreAuthorize("@cyPerm.hasPerm('sys:blackList:add')")
@PreAuthorize
(
"@cyPerm.hasPerm('sys:blackList:add')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-新增黑名单表"
,
businessType
=
CyLogTypeEnum
.
INSERT
)
@Operation
(
summary
=
"添加黑名单表"
,
description
=
"添加黑名单表"
)
@PostMapping
(
value
=
"/add"
)
...
...
@@ -52,13 +53,14 @@ public class OpmBlackListController extends CyPaginationController<OpmBlackList>
CyMessCons
.
MESSAGE_ALERT_ERROR
,
opmBlackList
);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:blackList:delete')")
@PreAuthorize
(
"@cyPerm.hasPerm('sys:blackList:delete')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-删除黑名单表"
,
businessType
=
CyLogTypeEnum
.
DELETE
)
@Operation
(
summary
=
"删除黑名单表"
,
description
=
"删除黑名单表"
)
@Parameters
({
@Parameter
(
name
=
"businessId"
,
description
=
"businessId"
,
required
=
true
,
schema
=
@Schema
(
type
=
"string"
))})
@DeleteMapping
(
"/delete/{businessId:\\w+}"
)
public
CyResult
delete
(
@PathVariable
int
businessId
,
OpmBlackList
opmBlackList
)
{
opmBlackList
.
setBusinessId
(
String
.
valueOf
(
businessId
)
);
opmBlackList
.
setBusinessId
(
businessId
);
CyPersistModel
data
=
opmBlackListServiceImpl
.
remove
(
opmBlackList
);
return
CyResultGenUtil
.
builder
(
data
,
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
...
...
@@ -66,13 +68,13 @@ public class OpmBlackListController extends CyPaginationController<OpmBlackList>
businessId
);
}
//
@PreAuthorize("@cyPerm.hasPerm('sys:blackList:update')")
@PreAuthorize
(
"@cyPerm.hasPerm('sys:blackList:update')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-修改黑名单表"
,
businessType
=
CyLogTypeEnum
.
UPDATE
)
@Operation
(
summary
=
"修改黑名单表"
,
description
=
"修改黑名单表"
)
@Parameters
({
@Parameter
(
name
=
"businessId"
,
description
=
"businessId"
,
required
=
false
,
schema
=
@Schema
(
type
=
"string"
))})
@PutMapping
(
"/update/{businessId:\\w+}"
)
public
CyResult
update
(
@PathVariable
int
businessId
,
@Valid
OpmBlackList
opmBlackList
,
BindingResult
bindingResult
)
{
opmBlackList
.
setBusinessId
(
String
.
valueOf
(
businessId
)
);
opmBlackList
.
setBusinessId
(
businessId
);
CyPersistModel
data
=
opmBlackListServiceImpl
.
merge
(
opmBlackList
);
return
CyResultGenUtil
.
builder
(
data
,
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
...
...
@@ -80,7 +82,7 @@ public class OpmBlackListController extends CyPaginationController<OpmBlackList>
opmBlackList
);
}
//
@PreAuthorize("@cyPerm.hasPerm('sys:blackList:query')")
@PreAuthorize
(
"@cyPerm.hasPerm('sys:blackList:query')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-查询黑名单表"
,
businessType
=
CyLogTypeEnum
.
QUERY
)
@Operation
(
summary
=
"查询单一黑名单表"
,
description
=
"查询单一黑名单表"
)
@Parameters
({
@Parameter
(
name
=
"businessId"
,
description
=
"businessId"
,
required
=
true
,
schema
=
@Schema
(
type
=
"string"
))})
...
...
@@ -92,7 +94,7 @@ public class OpmBlackListController extends CyPaginationController<OpmBlackList>
opmBlackListServiceImpl
.
findById
(
businessId
));
}
//
@PreAuthorize("@cyPerm.hasPerm('sys:blackList:list')")
@PreAuthorize
(
"@cyPerm.hasPerm('sys:blackList:list')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-查询黑名单表"
,
businessType
=
CyLogTypeEnum
.
QUERY
)
@Operation
(
summary
=
"查询黑名单表集合"
,
description
=
"查询黑名单表集合"
)
@GetMapping
(
value
=
"/listAll"
)
...
...
@@ -103,7 +105,7 @@ public class OpmBlackListController extends CyPaginationController<OpmBlackList>
opmBlackListServiceImpl
.
findAll
(
opmBlackList
));
}
//
@PreAuthorize("@cyPerm.hasPerm('sys:blackList:list')")
@PreAuthorize
(
"@cyPerm.hasPerm('sys:blackList:list')"
)
@CyOpeLogAnno
(
title
=
"system-黑名单表管理-查询黑名单表"
,
businessType
=
CyLogTypeEnum
.
QUERY
)
@Operation
(
summary
=
"分页查询黑名单表集合"
,
description
=
"分页查询黑名单表集合"
)
@GetMapping
(
value
=
"/list"
)
...
...
src/main/java/org/rcisoft/business/opmBlacklist/entity/OpmBlackList.java
View file @
4c4b2d16
...
...
@@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.*
;
import
org.rcisoft.core.entity.CyIdIncreEntity
;
import
org.rcisoft.core.entity.CyIdIncreNotDataEntity
;
import
org.rcisoft.core.entity.CyIdNotDataEntity
;
import
org.springframework.format.annotation.DateTimeFormat
;
...
...
@@ -20,7 +22,7 @@ import java.util.List;
*/
@Data
@TableName
(
"opm_black_list"
)
public
class
OpmBlackList
extends
CyIdNotDataEntity
<
OpmBlackList
>
{
public
class
OpmBlackList
extends
CyId
Incre
NotDataEntity
<
OpmBlackList
>
{
/**
...
...
@@ -65,5 +67,23 @@ public class OpmBlackList extends CyIdNotDataEntity<OpmBlackList> {
@TableField
(
exist
=
false
)
private
String
endTime
;
/**
* 会员ID
*/
@TableField
(
exist
=
false
)
private
Integer
memberId
;
/**
* 头像ID
*/
@TableField
(
exist
=
false
)
private
Integer
avatar
;
/**
* 会员昵称
*/
@TableField
(
exist
=
false
)
private
String
memNickName
;
}
src/main/java/org/rcisoft/business/opmBlacklist/service/impl/OpmBlackListServiceImpl.java
View file @
4c4b2d16
...
...
@@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
org.rcisoft.core.model.CyPageInfo
;
import
java.math.BigInteger
;
import
java.util.Date
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -42,6 +44,9 @@ public class OpmBlackListServiceImpl extends ServiceImpl<OpmBlackListRepository,
@Override
public
CyPersistModel
persist
(
OpmBlackList
opmBlackList
){
//增加操作
Integer
userId
=
Integer
.
valueOf
(
CyUserUtil
.
getAuthenBusinessId
());
opmBlackList
.
setUserId
(
BigInteger
.
valueOf
(
userId
));
opmBlackList
.
setCreateDate
(
new
Date
());
int
line
=
baseMapper
.
insert
(
opmBlackList
);
log
.
debug
(
CyUserUtil
.
getAuthenUsername
()+
"新增了ID为"
+
opmBlackList
.
getBusinessId
()+
"的黑名单表信息"
);
...
...
@@ -93,6 +98,8 @@ public class OpmBlackListServiceImpl extends ServiceImpl<OpmBlackListRepository,
@Override
public
IPage
<
OpmBlackList
>
findAllByPagination
(
CyPageInfo
<
OpmBlackList
>
paginationUtility
,
OpmBlackList
opmBlackList
){
String
userId
=
CyUserUtil
.
getAuthenBusinessId
();
opmBlackList
.
setUserId
(
BigInteger
.
valueOf
(
Integer
.
valueOf
(
userId
)));
return
baseMapper
.
queryOpmBlackListsPaged
(
paginationUtility
,
opmBlackList
);
}
...
...
src/main/resources/mapper/business/opmBlacklist/mapper/OpmBlackListMapper.xml
View file @
4c4b2d16
<?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=
"org.rcisoft.business.opmBlacklist.dao.OpmBlackListRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.opmBlacklist.entity.OpmBlackList"
>
<id
column=
"business_id"
jdbcType=
"BIGINT"
property=
"businessId"
/>
<result
column=
"create_date"
jdbcType=
"TIMESTAMP"
property=
"createDate"
/>
<result
column=
"user_id"
jdbcType=
"BIGINT"
property=
"userId"
/>
<result
column=
"target_id"
jdbcType=
"BIGINT"
property=
"targetId"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select
id=
"queryOpmBlackLists"
resultMap=
"BaseResultMap"
>
select * from opm_black_list
where 1=1
<if
test=
"entity.userId !=null and entity.userId != '' "
>
and user_id = #{entity.userId}
</if>
<if
test=
"entity.targetId !=null and entity.targetId != '' "
>
and target_id = #{entity.targetId}
</if>
ORDER BY business_id DESC
<select
id=
"queryOpmBlackLists"
resultType=
"org.rcisoft.business.opmBlacklist.entity.OpmBlackList"
>
SELECT
obl.*,
mi.business_id as memberId,
mi.avatar,
mi.mem_nick_name
FROM
opm_black_list obl
LEFT JOIN mem_info mi ON mi.user_id = obl.user_id
WHERE 1=1
AND obl.user_id = #{entity.userId}
ORDER BY
business_id DESC
</select>
<select
id=
"queryOpmBlackListsPaged"
resultMap=
"BaseResultMap"
>
select * from opm_black_list
where 1=1
<if
test=
"entity.userId !=null and entity.userId != '' "
>
and user_id = #{entity.userId}
</if>
<if
test=
"entity.targetId !=null and entity.targetId != '' "
>
and target_id = #{entity.targetId}
</if>
ORDER BY business_id DESC
<select
id=
"queryOpmBlackListsPaged"
resultType=
"org.rcisoft.business.opmBlacklist.entity.OpmBlackList"
>
SELECT
obl.*,
mi.business_id as memberId,
mi.mem_nick_name,
mi.avatar
FROM
opm_black_list obl
LEFT JOIN mem_info mi ON mi.user_id = obl.target_id
WHERE 1=1
AND obl.user_id = #{entity.userId}
ORDER BY
business_id DESC
</select>
</mapper>
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