init
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
package io.v.nutz.zhgh.mainPage.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.mainPage.models.NeedItems;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.zhgh.mainPage.service.MainPageNeedItemsService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author JyuHsin
|
||||
* @Description 首页待办事项
|
||||
* @createTime 2022年03月07日 10:16:00
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/needItems")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class MainPageNeedItemsController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private MainPageNeedItemsService needItemsService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/mainPage/needItems.html")
|
||||
@RequiresPermissions("system.mainPage.needItems")
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.needItems")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "name", required = false) String name) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
*
|
||||
from
|
||||
need_items
|
||||
$condition
|
||||
""");
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
cnd.where().andLike("menuName", name);
|
||||
}
|
||||
cnd.desc("code");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.needItems")
|
||||
public Object doHandle(@Param("data") NeedItems[] needItems) {
|
||||
for (NeedItems item : needItems) {
|
||||
if (StrUtil.isBlank(item.getId())) {
|
||||
item.setCreatUser(ShiroUtil.getPlatformUid());
|
||||
item.setCreatTime(DateUtil.now());
|
||||
}
|
||||
}
|
||||
dao.insertOrUpdate(needItems);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.needItems")
|
||||
public Object doDelete(String id) {
|
||||
dao.delete(NeedItems.class, id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.needItems")
|
||||
public Object getStateList() {
|
||||
Sql sql = Sqls.create("""
|
||||
select stateId as `value`, stateName as `label`, module from audit_state
|
||||
UNION
|
||||
select state_id as `value`,state_name as `label`, belong as module from state
|
||||
UNION
|
||||
select stateCode as `value`, stateName as `label`, 'proposal' as module from proposal_state
|
||||
ORDER BY `value` asc
|
||||
""");
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
List<String> moduleList = list.stream().map(o -> o.getString("module")).distinct().collect(Collectors.toList());
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
moduleList.forEach(item -> {
|
||||
NutMap map = NutMap.NEW();
|
||||
map.put("label", item);
|
||||
map.put("value", item);
|
||||
map.put("disabled", true);
|
||||
List<NutMap> stateList = list.stream().filter(o -> o.getString("module").equals(item)).collect(Collectors.toList());
|
||||
map.put("children", stateList);
|
||||
result.add(map);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.needItems")
|
||||
public Object getTableList() {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
table_name,table_rows,table_comment
|
||||
FROM
|
||||
information_schema.TABLES
|
||||
WHERE
|
||||
table_schema =(SELECT DATABASE())
|
||||
ORDER BY table_name
|
||||
""");
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.needItems")
|
||||
public Object columns(String tableName) {
|
||||
return getColumns(tableName);
|
||||
}
|
||||
|
||||
private List<Record> getColumns(String tableName) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
column_name,is_nullable,column_type,column_key,column_comment
|
||||
FROM
|
||||
information_schema.COLUMNS
|
||||
WHERE
|
||||
table_name = @tableName
|
||||
AND table_schema = (SELECT DATABASE())
|
||||
ORDER BY ordinal_position
|
||||
""").setParam("tableName", tableName);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.needItems")
|
||||
public Object getAuditList(String queryDataBase, String moduleName) {
|
||||
Sql sql = Sqls.create("select * from `%s`.audit_state where module = '%s'".formatted(queryDataBase, moduleName));
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getNeedItems() {
|
||||
return needItemsService.getNeedItems();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package io.v.nutz.zhgh.mainPage.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.mainPage.models.QuickEntry;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.sys.models.Sys_menu;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author JyuHsin
|
||||
* @Description 首页快速入口
|
||||
* @createTime 2022年03月07日 10:16:00
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@At("/platform/quickEntry")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class MainPageQuickEntryController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/mainPage/quickEntry.html")
|
||||
@RequiresPermissions("system.mainPage.quickEntry")
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.quickEntry")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "name", required = false) String name) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
*
|
||||
from
|
||||
quick_entry
|
||||
$condition
|
||||
""");
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
cnd.where().andLike("menuName", name);
|
||||
}
|
||||
cnd.asc("code");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.quickEntry")
|
||||
public Object doHandle(@Param("data") QuickEntry[] quickEntry) {
|
||||
for (QuickEntry item : quickEntry) {
|
||||
if (StrUtil.isBlank(item.getId())) {
|
||||
item.setCreatUser(ShiroUtil.getPlatformUid());
|
||||
item.setCreatTime(DateUtil.now());
|
||||
}
|
||||
}
|
||||
dao.insertOrUpdate(quickEntry);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("system.mainPage.quickEntry")
|
||||
public Object doDelete(String id) {
|
||||
dao.delete(QuickEntry.class, id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getQuickentry() {
|
||||
List<QuickEntry> quickEntries = dao.query(QuickEntry.class, Cnd.NEW().asc("code"));
|
||||
|
||||
//查所有菜单
|
||||
List<Sys_menu> menus = dao.query(Sys_menu.class, Cnd.NEW());
|
||||
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin")) {
|
||||
Sql sql = Sqls.create("""
|
||||
select menuId from sys_role_menu where roleId in (select roleId from sys_user_role where userId = @userId)
|
||||
""").setParam("userId", ShiroUtil.getPlatformUid());
|
||||
List<NutMap> menuIds = (List<NutMap>) Daos.query(dao, sql.toString(), Sqls.callback.maps());
|
||||
List<String> menuId = menuIds.stream().map(o -> o.getString("menuId")).collect(Collectors.toList());
|
||||
menus = dao.query(Sys_menu.class, Cnd.NEW().and("id", "in", menuId));
|
||||
}
|
||||
|
||||
List<Sys_menu> finalMenus = menus;
|
||||
List<QuickEntry> result = quickEntries.stream().filter(v -> Strings.isNotBlank(v.getHref())
|
||||
&& finalMenus.stream().anyMatch(x -> Strings.isNotBlank(x.getHref()) && x.getHref().equals(v.getHref()))).distinct().collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package io.v.nutz.zhgh.mainPage.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2023/3/6
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
@Table("need_items")
|
||||
public class NeedItems {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("菜单id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String menuId;
|
||||
|
||||
@Column
|
||||
@Comment("标题")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String title;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String href;
|
||||
|
||||
@Column
|
||||
@Comment("移动端地址地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String mobileHref;
|
||||
|
||||
@Column
|
||||
@Comment("图标")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String iconClass;
|
||||
|
||||
@Column
|
||||
@Comment("颜色")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String color;
|
||||
|
||||
@Column
|
||||
@Comment("创建人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String creatUser;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String creatTime;
|
||||
|
||||
@Column
|
||||
@Comment("查询的表")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String queryTable;
|
||||
|
||||
@Column
|
||||
@Comment("查询的审核字段")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String queryColumn;
|
||||
|
||||
@Column
|
||||
@Comment("查询的审核字段的值")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer stateId;
|
||||
|
||||
private Integer count;
|
||||
|
||||
@Column
|
||||
@Comment("申请人id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String userIdColumn;
|
||||
|
||||
@Column
|
||||
@Comment("查询类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String queryType;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package io.v.nutz.zhgh.mainPage.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2023/3/6
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
@Table("need_items_source")
|
||||
public class NeedItemsSource {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("数据库")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String queryDataBase;
|
||||
|
||||
@Column
|
||||
@Comment("表名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String queryTableName;
|
||||
|
||||
@Column
|
||||
@Comment("显示名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String displayName;
|
||||
|
||||
@Column
|
||||
@Comment("状态id对应的模块名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String moduleName;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package io.v.nutz.zhgh.mainPage.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author JyuHsin
|
||||
* @Date 2023/3/5
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
@Table("quick_entry")
|
||||
public class QuickEntry {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("菜单id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String menuId;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String href;
|
||||
|
||||
@Column
|
||||
@Comment("图标")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String iconClass;
|
||||
|
||||
@Column
|
||||
@Comment("颜色")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String color;
|
||||
|
||||
@Column
|
||||
@Comment("创建人")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String creatUser;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String creatTime;
|
||||
|
||||
private String path;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package io.v.nutz.zhgh.mainPage.service;
|
||||
|
||||
import io.v.nutz.zhgh.mainPage.models.NeedItems;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MainPageNeedItemsService extends ViService<NeedItems> {
|
||||
|
||||
List<NeedItems> getNeedItems();
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package io.v.nutz.zhgh.mainPage.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.utils.Roles;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.zhgh.mainPage.models.NeedItems;
|
||||
import io.v.nutz.zhgh.mainPage.service.MainPageNeedItemsService;
|
||||
import io.v.nutz.base.service.impl.ViServiceImpl;
|
||||
import io.v.nutz.sys.models.Sys_menu;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class MainPageNeedItemsServiceImpl extends ViServiceImpl<NeedItems> implements MainPageNeedItemsService {
|
||||
|
||||
public MainPageNeedItemsServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NeedItems> getNeedItems() {
|
||||
//查询数据库中的待办事项
|
||||
List<NeedItems> needItemsList = dao().queryByJoin(NeedItems.class, "^needItemsSource$", Cnd.NEW());
|
||||
|
||||
//根据当前登录用户的角色查询可以看到哪些菜单
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasRole("sysadmin")) {
|
||||
Sql sql = Sqls.create("""
|
||||
select menuId from sys_role_menu where roleId in (select roleId from sys_user_role where userId = @userId)
|
||||
""").setParam("userId", ShiroUtil.getPlatformUid());
|
||||
List<NutMap> menuIds = listMap(sql);
|
||||
List<String> menuId = menuIds.stream().map(o -> o.getString("menuId")).collect(Collectors.toList());
|
||||
cnd.and("id", "in", menuId);
|
||||
}
|
||||
List<Sys_menu> menus = dao().query(Sys_menu.class, cnd);
|
||||
|
||||
//根据菜单跳转路径筛选出页面需要展示的,这里当前登录用户能看到哪些菜单就能看到哪些待办
|
||||
List<Sys_menu> showMenuList = menus.stream().filter(o -> needItemsList.stream().anyMatch(x -> x.getHref().equals(o.getHref()))).collect(Collectors.toList());
|
||||
|
||||
showMenuList.forEach(item -> {
|
||||
String component = item.getHref();
|
||||
NeedItems needItems = needItemsList.stream().filter(o -> o.getHref().equals(component)).findAny().get();
|
||||
|
||||
//找数量,如果是系统管理员就查询所有的待审核数量
|
||||
String sqlStr = "";
|
||||
if(ShiroUtil.hasAnyRoles("sysadmin") || StrUtil.isBlank(needItems.getUserIdColumn()) || StrUtil.isBlank(needItems.getQueryType())) {
|
||||
sqlStr = "select count(*) from %s where %s = '%s'".formatted(needItems.getQueryTable(),
|
||||
needItems.getQueryColumn(), needItems.getStateId());
|
||||
} else {
|
||||
sqlStr = "select count(*) from %s s left join `user` u on s.%s = u.id where s.%s = '%s' @@".formatted(
|
||||
needItems.getQueryTable(),
|
||||
needItems.getUserIdColumn(),
|
||||
needItems.getQueryColumn(),
|
||||
needItems.getStateId()
|
||||
);
|
||||
String queryType = needItems.getQueryType();
|
||||
if("unit".equals(queryType)) {
|
||||
sqlStr = sqlStr.replaceAll("@@", "and u.unitid = '%s'".formatted(Vi.getUnit().getId()));
|
||||
} else if("myUnion".equals(queryType)) {
|
||||
sqlStr = sqlStr.replaceAll("@@", "and u.unionid = '%s'".formatted(Vi.getUnionId()));
|
||||
} else if("club".equals(queryType)) {
|
||||
//查询我管理的协会中有哪些人
|
||||
Sql s = Sqls.create("""
|
||||
select * from sys_club_user
|
||||
where clubid in (SELECT stid FROM sys_user_role where roleId = @roleId and userId = @userId)
|
||||
""").setParam("roleId", Roles.club01).setParam("userId", ShiroUtil.getPlatformUid());
|
||||
List<NutMap> clubList = listMap(s);
|
||||
List<String> clubUserList = clubList.stream().map(o -> o.getString("userid")).collect(Collectors.toList());
|
||||
sqlStr = sqlStr.replaceAll("@@", "and u.id in ('%s')".formatted(String.join("','", clubUserList)));
|
||||
} else if("dbt".equals(queryType)) {
|
||||
Sql s = Sqls.create("""
|
||||
select * from sys_user_role where dbtid = @dbtid
|
||||
""").setParam("dbtid", Vi.getLastDelegationId(ShiroUtil.getPlatformUid()));
|
||||
List<NutMap> list = listMap(s);
|
||||
List<String> dbtUserList = list.stream().map(o -> o.getString("userid")).collect(Collectors.toList());
|
||||
sqlStr = sqlStr.replaceAll("@@", "and u.id in ('%s')".formatted(String.join("','", dbtUserList)));
|
||||
}
|
||||
}
|
||||
int count = count(Sqls.create(sqlStr));
|
||||
needItems.setCount(count);
|
||||
});
|
||||
|
||||
List<NeedItems> result = needItemsList.stream().filter(v -> Strings.isNotBlank(v.getHref())
|
||||
&& menus.stream().anyMatch(x -> Strings.isNotBlank(x.getHref()) && x.getHref().equals(v.getHref()))).distinct().collect(Collectors.toList());
|
||||
return result.stream().filter(v -> v.getCount() > 0).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user