package com.product.patch.controller;
|
|
import com.product.core.controller.support.AbstractBaseController;
|
import com.product.core.exception.BaseException;
|
import com.product.core.spring.context.SpringMVCContextHolder;
|
import com.product.module.sys.version.ApiVersion;
|
import com.product.patch.config.ErrorCode;
|
import com.product.patch.service.SyncTableStructureService;
|
import com.product.patch.service.idel.ISyncTableStructureService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
/**
|
* 实现功能:
|
*
|
* @author 作者[夜丶光]
|
* @version 1.0.00 2024-10-17 15:57
|
*/
|
@RestController
|
@RequestMapping("/api/patch/sync")
|
public class SyncTableStructureController extends AbstractBaseController {
|
@Autowired
|
private SyncTableStructureService syncTableStructureService;
|
|
/**
|
* 将数据库表结构字段同步至缓存字段表字段
|
* @param request
|
* @return
|
*/
|
@RequestMapping(value = "/syncDBField2CacheTable/{version}")
|
@ApiVersion(1)
|
public String syncDBField2CacheTable(HttpServletRequest request) {
|
try {
|
ISyncTableStructureService service = (ISyncTableStructureService) getProxyInstance(syncTableStructureService);
|
service.execute();
|
return OK();
|
} catch (BaseException e) {
|
return error(e);
|
} catch (Exception e) {
|
System.err.println(e);
|
SpringMVCContextHolder.getSystemLogger().error(e);
|
return error(ErrorCode.SYNC_DB_FIELD_2_CACHE_TABLE);
|
}
|
}
|
}
|