Commit 65bea225 authored by guozhipeng's avatar guozhipeng

odata接口

parent 69719eef
...@@ -11,3 +11,9 @@ service feishuService { ...@@ -11,3 +11,9 @@ service feishuService {
//视图 //视图
entity FeiShuApprovalCodeView as projection on feishuDB.FeiShuApprovalCodeView;//飞书审批定义视图 entity FeiShuApprovalCodeView as projection on feishuDB.FeiShuApprovalCodeView;//飞书审批定义视图
} }
//开放接口
service openFeishuService @(requires: 'any'){
//实体
entity FeiShuApprover as projection on feishuDB.FeiShuApprover;
}
package customer.lianchuangjie.handlers;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import com.sap.cds.services.cds.CdsCreateEventContext;
import com.sap.cds.services.cds.CdsReadEventContext;
import com.sap.cds.services.cds.CqnService;
import com.sap.cds.services.handler.EventHandler;
import com.sap.cds.services.handler.annotations.On;
import com.sap.cds.services.handler.annotations.ServiceName;
/**
* 参考文档:https://developers.sap.com/tutorials/cp-cap-java-custom-handler.html
*/
@Slf4j
@Component
@ServiceName("openFeishuService")
public class OpenFeishuServiceHandler implements EventHandler {
private Map<Object, Map<String, Object>> results = new HashMap<>();
@On(event = CqnService.EVENT_CREATE, entity = "openFeishuService.FeiShuApprover")
public void onCreate(CdsCreateEventContext context) {
log.info("OpenFeishuServiceHandler[openFeishuService.FeiShuApprover].onCreate");
context.setResult(results.values());
}
@On(event = CqnService.EVENT_READ, entity = "openFeishuService.FeiShuApprover")
public void onRead(CdsReadEventContext context) {
log.info("OpenFeishuServiceHandler[openFeishuService.FeiShuApprover].onRead");
context.setResult(results.values());
}
/*@On(event = CqnService.EVENT_UPDATE, entity = "openFeishuService.FeiShuApprover")
public void onUpdate(CdsReadEventContext context) {
log.info("OpenFeishuServiceHandler[openFeishuService.FeiShuApprover].onUpdate");
context.setResult(results.values());
}*/
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment