/*
 * @Author: YKH
 * @Date: 2021-12-08 10:26:27
 * @LastEditTime: 2022-03-21 23:06:13
 * @Description: 
 * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\shuyou\controller\admin\game_target_tencent.ts
 */
import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from 'midwayjs-cool-core';
import { ShuyouGameTargetEntity } from '../../entity/game_target';
import { ShuyouGameTargetTencentService } from '../../service/game_target_tencent';

/**
 * 游戏目标
 */
@Provide()
@CoolController({
  // 添加通用CRUD接口
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  // 设置表实体
  entity: ShuyouGameTargetEntity,
  service: ShuyouGameTargetTencentService,

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


}
