20261008
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
const normalizeSortRule = require('../../utils/sortRule.js');
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* XXXnameXXX
|
||||
* @url admin/old/sys/getList 前端调用的url参数地址
|
||||
* data 请求参数
|
||||
* @param {String} params1 参数1
|
||||
*/
|
||||
main: async (event) => {
|
||||
let { data = {}, userInfo, util, filterResponse, originalParam } = event;
|
||||
let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
|
||||
let { pageIndex, pageSize, formData, sortRule } = data;
|
||||
let res = { code: 0, msg: "" };
|
||||
// 业务逻辑开始-----------------------------------------------------------
|
||||
|
||||
const whereJson = {}
|
||||
if (vk.pubfn.isNotNull(formData)) {
|
||||
if (vk.pubfn.isNotNull(formData.transactionId)) whereJson.transactionId = new RegExp(formData.transactionId)
|
||||
if (vk.pubfn.isNotNull(formData.type)) whereJson.type = formData.type
|
||||
if (vk.pubfn.isNotNull(formData.status)) whereJson.status = formData.status
|
||||
|
||||
}
|
||||
|
||||
res = await vk.baseDao.selects({
|
||||
dbName: "jjx-contract",
|
||||
getCount: true,
|
||||
pageIndex,
|
||||
pageSize,
|
||||
whereJson,
|
||||
sortArr: normalizeSortRule(sortRule, [{"name": "_add_time", "type":"desc" }], ["_add_time"]),
|
||||
foreignDB: [
|
||||
{
|
||||
dbName: "uni-id-users",
|
||||
localKey: "userId",
|
||||
foreignKey: "_id",
|
||||
as: "user",
|
||||
limit: 1, // limit=1则以对象形式返回
|
||||
fieldJson: {
|
||||
_id: true,
|
||||
company: {
|
||||
companyName: true
|
||||
},
|
||||
person: {
|
||||
personName: true
|
||||
},
|
||||
businessCard: true,
|
||||
accountType: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
dbName: "jjx-user-contract",
|
||||
localKey: "_id",
|
||||
foreignKey: "contractId",
|
||||
as: "userContract",
|
||||
limit: 500, // limit=1则以对象形式返回
|
||||
foreignDB: [
|
||||
{
|
||||
dbName: "uni-id-users",
|
||||
localKey: "userId",
|
||||
foreignKey: "_id",
|
||||
as: "user",
|
||||
limit: 1, // limit=1则以对象形式返回
|
||||
fieldJson: {
|
||||
_id: true,
|
||||
company: {
|
||||
companyName: true,
|
||||
mobile: true,
|
||||
},
|
||||
person: {
|
||||
personName: true,
|
||||
mobile: true,
|
||||
},
|
||||
businessCard: true,
|
||||
accountType: true,
|
||||
mobile: true,
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user