เช็ค ข้อมูลหลัก #809 (เรื่อง search)
This commit is contained in:
parent
5e8b372323
commit
39b82dfa0a
3 changed files with 53 additions and 8 deletions
|
|
@ -11,12 +11,14 @@ import {
|
|||
Request,
|
||||
Response,
|
||||
Get,
|
||||
Query,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { CommandSys, CreateCommandSys, UpdateCommandSys } from "../entities/CommandSys";
|
||||
import { Like } from "typeorm";
|
||||
|
||||
@Route("api/v1/org/commandSys")
|
||||
@Tags("CommandSys")
|
||||
|
|
@ -35,8 +37,12 @@ export class CommandSysController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("list")
|
||||
async GetResult() {
|
||||
async GetResult(
|
||||
@Query("keyword") keyword?: string | null
|
||||
) {
|
||||
const condition = keyword && keyword.length > 0 ? { sysName: Like(`%${keyword}%`) } : {};
|
||||
const _commandSys = await this.commandSysRepository.find({
|
||||
where: condition,
|
||||
select: [
|
||||
"id",
|
||||
"sysName",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue