增加接口

This commit is contained in:
TS-QD1 2023-04-12 09:55:13 +08:00
parent 07f79cfeed
commit 88b84c4e40
5 changed files with 56 additions and 0 deletions

View File

@ -12,6 +12,8 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ClassName: UserExpandController
* @Description: 用户拓展

View File

@ -9,14 +9,17 @@ import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.exceptions.ParamsException;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.pojo.vos.IdsVO;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @ClassName: UserExpandController
@ -87,4 +90,19 @@ public class UserExpandResourceController extends DefaultBaseController {
return userExpandService.listWholeByRoleIdAndAreaCode(roleId, areaCode);
}
@ApiOperation(value = "通过角色和区域编码获取拓展属性完整分页列表", notes = "通过角色和区域编码获取拓展属性完整分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", required = true),
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", required = true)
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage/role-id/{roleId}/area-code/{areaCode}")
public SuccessResultList<List<UserExpandDTO>> listPageByRoleIdAndAreaCode(@PathVariable("roleId") String roleId,
@PathVariable("areaCode") String areaCode,
ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return userExpandService.listPageByRoleIdAndAreaCode(roleId, areaCode, page);
}
}

View File

@ -7,7 +7,9 @@ import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO;
import cn.com.tenlion.usercenter.pojo.vos.userexpand.GridUserAuthBindVO;
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
import ink.wgink.interfaces.user.IUserExpandBaseService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.result.SuccessResultList;
import java.util.List;
@ -94,4 +96,14 @@ public interface IUserExpandService extends IUserExpandBaseService<UserExpandDTO
* @return
*/
GridUserAuthBindDTO getAuthAndBindResult(GridUserAuthBindVO gridUserAuthBindVO);
/**
* 通过角色和区域编码获取拓展属性完整分页列表
*
* @param roleId
* @param areaCode
* @param page
* @return
*/
SuccessResultList<List<UserExpandDTO>> listPageByRoleIdAndAreaCode(String roleId, String areaCode, ListPage page);
}

View File

@ -12,6 +12,8 @@ import cn.com.tenlion.usercenter.pojo.pos.userexpand.UserExpandPO;
import cn.com.tenlion.usercenter.pojo.vos.userexpand.GridUserAuthBindVO;
import cn.com.tenlion.usercenter.pojo.vos.userexpand.UserExpandVO;
import cn.com.tenlion.usercenter.service.userexpand.IUserExpandService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.ParamsException;
import ink.wgink.exceptions.SearchException;
@ -46,6 +48,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @ClassName: UserExpandServiceImpl
@ -408,6 +411,21 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
return gridUserAuthBindDTO;
}
@Override
public SuccessResultList<List<UserExpandDTO>> listPageByRoleIdAndAreaCode(String roleId, String areaCode, ListPage page) {
page.getParams().put("roleId", roleId);
page.getParams().put("areaCode", areaCode);
PageHelper.startPage(page.getPage(), page.getRows());
List<UserExpandDTO> userExpandDTOS = userExpandDao.list(page.getParams());
if(userExpandDTOS.size() > 0) {
List<String> userIds = userExpandDTOS.stream().map(UserExpandDTO::getUserId).collect(Collectors.toList());
List<UserDTO> userDTOs = userService.listByUserIds(userIds);
setUser(userDTOs, userExpandDTOS);
}
PageInfo<UserExpandDTO> pageInfo = new PageInfo<>(userExpandDTOS);
return new SuccessResultList<>(userExpandDTOS, pageInfo.getPageNum(), pageInfo.getTotal());
}
/**
* 设置用户
*

View File

@ -307,6 +307,12 @@
#{userIds[${index}]}
</foreach>
</if>
<if test="roleId != null and roleId != ''">
AND
EXISTS (SELECT 1 FROM sys_role_user st1 WHERE t1.user_id = st1.user_id AND st1.role_id = #{roleId})
</if>
AND
EXISTS (SELECT 1 FROM sys_user st1 WHERE t1.user_id = st1.user_id)
</where>
</select>