待我审核
parent
b10654376d
commit
a84c4c31c3
|
@ -177,10 +177,6 @@ public class ProcessController {
|
|||
*/
|
||||
@GetMapping("/review")
|
||||
public String review(Model model) {
|
||||
Admin admin = getLoginUser();
|
||||
// 超级管理员,只有查看权限,不能编辑和删除除非是自己的
|
||||
model.addAttribute("adminId", admin.getId());
|
||||
model.addAttribute("isAdmin", isAdministrator(admin));
|
||||
model.addAttribute("processTypes", ProcessType.values());
|
||||
return "/admin/business/process-review";
|
||||
}
|
||||
|
@ -662,42 +658,42 @@ public class ProcessController {
|
|||
.withMatcher("projectNo", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("projectTitle", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("applyPersonName", ExampleMatcher.GenericPropertyMatcher::contains);
|
||||
|
||||
// 只展示自己创建的草稿
|
||||
Admin admin = getLoginUser();
|
||||
if (!isAdministrator(admin)) {
|
||||
Integer loginUserId = admin.getId();
|
||||
if (forAudit) {
|
||||
return repository.findAll((root, query, cb) -> {
|
||||
Predicate predicate = QueryByExamplePredicateBuilder.getPredicate(root, cb, Example.of(projectProcess, exampleMatcher));
|
||||
// 添加新的条件
|
||||
// Predicate equal = cb.equal(root.get("applyPersonId"), loginUserId);
|
||||
Expression<Integer> findInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("currentAuditId"));
|
||||
return cb.and(predicate, cb.greaterThan(findInSet, 0));
|
||||
}, pageRequest);
|
||||
}
|
||||
else {
|
||||
// 已办流程
|
||||
return repository.findAll((root, query, cb) -> {
|
||||
Predicate predicate = QueryByExamplePredicateBuilder.getPredicate(root, cb, Example.of(projectProcess, exampleMatcher));
|
||||
// 添加新的条件
|
||||
Predicate applyPersonId = cb.equal(root.get("applyPersonId"), loginUserId);
|
||||
Integer loginUserId = admin.getId();
|
||||
|
||||
// 待自己审的
|
||||
Expression<Integer> findInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("currentAuditId"));
|
||||
Expression<Integer> reviewedIdFindInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("reviewedId"));
|
||||
|
||||
Predicate or = cb.or(applyPersonId,
|
||||
cb.greaterThan(reviewedIdFindInSet, 0),
|
||||
cb.greaterThan(findInSet, 0));
|
||||
|
||||
return cb.and(predicate, or);
|
||||
}, pageRequest);
|
||||
}
|
||||
// 待我审核
|
||||
if (forAudit) {
|
||||
// 超级管理员也看不到,除非该他审核
|
||||
return repository.findAll((root, query, cb) -> {
|
||||
Predicate predicate = QueryByExamplePredicateBuilder.getPredicate(root, cb, Example.of(projectProcess, exampleMatcher));
|
||||
// 添加新的条件
|
||||
Expression<Integer> findInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("currentAuditId"));
|
||||
return cb.and(predicate, cb.greaterThan(findInSet, 0));
|
||||
}, pageRequest);
|
||||
}
|
||||
|
||||
// 超级好管理员不需要
|
||||
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageRequest);
|
||||
// 已办流程
|
||||
|
||||
if (isAdministrator(admin)) {
|
||||
// 超级好管理员不需要
|
||||
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageRequest);
|
||||
}
|
||||
|
||||
return repository.findAll((root, query, cb) -> {
|
||||
Predicate predicate = QueryByExamplePredicateBuilder.getPredicate(root, cb, Example.of(projectProcess, exampleMatcher));
|
||||
// 添加新的条件
|
||||
Predicate applyPersonId = cb.equal(root.get("applyPersonId"), loginUserId);
|
||||
|
||||
// 待自己审的
|
||||
Expression<Integer> findInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("currentAuditId"));
|
||||
Expression<Integer> reviewedIdFindInSet = cb.function("find_in_set", Integer.class, cb.literal(loginUserId), root.get("reviewedId"));
|
||||
|
||||
Predicate or = cb.or(applyPersonId,
|
||||
cb.greaterThan(reviewedIdFindInSet, 0),
|
||||
cb.greaterThan(findInSet, 0));
|
||||
|
||||
return cb.and(predicate, or);
|
||||
}, pageRequest);
|
||||
}
|
||||
|
||||
private boolean isAdministrator(Admin admin) {
|
||||
|
|
|
@ -114,11 +114,7 @@
|
|||
<el-table-column label="操作" fixed="right" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showDetail(scope.row, scope)">查看详情</el-button>
|
||||
<#if isAdmin>
|
||||
<el-button type="text" @click="auditProcess(scope.row, scope)">审核</el-button>
|
||||
<#else>
|
||||
<el-button type="text" @click="auditProcess(scope.row, scope)">审核</el-button>
|
||||
</#if>
|
||||
<el-button type="text" @click="auditProcess(scope.row, scope)">审核</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
|
Loading…
Reference in New Issue