All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template-application-angular.data.dao.entity.js.template Maven / Gradle / Ivy

#if($dataCount)
var query = require('db/v3/query');
#end
var daoApi = require('db/v3/dao');
var dao = daoApi.create({
	'table': '${dataName}',
	'properties': [
#foreach ($property in $properties)
#if($foreach.isFirst())
		{
#else
 {
#end
			'name': '${property.name}',
			'column': '${property.dataName}',
			'type': '${property.dataType}',
#if($property.dataPrimaryKey)
			'id': true,
#end
#if($property.dataNotNull)
			'required': true
#end
		}#if($foreach.hasNext),#end
#end
]
});
exports.list = function(settings) {
	return dao.list(settings);
};
#if($type != 'REPORT')

exports.get = function(id) {
	return dao.find(id);
};

exports.create = function(entity) {
	return dao.insert(entity);
};

exports.update = function(entity) {
	return dao.update(entity);
};

exports.delete = function(id) {
	dao.remove(id);
};
#end

exports.count = function() {
	return dao.count();
};

exports.customDataCount = function() {
#if($dataCount)
	var resultSet = query.execute("${dataCount}");
	if (resultSet !== null && resultSet[0] !== null) {
		if (resultSet[0].COUNT !== undefined && resultSet[0].COUNT !== null) {
			return resultSet[0].COUNT;
		} else if (resultSet[0].count !== undefined && resultSet[0].count !== null) {
			return resultSet[0].count;
		}
	}
	return 0;
#else
	return dao.count();
#end
};




© 2015 - 2025 Weber Informatics LLC | Privacy Policy