import { default as BaseController } from "../../baseController";
|
import { Post } from "egg-shell-decorators";
|
import { BaseDestination } from "../../../entity/basicInfo/workshop/baseDestination";
|
|
// import { BaseBrand } from "../../../entity/basicInfo/base/baseBrand";
|
|
export default class ProductInfoController extends BaseController {
|
//#region getList 获得目的地列表
|
/**
|
* 获得目的地列表
|
*/
|
@Post()
|
public async getList() {
|
let { ctx } = this;
|
try {
|
let whereStr = "1=1"; // 不筛选空器具
|
var where: any = {};
|
|
// 关键词查询条件
|
if (this.body.name) {
|
let name = this.ctx.helper.sqlSecurity(this.body.name);
|
whereStr += ` AND (destinationName LIKE '%' + :name + '%' OR destinationCode LIKE '%' + :name + '%')`;
|
where.name = name;
|
}
|
|
let builder = this.dbRead.createQueryBuilder(BaseDestination, "t").where(whereStr, where);
|
|
builder.take(500);
|
let dataList = [];
|
dataList = await builder.getMany();
|
this.info.result = true;
|
this.info.data = dataList;
|
|
ctx.body = this.info;
|
} catch (ex) {
|
let msg = "异常错误信息:" + ex.message;
|
this.info.result = false;
|
this.info.msg = msg;
|
ctx.body = this.info;
|
}
|
}
|
//#endregion
|
}
|