提交 804c1ca1 作者: obcy

【事件专题列表查询接口】

上级 77a52d17
...@@ -98,10 +98,13 @@ public class EventManageController { ...@@ -98,10 +98,13 @@ public class EventManageController {
@RequestParam(name = "startTime", required = false) String startTime, @RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "endTime", required = false) String endTime, @RequestParam(name = "endTime", required = false) String endTime,
@RequestParam(name = "order", required = false) String order, @RequestParam(name = "order", required = false) String order,
@RequestParam(name = "subjectTypeId", required = false) String subjectTypeId,
@RequestParam(name = "id", required = false) String id,
@RequestParam(name = "createBy", required = false) String createBy,
@RequestParam(name = "orderType", defaultValue = "asc") String orderType, @RequestParam(name = "orderType", defaultValue = "asc") String orderType,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
IPage<EventManageVO> pageList = eventService.pageList(eventName, eventType, facePublic, publishStatus, startTime, endTime, order, orderType, pageNo, pageSize); IPage<EventManageVO> pageList = eventService.pageList(eventName, eventType, facePublic, publishStatus, startTime, endTime, order, orderType, pageNo, pageSize, subjectTypeId, id,createBy);
return Result.OK(pageList); return Result.OK(pageList);
} }
......
...@@ -48,7 +48,9 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -48,7 +48,9 @@ public interface EventMapper extends BaseMapper<Event> {
@Param("facePublic") Integer facePublic, @Param("publishStatus") Integer publishStatus, @Param("facePublic") Integer facePublic, @Param("publishStatus") Integer publishStatus,
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("order") String order, @Param("orderType") String orderType, @Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize); @Param("offset") Integer offset, @Param("pageSize") Integer pageSize,
@Param("typeIds") List<String> typeIds, @Param("id") String id, @Param("createBy") String createBy
);
/** /**
* 总数量-后台管理 * 总数量-后台管理
...@@ -62,7 +64,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -62,7 +64,7 @@ public interface EventMapper extends BaseMapper<Event> {
*/ */
Integer totalCount(@Param("eventName") String eventName, @Param("eventType") Integer eventType, Integer totalCount(@Param("eventName") String eventName, @Param("eventType") Integer eventType,
@Param("facePublic") Integer facePublic, @Param("publishStatus") Integer publishStatus, @Param("facePublic") Integer facePublic, @Param("publishStatus") Integer publishStatus,
@Param("startTime") String startTime, @Param("endTime") String endTime); @Param("startTime") String startTime, @Param("endTime") String endTime,@Param("typeIds") List<String> typeIds, @Param("id") String id, @Param("createBy") String createBy);
/** /**
* 分页列表-门户(全部) * 分页列表-门户(全部)
......
...@@ -49,11 +49,26 @@ ...@@ -49,11 +49,26 @@
</select> </select>
<select id="pageList" resultType="com.zzsn.event.vo.EventManageVO"> <select id="pageList" resultType="com.zzsn.event.vo.EventManageVO">
select t2.type_name,t1.id,t1.event_icon,t1.event_name,t1.event_label,t1.status, select t2.type_name,t1.id,t1.event_icon,t1.event_name,m.subjectTypeName,t1.event_label,t1.status,
t1.face_public,t1.publish_status,t1.create_time,t1.publish_date,t1.start_time,t1.end_time,t1.create_by t1.face_public,t1.publish_status,t1.create_time,t1.publish_date,t1.start_time,t1.end_time,t1.create_by
from event t1 from event t1
inner join event_category t2 on t1.event_type =t2.id inner join event_category t2 on t1.event_type =t2.id
INNER JOIN
(
select stm.subject_id,st.type_name as subjectTypeName from subject_type_map stm inner join subject_type st on stm.type_id = st.id
where 1=1 where 1=1
<if test="typeIds!=null and typeIds.size()>0">
and stm.type_id in
<foreach collection="typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) m
on t1.id = m.subject_id
where 1=1
<if test="id !=null and id !=''">
and t1.id =#{id}
</if>
<if test="eventName!=null and eventName != ''"> <if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%') and t1.event_name like CONCAT('%',#{eventName},'%')
</if> </if>
...@@ -72,6 +87,9 @@ ...@@ -72,6 +87,9 @@
<if test="endTime!=null and endTime != ''"> <if test="endTime!=null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime} and t1.create_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="createBy!=null and createBy != ''">
and t1.create_by like CONCAT('%',#{create_by},'%')
</if>
<if test="order!=null and order != ''"> <if test="order!=null and order != ''">
order by t1.${order} order by t1.${order}
<if test="orderType!=null and orderType != ''"> <if test="orderType!=null and orderType != ''">
...@@ -83,7 +101,22 @@ ...@@ -83,7 +101,22 @@
<select id="totalCount" resultType="java.lang.Integer"> <select id="totalCount" resultType="java.lang.Integer">
select count(1) from event t1 select count(1) from event t1
inner join event_category t2 on t1.event_type =t2.id inner join event_category t2 on t1.event_type =t2.id
INNER JOIN
(
select stm.subject_id,st.type_name from subject_type_map stm inner join subject_type st on stm.type_id = st.id
where 1=1
<if test="typeIds!=null and typeIds.size()>0">
and stm.type_id in
<foreach collection="typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) m
on t1.id = m.subject_id
where 1=1 where 1=1
<if test="id !=null and id !=''">
and t1.id =#{id}
</if>
<if test="eventName!=null and eventName != ''"> <if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%') and t1.event_name like CONCAT('%',#{eventName},'%')
</if> </if>
...@@ -102,6 +135,9 @@ ...@@ -102,6 +135,9 @@
<if test="endTime!=null and endTime != ''"> <if test="endTime!=null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime} and t1.create_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="createBy!=null and createBy != ''">
and t1.create_by like CONCAT('%',#{create_by},'%')
</if>
</select> </select>
<select id="frontAllPageList" resultType="com.zzsn.event.vo.EventFrontVO"> <select id="frontAllPageList" resultType="com.zzsn.event.vo.EventFrontVO">
......
...@@ -42,11 +42,13 @@ public interface IEventService extends IService<Event> { ...@@ -42,11 +42,13 @@ public interface IEventService extends IService<Event> {
* @param orderType 排序方式 * @param orderType 排序方式
* @param pageNo 偏移量 * @param pageNo 偏移量
* @param pageSize 返回条数 * @param pageSize 返回条数
* @param subjectTypeId
* @param id
* @author lkg * @author lkg
* @date 2024/4/8 * @date 2024/4/8
*/ */
IPage<EventManageVO> pageList(String eventName, Integer eventType, Integer facePublic, Integer publishStatus, String startTime, String endTime, IPage<EventManageVO> pageList(String eventName, Integer eventType, Integer facePublic, Integer publishStatus, String startTime, String endTime,
String order, String orderType, Integer pageNo, Integer pageSize); String order, String orderType, Integer pageNo, Integer pageSize, String subjectTypeId, String id, String createBy);
/** /**
* 分页列表-门户(全部) * 分页列表-门户(全部)
......
package com.zzsn.event.service.impl; package com.zzsn.event.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -9,8 +12,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -9,8 +12,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.constant.Constants; import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.*; import com.zzsn.event.entity.*;
import com.zzsn.event.entity.arrange.ClbModelArrange;
import com.zzsn.event.enums.BindTypeEnum; import com.zzsn.event.enums.BindTypeEnum;
import com.zzsn.event.enums.CodePrefixEnum; import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.enums.SourceTypeEnum;
import com.zzsn.event.es.EsService; import com.zzsn.event.es.EsService;
import com.zzsn.event.mapper.EventMapper; import com.zzsn.event.mapper.EventMapper;
import com.zzsn.event.service.*; import com.zzsn.event.service.*;
...@@ -111,6 +116,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -111,6 +116,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
private PythonUtil pythonUtil; private PythonUtil pythonUtil;
@Autowired @Autowired
private EsOpUtil esOpUtil; private EsOpUtil esOpUtil;
@Autowired
private IClbModelArrangeService clbModelArrangeService;
@Value("${kafka.topic.event.run:}") @Value("${kafka.topic.event.run:}")
private String EVENT_MODEL_KAFKA_CHANNEL; private String EVENT_MODEL_KAFKA_CHANNEL;
...@@ -146,13 +153,29 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -146,13 +153,29 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
} }
@Override @Override
public IPage<EventManageVO> pageList(String eventName, Integer eventType, Integer facePublic, Integer publishStatus, String startTime, String endTime, String order, String orderType, Integer pageNo, Integer pageSize) { public IPage<EventManageVO> pageList(String eventName, Integer eventType, Integer facePublic, Integer publishStatus, String startTime, String endTime, String order, String orderType, Integer pageNo, Integer pageSize, String subjectTypeId, String id, String createBy) {
List<String> typeIds = new ArrayList<>();
if (StringUtils.isNotEmpty(subjectTypeId) && !"0".equals(subjectTypeId)) {
typeIds = iSubjectTypeService.belowIdList(subjectTypeId, 2);
}
int offset = (pageNo - 1) * pageSize; int offset = (pageNo - 1) * pageSize;
List<EventManageVO> pageList = baseMapper.pageList(eventName, eventType, facePublic, publishStatus, startTime, endTime, order, orderType, offset, pageSize); List<EventManageVO> pageList = baseMapper.pageList(eventName, eventType, facePublic, publishStatus, startTime, endTime, order, orderType, offset, pageSize,typeIds,id,createBy);
//获取总条数 //获取总条数
Integer count = baseMapper.totalCount(eventName, eventType, facePublic, publishStatus, startTime, endTime); Integer count = baseMapper.totalCount(eventName, eventType, facePublic, publishStatus, startTime, endTime,typeIds,id,createBy);
IPage<EventManageVO> pageData = new Page<>(pageNo, pageSize, count); IPage<EventManageVO> pageData = new Page<>(pageNo, pageSize, count);
pageData.setRecords(pageList); pageData.setRecords(pageList);
List<EventManageVO> records = pageData.getRecords();
if (CollUtil.isNotEmpty(records)) {
List<String> idList = records.stream().map(EventManageVO::getId).collect(Collectors.toList());
//查询绑定的流程
List<ClbModelArrange> clbModelArranges = clbModelArrangeService.listBySubjectIds(idList);
if (CollectionUtil.isNotEmpty(clbModelArranges)) {
clbModelArranges.forEach(e -> e.setType(SourceTypeEnum.getValueNameByValue(e.getType())));
Map<String, List<ClbModelArrange>> collect = clbModelArranges.stream().collect(Collectors.groupingBy(ClbModelArrange::getSubjectId));
records.forEach(e -> e.setClbModelArranges(collect.get(e.getId())));
}
}
return pageData; return pageData;
} }
......
package com.zzsn.event.vo; package com.zzsn.event.vo;
import com.zzsn.event.entity.arrange.ClbModelArrange;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* *
* *
...@@ -16,6 +19,7 @@ public class EventManageVO { ...@@ -16,6 +19,7 @@ public class EventManageVO {
private String eventIcon; private String eventIcon;
private String eventName; private String eventName;
private String typeName; private String typeName;
private String subjectTypeName;
private String eventLabel; private String eventLabel;
private Integer facePublic; private Integer facePublic;
private Integer publishStatus; private Integer publishStatus;
...@@ -25,4 +29,6 @@ public class EventManageVO { ...@@ -25,4 +29,6 @@ public class EventManageVO {
private String startTime; private String startTime;
private String endTime; private String endTime;
private Integer status; private Integer status;
/**专题题绑定流程信息*/
private List<ClbModelArrange> clbModelArranges;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论