✨ 作品集功能完善
This commit is contained in:
parent
49ab45f3bd
commit
8b2c7f93b5
5
pom.xml
5
pom.xml
@ -180,11 +180,6 @@
|
|||||||
<artifactId>weixin-java-open</artifactId>
|
<artifactId>weixin-java-open</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.7.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.binarywang</groupId>
|
|
||||||
<artifactId>java-emoji-converter</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -53,4 +53,6 @@ public class ArticleDTO {
|
|||||||
private List<CommentDTO> articleComments;
|
private List<CommentDTO> articleComments;
|
||||||
|
|
||||||
private List<PortfolioArticleDTO> portfolios;
|
private List<PortfolioArticleDTO> portfolios;
|
||||||
|
|
||||||
|
private Integer sortNo;
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,6 @@ public class PortfolioArticleDTO {
|
|||||||
|
|
||||||
private String portfolioTitle;
|
private String portfolioTitle;
|
||||||
|
|
||||||
|
private Integer sortNo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ public class Portfolio {
|
|||||||
private Integer portfolioAuthorId;
|
private Integer portfolioAuthorId;
|
||||||
/** 作品集介绍 */
|
/** 作品集介绍 */
|
||||||
private String portfolioDescription;
|
private String portfolioDescription;
|
||||||
|
/** 作品集介绍 Html */
|
||||||
|
private String portfolioDescriptionHtml;
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
|
@ -21,9 +21,10 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
|||||||
/**
|
/**
|
||||||
* 查询作品集
|
* 查询作品集
|
||||||
* @param id
|
* @param id
|
||||||
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PortfolioDTO selectPortfolioDTOById(@Param("id") Integer id);
|
PortfolioDTO selectPortfolioDTOById(@Param("id") Integer id, @Param("type") Integer type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计作品集下文章数
|
* 统计作品集下文章数
|
||||||
@ -55,4 +56,13 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer selectMaxSortNo(@Param("idPortfolio") Integer idPortfolio);
|
Integer selectMaxSortNo(@Param("idPortfolio") Integer idPortfolio);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新文章排序号
|
||||||
|
* @param idPortfolio
|
||||||
|
* @param idArticle
|
||||||
|
* @param sortNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer updateArticleSortNo(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle, @Param("sortNo") Integer sortNo);
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,10 @@ public interface PortfolioService extends Service<Portfolio> {
|
|||||||
|
|
||||||
/** 查询作品集
|
/** 查询作品集
|
||||||
* @param idPortfolio
|
* @param idPortfolio
|
||||||
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PortfolioDTO findPortfolioDTOById(Integer idPortfolio);
|
PortfolioDTO findPortfolioDTOById(Integer idPortfolio, Integer type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保持/更新作品集
|
* 保持/更新作品集
|
||||||
@ -54,4 +55,11 @@ public interface PortfolioService extends Service<Portfolio> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map bindArticle(PortfolioArticleDTO portfolioArticle);
|
Map bindArticle(PortfolioArticleDTO portfolioArticle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新文章排序号
|
||||||
|
* @param portfolioArticle
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map updateArticleSortNo(PortfolioArticleDTO portfolioArticle);
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,8 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PortfolioDTO findPortfolioDTOById(Integer idPortfolio) {
|
public PortfolioDTO findPortfolioDTOById(Integer idPortfolio, Integer type) {
|
||||||
PortfolioDTO portfolio = portfolioMapper.selectPortfolioDTOById(idPortfolio);
|
PortfolioDTO portfolio = portfolioMapper.selectPortfolioDTOById(idPortfolio,type);
|
||||||
Author author = userService.selectAuthor(portfolio.getPortfolioAuthorId());
|
Author author = userService.selectAuthor(portfolio.getPortfolioAuthorId());
|
||||||
genPortfolioAuthor(portfolio,author);
|
genPortfolioAuthor(portfolio,author);
|
||||||
Integer articleNumber = portfolioMapper.selectCountArticleNumber(portfolio.getIdPortfolio());
|
Integer articleNumber = portfolioMapper.selectCountArticleNumber(portfolio.getIdPortfolio());
|
||||||
@ -106,6 +106,27 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map updateArticleSortNo(PortfolioArticleDTO portfolioArticle) {
|
||||||
|
Map map = new HashMap(1);
|
||||||
|
if (portfolioArticle.getIdPortfolio() == null || portfolioArticle.getIdPortfolio() == 0) {
|
||||||
|
map.put("message", "作品集数据异常!");
|
||||||
|
}
|
||||||
|
if (portfolioArticle.getIdArticle() == null || portfolioArticle.getIdArticle() == 0) {
|
||||||
|
map.put("message", "文章数据异常!");
|
||||||
|
}
|
||||||
|
if (portfolioArticle.getSortNo() == null) {
|
||||||
|
map.put("message", "排序号不能为空!");
|
||||||
|
}
|
||||||
|
Integer result = portfolioMapper.updateArticleSortNo(portfolioArticle.getIdPortfolio(),portfolioArticle.getIdArticle(),portfolioArticle.getSortNo());
|
||||||
|
if (result > 0) {
|
||||||
|
map.put("message", "更新成功!");
|
||||||
|
} else {
|
||||||
|
map.put("message", "更新失败!");
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
private PortfolioDTO genPortfolioAuthor(PortfolioDTO portfolioDTO, Author author) {
|
private PortfolioDTO genPortfolioAuthor(PortfolioDTO portfolioDTO, Author author) {
|
||||||
portfolioDTO.setPortfolioAuthorAvatarUrl(author.getUserAvatarURL());
|
portfolioDTO.setPortfolioAuthorAvatarUrl(author.getUserAvatarURL());
|
||||||
portfolioDTO.setPortfolioAuthorName(author.getUserNickname());
|
portfolioDTO.setPortfolioAuthorName(author.getUserNickname());
|
||||||
|
@ -124,7 +124,7 @@ public class CommonApiController {
|
|||||||
@GetMapping("/portfolio/{id}")
|
@GetMapping("/portfolio/{id}")
|
||||||
@VisitLogger
|
@VisitLogger
|
||||||
public GlobalResult<Map<String, Object>> portfolio(@PathVariable Integer id){
|
public GlobalResult<Map<String, Object>> portfolio(@PathVariable Integer id){
|
||||||
PortfolioDTO portfolioDTO = portfolioService.findPortfolioDTOById(id);
|
PortfolioDTO portfolioDTO = portfolioService.findPortfolioDTOById(id,1);
|
||||||
Map<String, Object> map = new HashMap<>(1);
|
Map<String, Object> map = new HashMap<>(1);
|
||||||
map.put("portfolio", portfolioDTO);
|
map.put("portfolio", portfolioDTO);
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
@ -24,8 +24,8 @@ public class PortfolioController {
|
|||||||
private PortfolioService portfolioService;
|
private PortfolioService portfolioService;
|
||||||
|
|
||||||
@GetMapping("/detail/{id}")
|
@GetMapping("/detail/{id}")
|
||||||
public GlobalResult detail(@PathVariable Integer id) {
|
public GlobalResult detail(@PathVariable Integer id,@RequestParam(defaultValue = "0") Integer type) {
|
||||||
PortfolioDTO portfolio = portfolioService.findPortfolioDTOById(id);
|
PortfolioDTO portfolio = portfolioService.findPortfolioDTOById(id, type);
|
||||||
Map map = new HashMap<>(1);
|
Map map = new HashMap<>(1);
|
||||||
map.put("portfolio", portfolio);
|
map.put("portfolio", portfolio);
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
@ -55,4 +55,10 @@ public class PortfolioController {
|
|||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update-article-sort-no")
|
||||||
|
public GlobalResult updateArticleSortNo(@RequestBody PortfolioArticleDTO portfolioArticle) {
|
||||||
|
Map map = portfolioService.updateArticleSortNo(portfolioArticle);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
<result column="article_link" property="articleLink"></result>
|
<result column="article_link" property="articleLink"></result>
|
||||||
<result column="article_status" property="articleStatus"></result>
|
<result column="article_status" property="articleStatus"></result>
|
||||||
<result column="updated_time" property="updatedTime"></result>
|
<result column="updated_time" property="updatedTime"></result>
|
||||||
|
<result column="sort_no" property="sortNo"></result>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap id="ArticleContentResultMap" type="com.rymcu.vertical.entity.ArticleContent">
|
<resultMap id="ArticleContentResultMap" type="com.rymcu.vertical.entity.ArticleContent">
|
||||||
<result column="id_article" property="idArticle"/>
|
<result column="id_article" property="idArticle"/>
|
||||||
@ -108,7 +109,7 @@
|
|||||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id where article_status = '1' and art.article_author_id = #{idUser} order by updated_time desc
|
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id where article_status = '1' and art.article_author_id = #{idUser} order by updated_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectArticlesByIdPortfolio" resultMap="DTOResultMap">
|
<select id="selectArticlesByIdPortfolio" resultMap="DTOResultMap">
|
||||||
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_portfolio_article vpa on vpa.id_vertical_article = art.id and vpa.id_vertical_portfolio = #{idPortfolio}
|
select art.*,su.nickname,su.avatar_url,vpa.sort_no from vertical_article art join vertical_portfolio_article vpa on vpa.id_vertical_article = art.id and vpa.id_vertical_portfolio = #{idPortfolio}
|
||||||
left join vertical_user su on art.article_author_id = su.id where art.article_status = 0 and vpa.id_vertical_portfolio = #{idPortfolio} order by sort_no
|
left join vertical_user su on art.article_author_id = su.id where art.article_status = 0 and vpa.id_vertical_portfolio = #{idPortfolio} order by sort_no
|
||||||
</select>
|
</select>
|
||||||
<select id="selectUnbindArticlesByIdPortfolio" resultMap="DTOResultMap">
|
<select id="selectUnbindArticlesByIdPortfolio" resultMap="DTOResultMap">
|
||||||
|
@ -21,11 +21,23 @@
|
|||||||
<insert id="insertPortfolioArticle">
|
<insert id="insertPortfolioArticle">
|
||||||
insert into vertical_portfolio_article (id_vertical_portfolio, id_vertical_article, sort_no) values (#{idPortfolio}, #{idArticle}, #{maxSortNo})
|
insert into vertical_portfolio_article (id_vertical_portfolio, id_vertical_article, sort_no) values (#{idPortfolio}, #{idArticle}, #{maxSortNo})
|
||||||
</insert>
|
</insert>
|
||||||
|
<update id="updateArticleSortNo">
|
||||||
|
update vertical_portfolio_article set sort_no = #{sortNo} where id_vertical_portfolio = #{idPortfolio} and id_vertical_article = #{idArticle}
|
||||||
|
</update>
|
||||||
<select id="selectUserPortfoliosByIdUser" resultMap="DTOResultMap">
|
<select id="selectUserPortfoliosByIdUser" resultMap="DTOResultMap">
|
||||||
select id, portfolio_head_img_url, portfolio_title, portfolio_author_id, portfolio_description, updated_time from vertical_portfolio where portfolio_author_id = #{idUser}
|
select id, portfolio_head_img_url, portfolio_title, portfolio_author_id, portfolio_description, updated_time from vertical_portfolio where portfolio_author_id = #{idUser}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPortfolioDTOById" resultMap="DTOResultMap">
|
<select id="selectPortfolioDTOById" resultMap="DTOResultMap">
|
||||||
select id, portfolio_head_img_url, portfolio_title, portfolio_author_id, portfolio_description, updated_time from vertical_portfolio where id = #{id}
|
select id, portfolio_head_img_url, portfolio_title, portfolio_author_id,
|
||||||
|
<choose>
|
||||||
|
<when test="type == 1">
|
||||||
|
portfolio_description_html as portfolio_description,
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
portfolio_description,
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
updated_time from vertical_portfolio where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectCountArticleNumber" resultType="java.lang.Integer">
|
<select id="selectCountArticleNumber" resultType="java.lang.Integer">
|
||||||
select count(*) from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio}
|
select count(*) from vertical_portfolio_article where id_vertical_portfolio = #{idPortfolio}
|
||||||
|
Loading…
Reference in New Issue
Block a user