|
|
|
@ -7,16 +7,32 @@ import org.apache.ibatis.executor.Executor;
|
|
|
|
|
import org.apache.ibatis.mapping.MappedStatement;
|
|
|
|
|
import org.apache.ibatis.plugin.Intercepts;
|
|
|
|
|
import org.apache.ibatis.plugin.Signature;
|
|
|
|
|
import org.apache.ibatis.session.ResultHandler;
|
|
|
|
|
import org.apache.ibatis.session.RowBounds;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.applib.ApplicationContextProvider;
|
|
|
|
|
import cokr.xit.base.FileController;
|
|
|
|
|
import cokr.xit.base.file.service.FileQuery;
|
|
|
|
|
import cokr.xit.foundation.data.paging.MapperSupport;
|
|
|
|
|
|
|
|
|
|
@Intercepts({
|
|
|
|
|
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
|
|
|
|
|
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})
|
|
|
|
|
})
|
|
|
|
|
public class AddsMapperSupport extends MapperSupport {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected Object query(Executor executor, MappedStatement mappedStatement, Object obj, RowBounds rowBounds, ResultHandler<?> resultHandler) throws SQLException {
|
|
|
|
|
String id = mappedStatement.getId();
|
|
|
|
|
|
|
|
|
|
if(id.equals("cokr.xit.base.file.dao.FileMapper.getFileList")
|
|
|
|
|
|| id.equals("cokr.xit.base.file.dao.FileMapper.getFilesOf")) {
|
|
|
|
|
FileController addsFileController = (FileController) ApplicationContextProvider.getApplicationContext().getBean("fileController");
|
|
|
|
|
((FileQuery)obj).setType(addsFileController.getFileRootPath());
|
|
|
|
|
}
|
|
|
|
|
return super.query(executor, mappedStatement, obj, rowBounds, resultHandler);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected Object update(Executor executor, MappedStatement mappedStatement, Object obj) throws SQLException {
|
|
|
|
|
String id = mappedStatement.getId();
|
|
|
|
|