Browse Source

(*)报表查询接口 修改排序

master
wuqun 2 years ago
parent
commit
603d93af63
  1. 12
      api/app/lib/controllers/report/achievement.js
  2. 2
      api/app/lib/controllers/report/index.js

12
api/app/lib/controllers/report/achievement.js

@ -12,7 +12,7 @@ async function getReceivedDetail(ctx) {
}
let findOption = {
where: where,
order: [['id', 'DESC']]
order: [['id', 'ASC']]
}
if (!toExport) {//非导出时考虑分页
if (limit) {
@ -132,7 +132,7 @@ async function getAchievementDetail(ctx) {
}
let findOption = {
where: where,
order: [['id', 'DESC']]
order: [['id', 'ASC']]
}
if (!toExport) {//非导出时考虑分页
if (limit) {
@ -349,7 +349,7 @@ async function getContractDetail(ctx) {
where: where,
offset: Number(page) * Number(limit),
limit: Number(limit),
order: [['id', 'DESC']]
order: [['id', 'ASC']]
});
ctx.status = 200
ctx.body = contractDetail;
@ -376,7 +376,7 @@ async function getInvoicingDetail(ctx) {
where: where,
offset: Number(page) * Number(limit),
limit: Number(limit),
order: [['id', 'DESC']]
order: [['id', 'ASC']]
});
ctx.status = 200
ctx.body = invoiceDetail;
@ -394,7 +394,7 @@ async function exportContractDetail(ctx) {
try {
const { models } = ctx.fs.dc;
let exportData = await models.ContractDetail.findAll({
order: [['id', 'DESC']]
order: [['id', 'ASC']]
});
const { utils: { simpleExcelDown, contractDetailsColumnKeys } } = ctx.app.fs;
let header = [];
@ -423,7 +423,7 @@ async function exportInvoicingDetail(ctx) {
try {
const { models } = ctx.fs.dc;
let exportData = await models.InvoiceDetail.findAll({
order: [['id', 'DESC']]
order: [['id', 'ASC']]
});
const { utils: { simpleExcelDown, invoicingDetailsColumnKeys } } = ctx.app.fs;
let header = [];

2
api/app/lib/controllers/report/index.js

@ -58,7 +58,7 @@ async function getSalersReport(ctx) {
const salersRes = await clickHouse.hr.query(`
SELECT * from sales_distribution as sales
${innerSelectQuery}
order by id desc
order by id asc
${!toExport && limit ? `LIMIT ${limit}` : ''}
${!toExport && limit && page ? 'OFFSET ' + parseInt(limit) * parseInt(page) : ''}
`).toPromise()

Loading…
Cancel
Save