| | |
| | | |
| | | @Override |
| | | public List<Slideshow> selectList() { |
| | | return baseMapper.selectList(new QueryWrapper<Slideshow>().lambda()); |
| | | return baseMapper.selectList(new QueryWrapper<Slideshow>().lambda()); |
| | | } |
| | | |
| | | @Override |
| | | public Slideshow queryById(Integer id) { |
| | | return baseMapper.selectOne(new QueryWrapper<Slideshow>().lambda().eq(Slideshow::getId,id)); |
| | | return baseMapper.selectOne(new QueryWrapper<Slideshow>().lambda().eq(Slideshow::getId, id)); |
| | | } |
| | | |
| | | @Override |
| | | public ResultData add(Slideshow slideshow){ |
| | | if (slideshow.getUrl()==null||slideshow.getUrl()=="") |
| | | return ResultData.error("图片地址不能为空"); |
| | | if (slideshow.getLinkType()==null) |
| | | return ResultData.error("跳转链接类型不能为空"); |
| | | if (slideshow.getTitle()==null||slideshow.getTitle()=="") |
| | | return ResultData.error("标题不能为空"); |
| | | if (slideshow.getLinkType().equals(2)&&(slideshow.getContent()==null||slideshow.getContent()=="")) |
| | | return ResultData.error("类型为富文本时,富文本内容不能为空"); |
| | | if (slideshow.getLinkType().equals(4)&&(slideshow.getLink()==null||slideshow.getLink()=="")) |
| | | return ResultData.error("类型为微信文章时,文章链接容不能为空"); |
| | | public ResultData add(Slideshow slideshow) { |
| | | if (slideshow.getUrl() == null || slideshow.getUrl() == "") |
| | | return ResultData.error("图片地址不能为空"); |
| | | if (slideshow.getLinkType() == null) |
| | | return ResultData.error("跳转链接类型不能为空"); |
| | | if (slideshow.getLinkType().equals(2)) { |
| | | if (slideshow.getTitle() == null || slideshow.getTitle() == "") |
| | | return ResultData.error("类型为富文本时,标题不能为空"); |
| | | if (slideshow.getContent() == null || slideshow.getContent() == "") |
| | | return ResultData.error("类型为富文本时,富文本内容不能为空"); |
| | | } |
| | | if (slideshow.getLinkType().equals(3) && (slideshow.getLink() == null || slideshow.getLink() == "")) |
| | | return ResultData.error("类型为微信文章时,文章链接容不能为空"); |
| | | slideshow.setCreateTime(LocalDateTime.now()); |
| | | return ResultData.success( baseMapper.insert(slideshow)) ; |
| | | return ResultData.success(baseMapper.insert(slideshow)); |
| | | } |
| | | |
| | | @Override |
| | | public ResultData update(Slideshow slideshow){ |
| | | if (slideshow.getUrl()==null||slideshow.getUrl()=="") |
| | | return ResultData.error("图片地址不能为空"); |
| | | if (slideshow.getLinkType()==null) |
| | | return ResultData.error("跳转链接类型不能为空"); |
| | | if (slideshow.getTitle()==null||slideshow.getTitle()=="") |
| | | return ResultData.error("标题不能为空"); |
| | | if (slideshow.getLinkType().equals(2)&&(slideshow.getContent()==null||slideshow.getContent()=="")) |
| | | return ResultData.error("类型为富文本时,富文本内容不能为空"); |
| | | if (slideshow.getLinkType().equals(4)&&(slideshow.getLink()==null||slideshow.getLink()=="")) |
| | | return ResultData.error("类型为微信文章时,文章链接容不能为空"); |
| | | return ResultData.success(baseMapper.updateById(slideshow)); |
| | | public ResultData update(Slideshow slideshow) { |
| | | if (slideshow.getUrl() == null || slideshow.getUrl() == "") |
| | | return ResultData.error("图片地址不能为空"); |
| | | if (slideshow.getLinkType() == null) |
| | | return ResultData.error("跳转链接类型不能为空"); |
| | | if (slideshow.getLinkType().equals(2)) { |
| | | if (slideshow.getTitle() == null || slideshow.getTitle() == "") |
| | | return ResultData.error("类型为富文本时,标题不能为空"); |
| | | if (slideshow.getContent() == null || slideshow.getContent() == "") |
| | | return ResultData.error("类型为富文本时,富文本内容不能为空"); |
| | | } |
| | | if (slideshow.getLinkType().equals(3) && (slideshow.getLink() == null || slideshow.getLink() == "")) |
| | | return ResultData.error("类型为微信文章时,文章链接容不能为空"); |
| | | return ResultData.success(baseMapper.updateById(slideshow)); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public ResultData delete(Integer id){ |
| | | public ResultData delete(Integer id) { |
| | | int i = baseMapper.deleteById(id); |
| | | if(i>0) |
| | | return ResultData.success(); |
| | | if (i > 0) |
| | | return ResultData.success(); |
| | | else |
| | | return ResultData.error(); |
| | | return ResultData.error(); |
| | | } |
| | | |
| | | } |