echo off
setlocal enabledelayedexpansion&pushd %~dp0
rem 查找继承了AbstractBatchServiceVerify.java的子类
findstr /s /m /c:"extends AbstractBatchServiceVerify" *.java>AbstractBatchServiceVerify.txt
rem 将子类名称保存到temp.txt中
del /q temp.txt
for /f "delims=" %%i in (AbstractBatchServiceVerify.txt) do (
echo .%%~ni
)>>temp.txt
rem 在service.xml中查找配置子类的bean
findstr /s /n /l /g:temp.txt *.service.xml>AbstractBatchServiceVerify.txt
del /q result.txt
FOR /F "tokens=1,2 delims=:" %%i in (AbstractBatchServiceVerify.txt) do (
set isFound=false
echo %%i|findstr /c:"target">nul 2>nul&&set isFound=true
if !isFound!==false (
set /a pre=%%j-1
set /a current=%%j
set /a next=%%j+1
call ReadLine2.bat %%i !pre!|findstr /c:BatchVerify_>nul 2>nul || call ReadLine2.bat %%i !pre! !current! !next!>>result.txt
)
)
ReadLine2.bat 内容如下:
@echo off&SetLocal ENABLEDELAYEDEXPANSION
:::::::::::ReadLine2.Bat::::::::::::::::::
if "%1"=="" (goto --help) else (set file=%1)
if not exist %file% goto :eof
if "%2"=="" (
for /f "tokens=1* delims=:" %%a in ('findstr /n .* "%file%"') do echo/%%b
goto :eof
) else (
set args=%*
for %%a in (!args!) do (
if not "%%a"=="%1" (for /f "tokens=1* delims=:" %%b in ('findstr /n .* "%file%"') do (
if "%%b"=="%%a" echo/%%c)
)
)
)
goto :eof
:--help
echo/======================================
echo/本程序段需要带参数才能正常运行
echo/&echo/Usage:&echo/Call ReadLine2 ^<文件名^> ^<读取行号^>
echo/&echo/例如:Call ReadLine2 aa.txt 5 7 11 ,将读取aa.txt文件的第5,7,11行
echo/&echo/如果^<读取行号^>没有指定,将读取整个文件的内容
echo/======================================
goto :eof
检查直接继承AbstractBatchServiceVerify.java的所有子类配置的bean id是否包含字符串BatchVerify_
猜你喜欢
转载自511039003.iteye.com/blog/2063854
今日推荐
周排行