【7.6.0】【sys】【menu】整理搜索条件

pull/55/MERGE
fengshuonan 2023-06-14 21:46:33 +08:00
parent c9180272f4
commit 2df2af575e
1 changed files with 9 additions and 42 deletions

View File

@ -2,6 +2,7 @@ package cn.stylefeng.roses.kernel.sys.modular.menu.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.sys.modular.menu.entity.SysMenu;
import cn.stylefeng.roses.kernel.sys.modular.menu.enums.SysMenuExceptionEnum;
@ -13,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@ -105,47 +105,14 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
private LambdaQueryWrapper<SysMenu> createWrapper(SysMenuRequest sysMenuRequest) {
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
Long menuId = sysMenuRequest.getMenuId();
Long menuParentId = sysMenuRequest.getMenuParentId();
String menuPids = sysMenuRequest.getMenuPids();
String menuName = sysMenuRequest.getMenuName();
String menuCode = sysMenuRequest.getMenuCode();
Long appId = sysMenuRequest.getAppId();
BigDecimal menuSort = sysMenuRequest.getMenuSort();
Integer statusFlag = sysMenuRequest.getStatusFlag();
String remark = sysMenuRequest.getRemark();
Integer menuType = sysMenuRequest.getMenuType();
String antdvRouter = sysMenuRequest.getAntdvRouter();
String antdvComponent = sysMenuRequest.getAntdvComponent();
String antdvIcon = sysMenuRequest.getAntdvIcon();
String antdvLinkUrl = sysMenuRequest.getAntdvLinkUrl();
String antdvActiveUrl = sysMenuRequest.getAntdvActiveUrl();
String antdvVisible = sysMenuRequest.getAntdvVisible();
String expandField = sysMenuRequest.getExpandField();
Long versionFlag = sysMenuRequest.getVersionFlag();
String delFlag = sysMenuRequest.getDelFlag();
Long tenantId = sysMenuRequest.getTenantId();
queryWrapper.eq(ObjectUtil.isNotNull(menuId), SysMenu::getMenuId, menuId);
queryWrapper.eq(ObjectUtil.isNotNull(menuParentId), SysMenu::getMenuParentId, menuParentId);
queryWrapper.like(ObjectUtil.isNotEmpty(menuPids), SysMenu::getMenuPids, menuPids);
queryWrapper.like(ObjectUtil.isNotEmpty(menuName), SysMenu::getMenuName, menuName);
queryWrapper.like(ObjectUtil.isNotEmpty(menuCode), SysMenu::getMenuCode, menuCode);
queryWrapper.eq(ObjectUtil.isNotNull(appId), SysMenu::getAppId, appId);
queryWrapper.eq(ObjectUtil.isNotNull(menuSort), SysMenu::getMenuSort, menuSort);
queryWrapper.eq(ObjectUtil.isNotNull(statusFlag), SysMenu::getStatusFlag, statusFlag);
queryWrapper.like(ObjectUtil.isNotEmpty(remark), SysMenu::getRemark, remark);
queryWrapper.eq(ObjectUtil.isNotNull(menuType), SysMenu::getMenuType, menuType);
queryWrapper.like(ObjectUtil.isNotEmpty(antdvRouter), SysMenu::getAntdvRouter, antdvRouter);
queryWrapper.like(ObjectUtil.isNotEmpty(antdvComponent), SysMenu::getAntdvComponent, antdvComponent);
queryWrapper.like(ObjectUtil.isNotEmpty(antdvIcon), SysMenu::getAntdvIcon, antdvIcon);
queryWrapper.like(ObjectUtil.isNotEmpty(antdvLinkUrl), SysMenu::getAntdvLinkUrl, antdvLinkUrl);
queryWrapper.like(ObjectUtil.isNotEmpty(antdvActiveUrl), SysMenu::getAntdvActiveUrl, antdvActiveUrl);
queryWrapper.like(ObjectUtil.isNotEmpty(antdvVisible), SysMenu::getAntdvVisible, antdvVisible);
queryWrapper.like(ObjectUtil.isNotEmpty(expandField), SysMenu::getExpandField, expandField);
queryWrapper.eq(ObjectUtil.isNotNull(versionFlag), SysMenu::getVersionFlag, versionFlag);
queryWrapper.like(ObjectUtil.isNotEmpty(delFlag), SysMenu::getDelFlag, delFlag);
queryWrapper.eq(ObjectUtil.isNotNull(tenantId), SysMenu::getTenantId, tenantId);
// 根据搜索条件查询菜单,根据菜单名称、编码、路由地址、组件地址
String searchText = sysMenuRequest.getSearchText();
if (StrUtil.isNotBlank(searchText)) {
queryWrapper.like(SysMenu::getMenuName, searchText);
queryWrapper.or().like(SysMenu::getMenuCode, searchText);
queryWrapper.or().like(SysMenu::getAntdvRouter, searchText);
queryWrapper.or().like(SysMenu::getAntdvComponent, searchText);
}
return queryWrapper;
}