/*
 * @Author: YKH
 * @Date: 2022-09-01 14:20:37
 * @LastEditTime: 2022-10-08 13:35:01
 * @Description: file content
 * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\shuyou\controller\admin\rent_computer_shop.ts
 */

import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from 'midwayjs-cool-core';
import { ShuyouRentComputerShopEntity } from '../../entity/rent_computer_shop';
import { ShuyouRentComputerShopService } from '../../service/rent_computer_shop';

/**
 * 租机店铺
 */
@Provide()
@CoolController({
  // 添加通用CRUD接口
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  // 设置表实体
  entity: ShuyouRentComputerShopEntity,
  service: ShuyouRentComputerShopService,

  before: ctx => {
    //前段数据转JSON格式

    const data = ctx.request.body;
    if (data.name == '') {
      data.name = null;
    }
    ctx.request.body.data = JSON.stringify(data);
  },
  // 分页查询配置
  pageQueryOp: {
    // 让字段支持模糊查询
    keyWordLikeFields: ['name'],
    // 让字段支持筛选
    fieldEq: ['name'],
  },
})
export class ShuyouRentComputerShopController extends BaseController {}
