暂存
This commit is contained in:
@@ -81,7 +81,7 @@ async function list(req, res) {
|
||||
)
|
||||
|
||||
const [rows] = await pool.query(
|
||||
`${LIST_SELECT} ${where} ORDER BY a.id DESC LIMIT ? OFFSET ?`,
|
||||
`${LIST_SELECT} ${where} ORDER BY a.id ASC LIMIT ? OFFSET ?`,
|
||||
[...params, pageSize, offset]
|
||||
)
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ const DETAIL_SELECT = LIST_SELECT
|
||||
async function list(req, res) {
|
||||
try {
|
||||
const { page, pageSize, offset } = pagination(req.query)
|
||||
const { status, customer_name, contract_no, contract_name, employee_name, id, effective_date_start, effective_date_end } = req.query
|
||||
const { status, type, customer_name, contract_no, contract_name, employee_name, id, effective_date_start, effective_date_end } = req.query
|
||||
|
||||
let where = 'WHERE 1=1'
|
||||
const params = []
|
||||
@@ -68,6 +68,10 @@ async function list(req, res) {
|
||||
where += ' AND c.status = ?'
|
||||
params.push(status)
|
||||
}
|
||||
if (type) {
|
||||
where += ' AND c.type = ?'
|
||||
params.push(type)
|
||||
}
|
||||
if (contract_name) {
|
||||
where += ' AND c.contract_name LIKE ?'
|
||||
params.push(`%${contract_name}%`)
|
||||
@@ -105,7 +109,7 @@ async function list(req, res) {
|
||||
)
|
||||
|
||||
const [rows] = await pool.query(
|
||||
`${LIST_SELECT} ${where} ORDER BY c.id DESC LIMIT ? OFFSET ?`,
|
||||
`${LIST_SELECT} ${where} ORDER BY c.id ASC LIMIT ? OFFSET ?`,
|
||||
[...params, pageSize, offset]
|
||||
)
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ async function list(req, res) {
|
||||
const [rows] = await pool.query(
|
||||
`SELECT c.*
|
||||
FROM customers c
|
||||
${where} ORDER BY c.id DESC LIMIT ? OFFSET ?`,
|
||||
${where} ORDER BY c.id ASC LIMIT ? OFFSET ?`,
|
||||
[...params, pageSize, offset]
|
||||
)
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ async function list(req, res) {
|
||||
)
|
||||
|
||||
const [rows] = await pool.query(
|
||||
`SELECT * FROM employees ${where} ORDER BY id DESC LIMIT ? OFFSET ?`,
|
||||
`SELECT * FROM employees ${where} ORDER BY id ASC LIMIT ? OFFSET ?`,
|
||||
[...params, pageSize, offset]
|
||||
)
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ async function list(req, res) {
|
||||
)
|
||||
|
||||
const [rows] = await pool.query(
|
||||
`SELECT * FROM products ${where} ORDER BY id DESC LIMIT ? OFFSET ?`,
|
||||
`SELECT * FROM products ${where} ORDER BY id ASC LIMIT ? OFFSET ?`,
|
||||
[...params, pageSize, offset]
|
||||
)
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ async function list(req, res) {
|
||||
)
|
||||
|
||||
const [rows] = await pool.query(
|
||||
`SELECT * FROM suppliers ${where} ORDER BY id DESC LIMIT ? OFFSET ?`,
|
||||
`SELECT * FROM suppliers ${where} ORDER BY id ASC LIMIT ? OFFSET ?`,
|
||||
[...params, pageSize, offset]
|
||||
)
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ async function list(req, res) {
|
||||
)
|
||||
|
||||
const [rows] = await pool.query(
|
||||
`${USER_LIST_SQL} ${where} ORDER BY u.id DESC LIMIT ? OFFSET ?`,
|
||||
`${USER_LIST_SQL} ${where} ORDER BY u.id ASC LIMIT ? OFFSET ?`,
|
||||
[...params, pageSize, offset]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user