Commit 91b0fbea authored by liwei's avatar liwei

修改了规范

parent 82a00cba
......@@ -3,8 +3,7 @@ package org.rcisoft.business.opmArticle.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.cmsBanner.entity.CmsBanner;
import org.rcisoft.business.opmArticle.entity.ArticleCommentDTO;
import org.rcisoft.business.opmArticle.entity.ArticleCommentVO;
import org.rcisoft.business.opmArticle.entity.LikeDTO;
import org.rcisoft.business.opmArticle.entity.OpmArticle;
import org.rcisoft.core.mapper.CyBaseMapper;
......@@ -31,12 +30,10 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
OpmArticle selectByIdWithUrl(String id);
List<ArticleCommentDTO> SelectArticleComment(Integer businessId);
List<ArticleCommentVO> SelectArticleComment(Integer businessId);
int deleteComment(OpmArticle opmArticle);
List<String> SelectPathList(Integer businessId);
//添加点赞记录
int likeAdd(@Param("entity") LikeDTO likeDTO);
......
......@@ -4,7 +4,7 @@ package org.rcisoft.business.opmArticle.entity;
import lombok.Data;
@Data
public class ArticleCommentDTO {
public class ArticleCommentVO {
/**
......@@ -30,6 +30,6 @@ public class ArticleCommentDTO {
/**
* 用户头像
*/
String path;
String url;
}
package org.rcisoft.business.opmArticle.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
......@@ -67,10 +66,12 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
private String pictureId;
/**
* 图片地址
*
* 动态图片,以逗号分割
*
*/
@TableField(exist = false)
List<String> path;
String url;
/**
* 话题名称
......@@ -150,14 +151,7 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
* 评论列表
*/
@TableField(exist = false)
List<ArticleCommentDTO> articleCommentDTOList;
/**
* 动态图片,以逗号分割
*/
@TableField(exist = false)
private String pictureUrls;
List<ArticleCommentVO> articleCommentVOList;
/**
......
......@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.opmArticle.dao.OpmArticleRepository;
import org.rcisoft.business.opmArticle.entity.ArticleCommentDTO;
import org.rcisoft.business.opmArticle.entity.ArticleCommentVO;
import org.rcisoft.business.opmArticle.entity.LikeDTO;
import org.rcisoft.business.opmArticle.entity.OpmArticle;
import org.rcisoft.business.opmArticle.service.OpmArticleService;
......@@ -86,16 +86,16 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
/**
* 根据id查询 opmArticle管理
* @param id
* @param articleId
* @return
*/
@Override
public OpmArticle findById(String id){
OpmArticle opmArticle = baseMapper.selectByIdWithUrl(id);
List<ArticleCommentDTO> list = baseMapper.SelectArticleComment(opmArticle.getBusinessId());
List<String> pathList = baseMapper.SelectPathList(opmArticle.getBusinessId());
opmArticle.setPath(pathList);
opmArticle.setArticleCommentDTOList(list);
public OpmArticle findById(String articleId){
//根据动态id 查询动态详情
OpmArticle opmArticle = baseMapper.selectByIdWithUrl(articleId);
//查询该动态的评论
List<ArticleCommentVO> list = baseMapper.SelectArticleComment(opmArticle.getBusinessId());
opmArticle.setArticleCommentVOList(list);
return opmArticle;
}
......
......@@ -102,7 +102,7 @@
WHEN opl.business_id IS NOT NULL THEN 1 ELSE 0
END AS isLike,
oi.url AS memAvatar,
GROUP_CONCAT(DISTINCT pic_urls.url ORDER BY pic_urls.url SEPARATOR ',') AS pictureUrls
GROUP_CONCAT(DISTINCT pic_urls.url ORDER BY pic_urls.url SEPARATOR ',') AS url
FROM
opm_article opa
LEFT JOIN opm_topic opt ON opa.topic_id = opt.business_id
......@@ -167,20 +167,39 @@
opa.business_id DESC
</select>
<select id="selectByIdWithUrl" resultType="org.rcisoft.business.opmArticle.entity.OpmArticle">
SELECT opa.*,
oi.url,
mi.mem_code as memCode
from opm_article opa
SELECT
opa.*,
mi.mem_code AS memCode,
GROUP_CONCAT( DISTINCT pic_urls.url ORDER BY pic_urls.url SEPARATOR ',' ) AS url
FROM
opm_article opa
LEFT JOIN mem_info mi ON mi.user_id = opa.create_by
LEFT JOIN oss_info oi ON oi.business_id = opa.picture_id
where 1 = 1
and opa.del_flag = '0'
and opa.business_id = #{businessId}
LEFT JOIN (
SELECT
opm_article.business_id,
CAST( JSON_UNQUOTE( JSON_EXTRACT( picture_id, CONCAT( '$.id[', jt_ids.idx - 1, ']' ))) AS UNSIGNED ) AS picture_id
FROM
opm_article,
JSON_TABLE (
JSON_EXTRACT( opm_article.picture_id, '$.id' ),
'$[*]' COLUMNS ( idx FOR ORDINALITY )) AS jt_ids
WHERE
opm_article.del_flag = '0'
) AS pic_ids ON opa.business_id = pic_ids.business_id
LEFT JOIN oss_info pic_urls ON pic_ids.picture_id = pic_urls.business_id
WHERE
1 = 1
AND opa.del_flag = '0'
AND opa.business_id = #{businessId}
GROUP BY
opa.business_id
ORDER BY
opa.business_id DESC
</select>
<select id="SelectArticleComment" resultType="org.rcisoft.business.opmArticle.entity.ArticleCommentDTO">
<select id="SelectArticleComment" resultType="org.rcisoft.business.opmArticle.entity.ArticleCommentVO">
SELECT opc.*,
mi.mem_code as memCode,
oi.url as path
oi.url as url
FROM opm_article_comment opc
LEFT JOIN mem_info mi ON mi.user_id = opc.create_by
left join oss_info oi on oi.business_id = mi.avatar
......@@ -188,23 +207,6 @@
AND opc.del_flag = '0'
AND opc.article_id = #{articleId}
</select>
<select id="SelectPathList" resultType="java.lang.String">
SELECT
oi.url
FROM
oss_info oi
RIGHT JOIN (
SELECT
business_id,
CAST( JSON_UNQUOTE( JSON_EXTRACT( picture_id, CONCAT( '$."id"[', idx - 1, ']' ))) AS UNSIGNED ) AS picture_id
FROM
opm_article,
JSON_TABLE ( JSON_EXTRACT( picture_id, '$.id' ), '$[*]' COLUMNS ( idx FOR ORDINALITY ) ) AS jt_ids
WHERE
opm_article.business_id = #{businessId}
AND opm_article.del_flag = '0'
) AS jt ON oi.business_id = jt.picture_id;
</select>
<delete id="deleteComment">
update opm_article_comment set del_flag = '1' where business_id = #{businessId}
and del_flag = '0'
......
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