zeanium-node
Advanced tools
Comparing version 0.6.19 to 0.6.20
{ | ||
"name": "zeanium-node", | ||
"version": "0.6.19", | ||
"version": "0.6.20", | ||
"description": "Zeanium for Node.js, simple http server and custome your business.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,3 @@ /** | ||
methods: { | ||
addTreeNode: function (table, model){ | ||
addNode: function (table, model){ | ||
var _pid = model.pid || 0; | ||
@@ -15,3 +15,3 @@ return zn.createTransactionBlock() | ||
table: table, | ||
fields: 'id,depth,parentPath,treeOrder', | ||
fields: 'id, zn_tree_depth, zn_tree_parent_path,zn_tree_order', | ||
where: { | ||
@@ -22,3 +22,3 @@ id: _pid | ||
table: table, | ||
fields: 'max(treeOrder)+1 as treeOrder', | ||
fields: 'max(zn_tree_order)+1 as zn_tree_order', | ||
where: { | ||
@@ -31,12 +31,12 @@ delFlag: 0, | ||
var _pidModel = rows[0][0], | ||
_treeOrder = rows[1][0].treeOrder|| 1, | ||
_treeOrder = rows[1][0].zn_tree_order|| 1, | ||
_pid = _pidModel ? _pidModel.id: 0, | ||
_depth = (_pidModel?_pidModel.depth:0) + 1, | ||
_parentPath = (_pidModel?_pidModel.parentPath:'') + (_pid === 0 ? '' : _pid) + ','; | ||
_depth = (_pidModel?_pidModel.zn_tree_depth:0) + 1, | ||
_parentPath = (_pidModel?_pidModel.zn_tree_parent_path:'') + (_pid === 0 ? '' : _pid) + ','; | ||
if(typeof model == 'string'){ | ||
model = JSON.parse(model); | ||
} | ||
model.parentPath = _parentPath; | ||
model.treeOrder = _treeOrder; | ||
model.depth = _depth; | ||
model.zn_tree_parent_path = _parentPath; | ||
model.zn_tree_order = _treeOrder; | ||
model.zn_tree_depth = _depth; | ||
return zn.sql.insert({ | ||
@@ -47,3 +47,3 @@ table: table, | ||
table: table, | ||
updates: 'sons=sons+1', | ||
updates: 'zn_tree_son_count=zn_tree_son_count+1', | ||
where: { | ||
@@ -55,7 +55,7 @@ id: _pid | ||
}, | ||
deleteTreeNode: function (table, where){ | ||
deleteNode: function (table, where){ | ||
return zn.createTransactionBlock() | ||
.query(zn.sql.select({ | ||
table: table, | ||
fields: 'id, pid, treeOrder', | ||
fields: 'id, zn_tree_pid, zn_tree_order', | ||
where: where | ||
@@ -67,9 +67,9 @@ })) | ||
var _sql = 'delete from {0} where id={1};'.format(table, _model.id), | ||
_pid = +_model.pid; | ||
_pid = +_model.zn_tree_pid; | ||
if(_pid){ | ||
_sql += 'update {0} set sons=sons-1 where id={1};'.format(table, _pid); | ||
_sql += 'update {0} set zn_tree_son_count=zn_tree_son_count-1 where id={1};'.format(table, _pid); | ||
} | ||
_sql += 'update {0} set treeOrder=treeOrder-1 where treeOrder>{1} and pid={2};'.format(table, _model.treeOrder, _pid); | ||
_sql += "delete from {0} where locate(',{1},',parentPath)<>0;".format(table, _model.id); | ||
_sql += 'update {0} set zn_tree_order=zn_tree_order-1 where zn_tree_order>{1} and zn_tree_pid={2};'.format(table, _model.zn_tree_order, _pid); | ||
_sql += "delete from {0} where locate(',{1},',zn_tree_parent_path)<>0;".format(table, _model.id); | ||
return _sql; | ||
@@ -81,5 +81,5 @@ } else { | ||
}, | ||
orderTreeNode: function (table, id, order){ | ||
orderNode: function (table, id, order){ | ||
return zn.createTransactionBlock() | ||
.query('select {0} from {1} where id={2};select count(id) as count from {1} where pid=(select pid from {1} where id={2});'.format('id,pid,treeOrder', table, id)) | ||
.query('select {0} from {1} where id={2};select count(id) as count from {1} where zn_tree_pid=(select zn_tree_pid from {1} where id={2});'.format('id, zn_tree_pid, zn_tree_order', table, id)) | ||
.query('order', function (sql, rows, fields){ | ||
@@ -90,3 +90,3 @@ var _model = rows[0][0], | ||
if(_model){ | ||
var _treeOrder = +_model.treeOrder, | ||
var _treeOrder = +_model.zn_tree_order, | ||
_newOrder = _treeOrder - 1; | ||
@@ -106,4 +106,4 @@ | ||
var _sql = 'update {0} set treeOrder={1} where treeOrder={2} and pid={3};'.format(table, _treeOrder, _newOrder, _model.pid); | ||
_sql += 'update {0} set treeOrder={1} where id={2};'.format(table, _newOrder, _model.id); | ||
var _sql = 'update {0} set zn_tree_order={1} where zn_tree_order={2} and zn_tree_pid={3};'.format(table, _treeOrder, _newOrder, _model.zn_tree_pid); | ||
_sql += 'update {0} set zn_tree_order={1} where id={2};'.format(table, _newOrder, _model.id); | ||
return _sql; | ||
@@ -110,0 +110,0 @@ } else { |
@@ -11,3 +11,3 @@ /** | ||
this.beginTransaction() | ||
.block(zn.block.tree.addTreeNode(this._table, values)) | ||
.block(zn.block.tree.addNode(this._table, values)) | ||
.on('error', function (sender, error){ | ||
@@ -26,3 +26,3 @@ _defer.reject(error); | ||
this.beginTransaction() | ||
.block(zn.block.tree.deleteTreeNode(this._table, where)) | ||
.block(zn.block.tree.deleteNode(this._table, where)) | ||
.on('error', function (sender, error){ | ||
@@ -41,3 +41,3 @@ _defer.reject(error); | ||
this.beginTransaction() | ||
.block(zn.block.tree.orderTreeNode(this._table, id, order)) | ||
.block(zn.block.tree.orderNode(this._table, id, order)) | ||
.on('error', function (sender, error){ | ||
@@ -44,0 +44,0 @@ _defer.reject(error); |
@@ -5,3 +5,3 @@ zn.define(function () { | ||
properties: { | ||
fileIds: { | ||
zn_attachment_file_ids: { | ||
value: null, | ||
@@ -12,5 +12,5 @@ type: ['varchar', 250], | ||
}, | ||
files: { | ||
zn_attachment_file_paths: { | ||
value: null, | ||
type: ['varchar', 250], | ||
type: ['varchar', 1000], | ||
ignore: true, | ||
@@ -17,0 +17,0 @@ default: ',' |
zn.define(function () { | ||
return zn.Class("zn.db.common.model.Base", zn.db.data.Model, { | ||
@@ -13,17 +11,14 @@ properties: { | ||
}, | ||
/* | ||
_id: { | ||
zn_id: { | ||
value: null, | ||
type: ['char', 36], | ||
get: function (){ | ||
return '{uuid()}'; | ||
}, | ||
default: '' | ||
},*/ | ||
title: { | ||
return zn.uuid(); | ||
} | ||
}, | ||
zn_title: { | ||
value: null, | ||
type: ['varchar', 100], | ||
default: '' | ||
type: ['varchar', 100] | ||
}, | ||
createTime: { | ||
zn_create_time: { | ||
value: null, | ||
@@ -35,3 +30,3 @@ type: ['timestamp'], | ||
}, | ||
createPerson: { | ||
zn_create_user: { | ||
value: null, | ||
@@ -46,3 +41,3 @@ type: ['int', 11], | ||
}, | ||
modifyTime: { | ||
zn_modify_time: { | ||
value: null, | ||
@@ -56,3 +51,3 @@ type: ['datetime'], | ||
}, | ||
modifyPerson: { | ||
zn_modify_user: { | ||
value: null, | ||
@@ -68,3 +63,3 @@ type: ['int', 11], | ||
}, | ||
delFlag: { | ||
zn_deleted: { | ||
value: null, | ||
@@ -76,3 +71,3 @@ type: ['int', 4], | ||
}, | ||
note: { | ||
zn_note: { | ||
value: null, | ||
@@ -79,0 +74,0 @@ type: ['varchar', 250], |
@@ -5,3 +5,3 @@ zn.define(function () { | ||
properties: { | ||
type: { | ||
zn_file_type: { | ||
value: null, | ||
@@ -11,3 +11,3 @@ type: ['int', 11], | ||
}, | ||
path: { | ||
zn_file_path: { | ||
value: null, | ||
@@ -17,3 +17,3 @@ type: ['varchar', 100], | ||
}, | ||
url: { | ||
zn_file_url: { | ||
value: null, | ||
@@ -23,3 +23,3 @@ type: ['varchar', 100], | ||
}, | ||
tempTitle: { | ||
zn_file_temp_title: { | ||
value: null, | ||
@@ -29,3 +29,3 @@ type: ['varchar', 100], | ||
}, | ||
specialTitle: { | ||
zn_file_specify_title: { | ||
value: null, | ||
@@ -35,3 +35,3 @@ type: ['varchar', 100], | ||
}, | ||
fileSuffix: { | ||
zn_file_suffix: { | ||
value: null, | ||
@@ -41,3 +41,3 @@ type: ['varchar', 100], | ||
}, | ||
length: { | ||
zn_file_length: { | ||
value: null, | ||
@@ -47,6 +47,6 @@ type: ['int', 10], | ||
}, | ||
size: { | ||
zn_file_size: { | ||
value: null, | ||
type: ['varchar', 20], | ||
default: function (){ | ||
get: function (){ | ||
var value = this.getInt('length'); | ||
@@ -53,0 +53,0 @@ if(value){ |
@@ -1,2 +0,2 @@ | ||
zn.define('../collection/Rights',function (Rights) { | ||
zn.define('../collection/Rights', function (Rights) { | ||
@@ -6,15 +6,13 @@ return zn.Class("zn.db.common.model.Rights", zn.db.data.Model, { | ||
properties: { | ||
ownerId: { | ||
zn_rights_owner_id: { | ||
value: null, | ||
type: ['int', 11], | ||
convert: 'zn_convert_user({})', | ||
default: '0' | ||
convert: 'zn_convert_user({})' | ||
}, | ||
ifEnabledRights: { | ||
zn_rights_enabled: { | ||
value: null, | ||
type: ['int', 4], | ||
ignore: true, | ||
default: '0' | ||
ignore: true | ||
}, | ||
users: { | ||
zn_rights_users: { | ||
value: null, | ||
@@ -25,3 +23,3 @@ type: ['varchar', 250], | ||
}, | ||
roles: { | ||
zn_rights_roles: { | ||
value: null, | ||
@@ -32,3 +30,3 @@ type: ['varchar', 250], | ||
}, | ||
observeUsers: { | ||
zn_rights_observe_users: { | ||
value: null, | ||
@@ -39,3 +37,3 @@ type: ['varchar', 250], | ||
}, | ||
observeRoles: { | ||
zn_rights_observe_roles: { | ||
value: null, | ||
@@ -42,0 +40,0 @@ type: ['varchar', 250], |
@@ -5,3 +5,3 @@ zn.define(function () { | ||
properties: { | ||
tags: { | ||
zn_tag_vars: { | ||
value: null, | ||
@@ -8,0 +8,0 @@ type: ['varchar', 250], |
@@ -6,3 +6,3 @@ zn.define('../collection/Tree',function (Tree) { | ||
properties: { | ||
type: { | ||
zn_tree_pid: { | ||
value: null, | ||
@@ -12,8 +12,9 @@ type: ['int', 11], | ||
}, | ||
pid: { | ||
zn_tree_depth: { | ||
value: null, | ||
type: ['int', 11], | ||
ignore: true, | ||
default: '0' | ||
}, | ||
depth: { | ||
zn_tree_order: { | ||
value: null, | ||
@@ -24,9 +25,9 @@ type: ['int', 11], | ||
}, | ||
treeOrder: { | ||
zn_tree_parent_path: { | ||
value: null, | ||
type: ['int', 11], | ||
type: ['varchar', 250], | ||
ignore: true, | ||
default: '0' | ||
default: ',' | ||
}, | ||
sons: { | ||
zn_tree_son_count: { | ||
value: null, | ||
@@ -37,3 +38,3 @@ type: ['int', 11], | ||
}, | ||
maxCount: { | ||
zn_tree_max_son_count: { | ||
value: null, | ||
@@ -44,12 +45,11 @@ type: ['int', 11], | ||
}, | ||
parentPath: { | ||
zn_tree_extend: { | ||
value: null, | ||
type: ['varchar', 250], | ||
ignore: true, | ||
default: ',' | ||
type: ['varchar', 500], | ||
default: '' | ||
}, | ||
ext: { | ||
zn_tree_type: { | ||
value: null, | ||
type: ['varchar', 500], | ||
default: '' | ||
type: ['int', 11], | ||
default: '0' | ||
} | ||
@@ -56,0 +56,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
255161
5987