Commit 838f48f6 by huangjinxin

Merge remote-tracking branch 'origin/develop' into develop

2 parents b158f29f f9abb1ce
......@@ -45,7 +45,7 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
@Query(value = "select t.* from (select tt.*,r.is_read," +
" (select group_concat(u.nickname) from zzz_msg_receiver rr join sys_user u on u.id=rr.user_id where rr.msg_id=tt.id) receivers"+
" from zzz_msg tt join zzz_msg_receiver r on r.msg_id=tt.id and r.user_id=:#{#req.userId}" +
" from zzz_msg tt join zzz_msg_receiver r on r.deleted=0 and r.msg_id=tt.id and r.user_id=:#{#req.userId}" +
" where IF(:#{#msgGroupResp.clusterId} is not null, tt.cluster_id=:#{#msgGroupResp.clusterId}, tt.cluster_id is null)" +
" and IF(:#{#msgGroupResp.branchId} is not null, tt.branch_id=:#{#msgGroupResp.branchId}, tt.branch_id is null)" +
" and IF(:#{#msgGroupResp.groupId} is not null, tt.group_id=:#{#msgGroupResp.groupId}, tt.group_id is null)" +
......
......@@ -42,6 +42,12 @@ public class MsgReceiverEntity {
@Column(name = "is_read")
private Integer isRead;
/**
* 是否删除,0:正常,1:删除
*/
@Column(name = "deleted")
private Integer deleted;
@Column(name = "create_time", nullable = false, columnDefinition = "datetime default current_timestamp")
private Date createTime;
......
......@@ -87,9 +87,14 @@ public class MsgServiceImpl implements MsgService {
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer msgId, String userId) {
List<MsgReceiverEntity> list = msgReceiverDao.findAll(Example.of(new MsgReceiverEntity().setMsgId(msgId).setUserId(userId)));
List<MsgReceiverEntity> list = msgReceiverDao.findAll(Example.
of(new MsgReceiverEntity()
.setMsgId(msgId).
setUserId(userId)
.setDeleted(0)));
list.forEach(msgReceiverEntity -> {
msgReceiverDao.deleteById(msgReceiverEntity.getId());
msgReceiverEntity.setDeleted(1);
msgReceiverDao.save(msgReceiverEntity);
});
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!