【更新】BIZ模块增加用户组选择器功能,sys组织选择器优化

This commit is contained in:
xuyuxiang
2025-09-21 14:03:00 +08:00
parent 8d680f1f27
commit c4df65f41a
6 changed files with 80 additions and 16 deletions

View File

@@ -0,0 +1,43 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
*
* 1.请不要删除和修改根目录下的LICENSE文件。
* 2.请不要删除和修改Snowy源码头部的版权声明。
* 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
* 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
* 5.不可二次分发开源参与同类竞品如有想法可联系团队xiaonuobase@qq.com商议合作。
* 6.若您的项目无法满足以上几点需要更多功能代码获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.biz.modular.group.provider;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import vip.xiaonuo.biz.api.BizGroupApi;
import vip.xiaonuo.biz.modular.group.param.BizGroupSelectorParam;
import vip.xiaonuo.biz.modular.group.service.BizGroupService;
/**
* 用户组API接口提供者
*
* @author yubaoshan
* @date 2024/12/21 01:25
**/
@Service
public class BizGroupApiProvider implements BizGroupApi {
@Resource
private BizGroupService bizGroupService;
@SuppressWarnings("ALL")
@Override
public Page<JSONObject> groupSelector(String searchKey) {
BizGroupSelectorParam bizGroupSelectorParam = new BizGroupSelectorParam();
bizGroupSelectorParam.setSearchKey(searchKey);
return BeanUtil.toBean(bizGroupService.groupSelector(bizGroupSelectorParam), Page.class);
}
}

View File

@@ -26,14 +26,6 @@ import lombok.Setter;
@Setter
public class SysGroupSelectorParam {
/** 当前页 */
@Schema(description = "当前页码")
private Integer current;
/** 每页条数 */
@Schema(description = "每页条数")
private Integer size;
/** 姓名关键词 */
@Schema(description = "姓名关键词")
private String searchKey;

View File

@@ -54,10 +54,8 @@ public class SysGroupApiProvider implements SysGroupApi {
@SuppressWarnings("ALL")
@Override
public Page<JSONObject> groupSelector(String searchKey, int current, int size) {
public Page<JSONObject> groupSelector(String searchKey) {
SysGroupSelectorParam sysGroupSelectorParam = new SysGroupSelectorParam();
sysGroupSelectorParam.setCurrent(current);
sysGroupSelectorParam.setSize(size);
sysGroupSelectorParam.setSearchKey(searchKey);
return BeanUtil.toBean(sysGroupService.groupSelector(sysGroupSelectorParam), Page.class);
}

View File

@@ -185,10 +185,8 @@ public class SysGroupServiceImpl extends ServiceImpl<SysGroupMapper, SysGroup> i
queryWrapper.lambda().select(SysGroup::getId, SysGroup::getName, SysGroup::getSortCode, SysGroup::getRemark);
queryWrapper.lambda().orderByAsc(SysGroup::getSortCode);
// 如果查询条件为空,则直接查询
if (!ObjectUtil.isAllEmpty(sysGroupSelectorParam.getSearchKey())) {
if (ObjectUtil.isNotEmpty(sysGroupSelectorParam.getSearchKey())) {
queryWrapper.lambda().like(SysGroup::getName, sysGroupSelectorParam.getSearchKey());
}
if (ObjectUtil.isNotEmpty(sysGroupSelectorParam.getSearchKey())) {
queryWrapper.lambda().like(SysGroup::getName, sysGroupSelectorParam.getSearchKey());
}
return this.page(CommonPageRequest.defaultPage(), queryWrapper.lambda());
}