Browse Source

获取身份列表(分页) 接口

tags/V1.7.0
wanghaoran 1 year ago
parent
commit
e78225d23e
4 changed files with 39 additions and 2 deletions
  1. +12
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/controller/IdentityController.java
  2. +2
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/IdentityQuery.java
  3. +2
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/IIdentityService.java
  4. +23
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/IdentityServiceImpl.java

+ 12
- 0
tuoheng-api/src/main/java/com/tuoheng/api/controller/IdentityController.java View File

@@ -20,6 +20,18 @@ public class IdentityController {
* @param identityQuery 查询条件
* @return
*/
@GetMapping("/index")
public JsonResult index(IdentityQuery identityQuery) {
return identityService.queryPage(identityQuery);
}


/**
* 获取身份列表(分页)
*
* @param identityQuery 查询条件
* @return
*/
@GetMapping("/getList")
public JsonResult getList(IdentityQuery identityQuery) {
return identityService.getListInfo(identityQuery);

+ 2
- 1
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/IdentityQuery.java View File

@@ -1,9 +1,10 @@
package com.tuoheng.api.entity.request;

import com.tuoheng.common.common.BaseQuery;
import lombok.Data;

@Data
public class IdentityQuery {
public class IdentityQuery extends BaseQuery {

/**
* 租户ID

+ 2
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/IIdentityService.java View File

@@ -16,4 +16,6 @@ public interface IIdentityService extends IBaseService<Identity> {
JsonResult getListInfo(IdentityQuery identityQuery);

JsonResult submit(IdentityApply identityApply);

JsonResult queryPage(IdentityQuery identityQuery);
}

+ 23
- 1
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/IdentityServiceImpl.java View File

@@ -2,7 +2,9 @@ package com.tuoheng.api.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.constants.DictConstants;
import com.tuoheng.api.entity.domain.*;
import com.tuoheng.api.entity.request.IdentityQuery;
@@ -48,7 +50,9 @@ public class IdentityServiceImpl extends BaseServiceImpl<IdentityMapper, Identit
return JsonResult.error("租户ID为空!");
}
List<Identity> identityList = identityMapper.selectList(new LambdaQueryWrapper<Identity>()
.eq(Identity::getTenantId, identityQuery.getTenantId()));
.eq(Identity::getTenantId, identityQuery.getTenantId())
.eq(Identity::getMark, 1)
.orderByDesc(Identity::getCreateTime));
return JsonResult.success(identityList);
}

@@ -100,4 +104,22 @@ public class IdentityServiceImpl extends BaseServiceImpl<IdentityMapper, Identit
}
return JsonResult.success();
}

@Override
public JsonResult queryPage(IdentityQuery query) {
if (null == query.getPage() || null == query.getLimit()) {
return JsonResult.error("参数为空!");
}
if (null == query.getTenantId()) {
return JsonResult.error("租户ID为空!");
}
// 获取分页数据
IPage<Identity> page = new Page<>(query.getPage(), query.getLimit());
IPage<Identity> pageData = identityMapper.selectPage(page, new LambdaQueryWrapper<Identity>()
.eq(Identity::getTenantId, query.getTenantId())
.eq(Identity::getMark, 1)
.orderByDesc(Identity::getCreateTime));

return JsonResult.success(pageData);
}
}

Loading…
Cancel
Save