57 lines
1.8 KiB
C++
57 lines
1.8 KiB
C++
|
|
|
|||
|
|
/**********************************************************************************
|
|||
|
|
* @file SimpleCtrl.hpp
|
|||
|
|
* @brief 使用oatpp简单api的控制器类
|
|||
|
|
* @author yikenan
|
|||
|
|
* @versiong 1.0
|
|||
|
|
* @date 2021/12/27
|
|||
|
|
**********************************************************************************/
|
|||
|
|
|
|||
|
|
#pragma once
|
|||
|
|
|
|||
|
|
#include "oatpp/web/server/api/ApiController.hpp"
|
|||
|
|
#include "oatpp/core/macro/codegen.hpp"
|
|||
|
|
#include "oatpp/core/macro/component.hpp"
|
|||
|
|
|
|||
|
|
#include OATPP_CODEGEN_BEGIN( ApiController )
|
|||
|
|
|
|||
|
|
namespace web_server
|
|||
|
|
{
|
|||
|
|
namespace module_alarm
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 使用oatpp简单api的控制器类
|
|||
|
|
*/
|
|||
|
|
class CSimpleCtrl final : public oatpp::web::server::api::ApiController
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
explicit CSimpleCtrl( OATPP_COMPONENT( std::shared_ptr<ObjectMapper>, objMapper ));
|
|||
|
|
|
|||
|
|
~CSimpleCtrl() override = default;
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
ENDPOINT( "POST", "findAlarmcolor", findAlarmcolor );
|
|||
|
|
|
|||
|
|
ENDPOINT( "POST", "insertColor", insertColor, BODY_STRING( String, strReq ));
|
|||
|
|
|
|||
|
|
ENDPOINT( "GET", "queryEventMsFromMySql", queryEventMsFromMySql, QUERY( String, content ),
|
|||
|
|
QUERY( String, priority ), QUERY( String, location ), QUERY( String, devType ), QUERY( String, type ),
|
|||
|
|
QUERY( String, regionId ), QUERY( String, startTime ), QUERY( String, endTime ),
|
|||
|
|
QUERY( Int32, orderType ), QUERY( String, orderFlag ), QUERY( Int16, pageSize ), QUERY( Int16, page )
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
ENDPOINT( "GET", "queryAlarmTreeMs", queryAlarmTreeMs,
|
|||
|
|
REQUEST( std::shared_ptr<IncomingRequest>, spRequest ));
|
|||
|
|
|
|||
|
|
ENDPOINT( "GET", "queryEventConditionMs", queryEventConditionMs,
|
|||
|
|
/*QUERY( Int32 , type ), QUERY( Int32, id ),*/REQUEST( std::shared_ptr<IncomingRequest>, spRequest ));
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
} //namespace module_alarm
|
|||
|
|
} //namespace web_server
|
|||
|
|
|
|||
|
|
#include OATPP_CODEGEN_END( ApiController )
|
|||
|
|
|
|||
|
|
|