fix: 标记已读未记录查看时间

This commit is contained in:
fit2cloud-chenyw 2021-07-30 12:00:25 +08:00
parent 162ba5f48b
commit ed1fcd7671
4 changed files with 37 additions and 6 deletions

View File

@ -16,13 +16,13 @@ public interface ExtSysMsgMapper {
@Update({
"<script>",
"update sys_msg set status = 1 where msg_id in ",
"update sys_msg set status = 1, read_time = #{time} where msg_id in ",
"<foreach collection='msgIds' item='msgId' open='(' separator=',' close=')' >",
" #{msgId}",
"</foreach>",
"</script>"
})
int batchStatus(@Param("msgIds") List<Long> msgIds);
int batchStatus(@Param("msgIds") List<Long> msgIds, @Param("time") Long time);
@Delete({

View File

@ -109,7 +109,7 @@ public class SysMsgService {
}
public void setBatchReaded(List<Long> msgIds) {
extSysMsgMapper.batchStatus(msgIds);
extSysMsgMapper.batchStatus(msgIds, System.currentTimeMillis());
}
public void batchDelete(List<Long> msgIds) {

View File

@ -26,6 +26,15 @@ export function batchRead(data) {
})
}
export function batchDelete(data) {
return request({
url: '/api/sys_msg/batchDelete',
method: 'post',
loading: true,
data
})
}
export function treeList() {
return request({
url: '/api/sys_msg/treeNodes',

View File

@ -11,9 +11,16 @@
:pagination-config="paginationConfig"
@select="select"
@search="search"
@selection-change="handleSelectionChange"
@sort-change="sortChange"
>
<template #toolbar>
<el-button :disabled="multipleSelection.length === 0" @click="deleteBatch">{{ $t('commons.delete') }}</el-button>
</template>
<el-table-column
type="selection"
width="55"
/>
<el-table-column prop="content" :label="$t('webmsg.content')">
<template slot-scope="scope">
@ -57,7 +64,7 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query } from '@/api/system/msg'
import { query, batchDelete } from '@/api/system/msg'
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
import { addOrder, formatOrders } from '@/utils/index'
import { mapGetters } from 'vuex'
@ -85,7 +92,8 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0
}
},
multipleSelection: []
}
},
computed: {
@ -164,6 +172,20 @@ export default {
}
addOrder({ field: prop, value: order }, this.orderConditions)
this.search()
},
deleteBatch() {
if (this.multipleSelection.length === 0) {
this.$warning(this.$t('webmsg.please_select'))
return
}
const param = this.multipleSelection.map(item => item.msgId)
batchDelete(param).then(res => {
this.$success(this.$t('commons.delete_success'))
this.search()
})
},
handleSelectionChange(val) {
this.multipleSelection = val
}
}