修复问题
Showing
13 changed files
with
58 additions
and
19 deletions
| ... | @@ -20,7 +20,7 @@ import java.rmi.ServerException; | ... | @@ -20,7 +20,7 @@ import java.rmi.ServerException; |
| 20 | import java.util.List; | 20 | import java.util.List; |
| 21 | 21 | ||
| 22 | /** | 22 | /** |
| 23 | * 积木 信息操作处理 | 23 | * 系列 信息操作处理 |
| 24 | * | 24 | * |
| 25 | * @author GYongYi | 25 | * @author GYongYi |
| 26 | * @date 2024/9/8 15:32 | 26 | * @date 2024/9/8 15:32 | ... | ... |
| ... | @@ -52,4 +52,5 @@ email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1 | ... | @@ -52,4 +52,5 @@ email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1 |
| 52 | xcx.code.not.blank=小程序code不能为空 | 52 | xcx.code.not.blank=小程序code不能为空 |
| 53 | ##业务 | 53 | ##业务 |
| 54 | core.data.not.exists=数据不存在 | 54 | core.data.not.exists=数据不存在 |
| 55 | core.data.exists=数据存在 | ||
| 55 | core.advert.status.fail=广告状态不存在 | 56 | core.advert.status.fail=广告状态不存在 | ... | ... |
| ... | @@ -8,7 +8,7 @@ import lombok.Data; | ... | @@ -8,7 +8,7 @@ import lombok.Data; |
| 8 | import lombok.EqualsAndHashCode; | 8 | import lombok.EqualsAndHashCode; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | * 积木对象 core_building_block | 11 | * 系列对象 core_building_block |
| 12 | * | 12 | * |
| 13 | * @author GYongYi | 13 | * @author GYongYi |
| 14 | * @date 2024/9/8 16:27 | 14 | * @date 2024/9/8 16:27 | ... | ... |
| ... | @@ -27,11 +27,11 @@ public class Course extends BaseEntity { | ... | @@ -27,11 +27,11 @@ public class Course extends BaseEntity { |
| 27 | @TableId(value = "id") | 27 | @TableId(value = "id") |
| 28 | private String id; | 28 | private String id; |
| 29 | 29 | ||
| 30 | |||
| 30 | /** | 31 | /** |
| 31 | * 积木ID | 32 | * 系列ID |
| 32 | */ | 33 | */ |
| 33 | private String buildingBlockId; | 34 | private String buildingBlockId; |
| 34 | |||
| 35 | /** | 35 | /** |
| 36 | * 课程名称 | 36 | * 课程名称 |
| 37 | */ | 37 | */ | ... | ... |
| ... | @@ -2,8 +2,11 @@ package com.lego.core.domin.bo; | ... | @@ -2,8 +2,11 @@ package com.lego.core.domin.bo; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | 4 | ||
| 5 | import javax.validation.constraints.NotBlank; | ||
| 6 | import javax.validation.constraints.Size; | ||
| 7 | |||
| 5 | /** | 8 | /** |
| 6 | * 积木视图对象 | 9 | * 系列视图对象 |
| 7 | * | 10 | * |
| 8 | * @author GYongYi | 11 | * @author GYongYi |
| 9 | * @date 2024/9/8 16:27 | 12 | * @date 2024/9/8 16:27 |
| ... | @@ -22,15 +25,19 @@ public class BuildingBlockBo extends BaseBO { | ... | @@ -22,15 +25,19 @@ public class BuildingBlockBo extends BaseBO { |
| 22 | /** | 25 | /** |
| 23 | * 套件ID | 26 | * 套件ID |
| 24 | */ | 27 | */ |
| 28 | @NotBlank(message = "套件不能为空") | ||
| 25 | private String entiretyId; | 29 | private String entiretyId; |
| 26 | 30 | ||
| 27 | /** | 31 | /** |
| 28 | * 广告名称 | 32 | * 系列名称 |
| 29 | */ | 33 | */ |
| 34 | @NotBlank(message = "系列名称不能为空") | ||
| 35 | @Size(min = 0, max = 50, message = "系列名称长度不能超过{max}个字符") | ||
| 30 | private String name; | 36 | private String name; |
| 31 | 37 | ||
| 32 | /** | 38 | /** |
| 33 | * 文件ID | 39 | * 文件ID |
| 34 | */ | 40 | */ |
| 41 | @NotBlank(message = "图片不能为空") | ||
| 35 | private String ossId; | 42 | private String ossId; |
| 36 | } | 43 | } | ... | ... |
| ... | @@ -4,7 +4,7 @@ import com.lego.common.core.domain.PageQuery; | ... | @@ -4,7 +4,7 @@ import com.lego.common.core.domain.PageQuery; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * 积木搜索请求对象 | 7 | * 系列搜索请求对象 |
| 8 | * | 8 | * |
| 9 | * @author GYongYi | 9 | * @author GYongYi |
| 10 | * @date 2024/9/8 16:27 | 10 | * @date 2024/9/8 16:27 | ... | ... |
| ... | @@ -21,8 +21,9 @@ public class CourseBo extends BaseBO { | ... | @@ -21,8 +21,9 @@ public class CourseBo extends BaseBO { |
| 21 | private String id; | 21 | private String id; |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | * 积木ID | 24 | * 系列ID |
| 25 | */ | 25 | */ |
| 26 | @NotBlank(message = "系列不能为空") | ||
| 26 | private String buildingBlockId; | 27 | private String buildingBlockId; |
| 27 | 28 | ||
| 28 | /** | 29 | /** |
| ... | @@ -75,6 +76,7 @@ public class CourseBo extends BaseBO { | ... | @@ -75,6 +76,7 @@ public class CourseBo extends BaseBO { |
| 75 | /** | 76 | /** |
| 76 | * 教案OSS_id | 77 | * 教案OSS_id |
| 77 | */ | 78 | */ |
| 79 | @NotBlank(message = "教案不能为空") | ||
| 78 | private String teachingOssId; | 80 | private String teachingOssId; |
| 79 | 81 | ||
| 80 | /** | 82 | /** | ... | ... |
| ... | @@ -3,7 +3,7 @@ package com.lego.core.domin.vo; | ... | @@ -3,7 +3,7 @@ package com.lego.core.domin.vo; |
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| 6 | * 积木视图对象 core_building_block | 6 | * 系列视图对象 core_building_block |
| 7 | * | 7 | * |
| 8 | * @author GYongYi | 8 | * @author GYongYi |
| 9 | * @date 2024/9/8 16:27 | 9 | * @date 2024/9/8 16:27 | ... | ... |
| ... | @@ -19,12 +19,12 @@ public class CourseVo { | ... | @@ -19,12 +19,12 @@ public class CourseVo { |
| 19 | private String id; | 19 | private String id; |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| 22 | * 积木ID | 22 | * 系列ID |
| 23 | */ | 23 | */ |
| 24 | private String buildingBlockId; | 24 | private String buildingBlockId; |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * 积木名称 | 27 | * 系列名称 |
| 28 | */ | 28 | */ |
| 29 | private String buildingBlockName; | 29 | private String buildingBlockName; |
| 30 | 30 | ... | ... |
| ... | @@ -7,7 +7,7 @@ import com.lego.core.domin.vo.AdvertVo; | ... | @@ -7,7 +7,7 @@ import com.lego.core.domin.vo.AdvertVo; |
| 7 | import com.lego.core.domin.vo.BuildingBlockVo; | 7 | import com.lego.core.domin.vo.BuildingBlockVo; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * 积木Mapper接口 | 10 | * 系列Mapper接口 |
| 11 | * | 11 | * |
| 12 | * @author GYongYi | 12 | * @author GYongYi |
| 13 | * @date 2024/9/8 15:22 | 13 | * @date 2024/9/8 15:22 | ... | ... |
| ... | @@ -11,7 +11,7 @@ import java.util.Collection; | ... | @@ -11,7 +11,7 @@ import java.util.Collection; |
| 11 | import java.util.List; | 11 | import java.util.List; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | * 积木Service接口 | 14 | * 系列Service接口 |
| 15 | * | 15 | * |
| 16 | * @author GYongYi | 16 | * @author GYongYi |
| 17 | * @date 2024/9/8 15:24 | 17 | * @date 2024/9/8 15:24 |
| ... | @@ -73,7 +73,7 @@ public interface IBuildingBlockService { | ... | @@ -73,7 +73,7 @@ public interface IBuildingBlockService { |
| 73 | boolean remove(String id) throws ServerException; | 73 | boolean remove(String id) throws ServerException; |
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | * 根据ID集合获取积木 | 76 | * 根据ID集合获取系列 |
| 77 | * | 77 | * |
| 78 | * @param ids | 78 | * @param ids |
| 79 | * @return | 79 | * @return | ... | ... |
| ... | @@ -11,15 +11,16 @@ import com.lego.common.utils.MessageUtils; | ... | @@ -11,15 +11,16 @@ import com.lego.common.utils.MessageUtils; |
| 11 | import com.lego.common.utils.StreamUtils; | 11 | import com.lego.common.utils.StreamUtils; |
| 12 | import com.lego.core.annotation.LanguageAnnotation; | 12 | import com.lego.core.annotation.LanguageAnnotation; |
| 13 | import com.lego.core.domin.BuildingBlock; | 13 | import com.lego.core.domin.BuildingBlock; |
| 14 | import com.lego.core.domin.Course; | ||
| 15 | import com.lego.core.domin.Entirety; | ||
| 14 | import com.lego.core.domin.bo.BuildingBlockBo; | 16 | import com.lego.core.domin.bo.BuildingBlockBo; |
| 15 | import com.lego.core.domin.bo.BuildingBlockQueryBo; | 17 | import com.lego.core.domin.bo.BuildingBlockQueryBo; |
| 16 | import com.lego.core.domin.vo.BuildingBlockVo; | 18 | import com.lego.core.domin.vo.BuildingBlockVo; |
| 17 | import com.lego.core.domin.vo.CourseVo; | ||
| 18 | import com.lego.core.domin.vo.EntiretyVo; | 19 | import com.lego.core.domin.vo.EntiretyVo; |
| 19 | import com.lego.core.mapper.BuildingBlockMapper; | 20 | import com.lego.core.mapper.BuildingBlockMapper; |
| 21 | import com.lego.core.mapper.CourseMapper; | ||
| 20 | import com.lego.core.service.IBuildingBlockService; | 22 | import com.lego.core.service.IBuildingBlockService; |
| 21 | import com.lego.core.service.IEntiretyService; | 23 | import com.lego.core.service.IEntiretyService; |
| 22 | import io.micrometer.core.instrument.util.StringUtils; | ||
| 23 | import lombok.RequiredArgsConstructor; | 24 | import lombok.RequiredArgsConstructor; |
| 24 | import org.apache.commons.compress.utils.Lists; | 25 | import org.apache.commons.compress.utils.Lists; |
| 25 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
| ... | @@ -32,7 +33,7 @@ import java.util.Map; | ... | @@ -32,7 +33,7 @@ import java.util.Map; |
| 32 | import java.util.Set; | 33 | import java.util.Set; |
| 33 | 34 | ||
| 34 | /** | 35 | /** |
| 35 | * 积木Service业务层处理 | 36 | * 系列Service业务层处理 |
| 36 | * | 37 | * |
| 37 | * @author GYongYi | 38 | * @author GYongYi |
| 38 | * @date 2024/9/8 15:30 | 39 | * @date 2024/9/8 15:30 |
| ... | @@ -43,6 +44,7 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService { | ... | @@ -43,6 +44,7 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService { |
| 43 | private final BuildingBlockMapper baseMapper; | 44 | private final BuildingBlockMapper baseMapper; |
| 44 | private final IEntiretyService entiretyService; | 45 | private final IEntiretyService entiretyService; |
| 45 | private final OssService ossService; | 46 | private final OssService ossService; |
| 47 | private final CourseMapper courseMapper; | ||
| 46 | 48 | ||
| 47 | /** | 49 | /** |
| 48 | * 查询所有列表(带分页) | 50 | * 查询所有列表(带分页) |
| ... | @@ -54,7 +56,7 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService { | ... | @@ -54,7 +56,7 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService { |
| 54 | public TableDataInfo<BuildingBlockVo> listPage(BuildingBlockQueryBo queryBo, String language) { | 56 | public TableDataInfo<BuildingBlockVo> listPage(BuildingBlockQueryBo queryBo, String language) { |
| 55 | Page<BuildingBlockVo> page = baseMapper.selectVoPage(queryBo.build(), Wrappers.<BuildingBlock>lambdaQuery() | 57 | Page<BuildingBlockVo> page = baseMapper.selectVoPage(queryBo.build(), Wrappers.<BuildingBlock>lambdaQuery() |
| 56 | .like(StrUtil.isNotBlank(queryBo.getSearchKey()), BuildingBlock::getName, queryBo.getSearchKey()) | 58 | .like(StrUtil.isNotBlank(queryBo.getSearchKey()), BuildingBlock::getName, queryBo.getSearchKey()) |
| 57 | .eq(BuildingBlock::getLanguage, language)); | 59 | .eq(BuildingBlock::getLanguage, language).orderByAsc(BuildingBlock::getId)); |
| 58 | setInfo(page.getRecords()); | 60 | setInfo(page.getRecords()); |
| 59 | return TableDataInfo.build(page); | 61 | return TableDataInfo.build(page); |
| 60 | } | 62 | } |
| ... | @@ -160,11 +162,12 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService { | ... | @@ -160,11 +162,12 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService { |
| 160 | @Override | 162 | @Override |
| 161 | public boolean remove(String id) throws ServerException { | 163 | public boolean remove(String id) throws ServerException { |
| 162 | checkExists(id); | 164 | checkExists(id); |
| 165 | checkCourseExists(id); | ||
| 163 | return baseMapper.deleteById(id) > 0; | 166 | return baseMapper.deleteById(id) > 0; |
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | /** | 169 | /** |
| 167 | * 根据ID集合获取积木 | 170 | * 根据ID集合获取系列 |
| 168 | * | 171 | * |
| 169 | * @param ids | 172 | * @param ids |
| 170 | * @return | 173 | * @return |
| ... | @@ -193,4 +196,16 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService { | ... | @@ -193,4 +196,16 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService { |
| 193 | throw new ServerException(MessageUtils.message("core.data.not.exists")); | 196 | throw new ServerException(MessageUtils.message("core.data.not.exists")); |
| 194 | } | 197 | } |
| 195 | } | 198 | } |
| 199 | |||
| 200 | /** | ||
| 201 | * 校验数据是否存在 | ||
| 202 | * | ||
| 203 | * @param id | ||
| 204 | * @throws ServerException | ||
| 205 | */ | ||
| 206 | private void checkCourseExists(String id) throws ServerException { | ||
| 207 | if (courseMapper.exists(Wrappers.<Course>lambdaQuery().eq(Course::getBuildingBlockId, id))) { | ||
| 208 | throw new ServerException(MessageUtils.message("core.data.exists")); | ||
| 209 | } | ||
| 210 | } | ||
| 196 | } | 211 | } | ... | ... |
| ... | @@ -155,6 +155,7 @@ public class EntiretyServiceImpl implements IEntiretyService { | ... | @@ -155,6 +155,7 @@ public class EntiretyServiceImpl implements IEntiretyService { |
| 155 | @Override | 155 | @Override |
| 156 | public boolean remove(String id) throws ServerException { | 156 | public boolean remove(String id) throws ServerException { |
| 157 | checkExists(id); | 157 | checkExists(id); |
| 158 | checkBuildingBlockExists(id); | ||
| 158 | return baseMapper.deleteById(id) > 0; | 159 | return baseMapper.deleteById(id) > 0; |
| 159 | } | 160 | } |
| 160 | 161 | ||
| ... | @@ -174,4 +175,17 @@ public class EntiretyServiceImpl implements IEntiretyService { | ... | @@ -174,4 +175,17 @@ public class EntiretyServiceImpl implements IEntiretyService { |
| 174 | throw new ServerException(MessageUtils.message("core.data.not.exists")); | 175 | throw new ServerException(MessageUtils.message("core.data.not.exists")); |
| 175 | } | 176 | } |
| 176 | } | 177 | } |
| 178 | |||
| 179 | |||
| 180 | /** | ||
| 181 | * 校验数据是否存在 | ||
| 182 | * | ||
| 183 | * @param id | ||
| 184 | * @throws ServerException | ||
| 185 | */ | ||
| 186 | private void checkBuildingBlockExists(String id) throws ServerException { | ||
| 187 | if (buildingBlockMapper.exists(Wrappers.<BuildingBlock>lambdaQuery().eq(BuildingBlock::getEntiretyId, id))) { | ||
| 188 | throw new ServerException(MessageUtils.message("core.data.exists")); | ||
| 189 | } | ||
| 190 | } | ||
| 177 | } | 191 | } | ... | ... |
-
Please register or sign in to post a comment