|
@@ -6,12 +6,15 @@
|
|
|
package org.eco.vip.auth.service.client;
|
|
|
|
|
|
|
|
|
+import com.mybatisflex.core.paginate.Page;
|
|
|
+import com.mybatisflex.core.query.QueryWrapper;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.eco.vip.auth.domain.client.Client;
|
|
|
import org.eco.vip.auth.domain.client.pojo.ClientBO;
|
|
|
import org.eco.vip.auth.domain.client.pojo.ClientVO;
|
|
|
import org.eco.vip.auth.mapper.ClientMapper;
|
|
|
+import org.eco.vip.orm.domain.PageQuery;
|
|
|
import org.eco.vip.orm.pojo.PageResult;
|
|
|
import org.eco.vip.orm.service.BaseService;
|
|
|
import org.eco.vip.orm.utils.MapstructUtils;
|
|
@@ -19,6 +22,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
+import static org.eco.vip.auth.domain.client.table.ClientTableDef.CLIENT;
|
|
|
+
|
|
|
/**
|
|
|
* @description ClientService
|
|
|
*
|
|
@@ -32,14 +37,26 @@ public class ClientService extends BaseService<ClientMapper, Client> implements
|
|
|
@Resource
|
|
|
private ClientMapper clientMapper;
|
|
|
|
|
|
+ private QueryWrapper buildQueryWrapper(ClientBO clientBO) {
|
|
|
+ return super.buildBaseQueryWrapper()
|
|
|
+ .and(CLIENT.CLIENT_KEY.eq(clientBO.getClientKey()))
|
|
|
+ .and(CLIENT.CLIENT_SECRET.eq(clientBO.getClientSecret()))
|
|
|
+ .and(CLIENT.GRANT_TYPE.eq(clientBO.getGrantType()))
|
|
|
+ .and(CLIENT.DEVICE_TYPE.eq(clientBO.getDeviceType()))
|
|
|
+ .and(CLIENT.STATUS.eq(clientBO.getStatus()));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public PageResult<ClientVO> selectPage(ClientBO clientBO) {
|
|
|
- return null;
|
|
|
+ QueryWrapper queryWrapper = buildQueryWrapper(clientBO);
|
|
|
+ Page<ClientVO> page = clientMapper.paginateWithRelationsAs(PageQuery.build(), queryWrapper, ClientVO.class);
|
|
|
+ return PageResult.build(page);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<ClientVO> selectList(ClientBO clientBO) {
|
|
|
- return List.of();
|
|
|
+ QueryWrapper queryWrapper = buildQueryWrapper(clientBO);
|
|
|
+ return clientMapper.selectListWithRelationsByQueryAs(queryWrapper, ClientVO.class);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -50,7 +67,8 @@ public class ClientService extends BaseService<ClientMapper, Client> implements
|
|
|
|
|
|
@Override
|
|
|
public boolean update(ClientBO clientBO) {
|
|
|
- return false;
|
|
|
+ Client client = MapstructUtils.convert(clientBO, Client.class);
|
|
|
+ return this.updateById(client);
|
|
|
}
|
|
|
|
|
|
@Override
|