mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-04-22 22:22:51 +08:00
parent
608a1ded5c
commit
a3ab97019d
@ -35,6 +35,7 @@ public abstract class RepositoryService<TEntity, TPrimary, TLogger>(BasicReposit
|
|||||||
/// <param name="includeFields">包含的属性</param>
|
/// <param name="includeFields">包含的属性</param>
|
||||||
/// <param name="excludeFields">排除的属性</param>
|
/// <param name="excludeFields">排除的属性</param>
|
||||||
/// <param name="whereExp">查询表达式</param>
|
/// <param name="whereExp">查询表达式</param>
|
||||||
|
/// <param name="whereSql">查询sql</param>
|
||||||
/// <param name="ignoreVersion">是否忽略版本锁</param>
|
/// <param name="ignoreVersion">是否忽略版本锁</param>
|
||||||
/// <returns>更新行数</returns>
|
/// <returns>更新行数</returns>
|
||||||
protected Task<int> UpdateAsync( //
|
protected Task<int> UpdateAsync( //
|
||||||
@ -42,11 +43,12 @@ public abstract class RepositoryService<TEntity, TPrimary, TLogger>(BasicReposit
|
|||||||
, IEnumerable<string> includeFields //
|
, IEnumerable<string> includeFields //
|
||||||
, string[] excludeFields = null //
|
, string[] excludeFields = null //
|
||||||
, Expression<Func<TEntity, bool>> whereExp = null //
|
, Expression<Func<TEntity, bool>> whereExp = null //
|
||||||
|
, string whereSql = null //
|
||||||
, bool ignoreVersion = false)
|
, bool ignoreVersion = false)
|
||||||
{
|
{
|
||||||
// 默认匹配主键
|
// 默认匹配主键
|
||||||
whereExp ??= a => a.Id.Equals(newValue.Id);
|
whereExp ??= a => a.Id.Equals(newValue.Id);
|
||||||
var update = BuildUpdate(newValue, includeFields, excludeFields, ignoreVersion).Where(whereExp);
|
var update = BuildUpdate(newValue, includeFields, excludeFields, ignoreVersion).Where(whereExp).Where(whereSql);
|
||||||
return update.ExecuteAffrowsAsync();
|
return update.ExecuteAffrowsAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,14 +282,14 @@ public sealed class JobService(BasicRepository<Sys_Job, long> rpo, IJobRecordSer
|
|||||||
new Sys_Job { Status = JobStatues.Idle }, [nameof(Sys_Job.Status)], null
|
new Sys_Job { Status = JobStatues.Idle }, [nameof(Sys_Job.Status)], null
|
||||||
, a => a.Status == JobStatues.Running &&
|
, a => a.Status == JobStatues.Running &&
|
||||||
a.LastExecTime < DateTime.Now.AddSeconds(-Numbers.SECS_TIMEOUT_JOB)
|
a.LastExecTime < DateTime.Now.AddSeconds(-Numbers.SECS_TIMEOUT_JOB)
|
||||||
, true)
|
, null, true)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
var ret2 = await UpdateAsync( // 空闲中,下次执行时间在当前时间减去超时时间以前;将下次执行时间调整到现在
|
var ret2 = await UpdateAsync( // 空闲中,下次执行时间在当前时间减去超时时间以前;将下次执行时间调整到现在
|
||||||
new Sys_Job { NextExecTime = DateTime.Now, NextTimeId = DateTime.Now.TimeUnixUtc() }
|
new Sys_Job { NextExecTime = DateTime.Now, NextTimeId = DateTime.Now.TimeUnixUtc() }
|
||||||
, [nameof(Sys_Job.NextExecTime), nameof(Sys_Job.NextTimeId)], null
|
, [nameof(Sys_Job.NextExecTime), nameof(Sys_Job.NextTimeId)], null
|
||||||
, a => a.Status == JobStatues.Idle && a.NextExecTime < DateTime.Now.AddSeconds(-Numbers.SECS_TIMEOUT_JOB)
|
, a => a.Status == JobStatues.Idle && a.NextExecTime < DateTime.Now.AddSeconds(-Numbers.SECS_TIMEOUT_JOB)
|
||||||
, true)
|
, null, true)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return ret1 + ret2;
|
return ret1 + ret2;
|
||||||
}
|
}
|
||||||
|
@ -67,11 +67,11 @@ export default {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
try {
|
try {
|
||||||
await this.$API.sys_api.sync.post()
|
await this.$API.sys_api.sync.post()
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success('同步成功')
|
this.$message.success('同步成功')
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
this.loading = false
|
this.loading = false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -133,21 +133,21 @@ export default {
|
|||||||
const res = await this.$API.sys_config.bulkDelete.post({
|
const res = await this.$API.sys_config.bulkDelete.post({
|
||||||
items: this.selection,
|
items: this.selection,
|
||||||
})
|
})
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
loading?.close()
|
loading?.close()
|
||||||
},
|
},
|
||||||
async changeSwitch(event, row) {
|
async changeSwitch(event, row) {
|
||||||
try {
|
try {
|
||||||
await this.$API.sys_config.edit.post(row)
|
await this.$API.sys_config.edit.post(row)
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`操作成功`)
|
this.$message.success(`操作成功`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
filterChange(data) {
|
filterChange(data) {
|
||||||
Object.entries(data).forEach(([key, value]) => {
|
Object.entries(data).forEach(([key, value]) => {
|
||||||
@ -160,10 +160,10 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const res = await this.$API.sys_config.delete.post({ id: row.id })
|
const res = await this.$API.sys_config.delete.post({ id: row.id })
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
this.$refs.table.refresh()
|
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
onSearch(form) {
|
onSearch(form) {
|
||||||
if (Array.isArray(form.dy.createdTime)) {
|
if (Array.isArray(form.dy.createdTime)) {
|
||||||
|
@ -129,11 +129,11 @@ export default {
|
|||||||
async changeSwitch(event, row) {
|
async changeSwitch(event, row) {
|
||||||
try {
|
try {
|
||||||
await this.$API.sys_dept.setEnabled.post(row)
|
await this.$API.sys_dept.setEnabled.post(row)
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`操作成功`)
|
this.$message.success(`操作成功`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
async batchDel() {
|
async batchDel() {
|
||||||
let loading
|
let loading
|
||||||
@ -145,11 +145,11 @@ export default {
|
|||||||
const res = await this.$API.sys_dept.bulkDelete.post({
|
const res = await this.$API.sys_dept.bulkDelete.post({
|
||||||
items: this.selection,
|
items: this.selection,
|
||||||
})
|
})
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
loading?.close()
|
loading?.close()
|
||||||
},
|
},
|
||||||
filterChange(data) {
|
filterChange(data) {
|
||||||
@ -162,10 +162,10 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const res = await this.$API.sys_dept.delete.post({ id: row.id })
|
const res = await this.$API.sys_dept.delete.post({ id: row.id })
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
this.$refs.table.refresh()
|
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
onSearch(form) {
|
onSearch(form) {
|
||||||
if (Array.isArray(form.dy.createdTime)) {
|
if (Array.isArray(form.dy.createdTime)) {
|
||||||
|
@ -139,11 +139,11 @@ export default {
|
|||||||
async rowDel(row) {
|
async rowDel(row) {
|
||||||
try {
|
try {
|
||||||
const res = await this.$API.sys_dic.deleteContent.post({ id: row.id })
|
const res = await this.$API.sys_dic.deleteContent.post({ id: row.id })
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -241,15 +241,14 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await this.$API.sys_job.setEnabled.post(row)
|
await this.$API.sys_job.setEnabled.post(row)
|
||||||
this.$message.success(`操作成功`)
|
this.$message.success(`操作成功`)
|
||||||
this.$refs.table.refresh()
|
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
async execute(row) {
|
async execute(row) {
|
||||||
try {
|
try {
|
||||||
await this.$API.sys_job.execute.post({ id: row.id })
|
await this.$API.sys_job.execute.post({ id: row.id })
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$notify.success({
|
this.$notify.success({
|
||||||
dangerouslyUseHTMLString: true,
|
dangerouslyUseHTMLString: true,
|
||||||
message: `<div id="countdown">已发起执行请求,5 秒后弹出执行结果</div>`,
|
message: `<div id="countdown">已发起执行请求,5 秒后弹出执行结果</div>`,
|
||||||
@ -270,16 +269,17 @@ export default {
|
|||||||
.innerText.replace(countdown, `${parseInt(countdown) - 1}`)
|
.innerText.replace(countdown, `${parseInt(countdown) - 1}`)
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} catch {}
|
} catch {}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
//删除
|
//删除
|
||||||
async rowDel(row) {
|
async rowDel(row) {
|
||||||
try {
|
try {
|
||||||
const res = await this.$API.sys_job.delete.post({ id: row.id })
|
const res = await this.$API.sys_job.delete.post({ id: row.id })
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
//批量删除
|
//批量删除
|
||||||
async batchDel() {
|
async batchDel() {
|
||||||
@ -292,12 +292,12 @@ export default {
|
|||||||
const res = await this.$API.sys_job.bulkDelete.post({
|
const res = await this.$API.sys_job.bulkDelete.post({
|
||||||
items: this.selection,
|
items: this.selection,
|
||||||
})
|
})
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
loading?.close()
|
loading?.close()
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
//搜索
|
//搜索
|
||||||
|
@ -143,11 +143,11 @@ export default {
|
|||||||
async rowDel(row) {
|
async rowDel(row) {
|
||||||
try {
|
try {
|
||||||
const res = await this.$API.sys_sitemsg.delete.post({ id: row.id })
|
const res = await this.$API.sys_sitemsg.delete.post({ id: row.id })
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
//批量删除
|
//批量删除
|
||||||
async batchDel() {
|
async batchDel() {
|
||||||
@ -160,12 +160,12 @@ export default {
|
|||||||
const res = await this.$API.sys_sitemsg.bulkDelete.post({
|
const res = await this.$API.sys_sitemsg.bulkDelete.post({
|
||||||
items: this.selection,
|
items: this.selection,
|
||||||
})
|
})
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
loading?.close()
|
loading?.close()
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
//搜索
|
//搜索
|
||||||
|
@ -177,11 +177,11 @@ export default {
|
|||||||
async changeSwitch(event, row) {
|
async changeSwitch(event, row) {
|
||||||
try {
|
try {
|
||||||
await this.$API.sys_role.setEnabled.post(row)
|
await this.$API.sys_role.setEnabled.post(row)
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`操作成功`)
|
this.$message.success(`操作成功`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
async batchDel() {
|
async batchDel() {
|
||||||
let loading
|
let loading
|
||||||
@ -193,12 +193,12 @@ export default {
|
|||||||
const res = await this.$API.sys_role.bulkDelete.post({
|
const res = await this.$API.sys_role.bulkDelete.post({
|
||||||
items: this.selection,
|
items: this.selection,
|
||||||
})
|
})
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
loading?.close()
|
loading?.close()
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
filterChange(data) {
|
filterChange(data) {
|
||||||
Object.entries(data).forEach(([key, value]) => {
|
Object.entries(data).forEach(([key, value]) => {
|
||||||
@ -210,10 +210,10 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const res = await this.$API.sys_role.delete.post({ id: row.id })
|
const res = await this.$API.sys_role.delete.post({ id: row.id })
|
||||||
this.$message.success(`删除 ${res.data} 项`)
|
this.$message.success(`删除 ${res.data} 项`)
|
||||||
this.$refs.table.refresh()
|
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
onSearch(form) {
|
onSearch(form) {
|
||||||
if (Array.isArray(form.dy.createdTime)) {
|
if (Array.isArray(form.dy.createdTime)) {
|
||||||
|
@ -139,11 +139,11 @@ export default {
|
|||||||
async changeSwitch(event, row) {
|
async changeSwitch(event, row) {
|
||||||
try {
|
try {
|
||||||
await this.$API.sys_user.setEnabled.post(row)
|
await this.$API.sys_user.setEnabled.post(row)
|
||||||
this.$refs.table.refresh()
|
|
||||||
this.$message.success(`操作成功`)
|
this.$message.success(`操作成功`)
|
||||||
} catch {
|
} catch {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
filterChange(data) {
|
filterChange(data) {
|
||||||
Object.entries(data).forEach(([key, value]) => {
|
Object.entries(data).forEach(([key, value]) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user