Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
Project
Project
Details
Activity
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
liqin
chnmuseum-party
Commits
9d2ded2f
Commit
9d2ded2f
authored
Mar 31, 2021
by
jiawei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交 审核管理分页查询代码
parent
298a47c9
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
211 additions
and
11 deletions
+211
-11
AuditMapper.java
...java/cn/wisenergy/chnmuseum/party/mapper/AuditMapper.java
+32
-0
Audit.java
src/main/java/cn/wisenergy/chnmuseum/party/model/Audit.java
+4
-1
AuditService.java
...va/cn/wisenergy/chnmuseum/party/service/AuditService.java
+14
-1
AuditServiceImpl.java
...energy/chnmuseum/party/service/impl/AuditServiceImpl.java
+83
-5
AuditController.java
...nergy/chnmuseum/party/web/controller/AuditController.java
+41
-2
AuditMapper.xml
src/main/resources/mapper/AuditMapper.xml
+37
-2
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/mapper/AuditMapper.java
View file @
9d2ded2f
package
cn
.
wisenergy
.
chnmuseum
.
party
.
mapper
;
import
cn.wisenergy.chnmuseum.party.model.TUser
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.wisenergy.chnmuseum.party.model.Audit
;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.data.querydsl.QPageRequest
;
import
java.util.List
;
...
...
@@ -20,4 +23,33 @@ import java.util.List;
public
interface
AuditMapper
extends
BaseMapper
<
Audit
>
{
List
<
Audit
>
getUserList
(
Page
<
Audit
>
page
,
@Param
(
"user"
)
TUser
user
);
/**
* 视频审核分页
*
* @param page
* @param wrapper
* @return
*/
Page
<
Audit
>
getAssetPage
(
Page
<
Audit
>
page
,
@Param
(
Constants
.
WRAPPER
)
Wrapper
<
Audit
>
wrapper
);
/**
* 展板审核分页
*
* @param page
* @param wrapper
* @return
*/
Page
<
Audit
>
getExhibitionBoardPage
(
Page
<
Audit
>
page
,
@Param
(
Constants
.
WRAPPER
)
Wrapper
<
Audit
>
wrapper
);
/**
* 平台学习内容审核分页
*
* @param page
* @param wrapper
* @return
*/
Page
<
Audit
>
getLearningContentPage
(
Page
<
Audit
>
page
,
@Param
(
Constants
.
WRAPPER
)
Wrapper
<
Audit
>
wrapper
);
}
src/main/java/cn/wisenergy/chnmuseum/party/model/Audit.java
View file @
9d2ded2f
package
cn
.
wisenergy
.
chnmuseum
.
party
.
model
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Add
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Update
;
import
com.baomidou.mybatisplus.annotation.*
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -98,4 +97,8 @@ public class Audit implements Serializable {
@TableField
(
exist
=
false
)
private
String
userName
;
@ApiModelProperty
(
"审核项名称"
)
@TableField
(
exist
=
false
)
private
String
name
;
}
src/main/java/cn/wisenergy/chnmuseum/party/service/AuditService.java
View file @
9d2ded2f
package
cn
.
wisenergy
.
chnmuseum
.
party
.
service
;
import
cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum
;
import
cn.wisenergy.chnmuseum.party.common.enums.AuditTypeEnum
;
import
cn.wisenergy.chnmuseum.party.model.Audit
;
import
cn.wisenergy.chnmuseum.party.model.TUser
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -15,5 +17,16 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public
interface
AuditService
extends
IService
<
Audit
>
{
Page
<
Audit
>
getUserList
(
Page
<
Audit
>
page
,
TUser
user
);
Page
<
Audit
>
getUserList
(
Page
<
Audit
>
page
,
TUser
user
);
/**
* 分页查询
*
* @param name
* @param status
* @param type
* @param page
* @return
*/
Page
<
Audit
>
pageList
(
String
name
,
AuditStatusEnum
status
,
AuditTypeEnum
type
,
Page
<
Object
>
page
);
}
src/main/java/cn/wisenergy/chnmuseum/party/service/impl/AuditServiceImpl.java
View file @
9d2ded2f
package
cn
.
wisenergy
.
chnmuseum
.
party
.
service
.
impl
;
import
cn.wisenergy.chnmuseum.party.model.Audit
;
import
cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum
;
import
cn.wisenergy.chnmuseum.party.common.enums.AuditTypeEnum
;
import
cn.wisenergy.chnmuseum.party.mapper.AuditMapper
;
import
cn.wisenergy.chnmuseum.party.model.Audit
;
import
cn.wisenergy.chnmuseum.party.model.TUser
;
import
cn.wisenergy.chnmuseum.party.service.AssetService
;
import
cn.wisenergy.chnmuseum.party.service.AuditService
;
import
cn.wisenergy.chnmuseum.party.service.ExhibitionBoardService
;
import
cn.wisenergy.chnmuseum.party.service.LearningContentService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -29,8 +34,81 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
@Resource
private
AuditMapper
auditMapper
;
@Autowired
private
TUserServiceImpl
userService
;
@Autowired
AssetService
assetService
;
@Autowired
ExhibitionBoardService
exhibitionBoardService
;
@Autowired
LearningContentService
learningContentService
;
@Override
public
Page
<
Audit
>
getUserList
(
Page
<
Audit
>
page
,
TUser
user
)
{
return
page
.
setRecords
(
auditMapper
.
getUserList
(
page
,
user
));
return
page
.
setRecords
(
auditMapper
.
getUserList
(
page
,
user
));
}
/**
* 分页查询
*
* @param name
* @param status
* @param type
* @return
*/
@Override
public
Page
<
Audit
>
pageList
(
String
name
,
AuditStatusEnum
status
,
AuditTypeEnum
type
,
Page
<
Object
>
page
)
{
//分页
Page
<
Audit
>
auditPage
=
new
Page
<>();
auditPage
.
setCurrent
(
page
.
getCurrent
());
auditPage
.
setSize
(
page
.
getSize
());
//条件
QueryWrapper
<
Audit
>
ew
=
new
QueryWrapper
<
Audit
>()
.
eq
(
"a.type"
,
type
.
name
())
.
orderByDesc
(
"a.create_time"
,
"a.id"
);
//
if
(
status
!=
null
)
{
ew
.
eq
(
status
!=
null
,
"a.status"
,
status
.
name
());
}
Page
<
Audit
>
pageList
=
pageByType
(
ew
,
name
,
type
,
auditPage
);
return
pageList
;
}
/**
* 分别查询
*
* @param name
* @param type
* @param auditPage
* @return
*/
private
Page
<
Audit
>
pageByType
(
QueryWrapper
<
Audit
>
ew
,
String
name
,
AuditTypeEnum
type
,
Page
<
Audit
>
auditPage
)
{
Page
<
Audit
>
selectPage
=
null
;
if
(
StringUtils
.
isNotBlank
(
name
))
{
ew
.
and
(
i
->
i
.
like
(
"b.name"
,
name
).
or
().
like
(
"c.user_name"
,
name
));
}
switch
(
type
)
{
case
LEARNING_CONTENT:
selectPage
=
auditMapper
.
getLearningContentPage
(
auditPage
,
ew
);
break
;
case
EXHIBITION_BOARD:
selectPage
=
auditMapper
.
getExhibitionBoardPage
(
auditPage
,
ew
);
break
;
case
ACCOUNT:
break
;
case
ASSET:
selectPage
=
auditMapper
.
getAssetPage
(
auditPage
,
ew
);
default
:
}
//
return
selectPage
;
}
}
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/AuditController.java
View file @
9d2ded2f
...
...
@@ -24,6 +24,7 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.validation.constraints.NotBlank
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -40,6 +41,7 @@ import java.util.Map;
@RestController
@RequestMapping
(
"/audit"
)
@Api
(
tags
=
{
"审核管理操作接口"
})
@Validated
public
class
AuditController
extends
BaseController
{
@Resource
...
...
@@ -85,7 +87,7 @@ public class AuditController extends BaseController {
@PutMapping
(
"/update"
)
@RequiresPermissions
(
"/audit/update"
)
@ApiOperation
(
value
=
"修改禁用审核信息"
,
notes
=
"修改禁用审核信息"
)
public
Map
<
String
,
Object
>
updateAudit
(
@Validated
(
value
=
{
Update
.
class
})
Audit
audit
)
{
public
Map
<
String
,
Object
>
updateAudit
(
@
RequestBody
@
Validated
(
value
=
{
Update
.
class
})
Audit
audit
)
{
boolean
flag
;
if
(!
AuditStatusEnum
.
TBCA
.
name
().
equals
(
audit
.
getStatus
()))
{
audit
.
setLevel
(
AuditStatusEnum
.
TBCA
.
name
());
...
...
@@ -115,7 +117,7 @@ public class AuditController extends BaseController {
return
getFailResult
();
}
@DeleteMapping
(
"/delete"
)
@DeleteMapping
(
"/delete
/{id}
"
)
@RequiresPermissions
(
"/audit/delete"
)
@ApiOperation
(
value
=
"根据ID删除禁用审核"
,
notes
=
"根据ID删除禁用审核"
)
@ApiImplicitParams
(
value
=
{
...
...
@@ -193,5 +195,42 @@ public class AuditController extends BaseController {
return
getFailResult
();
}
//=================审核管理接口=================
@GetMapping
(
"/getPageAllList"
)
// @RequiresPermissions("/audit/getUserList")
@ApiOperation
(
value
=
"审核管理=========分页查询"
,
notes
=
"审核管理=========分页查询"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"_index"
,
value
=
"分页起始偏移量"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"_size"
,
value
=
"返回条数"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"账号名称或提交人"
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"status"
,
value
=
"待初审 TBC, 驳回 REFUSED,待复审 TBCA, 通过APPROVED_FINAL"
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"视频内容 ASSET,展板内容 EXHIBITION_BOARD,学习内容 LEARNING_CONTENT"
,
paramType
=
"query"
,
dataType
=
"String"
,
required
=
true
)
})
public
Map
<
String
,
Object
>
getPageAllList
(
String
name
,
String
status
,
@NotBlank
(
message
=
"type参数不能为空"
)
String
type
)
{
Page
<
Object
>
page
=
getPage
();
AuditStatusEnum
auditStatusEnum
=
null
;
AuditTypeEnum
auditTypeEnum
=
AuditTypeEnum
.
valueOf
(
type
);
if
(
auditTypeEnum
==
null
)
{
return
getFailResult
(
"type参数不正确"
);
}
if
(
StringUtils
.
isNotBlank
(
status
))
{
auditStatusEnum
=
AuditStatusEnum
.
valueOf
(
status
);
}
//
try
{
Page
<
Audit
>
auditList
=
auditService
.
pageList
(
name
,
auditStatusEnum
,
auditTypeEnum
,
page
);
return
getResult
(
auditList
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
getFailResult
();
}
}
src/main/resources/mapper/AuditMapper.xml
View file @
9d2ded2f
...
...
@@ -30,7 +30,8 @@
left join t_user u on u.id = a.user_id
where 1 = 1
<if
test=
"user.userName != null and user.userName != ''"
>
and (u.user_name LIKE concat('%', #{user.userName}, '%') or a.content LIKE concat('%', #{user.userName}, '%'))
and (u.user_name LIKE concat('%', #{user.userName}, '%') or a.content LIKE concat('%', #{user.userName},
'%'))
</if>
<if
test=
"user.status != null and user.status != ''"
>
and a.status = #{user.status}
...
...
@@ -47,4 +48,38 @@
order by a.create_time desc
</select>
<select
id=
"getAssetPage"
resultType=
"cn.wisenergy.chnmuseum.party.model.Audit"
>
SELECT
a.*,b.`name`,c.user_name AS userName
FROM
t_audit a
LEFT JOIN asset b ON a.ref_item_id = b.id
LEFT JOIN t_user c ON a.user_id = c.id
${ew.customSqlSegment}
</select>
<select
id=
"getExhibitionBoardPage"
resultType=
"cn.wisenergy.chnmuseum.party.model.Audit"
>
SELECT
a.*,b.`name`,c.user_name AS userName
FROM
t_audit a
LEFT JOIN exhibition_board b ON a.ref_item_id=b.id
LEFT JOIN t_user c ON a.user_id = c.id
${ew.customSqlSegment}
</select>
<select
id=
"getLearningContentPage"
resultType=
"cn.wisenergy.chnmuseum.party.model.Audit"
>
SELECT
a.*,b.`name`,c.user_name AS userName
FROM
t_audit a
LEFT JOIN learning_content b ON a.ref_item_id=b.id
LEFT JOIN t_user c ON a.user_id = c.id
${ew.customSqlSegment}
</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