认证服务、广告管理、应用管理service单测剔除真实db使用mock mapper

This commit is contained in:
gaoqr
2026-01-15 11:58:12 +08:00
parent 76a1ad2003
commit 77120e4d3e
6 changed files with 366 additions and 188 deletions
@@ -1,7 +1,7 @@
package com.cf.imes.module.system.service.dict;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.pojo.PageResult;
@@ -86,11 +86,7 @@ public class DictTypeServiceImpl implements DictTypeService {
// 字典类型发生改变,更新关联字典数据
String oldDictTypeDOType = oldDictTypeDO.getType();
if (ObjectUtil.notEqual(oldDictTypeDOType, updateReqVOType)) {
UpdateWrapper<DictDataDO> wrapper = new UpdateWrapper<>();
wrapper.set("dict_type", updateReqVOType);
wrapper.eq("dict_type", oldDictTypeDOType);
wrapper.eq("status", DeletedCodeEnum.NOT_DELETED.getStatus());
dictDataMapper.update(wrapper);
dictDataMapper.update(new LambdaUpdateWrapper<DictDataDO>().set(DictDataDO::getDictType, updateReqVOType).eq(DictDataDO::getDictType, oldDictTypeDOType).eq(DictDataDO::getStatus, DeletedCodeEnum.NOT_DELETED.getStatus()));
}
}
@@ -82,7 +82,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
AdvertisementDO advertisementDO = validateAdvertisementExists(id);
// 发布中的广告不允许编辑
if (advertisementDO.getStatus().equals(AdvertisementStatusEnum.PUBLISHED.getStatus())) {
if (AdvertisementStatusEnum.PUBLISHED.getStatus().equals(advertisementDO.getStatus())) {
throw new ServiceException(ADVERTISEMENT_UPDATE_STATUS_ERROR);
}