mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2025-12-11 13:52:50 +00:00
支持视图,crud支持新增修改支持动态配置,支持配置成save,save不校验字段
This commit is contained in:
parent
d15ae19f33
commit
41b886e055
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/core",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.4",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
||||
@ -37,6 +37,8 @@ export interface CoolConfig {
|
||||
softDelete: boolean;
|
||||
/** 分页查询每页条数 */
|
||||
pageSize: number;
|
||||
/** 插入方式 */
|
||||
upsert : 'normal' | 'save'
|
||||
// 多租户
|
||||
// tenant: boolean;
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/core",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.4",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
||||
@ -138,6 +138,7 @@ export class CoolEps {
|
||||
for (const entityMetadata of entityMetadatas) {
|
||||
const commColums = [];
|
||||
let columns = entityMetadata.columns;
|
||||
if(entityMetadata.tableType != 'regular') continue;
|
||||
columns = _.filter(
|
||||
columns.map((e) => {
|
||||
return {
|
||||
|
||||
@ -338,14 +338,15 @@ export abstract class BaseService {
|
||||
});
|
||||
await this.entity.save(param);
|
||||
} else{
|
||||
const upsert = this._coolConfig.crud?.upsert || 'normal';
|
||||
if (type == 'update') {
|
||||
param.updateTime = new Date();
|
||||
await this.entity.update(param.id, param);
|
||||
upsert == 'normal'? await this.entity.update(param.id, param): await this.entity.save(param);
|
||||
}
|
||||
if(type =='add'){
|
||||
param.createTime = new Date();
|
||||
param.updateTime = new Date();
|
||||
await this.entity.insert(param);
|
||||
upsert == 'normal'? await this.entity.insert(param): await this.entity.save(param);
|
||||
}
|
||||
}
|
||||
await this.modifyAfter(param, type);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user