import { Provide, Inject, Get, Query } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { BaseSysLayersService } from '../../../service/sys/layers';
import { BaseSysLayersEntity } from '../../../entity/sys/layers';

/**
 * 图层
 */
@Provide()
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: BaseSysLayersEntity,
  service: BaseSysLayersService,
})
export class BaseSysLayersController extends BaseController {
  @Inject()
  baseSysLayersService: BaseSysLayersService;

  @Get('/getMaxOrderNum', { summary: '获取ordernum' })
  async getMaxOrderNum() {
    const list = await this.baseSysLayersService.getMaxOrderNum();
    return this.ok(list);
  }
  @Get('/getMaxLayerOrder', { summary: '获取layerorder' })
  async getMaxLayerOrder(@Query('layerCode') layerCode: string) {
    const list = await this.baseSysLayersService.getMaxLayerOrder(layerCode);
    return this.ok(list);
  }
}
