Commit f41b9e05 authored by hanfeng's avatar hanfeng

修改seo列表

parent 367240e7
...@@ -106,7 +106,7 @@ public class Article { ...@@ -106,7 +106,7 @@ public class Article {
private Integer status; private Integer status;
@Column(name ="type") @Column(name = "type")
@ApiModelProperty(value = "文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网") @ApiModelProperty(value = "文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网")
private Integer type; private Integer type;
...@@ -114,7 +114,7 @@ public class Article { ...@@ -114,7 +114,7 @@ public class Article {
* 创建时间 * 创建时间
*/ */
@Column(name = "cre_time") @Column(name = "cre_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date creTime; private Date creTime;
...@@ -123,7 +123,7 @@ public class Article { ...@@ -123,7 +123,7 @@ public class Article {
* 修改时间 * 修改时间
*/ */
@Column(name = "upd_time") @Column(name = "upd_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updTime; private Date updTime;
...@@ -132,11 +132,24 @@ public class Article { ...@@ -132,11 +132,24 @@ public class Article {
* 上架时间 * 上架时间
*/ */
@Column(name = "add_time") @Column(name = "add_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "上架时间") @ApiModelProperty(value = "上架时间")
private Date addTime; private Date addTime;
@ApiModelProperty("seo*html标签优化") @ApiModelProperty("seo*html标签优化")
private String alt; private String alt;
@Column(name = "tag_title")
@ApiModelProperty("title标签内容")
private String tagTitle;
@Column(name = "keywords")
@ApiModelProperty("title标签内容")
private String keywords;
@Column(name = "description")
@ApiModelProperty("description")
private String description;
} }
...@@ -3,6 +3,7 @@ package com.xxfc.platform.uccn.biz; ...@@ -3,6 +3,7 @@ package com.xxfc.platform.uccn.biz;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.uccn.comstnt.UrlType; import com.xxfc.platform.uccn.comstnt.UrlType;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
import com.xxfc.platform.uccn.mapper.ArticleMapper; import com.xxfc.platform.uccn.mapper.ArticleMapper;
...@@ -64,7 +65,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -64,7 +65,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
if (UrlType.OFFICIAL_WEBSITE.getCode().equals(urlType)) { if (UrlType.OFFICIAL_WEBSITE.getCode().equals(urlType)) {
criteria.andEqualTo("status", 1); criteria.andEqualTo("status", 1);
} }
return mapper.selectOneByExample(example); Article article = mapper.selectOneByExample(example);
return article;
} }
...@@ -118,6 +120,10 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -118,6 +120,10 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
// } // }
} }
/**
* 添加文章
* @param article
*/
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void add(Article article) { public void add(Article article) {
if (article == null) { if (article == null) {
...@@ -131,11 +137,20 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -131,11 +137,20 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
if (article.getType() == null) { if (article.getType() == null) {
article.setType(0); article.setType(0);
} }
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo");
}
article.setCreTime(new Date()); article.setCreTime(new Date());
mapper.insertSelective(article); mapper.insertSelective(article);
} }
/**
* 后台文章列表
* @param query
* @return
*/
public PageInfo findAll(ArticleQuery query) { public PageInfo findAll(ArticleQuery query) {
PageHelper.startPage(query.getPage(),query.getLimit()); PageHelper.startPage(query.getPage(),query.getLimit());
Example exa = Example.builder(Article.class).where( Example exa = Example.builder(Article.class).where(
...@@ -147,13 +162,22 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -147,13 +162,22 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return PageInfo.of(articles); return PageInfo.of(articles);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateSelectiveByIdRe(Article article){ public int updateSelectiveByIdRe(Article article){
article.setUpdTime(new Date()); article.setUpdTime(new Date());
if (article.getTagTitle()==null||article.getKeywords()==null||article.getDescription()==null) {
throw new BaseException("必须设置seo");
}
return mapper.updateByPrimaryKeySelective(article); return mapper.updateByPrimaryKeySelective(article);
} }
/**
* 上架
* @param id
* @return
*/
public int putaway(Integer id) { public int putaway(Integer id) {
Article article = new Article(); Article article = new Article();
article.setId(id); article.setId(id);
...@@ -163,6 +187,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -163,6 +187,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return mapper.updateByPrimaryKeySelective(article); return mapper.updateByPrimaryKeySelective(article);
} }
/**
* 下架
* @param id
* @return
*/
public int soldOut(Integer id) { public int soldOut(Integer id) {
Article article = new Article(); Article article = new Article();
article.setId(id); article.setId(id);
...@@ -171,6 +200,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -171,6 +200,11 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
return mapper.updateByPrimaryKeySelective(article); return mapper.updateByPrimaryKeySelective(article);
} }
/**
* 删除
* @param id
* @return
*/
public int remove(Integer id) { public int remove(Integer id) {
Article article = new Article(); Article article = new Article();
article.setId(id); article.setId(id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment