Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-domain into dev

This commit is contained in:
wenjiarui 2023-03-10 11:07:27 +08:00
commit 4ebef4a9c4
10 changed files with 31 additions and 44 deletions

View File

@ -2938,15 +2938,13 @@ function constructAttributes(entity) {
], true))); ], true)));
break; break;
} }
case 'Float': { case 'Double':
attrAssignments.push(factory.createPropertyAssignment(factory.createIdentifier("type"), factory.createStringLiteral("float")), factory.createPropertyAssignment(factory.createIdentifier("params"), factory.createObjectLiteralExpression([ case 'Float':
factory.createPropertyAssignment(factory.createIdentifier("precision"), factory.createNumericLiteral(typeArguments[0].literal.text)), case 'Decimal': {
factory.createPropertyAssignment(factory.createIdentifier("scale"), factory.createNumericLiteral(typeArguments[1].literal.text)) if (['Double', 'Float'].includes(text)) {
], true))); console.warn("".concat(entity, "\u5BF9\u8C61\u4E2D\u8FD8\u6709").concat(text, "\u7C7B\u578B\u5B9A\u4E49\uFF0C\u73B0\u5728\u7EDF\u4E00\u7528Decimal\u8FDB\u884C\u5B58\u50A8"));
break; }
} attrAssignments.push(factory.createPropertyAssignment(factory.createIdentifier("type"), factory.createStringLiteral("decimal")), factory.createPropertyAssignment(factory.createIdentifier("params"), factory.createObjectLiteralExpression([
case 'Double': {
attrAssignments.push(factory.createPropertyAssignment(factory.createIdentifier("type"), factory.createStringLiteral("double")), factory.createPropertyAssignment(factory.createIdentifier("params"), factory.createObjectLiteralExpression([
factory.createPropertyAssignment(factory.createIdentifier("precision"), factory.createNumericLiteral(typeArguments[0].literal.text)), factory.createPropertyAssignment(factory.createIdentifier("precision"), factory.createNumericLiteral(typeArguments[0].literal.text)),
factory.createPropertyAssignment(factory.createIdentifier("scale"), factory.createNumericLiteral(typeArguments[1].literal.text)) factory.createPropertyAssignment(factory.createIdentifier("scale"), factory.createNumericLiteral(typeArguments[1].literal.text))
], true))); ], true)));

View File

@ -8,12 +8,14 @@ export declare type Text = string;
export declare type Image = string; export declare type Image = string;
export declare type File = string; export declare type File = string;
export declare type Datetime = number | Date; export declare type Datetime = number | Date;
export declare type Day = number | Date;
export declare type Time = number | Date;
export declare type Boolean = boolean; export declare type Boolean = boolean;
export declare type Price = number; export declare type Price = number;
export declare type PrimaryKey = string; export declare type PrimaryKey = string;
export declare type ForeignKey<E extends string> = string; export declare type ForeignKey<E extends string> = string;
export declare type Sequence = string; export declare type Sequence = string;
export { Geo, SingleGeo } from './Geo'; export { Geo, SingleGeo } from './Geo';
export declare type DataTypes = number | string | Datetime | Geo | Object | SingleGeo; export declare type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo;
export declare const types: string[]; export declare const types: string[];
export declare const unIndexedTypes: string[]; export declare const unIndexedTypes: string[];

View File

@ -1,5 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.unIndexedTypes = exports.types = void 0; exports.unIndexedTypes = exports.types = void 0;
exports.types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Boolean', 'Image', 'File', 'Geo', 'SingleGeo', 'Price']; exports.types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Day', 'Time',
'Boolean', 'Image', 'File', 'Geo', 'SingleGeo', 'Price'];
exports.unIndexedTypes = ['Text', 'Image', 'File', 'Object']; exports.unIndexedTypes = ['Text', 'Image', 'File', 'Object'];

View File

@ -19,3 +19,4 @@ export * from './Connector';
export * from './Timer'; export * from './Timer';
export * from './Port'; export * from './Port';
export * from './Endpoint'; export * from './Endpoint';
export * from './Style';

View File

@ -22,3 +22,4 @@ tslib_1.__exportStar(require("./Connector"), exports);
tslib_1.__exportStar(require("./Timer"), exports); tslib_1.__exportStar(require("./Timer"), exports);
tslib_1.__exportStar(require("./Port"), exports); tslib_1.__exportStar(require("./Port"), exports);
tslib_1.__exportStar(require("./Endpoint"), exports); tslib_1.__exportStar(require("./Endpoint"), exports);
tslib_1.__exportStar(require("./Style"), exports);

View File

@ -29,4 +29,6 @@ export interface DataTypeParams {
precision?: number; precision?: number;
scale?: number; scale?: number;
signed?: boolean; signed?: boolean;
max?: number;
min?: number;
} }

