1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package com.boman.system.common;
- import com.boman.system.service.impl.BaseSaveService;
- import lombok.Getter;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Qualifier;
- /**
- * @author shiqian
- * @description
- * @date 2021年03月22日 10:30
- **/
- public abstract class BaseTableService implements TableService{
- @Autowired
- @Qualifier("baseSaveService-one")
- private BaseSaveService baseSaveService;
- @Getter
- private String tableName;
- private boolean isInitialized;
- public BaseTableService() {
- }
- protected BaseTableService(String tableName) {
- this.tableName = tableName;
- isInitialized = false;
- }
- @Override
- public final void configure(TableServiceContext context) {
- if (!isInitialized) {
- doConfigure(context);
- isInitialized = true;
- }
- }
- protected void doConfigure(TableServiceContext context) {
- //每个业务可以在自己所在的自定义服务实现内部调整下自己的上下文(针对validators/filters的调整)
- //本方法一个表只会执行一次才对
- }
- @Override
- public RowResult executeAction(TableServiceContext context, MainTableRecord row) {
- LOGGER.debug("action====>" + context.getActionName());
- return baseSaveService.insertRow(context, row, context.getCurrentTime());
- // switch (context.getActionName()) {
- // case Constants.ACTION_SAVE:
- // switch (row.getAction()) {
- // case INSERT:
- // return baseSaveService.insertRow(context, row, context.getCurrentTime());
- // case UPDATE:
- // //return baseSaveService.updateRow(context, row, context.getCurrentTime());
- // default:
- // }
- // throw new NDSException("不应该执行到这里吧!");
- // case Constants.ACTION_DELETE:
- // //return baseDelService.delete(context, row);
- // case Constants.ACTION_VOID:
- // //return baseVoidService.execute(context, row);
- // case Constants.ACTION_SUBMIT:
- // //return baseSubmitService.isFlow(context, row);
- // case Constants.ACTION_UNSUBMIT:
- // //return baseUnSubmitService.execute(context, row);
- //
- // default:
- //// default:
- //// return RowResult.error("未知动作:" + context.getActionName());
- // }
- // return RowResult.ok(context.getLocale());
- // return RowResult.ok("");
- }
- }
|