This commit is contained in:
quantulr
2023-11-06 17:28:01 +08:00
parent 10e307b706
commit d6e1cdf5ba
11 changed files with 252 additions and 129 deletions

View File

@ -39,12 +39,12 @@ public class PcServiceImpI implements IPcService {
/**
* 主页
*
* @author cjh
* @return Map<String, Object>
* @author cjh
*/
@Override
public Map<String, Object> index() {
Map<String,Object> indexData = new LinkedHashMap<>();
Map<String, Object> indexData = new LinkedHashMap<>();
DecoratePage decoratePage = decoratePageMapper.selectOne(
new QueryWrapper<DecoratePage>()
.eq("id", 4)
@ -117,14 +117,14 @@ public class PcServiceImpI implements IPcService {
indexData.put("all", articlesAllList);
indexData.put("new", articlesNewList);
indexData.put("hot", articlesHostList);
return indexData;
return indexData;
}
/**
* 配置
*
* @author cjh
* @return Map<String, Object>
* @author cjh
*/
@Override
public Map<String, Object> getConfig() {
@ -154,33 +154,33 @@ public class PcServiceImpI implements IPcService {
websiteMap.put("pcTitle", websiteConfig.getOrDefault("pcTitle", ""));
// 演示公众号和小程序二维码
Map<String,String> qrCodeMap = new LinkedHashMap<>();
qrCodeMap.put("mnp",UrlUtils.toAbsoluteUrl(ConfigUtils.get("mp_channel","qrCode")));
qrCodeMap.put("oa",UrlUtils.toAbsoluteUrl(ConfigUtils.get("oa_channel","qrCode")));
Map<String, String> qrCodeMap = new LinkedHashMap<>();
qrCodeMap.put("mnp", UrlUtils.toAbsoluteUrl(ConfigUtils.get("mp_channel", "qrCode")));
qrCodeMap.put("oa", UrlUtils.toAbsoluteUrl(ConfigUtils.get("oa_channel", "qrCode")));
// 返回数据
config.put("version", GlobalConfig.version);
config.put("domain", UrlUtils.domain());
config.put("login", loginMap);
config.put("website", websiteMap);
config.put("copyright",copyrightMap);
config.put("qrcode",qrCodeMap);
config.put("copyright", copyrightMap);
config.put("qrcode", qrCodeMap);
return config;
}
/**
* 资讯中心
*
* @author fzr
* @return List<PcArticleCenterVo>
* @author fzr
*/
@Override
public List<PcArticleCenterVo> articleCenter() {
List<ArticleCategory> articleCategoryList = articleCategoryMapper.selectList(
new QueryWrapper<ArticleCategory>()
.eq("is_show", 1)
.eq("is_delete", 0)
.orderByDesc(Arrays.asList("sort", "id")));
.eq("is_show", 1)
.eq("is_delete", 0)
.orderByDesc(Arrays.asList("sort", "id")));
List<PcArticleCenterVo> list = new LinkedList<>();
for (ArticleCategory articleCategory : articleCategoryList) {
@ -213,19 +213,19 @@ public class PcServiceImpI implements IPcService {
/**
* 文章详情
*
* @author fzr
* @param id 文章主键
* @param id 文章主键
* @param userId 用户ID
* @return PcArticleDetailVo
* @author fzr
*/
@Override
public PcArticleDetailVo articleDetail(Integer id, Integer userId) {
// 文章详情
Article article = articleMapper.selectOne(new QueryWrapper<Article>()
.select(Article.class, info->
.select(Article.class, info ->
!info.getColumn().equals("is_show") &&
!info.getColumn().equals("is_delete") &&
!info.getColumn().equals("delete_time"))
!info.getColumn().equals("is_delete") &&
!info.getColumn().equals("delete_time"))
.eq("id", id)
.eq("is_delete", 0)
.last("limit 1"));
@ -237,14 +237,15 @@ public class PcServiceImpI implements IPcService {
// 分类名称
ArticleCategory articleCategory = articleCategoryMapper.selectOne(
new QueryWrapper<ArticleCategory>()
.eq("id", article.getCid())
.eq("is_delete", 0));
.eq("id", article.getCid())
.eq("is_delete", 0));
// 上一条记录
Article prev = articleMapper.selectOne(new QueryWrapper<Article>()
.select("id,title")
.lt("id", id)
.eq("is_delete", 0)
.eq(article.getCid() != null, "cid", article.getCid())
.orderByDesc(Arrays.asList("sort", "id"))
.last("limit 1"));
@ -253,6 +254,7 @@ public class PcServiceImpI implements IPcService {
.select("id,title")
.gt("id", id)
.eq("is_delete", 0)
.eq(article.getCid() != null, "cid", article.getCid())
.orderByDesc(Arrays.asList("sort", "id"))
.last("limit 1"));