package com.xiaopeng.operation.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xiaopeng.api.model.operation.XpOfficialPartner; import com.xiaopeng.common.core.exception.ServiceException; import com.xiaopeng.operation.mapper.XpOfficialPartnerMapper; import com.xiaopeng.operation.service.IXpOfficialPartnerService; import com.xiaopeng.operation.vo.OfficialPartnerVo; import org.springframework.stereotype.Service; @Service public class XpOfficialPartnerServiceImpl extends ServiceImpl implements IXpOfficialPartnerService { /** * 添加合作商 * @param vo */ @Override public void addOfficialPartner(OfficialPartnerVo vo) { XpOfficialPartner officialPartner = this.getOne(new QueryWrapper().eq("app_key", vo.getAppKey()).eq("is_deleted", 0)); if(null == officialPartner){ throw new ServiceException("权限校验失败"); } if(!officialPartner.getAppSecret().equals(vo.getAppSecret())){ throw new ServiceException("权限校验失败"); } XpOfficialPartner xpOfficialPartner = new XpOfficialPartner(); xpOfficialPartner.setName(vo.getName()); xpOfficialPartner.setBrandName(vo.getBrandName()); xpOfficialPartner.setLogoUrl(vo.getLogoUrl()); this.updateById(xpOfficialPartner); } }