/*
 * @Author: YKH
 * @Date: 2022-02-16 15:20:40
 * @LastEditTime: 2022-02-22 14:58:40
 * @Description: 
 * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\shuyou\controller\admin\special_account_consume.ts
 */
import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from 'midwayjs-cool-core';
import { ShuyouSpecialAccountConsumeEntity } from '../../entity/special_account_consume';
import { ShuyouSpecialAccountConsumeService } from '../../service/special_account_consume';

/**
 * 特殊卡使用记录
 */
@Provide()
@CoolController({
  // 添加通用CRUD接口
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  // 设置表实体
  entity: ShuyouSpecialAccountConsumeEntity,
  service: ShuyouSpecialAccountConsumeService,

  before: ctx => {
    //前段数据转JSON格式
    const data = ctx.request.body;
    if (data.card_text == "") {
      data.card_text = null
    }
    ctx.request.body.data = JSON.stringify(data);
  },
  // 分页查询配置
  pageQueryOp: {
    // 让字段支持模糊查询
    keyWordLikeFields: ['card_text'],
    // 让字段支持筛选
    fieldEq: ['card_text'],
    // 添加排序
    addOrderBy: {
      // 排序字段及排序方式
      id: 'desc',
    },
  },
})
export class ShuyouSpecialAccountConsumeController extends BaseController {
}
