| | |
| | | @Override |
| | | public Result getArticleInPage(AdminArticleDto adminArticleDto) { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId(); |
| | | long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId(); |
| | | Page<AdminArticleVo> page = new Page<>(adminArticleDto.getPageNum(), adminArticleDto.getPageSize()); |
| | | ArticleEntity articleEntity = new ArticleEntity(); |
| | | Long columnId = adminArticleDto.getColumnId() == null ? 0L : adminArticleDto.getColumnId(); |
| | |
| | | if(StrUtil.isNotEmpty(title)){ |
| | | articleEntity.setTitle(title); |
| | | } |
| | | if(UserEntity.USER_BELONG_TOP != belongId){ |
| | | articleEntity.setBelongId(belongId); |
| | | } |
| | | IPage<AdminArticleVo> list = this.baseMapper.selectAdminArticleInPage(page,articleEntity); |
| | | return Result.ok(list); |
| | | } |
| | |
| | | @Transactional |
| | | public Result addArticle(AdminAddArticleDto adminAddArticleDto) { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId(); |
| | | long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId(); |
| | | ArticleEntity articleEntity = new ArticleEntity(); |
| | | articleEntity.setBelongId(belongId); |
| | | String title = adminAddArticleDto.getTitle(); |
| | |
| | | String author = adminAddArticleDto.getAuthor(); |
| | | if(StrUtil.isNotEmpty(author)){ |
| | | articleEntity.setAuthor(author); |
| | | } |
| | | String authorBelong = adminAddArticleDto.getAuthorBelong(); |
| | | if(StrUtil.isNotEmpty(authorBelong)){ |
| | | articleEntity.setAuthorBelong(authorBelong); |
| | | } |
| | | String remark = adminAddArticleDto.getRemark(); |
| | | if(StrUtil.isNotEmpty(remark)){ |
| | |
| | | } |
| | | articleEntity.setTitle(title); |
| | | String childTitle = adminUpdateArticleDto.getChildTitle(); |
| | | if(StrUtil.isNotEmpty(childTitle)){ |
| | | articleEntity.setChildTitle(childTitle); |
| | | } |
| | | String author = adminUpdateArticleDto.getAuthor(); |
| | | if(StrUtil.isNotEmpty(author)){ |
| | | articleEntity.setAuthor(author); |
| | | } |
| | | |
| | | String remark = adminUpdateArticleDto.getRemark(); |
| | | if(StrUtil.isNotEmpty(remark)){ |
| | | articleEntity.setRemark(remark); |
| | | } |
| | | long columnId = adminUpdateArticleDto.getColumnId() == null ? 0L : adminUpdateArticleDto.getColumnId(); |
| | | if(columnId == 0L){ |
| | | return Result.fail("请选择文章栏目"); |
| | |
| | | Integer visits = adminUpdateArticleDto.getVisits() == null ? 0 : adminUpdateArticleDto.getVisits(); |
| | | articleEntity.setVisits(visits); |
| | | String mainDiagram = adminUpdateArticleDto.getMainDiagram(); |
| | | if(StrUtil.isNotEmpty(mainDiagram)){ |
| | | articleEntity.setMainDiagram(mainDiagram); |
| | | } |
| | | String atlas = adminUpdateArticleDto.getAtlas(); |
| | | articleEntity.setAtlas(atlas); |
| | | Date releaseTime = adminUpdateArticleDto.getReleaseTime(); |