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

pull/285/head
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,33 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* SnowyAPACHE 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.api;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* Api
*
* @author yubaoshan
* @date 2024/11/1 18:27:51
**/
public interface BizGroupApi {
/**
*
*
* @author yubaoshan
* @date 2024/11/1 18:27:51
*/
Page<JSONObject> groupSelector(String searchKey);
}

View File

@ -47,5 +47,5 @@ public interface SysGroupApi {
* @author yubaoshan * @author yubaoshan
* @date 2025/1/12 02:36 * @date 2025/1/12 02:36
*/ */
Page<JSONObject> groupSelector(String searchKey, int current, int size); Page<JSONObject> groupSelector(String searchKey);
} }

View File

@ -0,0 +1,43 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* SnowyAPACHE 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 @Setter
public class SysGroupSelectorParam { public class SysGroupSelectorParam {
/** 当前页 */
@Schema(description = "当前页码")
private Integer current;
/** 每页条数 */
@Schema(description = "每页条数")
private Integer size;
/** 姓名关键词 */ /** 姓名关键词 */
@Schema(description = "姓名关键词") @Schema(description = "姓名关键词")
private String searchKey; private String searchKey;

View File

@ -54,10 +54,8 @@ public class SysGroupApiProvider implements SysGroupApi {
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
@Override @Override
public Page<JSONObject> groupSelector(String searchKey, int current, int size) { public Page<JSONObject> groupSelector(String searchKey) {
SysGroupSelectorParam sysGroupSelectorParam = new SysGroupSelectorParam(); SysGroupSelectorParam sysGroupSelectorParam = new SysGroupSelectorParam();
sysGroupSelectorParam.setCurrent(current);
sysGroupSelectorParam.setSize(size);
sysGroupSelectorParam.setSearchKey(searchKey); sysGroupSelectorParam.setSearchKey(searchKey);
return BeanUtil.toBean(sysGroupService.groupSelector(sysGroupSelectorParam), Page.class); 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().select(SysGroup::getId, SysGroup::getName, SysGroup::getSortCode, SysGroup::getRemark);
queryWrapper.lambda().orderByAsc(SysGroup::getSortCode); queryWrapper.lambda().orderByAsc(SysGroup::getSortCode);
// 如果查询条件为空,则直接查询 // 如果查询条件为空,则直接查询
if (!ObjectUtil.isAllEmpty(sysGroupSelectorParam.getSearchKey())) { if (ObjectUtil.isNotEmpty(sysGroupSelectorParam.getSearchKey())) {
if (ObjectUtil.isNotEmpty(sysGroupSelectorParam.getSearchKey())) { queryWrapper.lambda().like(SysGroup::getName, sysGroupSelectorParam.getSearchKey());
queryWrapper.lambda().like(SysGroup::getName, sysGroupSelectorParam.getSearchKey());
}
} }
return this.page(CommonPageRequest.defaultPage(), queryWrapper.lambda()); return this.page(CommonPageRequest.defaultPage(), queryWrapper.lambda());
} }