@@ -9,10 +9,7 @@ import com.tuoheng.service.CurrentUser; | |||
import com.tuoheng.until.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @author chenjiandong | |||
@@ -42,4 +39,14 @@ public class TenantController { | |||
public JsonResult add(@RequestBody OidcTenantDto dto,@CurrentUser LoginUser loginUser){ | |||
return clientUserSevice.addTenant(dto,loginUser); | |||
} | |||
/** | |||
* 查询租户列表 | |||
* @return | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult list(){ | |||
return clientUserSevice.findTenants(); | |||
} | |||
} |
@@ -37,5 +37,9 @@ public class CreateClientUserDto { | |||
* 租户cod | |||
*/ | |||
private String code; | |||
/** | |||
* 租户名称 | |||
*/ | |||
private String name; | |||
} |
@@ -22,4 +22,6 @@ public class TenantPo extends BasePo { | |||
private String code; | |||
private String name; | |||
} |
@@ -31,4 +31,7 @@ public interface ClientUserSevice { | |||
* @return | |||
*/ | |||
JsonResult addTenant(OidcTenantDto dto,LoginUser loginUser); | |||
JsonResult findTenants(); | |||
} |
@@ -96,6 +96,7 @@ public class ClientUserServiceImpl implements ClientUserSevice { | |||
tenantPo.setUserId(userPo.getId()); | |||
//添加租户code | |||
tenantPo.setCode(createClientUserDto.getCode()); | |||
tenantPo.setName(createClientUserDto.getName()); | |||
tenantMapper.insertTenant(tenantPo); | |||
} | |||
} | |||
@@ -237,6 +238,17 @@ public class ClientUserServiceImpl implements ClientUserSevice { | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 查询租户以及该租户对应绑定的系统等 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult findTenants() { | |||
return null; | |||
} | |||
private JsonResult getResult(OidcTenantDto dto, String code, LoginUser loginUser) { | |||
Platform platform = platformMapper.selectOne(Wrappers.<Platform>lambdaQuery() | |||
.eq(Platform::getPlatformCode, code) |
@@ -3,8 +3,8 @@ | |||
<mapper namespace="com.tuoheng.mapper.TenantMapper"> | |||
<insert id="insertTenant" parameterType="com.tuoheng.model.po.TenantPo" keyProperty="id" useGeneratedKeys="true"> | |||
INSERT INTO t_tenant (user_id, remark, `code`) | |||
VALUES (#{userId}, #{remark}, #{code}) | |||
INSERT INTO t_tenant (user_id, remark, `code`, `name`) | |||
VALUES (#{userId}, #{remark}, #{code}, #{name}) | |||
</insert> | |||
<select id="getByCode" resultType="com.tuoheng.model.dto.TTenant"> |