Browse Source

新增租户名称字段

tags/v2.4.0
xiaoying 1 year ago
parent
commit
46f128a382
6 changed files with 34 additions and 6 deletions
  1. +11
    -4
      tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/TenantController.java
  2. +4
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/CreateClientUserDto.java
  3. +2
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/po/TenantPo.java
  4. +3
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/ClientUserSevice.java
  5. +12
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java
  6. +2
    -2
      tuoheng_oidc_admin/src/main/resources/mapper/TenantMapper.xml

+ 11
- 4
tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/TenantController.java View File

@@ -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();
}
}

+ 4
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/CreateClientUserDto.java View File

@@ -37,5 +37,9 @@ public class CreateClientUserDto {
* 租户cod
*/
private String code;
/**
* 租户名称
*/
private String name;

}

+ 2
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/po/TenantPo.java View File

@@ -22,4 +22,6 @@ public class TenantPo extends BasePo {

private String code;

private String name;

}

+ 3
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/ClientUserSevice.java View File

@@ -31,4 +31,7 @@ public interface ClientUserSevice {
* @return
*/
JsonResult addTenant(OidcTenantDto dto,LoginUser loginUser);

JsonResult findTenants();

}

+ 12
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java View File

@@ -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)

+ 2
- 2
tuoheng_oidc_admin/src/main/resources/mapper/TenantMapper.xml View File

@@ -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">

Loading…
Cancel
Save