【会话群组基础信息CRUD】

This commit is contained in:
weizhihong 2023-04-14 11:28:50 +08:00
parent 81cfda9d20
commit 5a0e1051fb
10 changed files with 1529 additions and 0 deletions

View File

@ -0,0 +1,53 @@
package club.joylink.rtss.controller.conversation;
import club.joylink.rtss.services.conversation.ConversationGroupServiceImpl;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.conversation.ConversationGroupQueryVO;
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 项目会话群设置controller
*/
@RestController
@RequestMapping("/api/conversationGroup")
public class ConversationGroupController {
@Autowired
private ConversationGroupServiceImpl conversationGroupService;
@GetMapping("/list")
public List<ConversationGroupVO> queryList(ConversationGroupQueryVO queryVO, @RequestAttribute AccountVO user) {
return conversationGroupService.queryList(queryVO, user);
}
@GetMapping("/page/users")
public PageVO<ConversationGroupVO> pagingQuery(ConversationGroupQueryVO queryVO, @RequestAttribute AccountVO user) {
return conversationGroupService.pagingQuery(queryVO, user);
}
@GetMapping("/{id}")
public ConversationGroupVO getById(@PathVariable Long id) {
return conversationGroupService.getById(id);
}
@PostMapping("")
public String create(@RequestBody ConversationGroupVO vo, @RequestAttribute AccountVO user) {
return conversationGroupService.create(vo, user);
}
@PutMapping("/{id}/data")
public void update(@PathVariable Long id, @RequestBody ConversationGroupVO vo) {
vo.setId(id);
conversationGroupService.update(vo);
}
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
conversationGroupService.delete(id);
}
}

View File

@ -0,0 +1,15 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfo;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfoExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface RtsConversationGroupInfoMapper extends MyBatisBaseDao<RtsConversationGroupInfo, Long, RtsConversationGroupInfoExample> {
List<RtsConversationGroupInfo> selectByExampleWithBLOBs(RtsConversationGroupInfoExample example);
int updateByExampleWithBLOBs(@Param("record") RtsConversationGroupInfo record, @Param("example") RtsConversationGroupInfoExample example);
int updateByPrimaryKeyWithBLOBs(RtsConversationGroupInfo record);
}

View File

@ -0,0 +1,62 @@
package club.joylink.rtss.entity.conversation;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 群组信息
*/
@Data
public class RtsConversationGroupInfo {
/**
* 主键
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 地图
*/
private Long mapId;
/**
* 项目code
*/
private String projectCode;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 创建者
*/
private Long creatorId;
/**
* 状态1为有效
*/
private Integer status;
/**
* 群组ID
*/
private Long leaderId;
/**
* 成员ID
*/
private String memberIds;
}

View File

