OrgUserController.java 1.35 KB
package cn.com.glsx.admin.modules.controller;

import cn.com.glsx.admin.modules.model.param.OrgUserSearch;
import cn.com.glsx.admin.modules.remote.RemoteUserApiService;
import cn.com.glsx.usercenter.api.feign.OrganizationService;
import com.glsx.plat.core.web.R;
import com.google.gson.reflect.TypeToken;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

@Slf4j
@RestController
@RequestMapping(value = "/orguser")
@Api(value = "用户组织", tags = {"用户组织"})
public class OrgUserController {

    @Autowired
    private RemoteUserApiService remoteUserApiService;

    @Autowired
    private OrganizationService organizationService;

    @GetMapping("/list")
    public R list(OrgUserSearch search) {
        remoteUserApiService.setCheckedOrgUsers(search);
        return R.ok().data(search);
    }

    @GetMapping("/getAllSubOrgIds")
    public R getAllSubOrgIds() {
        R<Set<Long>> setR = organizationService.getAllSubOrgIds();

        Set<Long> orgIds = setR.getDataList(new TypeToken<Set<Long>>() {
        }.getType());

        return R.ok().data(orgIds);
    }

}