View File

@ -5340,40 +5340,16 @@ function constructAttributes(entity: string): ts.PropertyAssignment[] {
); );
break; break;
} }
case 'Float': { case 'Double':
case 'Float':
case 'Decimal': {
if (['Double', 'Float'].includes(text)) {
console.warn(`${entity}对象中还有${text}类型定义现在统一用Decimal进行存储`);
}
attrAssignments.push( attrAssignments.push(
factory.createPropertyAssignment( factory.createPropertyAssignment(
factory.createIdentifier("type"), factory.createIdentifier("type"),
factory.createStringLiteral("float") factory.createStringLiteral("decimal")
),
factory.createPropertyAssignment(
factory.createIdentifier("params"),
factory.createObjectLiteralExpression(
[
factory.createPropertyAssignment(
factory.createIdentifier("precision"),
factory.createNumericLiteral(
(<ts.NumericLiteral>(<ts.LiteralTypeNode>typeArguments![0]).literal).text
)
),
factory.createPropertyAssignment(
factory.createIdentifier("scale"),
factory.createNumericLiteral(
(<ts.NumericLiteral>(<ts.LiteralTypeNode>typeArguments![1]).literal).text
)
)
],
true
)
)
);
break;
}
case 'Double': {
attrAssignments.push(
factory.createPropertyAssignment(
factory.createIdentifier("type"),
factory.createStringLiteral("double")
), ),
factory.createPropertyAssignment( factory.createPropertyAssignment(
factory.createIdentifier("params"), factory.createIdentifier("params"),

View File

@ -9,6 +9,8 @@ export type Text = string;
export type Image = string; export type Image = string;
export type File = string; export type File = string;
export type Datetime = number | Date; export type Datetime = number | Date;
export type Day = number | Date;
export type Time = number | Date;
export type Boolean = boolean; export type Boolean = boolean;
export type Price = number; export type Price = number;
export type PrimaryKey = string; export type PrimaryKey = string;
@ -16,7 +18,8 @@ export type ForeignKey<E extends string> = string;
export type Sequence = string; // 自增长序列为了让人阅读方便为了支持分布式这里用string底层实现可自定义 export type Sequence = string; // 自增长序列为了让人阅读方便为了支持分布式这里用string底层实现可自定义
export { Geo, SingleGeo } from './Geo'; export { Geo, SingleGeo } from './Geo';
export type DataTypes = number | string | Datetime | Geo | Object | SingleGeo; export type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo;
export const types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Boolean', 'Image', 'File', 'Geo', 'SingleGeo', 'Price']; export const types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Day', 'Time',
'Boolean', 'Image', 'File', 'Geo', 'SingleGeo', 'Price'];
export const unIndexedTypes = ['Text', 'Image', 'File', 'Object']; export const unIndexedTypes = ['Text', 'Image', 'File', 'Object'];

View File

@ -19,3 +19,4 @@ export * from './Connector';
export * from './Timer'; export * from './Timer';
export * from './Port'; export * from './Port';
export * from './Endpoint'; export * from './Endpoint';
export * from './Style';

View File

@ -218,4 +218,6 @@ export interface DataTypeParams {
precision?: number; precision?: number;
scale?: number; scale?: number;
signed?: boolean; signed?: boolean;
max?: number;
min?: number;
}; };