【7.2.2】【expand】用户列表增加Wrapper包装展示动态列

pull/29/head
fengshuonan 2022-04-01 11:40:47 +08:00
parent 7061b059aa
commit dcd867c64f
3 changed files with 52 additions and 0 deletions

View File

@ -200,6 +200,7 @@ public class SysExpandServiceImpl extends ServiceImpl<SysExpandMapper, SysExpand
SysExpandRequest sysExpandRequest = new SysExpandRequest();
sysExpandRequest.setExpandCode(expandCode);
sysExpandRequest.setPrimaryFieldValue(primaryFieldValue);
SysExpandData sysExpandData = this.getByExpandCode(sysExpandRequest);
// 获取对应数据

View File

@ -41,6 +41,8 @@ import cn.stylefeng.roses.kernel.system.api.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserRole;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserRoleService;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
import cn.stylefeng.roses.kernel.system.modular.user.wrapper.UserExpandWrapper;
import cn.stylefeng.roses.kernel.wrapper.api.annotation.Wrapper;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -202,6 +204,7 @@ public class SysUserController {
* @date 2020/11/6 13:49
*/
@GetResource(name = "系统用户_查询", path = "/sysUser/page")
@Wrapper(UserExpandWrapper.class)
public ResponseData<PageResult<SysUserDTO>> page(SysUserRequest sysUserRequest) {
return new SuccessResponseData<>(sysUserService.findPage(sysUserRequest));
}

View File

@ -0,0 +1,48 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.system.modular.user.wrapper;
import cn.hutool.extra.spring.SpringUtil;
import cn.stylefeng.roses.kernel.expand.modular.api.ExpandApi;
import cn.stylefeng.roses.kernel.system.api.pojo.user.SysUserDTO;
import cn.stylefeng.roses.kernel.wrapper.api.BaseWrapper;
import java.util.Map;
/**
*
*
* @author fengshuonan
* @date 2022/4/1 11:30
*/
public class UserExpandWrapper implements BaseWrapper<SysUserDTO> {
@Override
public Map<String, Object> doWrap(SysUserDTO beWrappedModel) {
ExpandApi expandApi = SpringUtil.getBean(ExpandApi.class);
return expandApi.getExpandDataInfo("user_expand", beWrappedModel.getUserId());
}
}