parent
8f30271702
commit
11aa66ef8d
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 80,
|
||||||
|
"proseWrap": "preserve",
|
||||||
|
"bracketSameLine": false,
|
||||||
|
"endOfLine": "auto",
|
||||||
|
"tabWidth": 4,
|
||||||
|
"useTabs": false,
|
||||||
|
"trailingComma": "none"
|
||||||
|
}
|
||||||
23
pc/app.vue
23
pc/app.vue
|
|
@ -2,6 +2,7 @@
|
||||||
import { ID_INJECTION_KEY, ElConfigProvider } from 'element-plus'
|
import { ID_INJECTION_KEY, ElConfigProvider } from 'element-plus'
|
||||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||||
import { useAppStore } from './stores/app'
|
import { useAppStore } from './stores/app'
|
||||||
|
|
||||||
provide(ID_INJECTION_KEY, {
|
provide(ID_INJECTION_KEY, {
|
||||||
prefix: 100,
|
prefix: 100,
|
||||||
current: 0
|
current: 0
|
||||||
|
|
@ -11,7 +12,8 @@ const config = {
|
||||||
}
|
}
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const { pc_title, pc_ico, pc_keywords, pc_desc } = appStore.getWebsiteConfig
|
const { pc_title, pc_ico, pc_keywords, pc_desc } = appStore.getWebsiteConfig
|
||||||
useHead({
|
const { clarity_code } = appStore.getSiteStatistics
|
||||||
|
const headOptions: any = {
|
||||||
title: pc_title,
|
title: pc_title,
|
||||||
meta: [
|
meta: [
|
||||||
{ name: 'description', content: pc_desc },
|
{ name: 'description', content: pc_desc },
|
||||||
|
|
@ -22,8 +24,23 @@ useHead({
|
||||||
rel: 'icon',
|
rel: 'icon',
|
||||||
href: pc_ico
|
href: pc_ico
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
})
|
script: []
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clarity_code) {
|
||||||
|
headOptions.script.push({
|
||||||
|
type: 'text/javascript',
|
||||||
|
innerHTML: `
|
||||||
|
(function(c,l,a,r,i,t,y){
|
||||||
|
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
||||||
|
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
||||||
|
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
||||||
|
})(window, document, "clarity", "script", "${clarity_code}");
|
||||||
|
`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
useHead(headOptions)
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<ElConfigProvider v-bind="config">
|
<ElConfigProvider v-bind="config">
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,9 @@ export enum RequestMethodsEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum RequestCodeEnum {
|
export enum RequestCodeEnum {
|
||||||
SUCCESS = 1,
|
NOT_INSTALL = -2,
|
||||||
FAIL = 0,
|
|
||||||
LOGIN_FAILURE = -1,
|
LOGIN_FAILURE = -1,
|
||||||
|
FAIL = 0,
|
||||||
|
SUCCESS = 1,
|
||||||
OPEN_NEW_PAGE = 2
|
OPEN_NEW_PAGE = 2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,28 @@
|
||||||
<template>
|
<template>
|
||||||
<section class="layout-default min-w-[1200px]">
|
<section class="layout-default min-w-[1200px]">
|
||||||
<LayoutHeader />
|
<LayoutHeader />
|
||||||
<div class="main-contain">
|
<div class="main-contain">
|
||||||
<LayoutMain class="flex-1 min-h-0 flex">
|
<LayoutMain class="flex-1 min-h-0 flex">
|
||||||
<slot v-if="userStore.isLogin || !$route.meta.auth" />
|
<slot v-if="userStore.isLogin || !$route.meta.auth" />
|
||||||
<ToLogin class="h-full" v-else />
|
<ToLogin class="h-full" v-else />
|
||||||
</LayoutMain>
|
</LayoutMain>
|
||||||
<LayoutFooter />
|
<LayoutFooter />
|
||||||
</div>
|
</div>
|
||||||
<Account />
|
<Account />
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import LayoutHeader from './components/header/index.vue'
|
import LayoutHeader from "./components/header/index.vue";
|
||||||
import LayoutMain from './components/main/index.vue'
|
import LayoutMain from "./components/main/index.vue";
|
||||||
import LayoutFooter from './components/footer/index.vue'
|
import LayoutFooter from "./components/footer/index.vue";
|
||||||
import Account from './components/account/index.vue'
|
import Account from "./components/account/index.vue";
|
||||||
import { useUserStore } from '~~/stores/user'
|
import { useUserStore } from "~~/stores/user";
|
||||||
import ToLogin from './components/account/to-login.vue'
|
import ToLogin from "./components/account/to-login.vue";
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore();
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.main-contain {
|
.main-contain {
|
||||||
min-height: calc(100vh - var(--header-height));
|
min-height: calc(100vh - var(--header-height));
|
||||||
@apply flex flex-col;
|
@apply flex flex-col;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ export const useAppStore = defineStore({
|
||||||
getLoginConfig: (state) => state.config.login || {},
|
getLoginConfig: (state) => state.config.login || {},
|
||||||
getCopyrightConfig: (state) => state.config.copyright || [],
|
getCopyrightConfig: (state) => state.config.copyright || [],
|
||||||
getQrcodeConfig: (state) => state.config.qrcode || {},
|
getQrcodeConfig: (state) => state.config.qrcode || {},
|
||||||
getAdminUrl: (state) => state.config.admin_url
|
getAdminUrl: (state) => state.config.admin_url,
|
||||||
|
getSiteStatistics: (state) => state.config.siteStatistics || {}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async getConfig() {
|
async getConfig() {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export const useUserStore = defineStore({
|
||||||
const data = await getUserCenter()
|
const data = await getUserCenter()
|
||||||
this.userInfo = data
|
this.userInfo = data
|
||||||
},
|
},
|
||||||
setUser(userInfo) {
|
setUser(userInfo: any) {
|
||||||
this.userInfo = userInfo
|
this.userInfo = userInfo
|
||||||
},
|
},
|
||||||
login(token: string) {
|
login(token: string) {
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,9 @@ export function createRequest(opt?: Partial<FetchOptions>) {
|
||||||
case RequestCodeEnum.LOGIN_FAILURE:
|
case RequestCodeEnum.LOGIN_FAILURE:
|
||||||
userStore.logout()
|
userStore.logout()
|
||||||
return Promise.reject(data)
|
return Promise.reject(data)
|
||||||
|
case RequestCodeEnum.NOT_INSTALL:
|
||||||
|
window.location.replace('/install/install.php')
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ import com.mdd.admin.validate.commons.PageValidate;
|
||||||
import com.mdd.admin.vo.article.ArticleCateVo;
|
import com.mdd.admin.vo.article.ArticleCateVo;
|
||||||
import com.mdd.common.core.PageResult;
|
import com.mdd.common.core.PageResult;
|
||||||
import com.mdd.common.entity.article.Article;
|
import com.mdd.common.entity.article.Article;
|
||||||
import com.mdd.common.entity.article.ArticleCategory;
|
import com.mdd.common.entity.article.ArticleCate;
|
||||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
import com.mdd.common.mapper.article.ArticleCateMapper;
|
||||||
import com.mdd.common.mapper.article.ArticleMapper;
|
import com.mdd.common.mapper.article.ArticleMapper;
|
||||||
import com.mdd.common.util.TimeUtils;
|
import com.mdd.common.util.TimeUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
@ -31,7 +31,7 @@ import java.util.List;
|
||||||
public class ArtCateServiceImpl implements IArtCateService {
|
public class ArtCateServiceImpl implements IArtCateService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ArticleCategoryMapper articleCategoryMapper;
|
ArticleCateMapper articleCategoryMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ArticleMapper articleMapper;
|
ArticleMapper articleMapper;
|
||||||
|
|
@ -44,15 +44,15 @@ public class ArtCateServiceImpl implements IArtCateService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ArticleCateVo> all() {
|
public List<ArticleCateVo> all() {
|
||||||
QueryWrapper<ArticleCategory> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ArticleCate> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.select("id", "name", "sort", "is_show", "create_time", "update_time")
|
queryWrapper.select("id", "name", "sort", "is_show", "create_time", "update_time")
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc(Arrays.asList("sort", "id"));
|
.orderByDesc(Arrays.asList("sort", "id"));
|
||||||
|
|
||||||
List<ArticleCategory> lists = articleCategoryMapper.selectList(queryWrapper);
|
List<ArticleCate> lists = articleCategoryMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
List<ArticleCateVo> vos = new ArrayList<>();
|
List<ArticleCateVo> vos = new ArrayList<>();
|
||||||
for (ArticleCategory category : lists) {
|
for (ArticleCate category : lists) {
|
||||||
ArticleCateVo vo = new ArticleCateVo();
|
ArticleCateVo vo = new ArticleCateVo();
|
||||||
BeanUtils.copyProperties(category, vo);
|
BeanUtils.copyProperties(category, vo);
|
||||||
|
|
||||||
|
|
@ -76,9 +76,9 @@ public class ArtCateServiceImpl implements IArtCateService {
|
||||||
Integer pageNo = pageValidate.getPageNo();
|
Integer pageNo = pageValidate.getPageNo();
|
||||||
Integer pageSize = pageValidate.getPageSize();
|
Integer pageSize = pageValidate.getPageSize();
|
||||||
|
|
||||||
QueryWrapper<ArticleCategory> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ArticleCate> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.select("id", "name", "sort", "is_show", "create_time", "update_time")
|
queryWrapper.select("id", "name", "sort", "is_show", "create_time", "update_time")
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc(Arrays.asList("sort", "id"));
|
.orderByDesc(Arrays.asList("sort", "id"));
|
||||||
|
|
||||||
articleCategoryMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
articleCategoryMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||||
|
|
@ -86,16 +86,16 @@ public class ArtCateServiceImpl implements IArtCateService {
|
||||||
"=:isShow@is_show:int"
|
"=:isShow@is_show:int"
|
||||||
});
|
});
|
||||||
|
|
||||||
IPage<ArticleCategory> iPage = articleCategoryMapper.selectPage(new Page<>(pageNo, pageSize), queryWrapper);
|
IPage<ArticleCate> iPage = articleCategoryMapper.selectPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||||
|
|
||||||
List<ArticleCateVo> list = new ArrayList<>();
|
List<ArticleCateVo> list = new ArrayList<>();
|
||||||
for (ArticleCategory category : iPage.getRecords()) {
|
for (ArticleCate category : iPage.getRecords()) {
|
||||||
ArticleCateVo vo = new ArticleCateVo();
|
ArticleCateVo vo = new ArticleCateVo();
|
||||||
BeanUtils.copyProperties(category, vo);
|
BeanUtils.copyProperties(category, vo);
|
||||||
|
|
||||||
Long number = articleMapper.selectCount(new QueryWrapper<Article>()
|
Long number = articleMapper.selectCount(new QueryWrapper<Article>()
|
||||||
.eq("cid", category.getId())
|
.eq("cid", category.getId())
|
||||||
.eq("is_delete", 0));
|
.isNull("delete_time"));
|
||||||
|
|
||||||
vo.setNumber(number);
|
vo.setNumber(number);
|
||||||
vo.setCreateTime(TimeUtils.timestampToDate(vo.getCreateTime()));
|
vo.setCreateTime(TimeUtils.timestampToDate(vo.getCreateTime()));
|
||||||
|
|
@ -115,13 +115,12 @@ public class ArtCateServiceImpl implements IArtCateService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ArticleCateVo detail(Integer id) {
|
public ArticleCateVo detail(Integer id) {
|
||||||
ArticleCategory model = articleCategoryMapper.selectOne(
|
ArticleCate model = articleCategoryMapper.selectOne(
|
||||||
new QueryWrapper<ArticleCategory>()
|
new QueryWrapper<ArticleCate>()
|
||||||
.select(ArticleCategory.class, info->
|
.select(ArticleCate.class, info->
|
||||||
!info.getColumn().equals("is_delete") &&
|
|
||||||
!info.getColumn().equals("delete_time"))
|
!info.getColumn().equals("delete_time"))
|
||||||
.eq("id", id)
|
.eq("id", id)
|
||||||
.eq("is_delete", 0));
|
.isNull("delete_time"));
|
||||||
|
|
||||||
Assert.notNull(model, "分类不存在");
|
Assert.notNull(model, "分类不存在");
|
||||||
|
|
||||||
|
|
@ -141,7 +140,7 @@ public class ArtCateServiceImpl implements IArtCateService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void add(ArtCateCreateValidate createValidate) {
|
public void add(ArtCateCreateValidate createValidate) {
|
||||||
ArticleCategory model = new ArticleCategory();
|
ArticleCate model = new ArticleCate();
|
||||||
model.setName(createValidate.getName());
|
model.setName(createValidate.getName());
|
||||||
model.setSort(createValidate.getSort());
|
model.setSort(createValidate.getSort());
|
||||||
model.setIsShow(model.getIsShow());
|
model.setIsShow(model.getIsShow());
|
||||||
|
|
@ -158,13 +157,13 @@ public class ArtCateServiceImpl implements IArtCateService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void edit(ArtCateUpdateValidate updateValidate) {
|
public void edit(ArtCateUpdateValidate updateValidate) {
|
||||||
ArticleCategory model = articleCategoryMapper.selectOne(
|
ArticleCate model = articleCategoryMapper.selectOne(
|
||||||
new QueryWrapper<ArticleCategory>()
|
new QueryWrapper<ArticleCate>()
|
||||||
.select(ArticleCategory.class, info->
|
.select(ArticleCate.class, info->
|
||||||
!info.getColumn().equals("is_delete") &&
|
!info.getColumn().equals("is_delete") &&
|
||||||
!info.getColumn().equals("delete_time"))
|
!info.getColumn().equals("delete_time"))
|
||||||
.eq("id", updateValidate.getId())
|
.eq("id", updateValidate.getId())
|
||||||
.eq("is_delete", 0));
|
.isNull("delete_time"));
|
||||||
|
|
||||||
Assert.notNull(model, "分类不存在");
|
Assert.notNull(model, "分类不存在");
|
||||||
|
|
||||||
|
|
@ -183,22 +182,21 @@ public class ArtCateServiceImpl implements IArtCateService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void del(Integer id) {
|
public void del(Integer id) {
|
||||||
ArticleCategory model = articleCategoryMapper.selectOne(
|
ArticleCate model = articleCategoryMapper.selectOne(
|
||||||
new QueryWrapper<ArticleCategory>()
|
new QueryWrapper<ArticleCate>()
|
||||||
.select("id,is_show")
|
.select("id,is_show")
|
||||||
.eq("id", id)
|
.eq("id", id)
|
||||||
.eq("is_delete", 0));
|
.isNull("delete_time"));
|
||||||
|
|
||||||
Assert.notNull(model, "分类不存在");
|
Assert.notNull(model, "分类不存在");
|
||||||
|
|
||||||
Article article = articleMapper.selectOne(new QueryWrapper<Article>()
|
Article article = articleMapper.selectOne(new QueryWrapper<Article>()
|
||||||
.eq("cid", id)
|
.eq("cid", id)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
|
|
||||||
Assert.isNull(article, "当前分类已被文章使用,请先移除!");
|
Assert.isNull(article, "当前分类已被文章使用,请先移除!");
|
||||||
|
|
||||||
model.setIsDelete(1);
|
|
||||||
model.setDeleteTime(TimeUtils.timestamp());
|
model.setDeleteTime(TimeUtils.timestamp());
|
||||||
articleCategoryMapper.updateById(model);
|
articleCategoryMapper.updateById(model);
|
||||||
}
|
}
|
||||||
|
|
@ -211,11 +209,11 @@ public class ArtCateServiceImpl implements IArtCateService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void change(Integer id) {
|
public void change(Integer id) {
|
||||||
ArticleCategory model = articleCategoryMapper.selectOne(
|
ArticleCate model = articleCategoryMapper.selectOne(
|
||||||
new QueryWrapper<ArticleCategory>()
|
new QueryWrapper<ArticleCate>()
|
||||||
.select("id,is_show")
|
.select("id,is_show")
|
||||||
.eq("id", id)
|
.eq("id", id)
|
||||||
.eq("is_delete", 0));
|
.isNull("delete_time"));
|
||||||
|
|
||||||
Assert.notNull(model, "分类不存在");
|
Assert.notNull(model, "分类不存在");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ import com.mdd.admin.vo.article.ArticleListedVo;
|
||||||
import com.mdd.common.config.GlobalConfig;
|
import com.mdd.common.config.GlobalConfig;
|
||||||
import com.mdd.common.core.PageResult;
|
import com.mdd.common.core.PageResult;
|
||||||
import com.mdd.common.entity.article.Article;
|
import com.mdd.common.entity.article.Article;
|
||||||
import com.mdd.common.entity.article.ArticleCategory;
|
import com.mdd.common.entity.article.ArticleCate;
|
||||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
import com.mdd.common.mapper.article.ArticleCateMapper;
|
||||||
import com.mdd.common.mapper.article.ArticleMapper;
|
import com.mdd.common.mapper.article.ArticleMapper;
|
||||||
import com.mdd.common.util.StringUtils;
|
import com.mdd.common.util.StringUtils;
|
||||||
import com.mdd.common.util.TimeUtils;
|
import com.mdd.common.util.TimeUtils;
|
||||||
|
|
@ -37,7 +37,7 @@ public class ArticleServiceImpl implements IArticleService {
|
||||||
ArticleMapper articleMapper;
|
ArticleMapper articleMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ArticleCategoryMapper articleCategoryMapper;
|
ArticleCateMapper articleCategoryMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章列表
|
* 文章列表
|
||||||
|
|
@ -120,13 +120,10 @@ public class ArticleServiceImpl implements IArticleService {
|
||||||
model.setCid(createValidate.getCid());
|
model.setCid(createValidate.getCid());
|
||||||
model.setTitle(createValidate.getTitle());
|
model.setTitle(createValidate.getTitle());
|
||||||
model.setImage(UrlUtils.toRelativeUrl(createValidate.getImage()));
|
model.setImage(UrlUtils.toRelativeUrl(createValidate.getImage()));
|
||||||
model.setIntro(createValidate.getIntro());
|
|
||||||
model.setContent(createValidate.getContent());
|
model.setContent(createValidate.getContent());
|
||||||
model.setSummary(createValidate.getSummary());
|
|
||||||
model.setSort(createValidate.getSort());
|
model.setSort(createValidate.getSort());
|
||||||
model.setIsShow(createValidate.getIsShow());
|
model.setIsShow(createValidate.getIsShow());
|
||||||
model.setAuthor(createValidate.getAuthor());
|
model.setAuthor(createValidate.getAuthor());
|
||||||
model.setVisit(createValidate.getVisit());
|
|
||||||
model.setCreateTime(TimeUtils.timestamp());
|
model.setCreateTime(TimeUtils.timestamp());
|
||||||
model.setUpdateTime(TimeUtils.timestamp());
|
model.setUpdateTime(TimeUtils.timestamp());
|
||||||
articleMapper.insert(model);
|
articleMapper.insert(model);
|
||||||
|
|
@ -148,17 +145,14 @@ public class ArticleServiceImpl implements IArticleService {
|
||||||
Assert.notNull(model, "文章不存在!");
|
Assert.notNull(model, "文章不存在!");
|
||||||
|
|
||||||
Assert.notNull(articleCategoryMapper.selectOne(
|
Assert.notNull(articleCategoryMapper.selectOne(
|
||||||
new QueryWrapper<ArticleCategory>()
|
new QueryWrapper<ArticleCate>()
|
||||||
.eq("id", updateValidate.getCid())
|
.eq("id", updateValidate.getCid())
|
||||||
.eq("is_delete", 0)), "分类不存在");
|
.isNull("delete_time")), "分类不存在");
|
||||||
|
|
||||||
model.setCid(updateValidate.getCid());
|
model.setCid(updateValidate.getCid());
|
||||||
model.setTitle(updateValidate.getTitle());
|
model.setTitle(updateValidate.getTitle());
|
||||||
model.setImage(UrlUtils.toRelativeUrl(updateValidate.getImage()));
|
model.setImage(UrlUtils.toRelativeUrl(updateValidate.getImage()));
|
||||||
model.setIntro(updateValidate.getIntro());
|
|
||||||
model.setContent(updateValidate.getContent());
|
model.setContent(updateValidate.getContent());
|
||||||
model.setSummary(updateValidate.getSummary());
|
|
||||||
model.setVisit(updateValidate.getVisit());
|
|
||||||
model.setIsShow(updateValidate.getIsShow());
|
model.setIsShow(updateValidate.getIsShow());
|
||||||
model.setAuthor(updateValidate.getAuthor());
|
model.setAuthor(updateValidate.getAuthor());
|
||||||
model.setSort(updateValidate.getSort());
|
model.setSort(updateValidate.getSort());
|
||||||
|
|
@ -181,8 +175,6 @@ public class ArticleServiceImpl implements IArticleService {
|
||||||
.eq("is_delete", 0));
|
.eq("is_delete", 0));
|
||||||
|
|
||||||
Assert.notNull(article, "文章不存在!");
|
Assert.notNull(article, "文章不存在!");
|
||||||
|
|
||||||
article.setIsDelete(1);
|
|
||||||
article.setDeleteTime(TimeUtils.timestamp());
|
article.setDeleteTime(TimeUtils.timestamp());
|
||||||
articleMapper.updateById(article);
|
articleMapper.updateById(article);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ public class DecoratePageServiceImpl implements IDecoratePageService {
|
||||||
|
|
||||||
DecoratePageVo vo = new DecoratePageVo();
|
DecoratePageVo vo = new DecoratePageVo();
|
||||||
vo.setId(decoratePage.getId());
|
vo.setId(decoratePage.getId());
|
||||||
vo.setPageType(decoratePage.getPageType());
|
vo.setPageType(decoratePage.getType());
|
||||||
vo.setPageData(decoratePage.getPageData());
|
vo.setPageData(decoratePage.getData());
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class DecoratePageServiceImpl implements IDecoratePageService {
|
||||||
DecoratePage decoratePage = decoratePageMapper.selectById(decoratePageValidate.getId());
|
DecoratePage decoratePage = decoratePageMapper.selectById(decoratePageValidate.getId());
|
||||||
Assert.notNull(decoratePage, "数据不存在!");
|
Assert.notNull(decoratePage, "数据不存在!");
|
||||||
|
|
||||||
decoratePage.setPageData(decoratePageValidate.getPageData());
|
decoratePage.setData(decoratePageValidate.getPageData());
|
||||||
decoratePage.setUpdateTime(System.currentTimeMillis() / 1000);
|
decoratePage.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||||
decoratePageMapper.updateById(decoratePage);
|
decoratePageMapper.updateById(decoratePage);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package com.mdd.common.entity.article;
|
package com.mdd.common.entity.article;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -25,10 +27,12 @@ public class Article implements Serializable {
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@ApiModelProperty("简介")
|
@ApiModelProperty("简介")
|
||||||
private String intro;
|
@TableField(value = "`desc`")
|
||||||
|
private String desc;
|
||||||
|
|
||||||
@ApiModelProperty("摘要")
|
@ApiModelProperty("摘要")
|
||||||
private String summary;
|
@TableField(value = "abstract")
|
||||||
|
private String abstractField;
|
||||||
|
|
||||||
@ApiModelProperty("封面")
|
@ApiModelProperty("封面")
|
||||||
private String image;
|
private String image;
|
||||||
|
|
@ -39,8 +43,11 @@ public class Article implements Serializable {
|
||||||
@ApiModelProperty("作者")
|
@ApiModelProperty("作者")
|
||||||
private String author;
|
private String author;
|
||||||
|
|
||||||
@ApiModelProperty("浏览")
|
@ApiModelProperty("虚拟浏览量")
|
||||||
private Integer visit;
|
private Integer clickVirtual;
|
||||||
|
|
||||||
|
@ApiModelProperty("实际浏览量")
|
||||||
|
private Integer clickActual;
|
||||||
|
|
||||||
@ApiModelProperty("排序")
|
@ApiModelProperty("排序")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
@ -48,9 +55,6 @@ public class Article implements Serializable {
|
||||||
@ApiModelProperty("是否显示: [0=否, 1=是]")
|
@ApiModelProperty("是否显示: [0=否, 1=是]")
|
||||||
private Integer isShow;
|
private Integer isShow;
|
||||||
|
|
||||||
@ApiModelProperty("是否删除: [0=否, 1=是]")
|
|
||||||
private Integer isDelete;
|
|
||||||
|
|
||||||
@ApiModelProperty("创建时间")
|
@ApiModelProperty("创建时间")
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("文章分类实体")
|
@ApiModel("文章分类实体")
|
||||||
public class ArticleCategory implements Serializable {
|
public class ArticleCate implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
@ -27,9 +27,6 @@ public class ArticleCategory implements Serializable {
|
||||||
@ApiModelProperty("是否显示: [0=否, 1=是]")
|
@ApiModelProperty("是否显示: [0=否, 1=是]")
|
||||||
private Integer isShow;
|
private Integer isShow;
|
||||||
|
|
||||||
@ApiModelProperty("是否删除: [0=否, 1=是]")
|
|
||||||
private Integer isDelete;
|
|
||||||
|
|
||||||
@ApiModelProperty("创建时间")
|
@ApiModelProperty("创建时间")
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
||||||
|
|
@ -19,13 +19,16 @@ public class DecoratePage implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@ApiModelProperty("页面类型")
|
@ApiModelProperty("页面类型")
|
||||||
private Integer pageType;
|
private Integer type;
|
||||||
|
|
||||||
@ApiModelProperty("页面名称")
|
@ApiModelProperty("页面名称")
|
||||||
private String pageName;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty("页面数据")
|
@ApiModelProperty("页面数据")
|
||||||
private String pageData;
|
private String data;
|
||||||
|
|
||||||
|
@ApiModelProperty("页面设置")
|
||||||
|
private String meta;
|
||||||
|
|
||||||
@ApiModelProperty("创建时间")
|
@ApiModelProperty("创建时间")
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package com.mdd.common.mapper.article;
|
package com.mdd.common.mapper.article;
|
||||||
|
|
||||||
import com.mdd.common.core.basics.IBaseMapper;
|
import com.mdd.common.core.basics.IBaseMapper;
|
||||||
import com.mdd.common.entity.article.ArticleCategory;
|
import com.mdd.common.entity.article.ArticleCate;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章分类
|
* 文章分类
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ArticleCategoryMapper extends IBaseMapper<ArticleCategory> {
|
public interface ArticleCateMapper extends IBaseMapper<ArticleCate> {
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ public class ArticleController {
|
||||||
IArticleService iArticleService;
|
IArticleService iArticleService;
|
||||||
|
|
||||||
@NotLogin
|
@NotLogin
|
||||||
@GetMapping("/category")
|
@GetMapping("/cate")
|
||||||
@ApiOperation(value="文章分类")
|
@ApiOperation(value="文章分类")
|
||||||
public AjaxResult<List<ArticleCateVo>> category() {
|
public AjaxResult<List<ArticleCateVo>> category() {
|
||||||
List<ArticleCateVo> list = iArticleService.category();
|
List<ArticleCateVo> list = iArticleService.category();
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("api/index")
|
@RequestMapping("/api/pc")
|
||||||
@Api(tags = "主页管理")
|
@Api(tags = "主页管理")
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,41 +24,41 @@ import java.util.Map;
|
||||||
@Api(tags = "电脑管理")
|
@Api(tags = "电脑管理")
|
||||||
public class PcController {
|
public class PcController {
|
||||||
|
|
||||||
@Resource
|
// @Resource
|
||||||
IPcService iPcService;
|
// IPcService iPcService;
|
||||||
|
//
|
||||||
@NotLogin
|
// @NotLogin
|
||||||
@GetMapping("/index")
|
// @GetMapping("/index")
|
||||||
@ApiOperation(value="主页数据")
|
// @ApiOperation(value="主页数据")
|
||||||
public AjaxResult<Map<String,Object>> index() {
|
// public AjaxResult<Map<String,Object>> index() {
|
||||||
Map<String, Object> index = iPcService.index();
|
// Map<String, Object> index = iPcService.index();
|
||||||
return AjaxResult.success(index);
|
// return AjaxResult.success(index);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@NotLogin
|
// @NotLogin
|
||||||
@GetMapping("/getConfig")
|
// @GetMapping("/getConfig")
|
||||||
@ApiOperation(value="公共配置")
|
// @ApiOperation(value="公共配置")
|
||||||
public AjaxResult<Map<String, Object>> getConfig() {
|
// public AjaxResult<Map<String, Object>> getConfig() {
|
||||||
Map<String, Object> config = iPcService.getConfig();
|
// Map<String, Object> config = iPcService.getConfig();
|
||||||
return AjaxResult.success(config);
|
// return AjaxResult.success(config);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@NotLogin
|
// @NotLogin
|
||||||
@GetMapping("/articleCenter")
|
// @GetMapping("/articleCenter")
|
||||||
@ApiOperation(value="资讯中心")
|
// @ApiOperation(value="资讯中心")
|
||||||
public AjaxResult<List<PcArticleCenterVo>> articleCenter() {
|
// public AjaxResult<List<PcArticleCenterVo>> articleCenter() {
|
||||||
List<PcArticleCenterVo> list = iPcService.articleCenter();
|
// List<PcArticleCenterVo> list = iPcService.articleCenter();
|
||||||
return AjaxResult.success(list);
|
// return AjaxResult.success(list);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@NotLogin
|
// @NotLogin
|
||||||
@GetMapping("/articleDetail")
|
// @GetMapping("/articleDetail")
|
||||||
@ApiOperation(value="文章详情")
|
// @ApiOperation(value="文章详情")
|
||||||
public AjaxResult<PcArticleDetailVo> articleDetail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
// public AjaxResult<PcArticleDetailVo> articleDetail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
// Integer userId = LikeFrontThreadLocal.getUserId();
|
||||||
|
//
|
||||||
PcArticleDetailVo vo = iPcService.articleDetail(id, userId);
|
// PcArticleDetailVo vo = iPcService.articleDetail(id, userId);
|
||||||
return AjaxResult.success(vo);
|
// return AjaxResult.success(vo);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ import com.github.yulichang.query.MPJQueryWrapper;
|
||||||
import com.mdd.common.config.GlobalConfig;
|
import com.mdd.common.config.GlobalConfig;
|
||||||
import com.mdd.common.core.PageResult;
|
import com.mdd.common.core.PageResult;
|
||||||
import com.mdd.common.entity.article.Article;
|
import com.mdd.common.entity.article.Article;
|
||||||
import com.mdd.common.entity.article.ArticleCategory;
|
import com.mdd.common.entity.article.ArticleCate;
|
||||||
import com.mdd.common.entity.article.ArticleCollect;
|
import com.mdd.common.entity.article.ArticleCollect;
|
||||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
import com.mdd.common.mapper.article.ArticleCateMapper;
|
||||||
import com.mdd.common.mapper.article.ArticleCollectMapper;
|
import com.mdd.common.mapper.article.ArticleCollectMapper;
|
||||||
import com.mdd.common.mapper.article.ArticleMapper;
|
import com.mdd.common.mapper.article.ArticleMapper;
|
||||||
import com.mdd.common.util.StringUtils;
|
import com.mdd.common.util.StringUtils;
|
||||||
|
|
@ -41,7 +41,7 @@ public class ArticleServiceImpl implements IArticleService {
|
||||||
ArticleMapper articleMapper;
|
ArticleMapper articleMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ArticleCategoryMapper articleCategoryMapper;
|
ArticleCateMapper articleCategoryMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ArticleCollectMapper articleCollectMapper;
|
ArticleCollectMapper articleCollectMapper;
|
||||||
|
|
@ -54,15 +54,15 @@ public class ArticleServiceImpl implements IArticleService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ArticleCateVo> category() {
|
public List<ArticleCateVo> category() {
|
||||||
List<ArticleCategory> articleCateVos = articleCategoryMapper.selectList(
|
List<ArticleCate> articleCateVos = articleCategoryMapper.selectList(
|
||||||
new QueryWrapper<ArticleCategory>()
|
new QueryWrapper<ArticleCate>()
|
||||||
.select("id,name")
|
.select("id,name")
|
||||||
.eq("is_show", 1)
|
.eq("is_show", 1)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc(Arrays.asList("sort", "id")));
|
.orderByDesc(Arrays.asList("sort", "id")));
|
||||||
|
|
||||||
List<ArticleCateVo> list = new LinkedList<>();
|
List<ArticleCateVo> list = new LinkedList<>();
|
||||||
for (ArticleCategory category: articleCateVos) {
|
for (ArticleCate category: articleCateVos) {
|
||||||
ArticleCateVo vo = new ArticleCateVo();
|
ArticleCateVo vo = new ArticleCateVo();
|
||||||
BeanUtils.copyProperties(category, vo);
|
BeanUtils.copyProperties(category, vo);
|
||||||
list.add(vo);
|
list.add(vo);
|
||||||
|
|
@ -177,7 +177,7 @@ public class ArticleServiceImpl implements IArticleService {
|
||||||
vo.setImage(UrlUtils.toAbsoluteUrl(article.getImage()));
|
vo.setImage(UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||||
vo.setCreateTime(TimeUtils.timestampToDate(article.getCreateTime()));
|
vo.setCreateTime(TimeUtils.timestampToDate(article.getCreateTime()));
|
||||||
|
|
||||||
article.setVisit(article.getVisit() + 1);
|
article.setClickActual(article.getClickActual() + 1);
|
||||||
articleMapper.updateById(article);
|
articleMapper.updateById(article);
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class IndexServiceImpl implements IIndexService {
|
||||||
List<Map<String, Object>> articleList = new LinkedList<>();
|
List<Map<String, Object>> articleList = new LinkedList<>();
|
||||||
List<Article> articles = articleMapper.selectList(new QueryWrapper<Article>()
|
List<Article> articles = articleMapper.selectList(new QueryWrapper<Article>()
|
||||||
.eq("is_show", 1)
|
.eq("is_show", 1)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc("id")
|
.orderByDesc("id")
|
||||||
.last("limit 20"));
|
.last("limit 20"));
|
||||||
|
|
||||||
|
|
@ -61,17 +61,17 @@ public class IndexServiceImpl implements IIndexService {
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("id", article.getId());
|
map.put("id", article.getId());
|
||||||
map.put("title", article.getTitle());
|
map.put("title", article.getTitle());
|
||||||
map.put("intro", article.getIntro());
|
map.put("intro", article.getContent());
|
||||||
map.put("summary", article.getSummary());
|
map.put("summary", article.getAbstractField());
|
||||||
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||||
map.put("author", article.getAuthor());
|
map.put("author", article.getAuthor());
|
||||||
map.put("visit", article.getVisit());
|
map.put("visit", article.getClickActual());
|
||||||
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
||||||
articleList.add(map);
|
articleList.add(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.put("domain", UrlUtils.domain());
|
response.put("domain", UrlUtils.domain());
|
||||||
response.put("pages", decoratePage.getPageData());
|
response.put("pages", decoratePage.getData());
|
||||||
response.put("article", articleList);
|
response.put("article", articleList);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
@ -93,9 +93,9 @@ public class IndexServiceImpl implements IIndexService {
|
||||||
Assert.notNull(decoratePage, "数据不存在!");
|
Assert.notNull(decoratePage, "数据不存在!");
|
||||||
|
|
||||||
Map<String, Object> response = new LinkedHashMap<>();
|
Map<String, Object> response = new LinkedHashMap<>();
|
||||||
response.put("type", decoratePage.getPageType());
|
response.put("type", decoratePage.getType());
|
||||||
response.put("name", decoratePage.getPageName());
|
response.put("name", decoratePage.getName());
|
||||||
response.put("pages", decoratePage.getPageData());
|
response.put("pages", decoratePage.getData());
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ package com.mdd.front.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.mdd.common.config.GlobalConfig;
|
import com.mdd.common.config.GlobalConfig;
|
||||||
|
import com.mdd.common.entity.article.ArticleCate;
|
||||||
import com.mdd.common.entity.decorate.DecoratePage;
|
import com.mdd.common.entity.decorate.DecoratePage;
|
||||||
import com.mdd.common.entity.article.Article;
|
import com.mdd.common.entity.article.Article;
|
||||||
import com.mdd.common.entity.article.ArticleCategory;
|
|
||||||
import com.mdd.common.entity.article.ArticleCollect;
|
import com.mdd.common.entity.article.ArticleCollect;
|
||||||
import com.mdd.common.exception.OperateException;
|
import com.mdd.common.exception.OperateException;
|
||||||
|
import com.mdd.common.mapper.article.ArticleCateMapper;
|
||||||
import com.mdd.common.mapper.decorate.DecoratePageMapper;
|
import com.mdd.common.mapper.decorate.DecoratePageMapper;
|
||||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
|
||||||
import com.mdd.common.mapper.article.ArticleCollectMapper;
|
import com.mdd.common.mapper.article.ArticleCollectMapper;
|
||||||
import com.mdd.common.mapper.article.ArticleMapper;
|
import com.mdd.common.mapper.article.ArticleMapper;
|
||||||
import com.mdd.common.util.*;
|
import com.mdd.common.util.*;
|
||||||
|
|
@ -28,7 +28,7 @@ public class PcServiceImpI implements IPcService {
|
||||||
DecoratePageMapper decoratePageMapper;
|
DecoratePageMapper decoratePageMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ArticleCategoryMapper articleCategoryMapper;
|
ArticleCateMapper articleCategoryMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ArticleCollectMapper articleCollectMapper;
|
ArticleCollectMapper articleCollectMapper;
|
||||||
|
|
@ -61,10 +61,10 @@ public class PcServiceImpI implements IPcService {
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("id", article.getId());
|
map.put("id", article.getId());
|
||||||
map.put("title", article.getTitle());
|
map.put("title", article.getTitle());
|
||||||
map.put("intro", article.getIntro());
|
map.put("intro", article.getContent());
|
||||||
map.put("summary", article.getSummary());
|
map.put("summary", article.getAbstractField());
|
||||||
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||||
map.put("visit", article.getVisit());
|
map.put("visit", article.getClickActual());
|
||||||
map.put("author", article.getAuthor());
|
map.put("author", article.getAuthor());
|
||||||
map.put("sort", article.getSort());
|
map.put("sort", article.getSort());
|
||||||
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
||||||
|
|
@ -82,10 +82,10 @@ public class PcServiceImpI implements IPcService {
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("id", article.getId());
|
map.put("id", article.getId());
|
||||||
map.put("title", article.getTitle());
|
map.put("title", article.getTitle());
|
||||||
map.put("intro", article.getIntro());
|
map.put("intro", article.getContent());
|
||||||
map.put("summary", article.getSummary());
|
map.put("summary", article.getAbstractField());
|
||||||
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||||
map.put("visit", article.getVisit());
|
map.put("visit", article.getClickActual());
|
||||||
map.put("sort", article.getSort());
|
map.put("sort", article.getSort());
|
||||||
map.put("author", article.getAuthor());
|
map.put("author", article.getAuthor());
|
||||||
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
||||||
|
|
@ -103,17 +103,17 @@ public class PcServiceImpI implements IPcService {
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("id", article.getId());
|
map.put("id", article.getId());
|
||||||
map.put("title", article.getTitle());
|
map.put("title", article.getTitle());
|
||||||
map.put("intro", article.getIntro());
|
map.put("intro", article.getContent());
|
||||||
map.put("summary", article.getSummary());
|
map.put("summary", article.getAbstractField());
|
||||||
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||||
map.put("author", article.getAuthor());
|
map.put("author", article.getAuthor());
|
||||||
map.put("visit", article.getVisit());
|
map.put("visit", article.getClickActual());
|
||||||
map.put("sort", article.getSort());
|
map.put("sort", article.getSort());
|
||||||
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
||||||
articlesHostList.add(map);
|
articlesHostList.add(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
indexData.put("pages", decoratePage.getPageData());
|
indexData.put("pages", decoratePage.getData());
|
||||||
indexData.put("all", articlesAllList);
|
indexData.put("all", articlesAllList);
|
||||||
indexData.put("new", articlesNewList);
|
indexData.put("new", articlesNewList);
|
||||||
indexData.put("hot", articlesHostList);
|
indexData.put("hot", articlesHostList);
|
||||||
|
|
@ -176,18 +176,18 @@ public class PcServiceImpI implements IPcService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<PcArticleCenterVo> articleCenter() {
|
public List<PcArticleCenterVo> articleCenter() {
|
||||||
List<ArticleCategory> articleCategoryList = articleCategoryMapper.selectList(
|
List<ArticleCate> articleCategoryList = articleCategoryMapper.selectList(
|
||||||
new QueryWrapper<ArticleCategory>()
|
new QueryWrapper<ArticleCate>()
|
||||||
.eq("is_show", 1)
|
.eq("is_show", 1)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc(Arrays.asList("sort", "id")));
|
.orderByDesc(Arrays.asList("sort", "id")));
|
||||||
|
|
||||||
List<PcArticleCenterVo> list = new LinkedList<>();
|
List<PcArticleCenterVo> list = new LinkedList<>();
|
||||||
for (ArticleCategory articleCategory : articleCategoryList) {
|
for (ArticleCate articleCategory : articleCategoryList) {
|
||||||
List<Article> articleList = articleMapper.selectList(new QueryWrapper<Article>()
|
List<Article> articleList = articleMapper.selectList(new QueryWrapper<Article>()
|
||||||
.eq("cid", articleCategory.getId())
|
.eq("cid", articleCategory.getId())
|
||||||
.eq("is_show", 1)
|
.eq("is_show", 1)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc(Arrays.asList("sort", "id"))
|
.orderByDesc(Arrays.asList("sort", "id"))
|
||||||
.last("limit 10"));
|
.last("limit 10"));
|
||||||
|
|
||||||
|
|
@ -224,10 +224,9 @@ public class PcServiceImpI implements IPcService {
|
||||||
Article article = articleMapper.selectOne(new QueryWrapper<Article>()
|
Article article = articleMapper.selectOne(new QueryWrapper<Article>()
|
||||||
.select(Article.class, info->
|
.select(Article.class, info->
|
||||||
!info.getColumn().equals("is_show") &&
|
!info.getColumn().equals("is_show") &&
|
||||||
!info.getColumn().equals("is_delete") &&
|
|
||||||
!info.getColumn().equals("delete_time"))
|
!info.getColumn().equals("delete_time"))
|
||||||
.eq("id", id)
|
.eq("id", id)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
|
|
||||||
if (StringUtils.isNull(article)) {
|
if (StringUtils.isNull(article)) {
|
||||||
|
|
@ -235,16 +234,16 @@ public class PcServiceImpI implements IPcService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分类名称
|
// 分类名称
|
||||||
ArticleCategory articleCategory = articleCategoryMapper.selectOne(
|
ArticleCate articleCategory = articleCategoryMapper.selectOne(
|
||||||
new QueryWrapper<ArticleCategory>()
|
new QueryWrapper<ArticleCate>()
|
||||||
.eq("id", article.getCid())
|
.eq("id", article.getCid())
|
||||||
.eq("is_delete", 0));
|
.isNull("delete_time"));
|
||||||
|
|
||||||
// 上一条记录
|
// 上一条记录
|
||||||
Article prev = articleMapper.selectOne(new QueryWrapper<Article>()
|
Article prev = articleMapper.selectOne(new QueryWrapper<Article>()
|
||||||
.select("id,title")
|
.select("id,title")
|
||||||
.lt("id", id)
|
.lt("id", id)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc(Arrays.asList("sort", "id"))
|
.orderByDesc(Arrays.asList("sort", "id"))
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
|
|
||||||
|
|
@ -252,7 +251,7 @@ public class PcServiceImpI implements IPcService {
|
||||||
Article next = articleMapper.selectOne(new QueryWrapper<Article>()
|
Article next = articleMapper.selectOne(new QueryWrapper<Article>()
|
||||||
.select("id,title")
|
.select("id,title")
|
||||||
.gt("id", id)
|
.gt("id", id)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc(Arrays.asList("sort", "id"))
|
.orderByDesc(Arrays.asList("sort", "id"))
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
|
|
||||||
|
|
@ -260,14 +259,14 @@ public class PcServiceImpI implements IPcService {
|
||||||
ArticleCollect collect = articleCollectMapper.selectOne(new QueryWrapper<ArticleCollect>()
|
ArticleCollect collect = articleCollectMapper.selectOne(new QueryWrapper<ArticleCollect>()
|
||||||
.eq("article_id", article.getId())
|
.eq("article_id", article.getId())
|
||||||
.eq("user_id", userId)
|
.eq("user_id", userId)
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
|
|
||||||
// 最新资讯
|
// 最新资讯
|
||||||
List<Article> news = articleMapper.selectList(new QueryWrapper<Article>()
|
List<Article> news = articleMapper.selectList(new QueryWrapper<Article>()
|
||||||
.select("id,title,image,create_time,update_time")
|
.select("id,title,image,create_time,update_time")
|
||||||
.eq("cid", article.getCid())
|
.eq("cid", article.getCid())
|
||||||
.eq("is_delete", 0)
|
.isNull("delete_time")
|
||||||
.orderByDesc("id")
|
.orderByDesc("id")
|
||||||
.last("limit 8"));
|
.last("limit 8"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ spring:
|
||||||
password: # Redis密码
|
password: # Redis密码
|
||||||
database: 0 # 数据库索引
|
database: 0 # 数据库索引
|
||||||
|
|
||||||
|
|
||||||
# Mybatis-plus配置 【是否开启SQL日志输出】
|
# Mybatis-plus配置 【是否开启SQL日志输出】
|
||||||
#mybatis-plus:
|
#mybatis-plus:
|
||||||
# configuration:
|
# configuration:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue