列表
#function list($strTableName, $strColumns, $where)
#set($strSql = `
select
${$strColumns}
from
${strTableName}
where 1 = 1
`)
#set($strSql = $strSql + @andWhere($where))
return $vs.dbTools.list($strSql, $where)
#end
#if ($vs.util.isNull($vs.stock.dbTools))
#set($vs.stock.dbTools = $vs.util.newMap())
#end
#set($vs.stock.dbTools.list= @list)
远程列表
#function remoteList($systemId, $strTableName, $strColumns, $where)
#if ($vs.util.isBlankOne($strTableName, $systemId))
return null
#end
#if ($vs.util.isNull($strColumns))
#set($strColumns = ' * ')
#end
#set($strSql = `
select
${$strColumns}
from
${strTableName}
where 1 = 1
`)
#set($strSql = $strSql + @andWhere($where))
return $vs.dbTools.remoteList($systemId, $strSql ,$where)
#end
#if ($vs.util.isNull($vs.stock.dbTools))
#set($vs.stock.dbTools = $vs.util.newMap())
#end
#set($vs.stock.dbTools.remoteList = @remoteList)
公共引用:条件
#function andWhere($where)
#set($sql = '')
#if ($vs.util.isMap($where))
#foreach ($key in $vs.util.getMapKeys($where))
#set($value = $where.get($key))
#if ($vs.util.isList($value))
#set($sql = $sql + " and " + $vs.sqlHelper.listIn($value, $key))
#else
#set($sql = $sql + $vs.sqlHelper.and($where, $key))
#end
#end
#end
return $sql
#end
#if ($vs.util.isNull($vs.stock.dbTools))
#set($vs.stock.dbTools = $vs.util.newMap())
#end
#set($vs.stock.dbTools.andWhere = @andWhere)