no message
Showing
4 changed files
with
111 additions
and
8 deletions
| ... | @@ -87,4 +87,29 @@ public class EntiretyController extends BaseController { | ... | @@ -87,4 +87,29 @@ public class EntiretyController extends BaseController { |
| 87 | public R<Void> remove(@PathVariable String id) throws ServerException { | 87 | public R<Void> remove(@PathVariable String id) throws ServerException { |
| 88 | return toAjax(service.remove(id)); | 88 | return toAjax(service.remove(id)); |
| 89 | } | 89 | } |
| 90 | |||
| 91 | |||
| 92 | @RepeatSubmit() | ||
| 93 | @PutMapping("/display/{id}") | ||
| 94 | public R<Void> display(@PathVariable String id) throws ServerException { | ||
| 95 | return toAjax(service.display(id)); | ||
| 96 | } | ||
| 97 | |||
| 98 | @RepeatSubmit() | ||
| 99 | @PutMapping("/batch/display/{entiretyIds}") | ||
| 100 | public R<Void> batchDisplay(@PathVariable String[] entiretyIds) throws ServerException { | ||
| 101 | return toAjax(service.batchDisplay(entiretyIds)); | ||
| 102 | } | ||
| 103 | |||
| 104 | @RepeatSubmit() | ||
| 105 | @PutMapping("/hide/{id}") | ||
| 106 | public R<Void> hide(@PathVariable String id) throws ServerException { | ||
| 107 | return toAjax(service.hide(id)); | ||
| 108 | } | ||
| 109 | |||
| 110 | @RepeatSubmit() | ||
| 111 | @PutMapping("/batch/hide/{entiretyIds}") | ||
| 112 | public R<Void> batchHide(@PathVariable String[] entiretyIds) throws ServerException { | ||
| 113 | return toAjax(service.batchHide(entiretyIds)); | ||
| 114 | } | ||
| 90 | } | 115 | } | ... | ... |
| ... | @@ -79,4 +79,39 @@ public interface IEntiretyService { | ... | @@ -79,4 +79,39 @@ public interface IEntiretyService { |
| 79 | * @return | 79 | * @return |
| 80 | */ | 80 | */ |
| 81 | List<EntiretyVo> list(String language, Collection<String> buildingBlockIds); | 81 | List<EntiretyVo> list(String language, Collection<String> buildingBlockIds); |
| 82 | |||
| 83 | /** | ||
| 84 | * 隐藏 | ||
| 85 | * | ||
| 86 | * @param id | ||
| 87 | * @return | ||
| 88 | * @throws ServerException | ||
| 89 | */ | ||
| 90 | boolean hide(String id) throws ServerException; | ||
| 91 | |||
| 92 | /** | ||
| 93 | * 批量隐藏 | ||
| 94 | * | ||
| 95 | * @param entiretyIds | ||
| 96 | * @return | ||
| 97 | * @throws ServerException | ||
| 98 | */ | ||
| 99 | boolean batchHide(String[] entiretyIds) throws ServerException; | ||
| 100 | /** | ||
| 101 | * 显示 | ||
| 102 | * | ||
| 103 | * @param id | ||
| 104 | * @return | ||
| 105 | * @throws ServerException | ||
| 106 | */ | ||
| 107 | boolean display(String id) throws ServerException; | ||
| 108 | |||
| 109 | /** | ||
| 110 | * 批量显示 | ||
| 111 | * | ||
| 112 | * @param entiretyIds | ||
| 113 | * @return | ||
| 114 | * @throws ServerException | ||
| 115 | */ | ||
| 116 | boolean batchDisplay(String[] entiretyIds) throws ServerException; | ||
| 82 | } | 117 | } | ... | ... |
| ... | @@ -17,6 +17,7 @@ import com.lego.common.utils.StreamUtils; | ... | @@ -17,6 +17,7 @@ import com.lego.common.utils.StreamUtils; |
| 17 | import com.lego.common.utils.StringUtils; | 17 | import com.lego.common.utils.StringUtils; |
| 18 | import com.lego.core.annotation.LanguageAnnotation; | 18 | import com.lego.core.annotation.LanguageAnnotation; |
| 19 | import com.lego.core.domain.Course; | 19 | import com.lego.core.domain.Course; |
| 20 | import com.lego.core.domain.Entirety; | ||
| 20 | import com.lego.core.domain.bo.CourseBo; | 21 | import com.lego.core.domain.bo.CourseBo; |
| 21 | import com.lego.core.domain.bo.CourseQueryBo; | 22 | import com.lego.core.domain.bo.CourseQueryBo; |
| 22 | import com.lego.core.domain.vo.CourseVo; | 23 | import com.lego.core.domain.vo.CourseVo; |
| ... | @@ -96,10 +97,10 @@ public class CourseServiceImpl implements ICourseService { | ... | @@ -96,10 +97,10 @@ public class CourseServiceImpl implements ICourseService { |
| 96 | vo.setPptOssUrl(ossUrlService.selectUrlByIds(vo.getPptOssId())); | 97 | vo.setPptOssUrl(ossUrlService.selectUrlByIds(vo.getPptOssId())); |
| 97 | } | 98 | } |
| 98 | if(vo.isVisible()){ | 99 | if(vo.isVisible()){ |
| 99 | vo.setDisplay("已显示"); | 100 | vo.setDisplay("【已显示】"); |
| 100 | } | 101 | } |
| 101 | else{ | 102 | else{ |
| 102 | vo.setDisplay("已隐藏"); | 103 | vo.setDisplay("【已隐藏】"); |
| 103 | } | 104 | } |
| 104 | } | 105 | } |
| 105 | } | 106 | } |
| ... | @@ -147,7 +148,7 @@ public class CourseServiceImpl implements ICourseService { | ... | @@ -147,7 +148,7 @@ public class CourseServiceImpl implements ICourseService { |
| 147 | */ | 148 | */ |
| 148 | @Override | 149 | @Override |
| 149 | public List<CourseVo> list() { | 150 | public List<CourseVo> list() { |
| 150 | List<CourseVo> list = baseMapper.selectVoList(null); | 151 | List<CourseVo> list = baseMapper.selectVoList(Wrappers.<Course>lambdaQuery().eq(Course::isVisible, true)); |
| 151 | for (CourseVo vo : list) { | 152 | for (CourseVo vo : list) { |
| 152 | if(StrUtil.isNotBlank(vo.getTwoDimensionalOssId())){ | 153 | if(StrUtil.isNotBlank(vo.getTwoDimensionalOssId())){ |
| 153 | vo.setTwoDimensionalOssUrl(ossUrlService.selectUrlByIds(vo.getTwoDimensionalOssId())); | 154 | vo.setTwoDimensionalOssUrl(ossUrlService.selectUrlByIds(vo.getTwoDimensionalOssId())); |
| ... | @@ -306,10 +307,6 @@ public class CourseServiceImpl implements ICourseService { | ... | @@ -306,10 +307,6 @@ public class CourseServiceImpl implements ICourseService { |
| 306 | 307 | ||
| 307 | @Override | 308 | @Override |
| 308 | public boolean batchDisplay(String[] courseIds) throws ServerException { | 309 | public boolean batchDisplay(String[] courseIds) throws ServerException { |
| 309 | if(courseIds==null) | ||
| 310 | System.out.println("=============1=========="); | ||
| 311 | else | ||
| 312 | System.out.println("========================"+Arrays.asList(courseIds)); | ||
| 313 | for (String id : courseIds) { | 310 | for (String id : courseIds) { |
| 314 | CourseVo courseVo = baseMapper.selectVoById(id); | 311 | CourseVo courseVo = baseMapper.selectVoById(id); |
| 315 | courseVo.setVisible(true); | 312 | courseVo.setVisible(true); | ... | ... |
| ... | @@ -16,6 +16,7 @@ import com.lego.core.domain.Course; | ... | @@ -16,6 +16,7 @@ import com.lego.core.domain.Course; |
| 16 | import com.lego.core.domain.Entirety; | 16 | import com.lego.core.domain.Entirety; |
| 17 | import com.lego.core.domain.bo.EntiretyBo; | 17 | import com.lego.core.domain.bo.EntiretyBo; |
| 18 | import com.lego.core.domain.vo.BuildingBlockVo; | 18 | import com.lego.core.domain.vo.BuildingBlockVo; |
| 19 | import com.lego.core.domain.vo.CourseVo; | ||
| 19 | import com.lego.core.domain.vo.EntiretyVo; | 20 | import com.lego.core.domain.vo.EntiretyVo; |
| 20 | import com.lego.core.mapper.CourseMapper; | 21 | import com.lego.core.mapper.CourseMapper; |
| 21 | import com.lego.core.mapper.EntiretyMapper; | 22 | import com.lego.core.mapper.EntiretyMapper; |
| ... | @@ -93,7 +94,7 @@ public class EntiretyServiceImpl implements IEntiretyService { | ... | @@ -93,7 +94,7 @@ public class EntiretyServiceImpl implements IEntiretyService { |
| 93 | */ | 94 | */ |
| 94 | @Override | 95 | @Override |
| 95 | public List<EntiretyVo> list() { | 96 | public List<EntiretyVo> list() { |
| 96 | List<EntiretyVo> list = baseMapper.selectVoList(null); | 97 | List<EntiretyVo> list = baseMapper.selectVoList(Wrappers.<Entirety>lambdaQuery().eq(Entirety::isVisible, true)); |
| 97 | setInfo(list); | 98 | setInfo(list); |
| 98 | return list; | 99 | return list; |
| 99 | } | 100 | } |
| ... | @@ -188,6 +189,12 @@ public class EntiretyServiceImpl implements IEntiretyService { | ... | @@ -188,6 +189,12 @@ public class EntiretyServiceImpl implements IEntiretyService { |
| 188 | if (StrUtil.isNotBlank(vo.getOssId())) { | 189 | if (StrUtil.isNotBlank(vo.getOssId())) { |
| 189 | vo.setOssUrl(ossUrlService.selectUrlByIds(vo.getOssId())); | 190 | vo.setOssUrl(ossUrlService.selectUrlByIds(vo.getOssId())); |
| 190 | } | 191 | } |
| 192 | if(vo.isVisible()){ | ||
| 193 | vo.setDisplay("【已显示】"); | ||
| 194 | } | ||
| 195 | else{ | ||
| 196 | vo.setDisplay("【已隐藏】"); | ||
| 197 | } | ||
| 191 | } | 198 | } |
| 192 | } | 199 | } |
| 193 | } | 200 | } |
| ... | @@ -203,4 +210,43 @@ public class EntiretyServiceImpl implements IEntiretyService { | ... | @@ -203,4 +210,43 @@ public class EntiretyServiceImpl implements IEntiretyService { |
| 203 | throw new ServerException(MessageUtils.message("core.data.exists")); | 210 | throw new ServerException(MessageUtils.message("core.data.exists")); |
| 204 | } | 211 | } |
| 205 | } | 212 | } |
| 213 | |||
| 214 | |||
| 215 | @Override | ||
| 216 | public boolean display(String id) throws ServerException { | ||
| 217 | EntiretyVo entiretyVo = baseMapper.selectVoById(id); | ||
| 218 | entiretyVo.setVisible(true); | ||
| 219 | Entirety entirety = BeanUtil.toBean(entiretyVo, Entirety.class); | ||
| 220 | return baseMapper.updateById(entirety) > 0; | ||
| 221 | } | ||
| 222 | |||
| 223 | @Override | ||
| 224 | public boolean batchDisplay(String[] entiretyIds) throws ServerException { | ||
| 225 | for (String id : entiretyIds) { | ||
| 226 | EntiretyVo entiretyVo = baseMapper.selectVoById(id); | ||
| 227 | entiretyVo.setVisible(true); | ||
| 228 | Entirety entirety = BeanUtil.toBean(entiretyVo, Entirety.class); | ||
| 229 | baseMapper.updateById(entirety); | ||
| 230 | } | ||
| 231 | return true; | ||
| 232 | } | ||
| 233 | |||
| 234 | @Override | ||
| 235 | public boolean hide(String id) throws ServerException { | ||
| 236 | EntiretyVo entiretyVo = baseMapper.selectVoById(id); | ||
| 237 | entiretyVo.setVisible(false); | ||
| 238 | Entirety entirety = BeanUtil.toBean(entiretyVo, Entirety.class); | ||
| 239 | return baseMapper.updateById(entirety) > 0; | ||
| 240 | } | ||
| 241 | |||
| 242 | @Override | ||
| 243 | public boolean batchHide(String[] entiretyIds) throws ServerException { | ||
| 244 | for (String id : entiretyIds) { | ||
| 245 | EntiretyVo entiretyVo = baseMapper.selectVoById(id); | ||
| 246 | entiretyVo.setVisible(false); | ||
| 247 | Entirety entirety = BeanUtil.toBean(entiretyVo, Entirety.class); | ||
| 248 | baseMapper.updateById(entirety); | ||
| 249 | } | ||
| 250 | return true; | ||
| 251 | } | ||
| 206 | } | 252 | } | ... | ... |
-
Please register or sign in to post a comment