package com.vci.web.controller;
|
|
import com.vci.starter.web.pagemodel.BaseResult;
|
import com.vci.starter.web.util.LangBaseUtil;
|
import com.vci.web.util.OsScanAnnotationTool;
|
import com.vci.web.util.WebUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 扫描表的控制器
|
* @author weidy
|
* @date 2021/8/21
|
*/
|
@RequestMapping("/scanAnnotationController")
|
@RestController
|
public class WebScanAnnotationController {
|
|
/**
|
* 扫描的工具
|
*/
|
@Autowired
|
private OsScanAnnotationTool scanAnnotationTool;
|
|
/**
|
* 使用包名扫描注解
|
* @param packName 包名
|
* @return 执行结果
|
*/
|
@PostMapping(value = "/scanAnnotation")
|
public synchronized BaseResult scanAnnotation(String packName){
|
try {
|
List<String> packageList = WebUtil.str2List(packName);
|
List<String> entityList = new ArrayList();
|
List<String> unScanEntityList = new ArrayList<String>();
|
scanAnnotationTool.doScanAnnotation2OSServer(packageList, entityList,unScanEntityList);
|
}catch (Throwable e){
|
return BaseResult.fail(LangBaseUtil.getErrorMsg(e));
|
}
|
return BaseResult.success();
|
}
|
}
|