Commit 91548447 authored by liwei's avatar liwei

Merge remote-tracking branch 'origin/master'

parents dbc51d64 1b6c055b
package org.rcisoft.app.appOpmTopic.controller;
/*固定导入*/
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import org.rcisoft.business.opmTopic.entity.OpmTopic;
import org.rcisoft.business.opmTopic.service.OpmTopicService;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/app/opmTopic")
public class AppOpmTopicController extends CyPaginationController<OpmTopic> {
@Autowired
private OpmTopicService opmTopicServiceImpl;
@PreAuthorize("@cyPerm.hasPerm('app:topic:detial')")
@CyOpeLogAnno(title = "system-公告管理-查询公告", businessType = CyLogTypeEnum.QUERY)
@Operation(summary = "查询单一公告", description = "查询单一公告")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true)})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable Integer businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
opmTopicServiceImpl.findById(businessId));
}
@PreAuthorize("@cyPerm.hasPerm('app:topic:query')")
@CyOpeLogAnno(title = "system-话题管理-查询话题", businessType = CyLogTypeEnum.QUERY)
@Operation(summary = "分页查询话题集合", description = "分页查询话题集合")
@GetMapping(value = "/queryOpmTopicByPagination")
public CyGridModel listByPagination(OpmTopic opmTopic) {
opmTopicServiceImpl.findAllByPagination(getPaginationUtility(), opmTopic);
return getGridModelResponse();
}
}
...@@ -15,7 +15,13 @@ public class opmArticleDTO extends CyIdIncreEntity<opmArticleDTO> { ...@@ -15,7 +15,13 @@ public class opmArticleDTO extends CyIdIncreEntity<opmArticleDTO> {
/** /**
* 发布人 * 发布人
*/ */
private Integer createUser; private String createUser;
/**
* 业务Id
*/
Integer businessId;
/** /**
* 发布时间 * 发布时间
......
package org.rcisoft.business.opmArticle.controller;
/*固定导入*/
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import jakarta.servlet.http.HttpServletResponse;
import org.rcisoft.business.opmArticle.entity.OpmArticle;
import org.rcisoft.business.opmArticle.service.OpmArticleService;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* Created by cy on 2024年3月30日 下午1:51:15.
*/
@RestController
@RequestMapping("/opmarticle")
public class OpmArticleController extends CyPaginationController<OpmArticle> {
@Autowired
private OpmArticleService opmArticleServiceImpl;
@PreAuthorize("@cyPerm.hasPerm('cms:banner:increase')")
@CyOpeLogAnno(title = "system-banner管理管理-新增banner管理", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="添加banner管理", description="添加banner管理")
@PostMapping(value = "/add")
public CyResult add(@Valid OpmArticle opmArticle, BindingResult bindingResult) {
CyPersistModel data = opmArticleServiceImpl.persist(opmArticle);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
opmArticle);
}
@PreAuthorize("@cyPerm.hasPerm('cms:banner:removing')")
@CyOpeLogAnno(title = "system-banner管理管理-删除banner管理", businessType = CyLogTypeEnum.DELETE)
@Operation(summary="逻辑删除banner管理", description="逻辑删除banner管理")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true)})
@DeleteMapping("/deleteLogical/{businessId:\\w+}")
public CyResult deleteLogical(@PathVariable String businessId,OpmArticle opmArticle) {
opmArticle.setBusinessId(Integer.valueOf(businessId));
CyPersistModel data = opmArticleServiceImpl.removeLogical(opmArticle);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:banner:delete')")
@CyOpeLogAnno(title = "system-banner管理管理-删除banner管理", businessType = CyLogTypeEnum.DELETE)
@Operation(summary="删除banner管理", description="删除banner管理")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true)})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable String businessId,OpmArticle opmArticle) {
opmArticle.setBusinessId(Integer.valueOf(businessId));
CyPersistModel data = opmArticleServiceImpl.remove(opmArticle);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@PreAuthorize("@cyPerm.hasPerm('cms:banner:modifications')")
@CyOpeLogAnno(title = "system-banner管理管理-修改banner管理", businessType = CyLogTypeEnum.UPDATE)
@Operation(summary="修改banner管理", description="修改banner管理")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = false)})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable String businessId, @Valid OpmArticle opmArticle, BindingResult bindingResult) {
opmArticle.setBusinessId(Integer.valueOf(businessId));
CyPersistModel data = opmArticleServiceImpl.merge(opmArticle);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
opmArticle);
}
@PreAuthorize("@cyPerm.hasPerm('cms:banner:singleSearch')")
@CyOpeLogAnno(title = "system-banner管理管理-查询banner管理", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询单一banner管理", description="查询单一banner管理")
@Parameters({@Parameter(name = "businessId", description = "businessId", required = true)})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable String businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
opmArticleServiceImpl.findById(businessId));
}
@PreAuthorize("@cyPerm.hasPerm('cms:banner:search')")
@CyOpeLogAnno(title = "system-banner管理管理-查询banner管理", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="查询banner管理集合", description="查询banner管理集合")
@GetMapping(value = "/queryOpmArticle")
public CyResult queryCmsBanners(OpmArticle opmArticle) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
opmArticleServiceImpl.findAll(opmArticle));
}
// @PreAuthorize("@cyPerm.hasPerm('cms:banner:pageSearch')")
@CyOpeLogAnno(title = "system-banner管理管理-查询banner管理", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询banner管理集合", description="分页查询banner管理集合")
@GetMapping(value = "/list")
public CyGridModel listByPagination(OpmArticle opmArticle) {
opmArticleServiceImpl.findAllByPagination(getPaginationUtility(), opmArticle);
return getGridModelResponse();
}
@PreAuthorize("@cyPerm.hasPerm('cms:banner:derive')")
@CyOpeLogAnno(title = "system-banner管理管理-查询banner管理", businessType = CyLogTypeEnum.EXPORT)
@Operation(summary = "导出banner管理信息", description = "导出banner管理信息")
@GetMapping(value = "/export")
public void outCmsBanner(HttpServletResponse response, OpmArticle opmArticle, @PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName="";
switch(excelId){
case "0": excelName="banner管理信息.xls";break;
case "1": excelName="banner管理信息.xlsx";break;
case "2": excelName="banner管理信息.csv";break;
}
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);
}
}
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.OpmArticle;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
/**
* Created with cy on 2024年3月30日 下午1:51:15.
*/
public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
List<OpmArticle> queryOpmArticle(@Param("entity") OpmArticle cmsBanner);
/**
* 分页查询 cmsBanner
*
*/
IPage<OpmArticle> queryOpmArticlePaged(CyPageInfo cyPageInfo, @Param("entity") OpmArticle cmsBanner);
OpmArticle selectByIdWithUrl(String id);
List<ArticleCommentDTO> SelectArticleComment(Integer businessId);
int deleteComment(OpmArticle opmArticle);
List<String> SelectPathList(Integer businessId);
}
package org.rcisoft.business.opmArticle.entity;
import lombok.Data;
@Data
public class ArticleCommentDTO {
/**
* 业务Id
*/
Integer businessId;
/**
* 会员编号
*/
String memCode;
/**
* 评论内容
*/
String content;
/**
* 父级Id
*/
Integer parentId;
/**
* 用户头像
*/
String path;
}
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;
import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity;
import java.util.List;
/**
* Created with cy on 2024年3月30日 下午1:51:15.
*/
@Data
@TableName("opm_article")
public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
/**
* @desc 内容
* @column content
* @default
*/
private String content;
/**
* @desc 评论数
* @column comment_count
* @default
*/
private Integer commentCount;
/**
* @desc 点赞数
* @column like_count
* @default
*/
private Integer likeCount;
/**
* @desc 审核状态
* @column exam_status
* @default
*/
private String examStatus;
/**
* @desc 是否动态
* @column is_article
* @default
*/
private String isArticle;
/**
* @desc 话题Id
* @column topic_id
* @default
*/
private Integer topicId;
/**
* 图片地址
*/
@TableField(exist = false)
List<String> path;
/**
* 话题名称
*/
@TableField(exist = false)
private String topic;
/**
* 创建人会员号
*/
@TableField(exist = false)
private String memCode;
/**
* 开始时间
*/
@JsonIgnore
@TableField(exist = false)
private String beginTime;
/**
* 结束时间
*/
@JsonIgnore
@TableField(exist = false)
private String endTime;
/**
* 评论列表
*/
@TableField(exist = false)
List<ArticleCommentDTO> articleCommentDTOList;
}
package org.rcisoft.business.opmArticle.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.rcisoft.business.cmsBanner.entity.CmsBanner;
import org.rcisoft.business.opmArticle.entity.OpmArticle;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import java.util.List;
/**
* Created by cy on 2024年3月30日 下午1:51:15.
*/
public interface OpmArticleService {
/**
* 保存 opmArticle管理
* @param opmArticle
* @return
*/
CyPersistModel persist(OpmArticle opmArticle);
/**
* 删除 opmArticle管理
* @param opmArticle
* @return
*/
CyPersistModel remove(OpmArticle opmArticle);
/**
* 逻辑删除 opmArticle管理
* @param opmArticle
* @return
*/
CyPersistModel removeLogical(OpmArticle opmArticle);
/**
* 修改 opmArticle管理
* @param opmArticle
* @return
*/
CyPersistModel merge(OpmArticle opmArticle);
/**
* 根据id查询 opmArticle管理
* @param id
* @return
*/
OpmArticle findById(String id);
/**
* 分页查询 opmArticle管理
* @param opmArticle
* @return
*/
IPage<OpmArticle> findAllByPagination(CyPageInfo<OpmArticle> paginationUtility,
OpmArticle opmArticle);
/**
* 查询list opmArticle管理
* @param opmArticle
* @return
*/
List<OpmArticle> findAll(OpmArticle opmArticle);
/**
* 导出opmArticle管理
* @return
*/
List<OpmArticle> export(OpmArticle opmArticle);
/**
* 逻辑删除 评论
* @param opmArticle
* @return
*/
CyPersistModel removeComment(OpmArticle opmArticle);
}
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;
import org.rcisoft.business.opmArticle.service.OpmArticleService;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cy on 2024年3月30日 下午1:51:15.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, OpmArticle> implements OpmArticleService {
@Autowired
private Global global;
/**
* 保存 opmArticle管理
* @param opmArticle
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(OpmArticle opmArticle){
//增加操作
int line = baseMapper.insert(opmArticle);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
opmArticle.getBusinessId()+"的opmArticle管理信息");
return new CyPersistModel(line);
}
/**
* 删除 opmArticle管理
* @param opmArticle
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(OpmArticle opmArticle){
int line = baseMapper.realDelete(opmArticle);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+
opmArticle.getBusinessId()+"的opmArticle管理信息");
return new CyPersistModel(line);
}
/**
* 逻辑删除 opmArticle管理
* @param opmArticle
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel removeLogical(OpmArticle opmArticle){
opmArticle.setDeleted();
int line = baseMapper.deleteById(opmArticle);
log.debug(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+
opmArticle.getBusinessId()+"的opmArticle管理信息");
return new CyPersistModel(line);
}
/**
* 修改 opmArticle管理
* @param opmArticle
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(OpmArticle opmArticle){
int line = baseMapper.updateById(opmArticle);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ opmArticle.getBusinessId()+"的opmArticle管理信息");
return new CyPersistModel(line);
}
/**
* 根据id查询 opmArticle管理
* @param id
* @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());
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;
}
/**
* 分页查询 opmArticle管理
* @param opmArticle
* @return
*/
@Override
public IPage<OpmArticle> findAllByPagination(CyPageInfo<OpmArticle> paginationUtility,
OpmArticle opmArticle){
IPage<OpmArticle> result = baseMapper.queryOpmArticlePaged(paginationUtility,opmArticle);
return result;
}
/**
* 查询list opmArticle管理
* @param opmArticle
* @return
*/
@Override
public List<OpmArticle> findAll(OpmArticle opmArticle){
return baseMapper.queryOpmArticle(opmArticle);
}
/**
* 导出opmArticle管理
* @return
*/
@Override
public List<OpmArticle> export(OpmArticle opmArticle) {
List<OpmArticle> opmArticleList = baseMapper.queryOpmArticle(opmArticle);
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);
}
}
...@@ -135,25 +135,12 @@ ...@@ -135,25 +135,12 @@
LEFT JOIN oss_info oi on ca.picture_id = oi.business_id LEFT JOIN oss_info oi on ca.picture_id = oi.business_id
LEFT JOIN sys_user su on su.business_id = ca.create_by LEFT JOIN sys_user su on su.business_id = ca.create_by
where ca.del_flag='0' where ca.del_flag='0'
<!-- <if test="entity.beginTime !=null and entity.beginTime != '' ">
and publish_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and publish_date &lt;= #{entity.endTime}
</if>-->
<if test="entity.flag!=null and entity.flag != '' "> <if test="entity.flag!=null and entity.flag != '' ">
and ca.flag = #{entity.flag} and ca.flag = #{entity.flag}
</if> </if>
<if test="entity.createBy !=null and entity.createBy != '' "> <if test="entity.createBy !=null and entity.createBy != '' ">
and ca.create_by like concat('%',#{entity.createBy},'%') and ca.create_by like concat('%',#{entity.createBy},'%')
</if> </if>
<!-- <if test="entity.beginTime !=null ">
and ca.publish_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null ">
and ca.publish_date &lt;= #{entity.endTime}
</if>-->
<if test="entity.updateBy !=null and entity.updateBy != '' "> <if test="entity.updateBy !=null and entity.updateBy != '' ">
and ca.update_by like concat('%',#{entity.updateBy},'%') and ca.update_by like concat('%',#{entity.updateBy},'%')
</if> </if>
...@@ -181,10 +168,10 @@ ...@@ -181,10 +168,10 @@
<if test="entity.isNeedMember !=null and entity.isNeedMember != '' "> <if test="entity.isNeedMember !=null and entity.isNeedMember != '' ">
and ca.is_need_member = #{entity.isNeedMember} and ca.is_need_member = #{entity.isNeedMember}
</if> </if>
<if test="entity.isRecommended !=null and entity.isRecommended != '' "> <if test="entity.isRecommended !=null">
and ca.is_recommended = #{entity.isRecommended} and ca.is_recommended = #{entity.isRecommended}
</if> </if>
<if test="entity.isTop !=null and entity.isTop != '' "> <if test="entity.isTop !=null">
and ca.is_top = #{entity.isTop} and ca.is_top = #{entity.isTop}
</if> </if>
<if test="entity.startTime !=null and entity.startTime != '' "> <if test="entity.startTime !=null and entity.startTime != '' ">
......
...@@ -117,10 +117,10 @@ ...@@ -117,10 +117,10 @@
<if test="entity.pictureId !=null and entity.pictureId != '' "> <if test="entity.pictureId !=null and entity.pictureId != '' ">
and picture_id = #{entity.pictureId} and picture_id = #{entity.pictureId}
</if> </if>
<if test="entity.isRecommended !=null and entity.isRecommended != '' "> <if test="entity.isRecommended !=null">
and is_recommended = #{entity.isRecommended} and is_recommended = #{entity.isRecommended}
</if> </if>
<if test="entity.isTop !=null and entity.isTop != '' "> <if test="entity.isTop !=null">
and is_top = #{entity.isTop} and is_top = #{entity.isTop}
</if> </if>
ORDER BY cn.publish_date DESC ORDER BY cn.publish_date DESC
......
...@@ -387,12 +387,12 @@ ...@@ -387,12 +387,12 @@
select select
a.create_date as createDate, a.create_date as createDate,
u.name as createUser, u.name as createUser,
t.topic_name as topic t.topic_name as topic,
a.business_id as businessId
from opm_article a from opm_article a
left join sys_user u on u.business_id = a.create_by left join sys_user u on u.business_id = a.create_by
left join opm_topic t on t.business_id = a.topic_id left join opm_topic t on t.business_id = a.topic_id
where a.del_flag = 0 where a.del_flag = 0
and a.is_article = 1
and a.exam_status = 0 and a.exam_status = 0
ORDER BY a.business_id DESC ORDER BY a.business_id DESC
</select> </select>
...@@ -434,7 +434,6 @@ ...@@ -434,7 +434,6 @@
SELECT COUNT(1) SELECT COUNT(1)
FROM opm_article a FROM opm_article a
WHERE a.del_flag = 0 WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 1 AND a.exam_status = 1
<if test="entity.firstDay !=null and entity.firstDay != '' "> <if test="entity.firstDay !=null and entity.firstDay != '' ">
and a.create_date &gt;= #{entity.firstDay} and a.create_date &gt;= #{entity.firstDay}
...@@ -451,47 +450,43 @@ ...@@ -451,47 +450,43 @@
</select> </select>
<select id="getArticleCountByDateRangeYes" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO"> <select id="getArticleCountByDateRangeYes" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO">
SELECT SELECT
DATE(a.update_date) as date, DATE(a.create_date) as date,
COUNT(1) as articleNum COUNT(1) as articleNum
FROM opm_article a FROM opm_article a
WHERE a.del_flag = 0 WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 1 AND a.exam_status = 1
AND DATE(a.update_date) BETWEEN #{startDate} AND #{endDate} AND DATE(a.create_date) BETWEEN #{startDate} AND #{endDate}
GROUP BY DATE(a.update_date) GROUP BY DATE(a.create_date)
</select> </select>
<select id="getArticleCountByMonthRangeYes" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO"> <select id="getArticleCountByMonthRangeYes" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO">
SELECT SELECT
DATE_FORMAT(a.update_date, '%Y-%m') as date, DATE_FORMAT(a.create_date, '%Y-%m') as date,
COUNT(1) as articleNum COUNT(1) as articleNum
FROM opm_article a FROM opm_article a
WHERE a.del_flag = 0 WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 1 AND a.exam_status = 1
AND DATE_FORMAT(a.update_date, '%Y-%m') BETWEEN #{startDateMonth} AND #{endDate} AND DATE_FORMAT(a.create_date, '%Y-%m') BETWEEN #{startDateMonth} AND #{endDate}
GROUP BY DATE_FORMAT(a.update_date, '%Y-%m') GROUP BY DATE_FORMAT(a.create_date, '%Y-%m')
</select> </select>
<select id="getArticleCountByDateRangeNo" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO"> <select id="getArticleCountByDateRangeNo" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO">
SELECT SELECT
DATE(a.update_date) as date, DATE(a.create_date) as date,
COUNT(1) as articleNum COUNT(1) as articleNum
FROM opm_article a FROM opm_article a
WHERE a.del_flag = 0 WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 0 AND a.exam_status = 0
AND DATE(a.update_date) BETWEEN #{startDate} AND #{endDate} AND DATE(a.create_date) BETWEEN #{startDate} AND #{endDate}
GROUP BY DATE(a.update_date) GROUP BY DATE(a.create_date)
</select> </select>
<select id="getArticleCountByMonthRangeNo" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO"> <select id="getArticleCountByMonthRangeNo" resultType="org.rcisoft.business.memInfo.entity.opmArticleDTO">
SELECT SELECT
DATE_FORMAT(a.update_date, '%Y-%m') as date, DATE_FORMAT(a.create_date, '%Y-%m') as date,
COUNT(1) as articleNum COUNT(1) as articleNum
FROM opm_article a FROM opm_article a
WHERE a.del_flag = 0 WHERE a.del_flag = 0
AND a.is_article = 1
AND a.exam_status = 0 AND a.exam_status = 0
AND DATE_FORMAT(a.update_date, '%Y-%m') BETWEEN #{startDateMonth} AND #{endDate} AND DATE_FORMAT(a.create_date, '%Y-%m') BETWEEN #{startDateMonth} AND #{endDate}
GROUP BY DATE_FORMAT(a.update_date, '%Y-%m') GROUP BY DATE_FORMAT(a.create_date, '%Y-%m')
</select> </select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.opmArticle.dao.OpmArticleRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.opmArticle.entity.OpmArticle">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="content" jdbcType="VARCHAR" property="content"/>
<result column="comment_count" jdbcType="VARCHAR" property="commentCount"/>
<result column="like_count" jdbcType="VARCHAR" property="likeCount"/>
<result column="topic_id" jdbcType="INTEGER" property="topicId"/>
<result column="exam_status" jdbcType="VARCHAR" property="examStatus"/>
<result column="is_article" jdbcType="VARCHAR" property="isArticle"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryOpmArticle" resultMap="BaseResultMap">
select opa.*,sot.topic_name as topic,mi.mem_code as memCode
from opm_article opa
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
and opa.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and opa.flag = #{entity.flag}
</if>
<if test="entity.isArticle !=null and entity.isArticle != '' ">
and opa.is_article = #{entity.isArticle}
</if>
<if test="entity.topicId !=null and entity.topicId != '' ">
and opa.topic_id = #{entity.topicId}
</if>
<if test="entity.businessId !=null and entity.businessId != '' ">
and opa.business_id = #{entity.businessId}
</if>
<if test="entity.examStatus !=null and entity.examStatus != '' ">
and opa.exam_status = #{entity.examStatus}
</if>
<if test="entity.content !=null and entity.content != '' ">
and opa.content like concat('%',#{entity.content},'%')
</if>
<if test="entity.topic !=null and entity.topic != '' ">
and sot.topic_name like concat('%',#{entity.topic},'%')
</if>
<if test="entity.createBy !=null and entity.createBy != '' ">
and opa.create_by = #{entity.createBy}
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and opa.create_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and opa.create_date &lt;= #{entity.endTime}
</if>
<if test="entity.updateBy !=null and entity.updateBy != '' ">
and opa.update_by = #{entity.updateBy}
</if>
<if test="entity.likeCount !=null and entity.likeCount != '' ">
and opa.like_count &gt;= #{entity.likeCount}
</if>
<if test="entity.commentCount !=null and entity.commentCount != '' ">
and opa.comment_count &gt;= #{entity.commentCount}
</if>
ORDER BY opa.business_id DESC
</select>
<select id="queryOpmArticlePaged" resultMap="BaseResultMap">
select opa.*,sot.topic_name as topic,mi.mem_code as memCode
from opm_article opa
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
and opa.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and opa.flag = #{entity.flag}
</if>
<if test="entity.isArticle !=null and entity.isArticle != '' ">
and opa.is_article = #{entity.isArticle}
</if>
<if test="entity.topicId !=null and entity.topicId != '' ">
and opa.topic_id = #{entity.topicId}
</if>
<if test="entity.businessId !=null and entity.businessId != '' ">
and opa.business_id = #{entity.businessId}
</if>
<if test="entity.examStatus !=null and entity.examStatus != '' ">
and opa.exam_status = #{entity.examStatus}
</if>
<if test="entity.content !=null and entity.content != '' ">
and opa.content like concat('%',#{entity.content},'%')
</if>
<if test="entity.topic !=null and entity.topic != '' ">
and sot.topic_name like concat('%',#{entity.topic},'%')
</if>
<if test="entity.createBy !=null and entity.createBy != '' ">
and opa.create_by = #{entity.createBy}
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and opa.create_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and opa.create_date &lt;= #{entity.endTime}
</if>
<if test="entity.updateBy !=null and entity.updateBy != '' ">
and opa.update_by = #{entity.updateBy}
</if>
<if test="entity.likeCount !=null and entity.likeCount != '' ">
and opa.like_count &gt;= #{entity.likeCount}
</if>
<if test="entity.commentCount !=null and entity.commentCount != '' ">
and opa.comment_count &gt;= #{entity.commentCount}
</if>
ORDER BY opa.business_id DESC
</select>
<select id="selectByIdWithUrl" resultType="org.rcisoft.business.opmArticle.entity.OpmArticle">
SELECT opa.*,
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'
and opa.business_id = #{businessId}
</select>
<select id="SelectArticleComment" resultType="org.rcisoft.business.opmArticle.entity.ArticleCommentDTO">
SELECT opc.*,
mi.mem_code as memCode,
oi.url as path
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
WHERE 1 = 1
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>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<update id="updateExamStatus" parameterType="org.rcisoft.business.opmTopic.entity.OpmTopic"> <update id="updateExamStatus" parameterType="org.rcisoft.business.opmTopic.entity.OpmTopic">
update opm_topic update opm_topic
set exam_status = '1' set exam_status = #{entity.examStatus}
where business_id = #{entity.businessId} where business_id = #{entity.businessId}
</update> </update>
......
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