| | |
| | | package com.xcong.farmer.cms; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.xcong.farmer.cms.modules.system.mapper.ColumnMapper; |
| | | import com.xcong.farmer.cms.modules.system.util.LoginUserUtil; |
| | | import com.xcong.farmer.cms.modules.system.vo.AdminArticleVo; |
| | | import com.xcong.farmer.cms.modules.system.vo.WebArticleVo; |
| | | import com.xcong.farmer.cms.modules.test.dao.TestUserDao; |
| | | import com.xcong.farmer.cms.modules.test.entity.TestUserEntity; |
| | | import org.jsoup.Jsoup; |
| | |
| | | private ArticleMapper articleMapper; |
| | | |
| | | @Test |
| | | public void articleTest(){ |
| | | WebArticleInPageDto webArticleInPageDto = new WebArticleInPageDto(); |
| | | webArticleInPageDto.setTimeType("一周内"); |
| | | webArticleInPageDto.setPageNum(1); |
| | | webArticleInPageDto.setPageSize(8); |
| | | Long companyId = 24L; |
| | | Page<WebArticleVo> page = new Page<>(webArticleInPageDto.getPageNum(), webArticleInPageDto.getPageSize()); |
| | | ArticleEntity articleEntity = new ArticleEntity(); |
| | | Long columnId = webArticleInPageDto.getColumnId() == null ? 0L : webArticleInPageDto.getColumnId(); |
| | | if(columnId != 0L){ |
| | | articleEntity.setColumnId(columnId); |
| | | } |
| | | String author = webArticleInPageDto.getAuthor(); |
| | | if(StrUtil.isNotEmpty(author)){ |
| | | articleEntity.setAuthor(author); |
| | | } |
| | | String queryKey = webArticleInPageDto.getQueryKey(); |
| | | if(StrUtil.isNotEmpty(queryKey)){ |
| | | articleEntity.setTitle(queryKey); |
| | | } |
| | | if(UserEntity.USER_BELONG_TOP != companyId){ |
| | | articleEntity.setCompanyId(companyId); |
| | | } |
| | | String timeType = webArticleInPageDto.getTimeType(); |
| | | if(StrUtil.isNotEmpty(timeType)){ |
| | | articleEntity.setTimeType(timeType); |
| | | } |
| | | IPage<WebArticleVo> list = articleMapper.selectWebArticleInPage(page,articleEntity); |
| | | System.out.println(list.getRecords()); |
| | | } |
| | | |
| | | @Test |
| | | public void dateTest(){ |
| | | String columnIdStrs = "68,63"; |
| | | AdminArticleDto adminArticleDto = new AdminArticleDto(); |
| | | |
| | | adminArticleDto.setColumnId(columnIdStrs); |
| | | adminArticleDto.setColumnIdStr(columnIdStrs); |
| | | adminArticleDto.setPageNum(1); |
| | | adminArticleDto.setPageSize(8); |
| | | Page<AdminArticleVo> page = new Page<>(adminArticleDto.getPageNum(), adminArticleDto.getPageSize()); |
| | | ArticleEntity articleEntity = new ArticleEntity(); |
| | | String columnIdStr = adminArticleDto.getColumnId(); |
| | | String columnIdStr = adminArticleDto.getColumnIdStr(); |
| | | if(StrUtil.isNotEmpty(columnIdStr)){ |
| | | long[] columnIdLongs = StrUtil.splitToLong(columnIdStr, StrUtil.COMMA); |
| | | List<Long> columnList = new ArrayList<>(); |