@ -0,0 +1,771 @@
package club.joylink.rtss.entity.conversation;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RtsConversationGroupInfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public RtsConversationGroupInfoExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLike(Long value) {
addCriterion("map_id like", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotLike(Long value) {
addCriterion("map_id not like", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andProjectCodeIsNull() {
addCriterion("project_code is null");
return (Criteria) this;
}
public Criteria andProjectCodeIsNotNull() {
addCriterion("project_code is not null");
return (Criteria) this;
}
public Criteria andProjectCodeEqualTo(String value) {
addCriterion("project_code =", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeLessThan(String value) {
addCriterion("project_code <", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeLike(String value) {
addCriterion("project_code like", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotLike(String value) {
addCriterion("project_code not like", value, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeIn(List<String> values) {
addCriterion("project_code in", values, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andLeaderIdIsNull() {
addCriterion("leader_id is null");
return (Criteria) this;
}
public Criteria andLeaderIdIsNotNull() {
addCriterion("leader_id is not null");
return (Criteria) this;
}
public Criteria andLeaderIdEqualTo(Long value) {
addCriterion("leader_id =", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdNotEqualTo(Long value) {
addCriterion("leader_id <>", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdGreaterThan(Long value) {
addCriterion("leader_id >", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdGreaterThanOrEqualTo(Long value) {
addCriterion("leader_id >=", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdLessThan(Long value) {
addCriterion("leader_id <", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdLessThanOrEqualTo(Long value) {
addCriterion("leader_id <=", value, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdIn(List<Long> values) {
addCriterion("leader_id in", values, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdNotIn(List<Long> values) {
addCriterion("leader_id not in", values, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdBetween(Long value1, Long value2) {
addCriterion("leader_id between", value1, value2, "leaderId");
return (Criteria) this;
}
public Criteria andLeaderIdNotBetween(Long value1, Long value2) {
addCriterion("leader_id not between", value1, value2, "leaderId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,62 @@
package club.joylink.rtss.services.conversation;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.conversation.ConversationGroupQueryVO;
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
import java.util.List;
/**
* 项目会话群组管理service接口
*/
public interface ConversationGroupService {
/**
* 查询会话群组列表
*
* @param queryVO 查询参数
* @param user 用户
* @return 群组列表
*/
List<ConversationGroupVO> queryList(ConversationGroupQueryVO queryVO, AccountVO user);
/**
* 查询带参数的会话群组列表
*
* @param queryVO 查询参数
* @param user 用户
* @return 群组列表
*/
PageVO<ConversationGroupVO> pagingQuery(ConversationGroupQueryVO queryVO, AccountVO user);
/**
* 根据ID获取会话群组信息
*
* @param id 主键
* @return 群组信息
*/
ConversationGroupVO getById(Long id);
/**
* 创建群组信息
*
* @param vo 群组信息
* @param user 用户信息
* @return 创建结果
*/
String create(ConversationGroupVO vo, AccountVO user);
/**
* 更新群组信息
* @param vo 群组信息
*/
void update(ConversationGroupVO vo);
/**
* 删除群组信息
*
* @param id 主键
*/
void delete(Long id);
}

View File

@ -0,0 +1,105 @@
package club.joylink.rtss.services.conversation;
import club.joylink.rtss.dao.RtsConversationGroupInfoMapper;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfo;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfoExample;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.conversation.ConversationGroupQueryVO;
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
import club.joylink.rtss.vo.project.ProjectInfoVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* 项目会话群组管理service
*/
@Slf4j
@Service
public class ConversationGroupServiceImpl implements ConversationGroupService {
private static final int VALID = 1;
@Autowired
private RtsConversationGroupInfoMapper conversationGroupInfoMapper;
@Override
public List<ConversationGroupVO> queryList(ConversationGroupQueryVO queryVO, AccountVO user) {
List<RtsConversationGroupInfo> conversationGroupInfoList = conversationGroupInfoMapper.selectByExampleWithBLOBs(getExample(queryVO));
return conversationGroupInfoList.stream().map(ConversationGroupVO::new).collect(Collectors.toList());
}
@Override
public PageVO<ConversationGroupVO> pagingQuery(ConversationGroupQueryVO queryVO, AccountVO user) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<RtsConversationGroupInfo> page = (Page<RtsConversationGroupInfo>) conversationGroupInfoMapper.selectByExampleWithBLOBs(getExample(queryVO));
return PageVO.convert(page, page.getResult().stream().map(ConversationGroupVO::new).collect(Collectors.toList()));
}
@Override
public ConversationGroupVO getById(Long id) {
RtsConversationGroupInfo rtsConversationGroupInfo = conversationGroupInfoMapper.selectByPrimaryKey(id);
return new ConversationGroupVO(rtsConversationGroupInfo);
}
@Override
public String create(ConversationGroupVO vo, AccountVO user) {
if (vo.getId() != null) {
update(vo);
} else {
RtsConversationGroupInfo rtsConversationGroupInfo = vo.toEntity();
rtsConversationGroupInfo.setCreateTime(LocalDateTime.now());
rtsConversationGroupInfo.setUpdateTime(LocalDateTime.now());
rtsConversationGroupInfo.setStatus(VALID);
conversationGroupInfoMapper.insert(rtsConversationGroupInfo);
}
return "保存成功";
}
@Override
public void update(ConversationGroupVO vo) {
if (vo.getId() != null) {
RtsConversationGroupInfo rtsConversationGroupInfo = vo.toEntity();
rtsConversationGroupInfo.setUpdateTime(LocalDateTime.now());
conversationGroupInfoMapper.updateByPrimaryKeySelective(rtsConversationGroupInfo);
}
}
@Override
public void delete(Long id) {
conversationGroupInfoMapper.deleteByPrimaryKey(id);
}
/**
* 获取查询条件
*
* @param queryVO 查询条件实体
* @return 条件实体
*/
private RtsConversationGroupInfoExample getExample(ConversationGroupQueryVO queryVO) {
RtsConversationGroupInfoExample example = new RtsConversationGroupInfoExample();
RtsConversationGroupInfoExample.Criteria criteria = example.createCriteria();
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
if (CollectionUtils.isEmpty(queryVO.getMapIds())) {
criteria.andMapIdIn(queryVO.getMapIds());
}
if (StringUtils.hasText(queryVO.getProjectCode())) {
criteria.andProjectCodeEqualTo(queryVO.getProjectCode());
}
criteria.andStatusEqualTo(VALID);
return example;
}
}

View File

@ -0,0 +1,22 @@
package club.joylink.rtss.simulation.cbtc.conversation;
/**
* 会话类型
*/
public enum ConversationType {
/**
* 电话 (兼容之前调度电话)
*/
PHONE(),
/**
* 群聊 (聊天室)
*/
GROUP_CHAT(),
/**
* 私聊 (成员一对一)
*/
PRIVATE_CHAT();
}

View File

@ -0,0 +1,29 @@
package club.joylink.rtss.vo.conversation;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class ConversationGroupQueryVO extends PageQueryVO {
/**
* 群组名称
*/
private String name;
/**
* 项目编码
*/
private String projectCode;
/**
* 地图ID
*/
private List<Long> mapIds;
}

View File

@ -0,0 +1,77 @@
package club.joylink.rtss.vo.conversation;
import club.joylink.rtss.entity.conversation.RtsConversationGroupInfo;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Getter
@Setter
@NoArgsConstructor
public class ConversationGroupVO {
/**
* 主键
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 地图ID
*/
private Long mapId;
/**
* 项目编码
*/
private String projectCode;
/**
* 群主角色ID
*/
private Long leaderId;
/**
* 群成员ID
*/
private List<Long> memberIds;
public ConversationGroupVO(RtsConversationGroupInfo info) {
this.id = info.getId();
this.name = info.getName();
this.mapId = info.getMapId();
this.leaderId = info.getLeaderId();
this.projectCode = info.getProjectCode();
if (StringUtils.hasText(info.getMemberIds())) {
this.memberIds = Arrays.stream(info.getMemberIds().split(",")).map(Long::valueOf).collect(Collectors.toList());
}
}
/**
* 转数据库存放实体
*
* @return 数据库实体
*/
public RtsConversationGroupInfo toEntity() {
RtsConversationGroupInfo info = new RtsConversationGroupInfo();
info.setId(this.id);
info.setName(this.name);
info.setMapId(this.mapId);
info.setProjectCode(this.projectCode);
info.setLeaderId(this.leaderId);
if (this.memberIds != null) {
info.setMemberIds(this.memberIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
}
return info;
}
}

View File

@ -0,0 +1,333 @@
<?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="club.joylink.rtss.dao.RtsConversationGroupInfoMapper">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="map_ids" jdbcType="BIGINT" property="mapId" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="leader_id" jdbcType="BIGINT" property="leaderId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
<result column="member_ids" jdbcType="LONGVARCHAR" property="memberIds" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List"> id, name, map_id, project_code, create_time, update_time, creator_id, status, leader_id </sql>
<sql id="Blob_Column_List"> member_ids </sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfoExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_conversation_group_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfoExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from rts_conversation_group_info
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_conversation_group_info
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from rts_conversation_group_info where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
insert into rts_conversation_group_info (id, name, map_id, project_code, create_time, update_time, creator_id, status, member_ids, leader_id )
values (
#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{mapId,jdbcType=BIGINT},
#{projectCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{creatorId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, #{memberIds,jdbcType=LONGVARCHAR},
#{leaderId,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
insert into rts_conversation_group_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="mapId != null">
map_id,
</if>
<if test="projectCode != null">
project_code,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="status != null">
status,
</if>
<if test="memberIds != null">
member_ids,
</if>
<if test="leaderId != null">
leader_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="mapId != null">
#{mapId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="memberIds != null">
#{memberIds,jdbcType=LONGVARCHAR},
</if>
<if test="leaderId != null">
#{leaderId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByExampleSelective" parameterType="map">
update rts_conversation_group_info
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.mapId != null">
map_id = #{record.mapId,jdbcType=BIGINT},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.memberIds != null">
member_ids = #{record.memberIds,jdbcType=LONGVARCHAR},
</if>
<if test="record.leaderId != null">
leader_id = #{record.leaderId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update rts_conversation_group_info
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
map_id = #{record.mapId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
status = #{record.status,jdbcType=INTEGER},
member_ids = #{record.memberIds,jdbcType=LONGVARCHAR},
leader_id = #{record.leaderId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update rts_conversation_group_info
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
map_id = #{record.mapId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
status = #{record.status,jdbcType=INTEGER},
leader_id = #{record.leaderId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
update rts_conversation_group_info
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="memberIds != null">
member_ids = #{memberIds,jdbcType=LONGVARCHAR},
</if>
<if test="leaderId != null">
leader_id = #{leaderId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
update rts_conversation_group_info
set name = #{name,jdbcType=VARCHAR}, map_id = #{mapId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, creator_id = #{creatorId,jdbcType=BIGINT},
status = #{status,jdbcType=INTEGER}, member_ids = #{memberIds,jdbcType=LONGVARCHAR},
leader_id = #{leaderId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.conversation.RtsConversationGroupInfo">
update rts_conversation_group_info
set name = #{name,jdbcType=VARCHAR}, map_id = #{mapId,jdbcType=BIGINT}, project_code = #{projectCode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT}, status = #{status,jdbcType=INTEGER},leader_id = #{leaderId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>