Commit b5f8c3b9 authored by 罗林杰's avatar 罗林杰

修改动态

parent 076400cd
......@@ -17,6 +17,12 @@ public class opmArticleDTO extends CyIdIncreEntity<opmArticleDTO> {
*/
private String createUser;
/**
* 业务Id
*/
Integer businessId;
/**
* 发布时间
*/
......
......@@ -135,4 +135,18 @@ public class OpmArticleController extends CyPaginationController<OpmArticle> {
List<OpmArticle> opmArticleList = opmArticleServiceImpl.export(opmArticle);
CyEpExcelUtil.exportExcel(opmArticleList, "banner管理信息", "banner管理信息", OpmArticle.class, excelName, response);
}
/**
* 逻辑删除评论
*/
@PreAuthorize("@cyPerm.hasPerm('cms:banner:removing')")
@DeleteMapping("/deleteComment/{businessId:\\w+}")
public CyResult deleteComment(@PathVariable String businessId,OpmArticle opmArticle) {
opmArticle.setBusinessId(Integer.valueOf(businessId));
CyPersistModel data = opmArticleServiceImpl.removeComment(opmArticle);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
}
......@@ -31,5 +31,9 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
OpmArticle selectByIdWithUrl(String id);
List<ArticleCommentDTO> SelectArticleComment(Integer businessId);
int deleteComment(OpmArticle opmArticle);
List<String> SelectPathList(Integer businessId);
}
......@@ -17,14 +17,6 @@ import java.util.List;
public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
/**
* @desc 图片
* @column picture_id
* @default
*/
private Integer pictureId;
/**
* @desc 内容
* @column content
......@@ -71,7 +63,7 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
* 图片地址
*/
@TableField(exist = false)
private String path;
List<String> path;
/**
* 话题名称
......
......@@ -71,4 +71,11 @@ public interface OpmArticleService {
*/
List<OpmArticle> export(OpmArticle opmArticle);
/**
* 逻辑删除 评论
* @param opmArticle
* @return
*/
CyPersistModel removeComment(OpmArticle opmArticle);
}
......@@ -4,6 +4,7 @@ package org.rcisoft.business.opmArticle.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.cmsBanner.entity.CmsBanner;
import org.rcisoft.business.opmArticle.dao.OpmArticleRepository;
import org.rcisoft.business.opmArticle.entity.ArticleCommentDTO;
import org.rcisoft.business.opmArticle.entity.OpmArticle;
......@@ -96,10 +97,17 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
@Override
public OpmArticle findById(String id){
OpmArticle opmArticle = baseMapper.selectByIdWithUrl(id);
if (opmArticle.getPath()!=null){
opmArticle.setPath(global.getBase_Discovery()+opmArticle.getPath());
}
List<ArticleCommentDTO> list = baseMapper.SelectArticleComment(opmArticle.getBusinessId());
List<String> pathList = baseMapper.SelectPathList(opmArticle.getBusinessId());
List<String> updatedPathList = new ArrayList<>();
if (pathList != null) {
for (String path : pathList) {
// 拼接新的路径并添加到新的列表中
String updatedPath = global.getBase_Discovery() + path;
updatedPathList.add(updatedPath);
}
}
opmArticle.setPath(updatedPathList);
opmArticle.setArticleCommentDTOList(list);
return opmArticle;
}
......@@ -113,12 +121,6 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
public IPage<OpmArticle> findAllByPagination(CyPageInfo<OpmArticle> paginationUtility,
OpmArticle opmArticle){
IPage<OpmArticle> result = baseMapper.queryOpmArticlePaged(paginationUtility,opmArticle);
List<OpmArticle> opmArticleList = result.getRecords();
for (OpmArticle article : opmArticleList){
if (article.getPath()!=null){
article.setPath(global.getBase_Discovery()+article.getPath());
}
}
return result;
}
......@@ -144,4 +146,20 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
return opmArticleList;
}
/**
* 逻辑删除 评论
* @param opmArticle
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel removeComment(OpmArticle opmArticle){
opmArticle.setDeleted();
int line = baseMapper.deleteComment(opmArticle);
log.debug(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+
opmArticle.getBusinessId()+"的opmArticleComment信息");
return new CyPersistModel(line);
}
}
......@@ -387,12 +387,12 @@
select
a.create_date as createDate,
u.name as createUser,
t.topic_name as topic
t.topic_name as topic,
a.business_id as businessId
from opm_article a
left join sys_user u on u.business_id = a.create_by
left join opm_topic t on t.business_id = a.topic_id
where a.del_flag = 0
and a.is_article = 1
and a.exam_status = 0
ORDER BY a.business_id DESC
</select>
......@@ -434,7 +434,6 @@
SELECT COUNT(1)
FROM opm_article a
WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 1
<if test="entity.firstDay !=null and entity.firstDay != '' ">
and a.create_date &gt;= #{entity.firstDay}
......@@ -451,47 +450,43 @@
</select>
<select id="getArticleCountByDateRangeYes" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO">
SELECT
DATE(a.update_date) as date,
DATE(a.create_date) as date,
COUNT(1) as articleNum
FROM opm_article a
WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 1
AND DATE(a.update_date) BETWEEN #{startDate} AND #{endDate}
GROUP BY DATE(a.update_date)
AND DATE(a.create_date) BETWEEN #{startDate} AND #{endDate}
GROUP BY DATE(a.create_date)
</select>
<select id="getArticleCountByMonthRangeYes" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO">
SELECT
DATE_FORMAT(a.update_date, '%Y-%m') as date,
DATE_FORMAT(a.create_date, '%Y-%m') as date,
COUNT(1) as articleNum
FROM opm_article a
WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 1
AND DATE_FORMAT(a.update_date, '%Y-%m') BETWEEN #{startDateMonth} AND #{endDate}
GROUP BY DATE_FORMAT(a.update_date, '%Y-%m')
AND DATE_FORMAT(a.create_date, '%Y-%m') BETWEEN #{startDateMonth} AND #{endDate}
GROUP BY DATE_FORMAT(a.create_date, '%Y-%m')
</select>
<select id="getArticleCountByDateRangeNo" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO">
SELECT
DATE(a.update_date) as date,
DATE(a.create_date) as date,
COUNT(1) as articleNum
FROM opm_article a
WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 0
AND DATE(a.update_date) BETWEEN #{startDate} AND #{endDate}
GROUP BY DATE(a.update_date)
AND DATE(a.create_date) BETWEEN #{startDate} AND #{endDate}
GROUP BY DATE(a.create_date)
</select>
<select id="getArticleCountByMonthRangeNo" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO">
SELECT
DATE_FORMAT(a.update_date, '%Y-%m') as date,
DATE_FORMAT(a.create_date, '%Y-%m') as date,
COUNT(1) as articleNum
FROM opm_article a
WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 0
AND DATE_FORMAT(a.update_date, '%Y-%m') BETWEEN #{startDateMonth} AND #{endDate}
GROUP BY DATE_FORMAT(a.update_date, '%Y-%m')
AND DATE_FORMAT(a.create_date, '%Y-%m') BETWEEN #{startDateMonth} AND #{endDate}
GROUP BY DATE_FORMAT(a.create_date, '%Y-%m')
</select>
</mapper>
......@@ -11,7 +11,6 @@
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="content" jdbcType="VARCHAR" property="content"/>
<result column="picture_id" jdbcType="INTEGER" property="pictureId"/>
<result column="comment_count" jdbcType="VARCHAR" property="commentCount"/>
<result column="like_count" jdbcType="VARCHAR" property="likeCount"/>
<result column="topic_id" jdbcType="INTEGER" property="topicId"/>
......@@ -21,9 +20,8 @@
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryOpmArticle" resultMap="BaseResultMap">
select opa.*,oi.path,sot.topic_name as topic,mi.mem_code as memCode
select opa.*,sot.topic_name as topic,mi.mem_code as memCode
from opm_article opa
left join oss_info oi on opa.picture_id = oi.business_id
left join opm_topic sot on opa.topic_id = sot.business_id
left join mem_info mi on opa.create_by = mi.user_id
where 1=1
......@@ -49,9 +47,6 @@
<if test="entity.topic !=null and entity.topic != '' ">
and sot.topic_name like concat('%',#{entity.topic},'%')
</if>
<if test="entity.pictureId !=null and entity.pictureId != '' ">
and opa.picture_id = #{entity.pictureId}
</if>
<if test="entity.createBy !=null and entity.createBy != '' ">
and opa.create_by = #{entity.createBy}
</if>
......@@ -74,9 +69,8 @@
</select>
<select id="queryOpmArticlePaged" resultMap="BaseResultMap">
select opa.*,oi.path,sot.topic_name as topic,mi.mem_code as memCode
select opa.*,sot.topic_name as topic,mi.mem_code as memCode
from opm_article opa
left join oss_info oi on opa.picture_id = oi.business_id
left join opm_topic sot on opa.topic_id = sot.business_id
left join mem_info mi on opa.create_by = mi.user_id
where 1=1
......@@ -102,9 +96,6 @@
<if test="entity.topic !=null and entity.topic != '' ">
and sot.topic_name like concat('%',#{entity.topic},'%')
</if>
<if test="entity.pictureId !=null and entity.pictureId != '' ">
and opa.picture_id = #{entity.pictureId}
</if>
<if test="entity.createBy !=null and entity.createBy != '' ">
and opa.create_by = #{entity.createBy}
</if>
......@@ -127,8 +118,10 @@
</select>
<select id="selectByIdWithUrl" resultType="org.rcisoft.business.opmArticle.entity.OpmArticle">
SELECT opa.*,
oi.path
oi.path,
mi.mem_code as memCode
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'
......@@ -145,5 +138,25 @@
AND opc.del_flag = '0'
AND opc.article_id = #{articleId}
</select>
<select id="SelectPathList" resultType="java.lang.String">
SELECT
oi.path
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'
</delete>
</mapper>
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