1a4ee1c4 by chentao

修复问题

1 parent abf53b61
......@@ -20,7 +20,7 @@ import java.rmi.ServerException;
import java.util.List;
/**
* 积木 信息操作处理
* 系列 信息操作处理
*
* @author GYongYi
* @date 2024/9/8 15:32
......
......@@ -52,4 +52,5 @@ email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1
xcx.code.not.blank=小程序code不能为空
##业务
core.data.not.exists=数据不存在
core.data.exists=数据存在
core.advert.status.fail=广告状态不存在
......
......@@ -8,7 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 积木对象 core_building_block
* 系列对象 core_building_block
*
* @author GYongYi
* @date 2024/9/8 16:27
......
......@@ -27,11 +27,11 @@ public class Course extends BaseEntity {
@TableId(value = "id")
private String id;
/**
* 积木ID
* 系列ID
*/
private String buildingBlockId;
/**
* 课程名称
*/
......
......@@ -2,8 +2,11 @@ package com.lego.core.domin.bo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 积木视图对象
* 系列视图对象
*
* @author GYongYi
* @date 2024/9/8 16:27
......@@ -22,15 +25,19 @@ public class BuildingBlockBo extends BaseBO {
/**
* 套件ID
*/
@NotBlank(message = "套件不能为空")
private String entiretyId;
/**
* 广告名称
* 系列名称
*/
@NotBlank(message = "系列名称不能为空")
@Size(min = 0, max = 50, message = "系列名称长度不能超过{max}个字符")
private String name;
/**
* 文件ID
*/
@NotBlank(message = "图片不能为空")
private String ossId;
}
......
......@@ -4,7 +4,7 @@ import com.lego.common.core.domain.PageQuery;
import lombok.Data;
/**
* 积木搜索请求对象
* 系列搜索请求对象
*
* @author GYongYi
* @date 2024/9/8 16:27
......
......@@ -21,8 +21,9 @@ public class CourseBo extends BaseBO {
private String id;
/**
* 积木ID
* 系列ID
*/
@NotBlank(message = "系列不能为空")
private String buildingBlockId;
/**
......@@ -75,6 +76,7 @@ public class CourseBo extends BaseBO {
/**
* 教案OSS_id
*/
@NotBlank(message = "教案不能为空")
private String teachingOssId;
/**
......
......@@ -3,7 +3,7 @@ package com.lego.core.domin.vo;
import lombok.Data;
/**
* 积木视图对象 core_building_block
* 系列视图对象 core_building_block
*
* @author GYongYi
* @date 2024/9/8 16:27
......
......@@ -19,12 +19,12 @@ public class CourseVo {
private String id;
/**
* 积木ID
* 系列ID
*/
private String buildingBlockId;
/**
* 积木名称
* 系列名称
*/
private String buildingBlockName;
......
......@@ -7,7 +7,7 @@ import com.lego.core.domin.vo.AdvertVo;
import com.lego.core.domin.vo.BuildingBlockVo;
/**
* 积木Mapper接口
* 系列Mapper接口
*
* @author GYongYi
* @date 2024/9/8 15:22
......
......@@ -11,7 +11,7 @@ import java.util.Collection;
import java.util.List;
/**
* 积木Service接口
* 系列Service接口
*
* @author GYongYi
* @date 2024/9/8 15:24
......@@ -73,7 +73,7 @@ public interface IBuildingBlockService {
boolean remove(String id) throws ServerException;
/**
* 根据ID集合获取积木
* 根据ID集合获取系列
*
* @param ids
* @return
......
......@@ -11,15 +11,16 @@ import com.lego.common.utils.MessageUtils;
import com.lego.common.utils.StreamUtils;
import com.lego.core.annotation.LanguageAnnotation;
import com.lego.core.domin.BuildingBlock;
import com.lego.core.domin.Course;
import com.lego.core.domin.Entirety;
import com.lego.core.domin.bo.BuildingBlockBo;
import com.lego.core.domin.bo.BuildingBlockQueryBo;
import com.lego.core.domin.vo.BuildingBlockVo;
import com.lego.core.domin.vo.CourseVo;
import com.lego.core.domin.vo.EntiretyVo;
import com.lego.core.mapper.BuildingBlockMapper;
import com.lego.core.mapper.CourseMapper;
import com.lego.core.service.IBuildingBlockService;
import com.lego.core.service.IEntiretyService;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.RequiredArgsConstructor;
import org.apache.commons.compress.utils.Lists;
import org.springframework.stereotype.Service;
......@@ -32,7 +33,7 @@ import java.util.Map;
import java.util.Set;
/**
* 积木Service业务层处理
* 系列Service业务层处理
*
* @author GYongYi
* @date 2024/9/8 15:30
......@@ -43,6 +44,7 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService {
private final BuildingBlockMapper baseMapper;
private final IEntiretyService entiretyService;
private final OssService ossService;
private final CourseMapper courseMapper;
/**
* 查询所有列表(带分页)
......@@ -54,7 +56,7 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService {
public TableDataInfo<BuildingBlockVo> listPage(BuildingBlockQueryBo queryBo, String language) {
Page<BuildingBlockVo> page = baseMapper.selectVoPage(queryBo.build(), Wrappers.<BuildingBlock>lambdaQuery()
.like(StrUtil.isNotBlank(queryBo.getSearchKey()), BuildingBlock::getName, queryBo.getSearchKey())
.eq(BuildingBlock::getLanguage, language));
.eq(BuildingBlock::getLanguage, language).orderByAsc(BuildingBlock::getId));
setInfo(page.getRecords());
return TableDataInfo.build(page);
}
......@@ -160,11 +162,12 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService {
@Override
public boolean remove(String id) throws ServerException {
checkExists(id);
checkCourseExists(id);
return baseMapper.deleteById(id) > 0;
}
/**
* 根据ID集合获取积木
* 根据ID集合获取系列
*
* @param ids
* @return
......@@ -193,4 +196,16 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService {
throw new ServerException(MessageUtils.message("core.data.not.exists"));
}
}
/**
* 校验数据是否存在
*
* @param id
* @throws ServerException
*/
private void checkCourseExists(String id) throws ServerException {
if (courseMapper.exists(Wrappers.<Course>lambdaQuery().eq(Course::getBuildingBlockId, id))) {
throw new ServerException(MessageUtils.message("core.data.exists"));
}
}
}
......
......@@ -155,6 +155,7 @@ public class EntiretyServiceImpl implements IEntiretyService {
@Override
public boolean remove(String id) throws ServerException {
checkExists(id);
checkBuildingBlockExists(id);
return baseMapper.deleteById(id) > 0;
}
......@@ -174,4 +175,17 @@ public class EntiretyServiceImpl implements IEntiretyService {
throw new ServerException(MessageUtils.message("core.data.not.exists"));
}
}
/**
* 校验数据是否存在
*
* @param id
* @throws ServerException
*/
private void checkBuildingBlockExists(String id) throws ServerException {
if (buildingBlockMapper.exists(Wrappers.<BuildingBlock>lambdaQuery().eq(BuildingBlock::getEntiretyId, id))) {
throw new ServerException(MessageUtils.message("core.data.exists"));
}
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!