package com.ks.goldcorn.service;
|
|
import com.ks.goldcorn.exception.GoldAppException;
|
import com.ks.goldcorn.mapper.GoldCornAppInfoMapper;
|
import com.ks.goldcorn.pojo.DO.GoldCornAppInfo;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
|
@Component
|
public class GoldCornAppManager {
|
|
@Resource
|
private GoldCornAppInfoMapper goldCornAppInfoMapper;
|
|
/**
|
* 根据AppCode查询APP
|
*
|
* @param code
|
* @return
|
*/
|
public GoldCornAppInfo selectByAppCode(String code) {
|
return goldCornAppInfoMapper.selectByAppCode(code);
|
}
|
|
|
/**
|
* 根据code查询AppId
|
*
|
* @param code
|
* @return
|
*/
|
public Long selectAppIdByAppCode(String code) {
|
GoldCornAppInfo app = selectByAppCode(code);
|
if (app == null) {
|
return null;
|
}
|
return app.getId();
|
}
|
|
/**
|
* 获取appID
|
*
|
* @param appCode
|
* @return
|
* @throws GoldAppException
|
*/
|
public Long getAppId(String appCode) throws GoldAppException {
|
Long appId = selectAppIdByAppCode(appCode);
|
if (appId == null) {
|
throw new GoldAppException(GoldAppException.CODE_NOT_EXIST, "应用不存在");
|
}
|
return appId;
|
}
|
}
|