完成每个平台租户查询其所属的授权运营商接口
This commit is contained in:
parent
a9ac2b784e
commit
a13af4841e
@ -9,6 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yuyang
|
* @author yuyang
|
||||||
* @date 2022/1/20 11:33
|
* @date 2022/1/20 11:33
|
||||||
@ -120,5 +123,18 @@ public class XhpcCardController extends BaseController {
|
|||||||
return xhpcCardService.queryWholeUserInfo(userAccount, userType);
|
return xhpcCardService.queryWholeUserInfo(userAccount, userType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* According tenant id of platform query that it own all grantOperators
|
||||||
|
*
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/2/12 15:12
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
@GetMapping("/grantOperatorUser")
|
||||||
|
public R<List<Map<String, Object>>> queryOperatorUser() {
|
||||||
|
|
||||||
|
return xhpcCardService.queryOperatorUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package com.xhpc.card.mapper;
|
|||||||
|
|
||||||
import com.xhpc.card.pojo.XhpcOperator;
|
import com.xhpc.card.pojo.XhpcOperator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface XhpcOperatorMapper {
|
public interface XhpcOperatorMapper {
|
||||||
|
|
||||||
int deleteByPrimaryKey(Long operatorId);
|
int deleteByPrimaryKey(Long operatorId);
|
||||||
@ -25,4 +27,13 @@ public interface XhpcOperatorMapper {
|
|||||||
*/
|
*/
|
||||||
XhpcOperator selectByName(String grantOperatorName);
|
XhpcOperator selectByName(String grantOperatorName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* according tenant id of platform query id and name of every operator
|
||||||
|
*
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/2/12 15:23
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
List<XhpcOperator> selectAll(String tenantId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3,6 +3,9 @@ package com.xhpc.card.service;
|
|||||||
import com.xhpc.card.domain.*;
|
import com.xhpc.card.domain.*;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yuyang
|
* @author yuyang
|
||||||
* @date 2022/1/20 13:44
|
* @date 2022/1/20 13:44
|
||||||
@ -97,4 +100,14 @@ public interface IXhpcCardService {
|
|||||||
*/
|
*/
|
||||||
R<CardUserInfo> queryWholeUserInfo(String userAccount, Integer userType);
|
R<CardUserInfo> queryWholeUserInfo(String userAccount, Integer userType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Platform query that it own all grantOperators
|
||||||
|
*
|
||||||
|
* @return infos of all grantOperator
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/2/12 15:14
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
R<List<Map<String, Object>>> queryOperatorUser();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -362,6 +362,30 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<List<Map<String, Object>>> queryOperatorUser() {
|
||||||
|
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
|
String userType = sysUser.getUserType();
|
||||||
|
if (!UserTypeUtil.SYS_USER_TYPE_ZERO.equals(userType)) {
|
||||||
|
R.fail("该用户不是平台,不能调用此接口");
|
||||||
|
}
|
||||||
|
String tenantId = sysUser.getTenantId();
|
||||||
|
List<XhpcOperator> xhpcOperators = xhpcOperatorMapper.selectAll(tenantId);
|
||||||
|
ArrayList<Map<String, Object>> dataList = new ArrayList<>();
|
||||||
|
if (xhpcOperators.isEmpty()) {
|
||||||
|
return R.ok(dataList);
|
||||||
|
}
|
||||||
|
for (XhpcOperator xhpcOperator : xhpcOperators) {
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("id", xhpcOperator.getOperatorId());
|
||||||
|
map.put("name", xhpcOperator.getName());
|
||||||
|
dataList.add(map);
|
||||||
|
}
|
||||||
|
return R.ok(dataList);
|
||||||
|
}
|
||||||
|
|
||||||
private void fillUserInfo(CardUserInfo cardUserInfo, Map<String, Object> userData) {
|
private void fillUserInfo(CardUserInfo cardUserInfo, Map<String, Object> userData) {
|
||||||
|
|
||||||
cardUserInfo.setCardSerialNumber((String) userData.get("cardID"));
|
cardUserInfo.setCardSerialNumber((String) userData.get("cardID"));
|
||||||
|
|||||||
@ -54,6 +54,12 @@
|
|||||||
from xhpc_operator
|
from xhpc_operator
|
||||||
where name = #{grantOperatorName}
|
where name = #{grantOperatorName}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
|
SELECT operator_id,
|
||||||
|
`name`
|
||||||
|
FROM xhpc_operator
|
||||||
|
where tenant_id = #{tenantId}
|
||||||
|
</select>
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
delete
|
delete
|
||||||
from xhpc_operator
|
from xhpc_operator
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user