add: 机构管理添加角色查询
This commit is contained in:
@@ -110,4 +110,5 @@ public interface TsRoleDao extends BaseMapper<TsRole> {
|
||||
@Select("select role_id from ts_role_resource where resource_id =#{oldResourceIds}")
|
||||
List<String> getResourceId(String oldResourceIds);
|
||||
|
||||
List<TsRole> getRoleDataByUserId(String userId);
|
||||
}
|
||||
|
||||
@@ -94,4 +94,7 @@ public interface ITsRoleService extends IService<TsRole> {
|
||||
* @return
|
||||
*/
|
||||
IPage<TsRole> getRole(TsRole tsRole);
|
||||
|
||||
|
||||
List<TsRole> getRoleDataByUserId(String userId);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
@@ -294,6 +295,15 @@ public class TsRoleServiceImpl extends ServiceImpl<TsRoleDao, TsRole> implements
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<TsRole> getRoleDataByUserId(String userId) {
|
||||
if(StringUtils.isNotBlank(userId)){
|
||||
return tsRoleDao.getRoleDataByUserId(userId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TsRole> getRole(TsRole tsRole) {
|
||||
IPage<TsRole> page = new Page<>(tsRole.getCurrent(), tsRole.getPageSize());
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.adc.da.base.entity.BaseEntity;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.adc.da.slrs.sarPosition.entity.TsPosition;
|
||||
import com.adc.da.slrs.sarRole.entity.TsRole;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
@@ -146,6 +147,10 @@ public class TsUser extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private List<TsPosition> positions;
|
||||
|
||||
@ApiModelProperty(value = "角色")
|
||||
@TableField(exist = false)
|
||||
private List<TsRole> roles;
|
||||
|
||||
@ApiModelProperty("当前页")
|
||||
@TableField(exist = false)
|
||||
private Integer current;
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.adc.da.slrs.sarPosition.entity.TsPosition;
|
||||
//import com.adc.da.slrs.sarPosition.service.ITsPositionService;
|
||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||
import com.adc.da.slrs.sarRole.entity.TsRole;
|
||||
import com.adc.da.slrs.sarRole.service.ITsRoleService;
|
||||
import com.adc.da.slrs.sarUser.entity.*;
|
||||
import com.adc.da.slrs.sarUser.dao.TsUserDao;
|
||||
@@ -534,6 +535,12 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
||||
// }
|
||||
// }
|
||||
|
||||
if(tsUsers!=null &&!tsUsers.isEmpty()){
|
||||
for (TsUser user:tsUsers) {
|
||||
List<TsRole> roleList = tsRoleService.getRoleDataByUserId(user.getUserId());
|
||||
user.setRoles(roleList);
|
||||
}
|
||||
}
|
||||
Page<TsUser> tsUserPage = new Page<>();
|
||||
tsUserPage.setCurrent(tsUser.getCurrent());
|
||||
tsUserPage.setSize(tsUser.getSize());
|
||||
|
||||
@@ -32,4 +32,8 @@
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getRoleDataByUserId" resultType="com.adc.da.slrs.sarRole.entity.TsRole">
|
||||
select * from ts_role where ID in ( SELECT ROLE_ID FROM `ts_user_role` where USER_ID = #{userId})
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user