Leeyh1121 5 months ago
commit ab6c1a56db

@ -7,9 +7,12 @@ import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.Intercepts; import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Signature; import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import cokr.xit.adds.core.util.CoreSpringUtils; import cokr.xit.adds.core.util.CoreSpringUtils;
import cokr.xit.base.FileController; import cokr.xit.base.FileController;
import cokr.xit.base.file.service.FileQuery;
import cokr.xit.foundation.data.paging.MapperSupport; import cokr.xit.foundation.data.paging.MapperSupport;
@Intercepts({ @Intercepts({
@ -17,6 +20,18 @@ import cokr.xit.foundation.data.paging.MapperSupport;
}) })
public class AddsMapperSupport extends MapperSupport { 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 = CoreSpringUtils.getFileController();
((FileQuery)obj).setType(addsFileController.getFileRootPath());
}
return super.query(executor, mappedStatement, obj, rowBounds, resultHandler);
}
@Override @Override
protected Object update(Executor executor, MappedStatement mappedStatement, Object obj) throws SQLException { protected Object update(Executor executor, MappedStatement mappedStatement, Object obj) throws SQLException {
String id = mappedStatement.getId(); String id = mappedStatement.getId();

@ -33,7 +33,8 @@
<sql id="selectFiles"> <sql id="selectFiles">
<if test="fileIDs != null"> <if test="fileIDs != null">
SELECT A.*, FILE_PATH URL SELECT A.*
, REPLACE(FILE_PATH,#{type},'/files/') AS URL
FROM TB_FILE A FROM TB_FILE A
WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>) WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)
ORDER BY FILE_ID ORDER BY FILE_ID
@ -41,7 +42,8 @@ SELECT A.*, FILE_PATH URL
<if test="fileIDs == null"> <if test="fileIDs == null">
<include refid="utility.paging-prefix" /> <include refid="utility.paging-prefix" />
SELECT A.*, FILE_PATH URL SELECT A.*
, REPLACE(FILE_PATH,#{type},'/files/') AS URL
FROM TB_FILE A FROM TB_FILE A
<where> <where>
<if test="infoType != null"> AND A.INF_TYPE = #{infoType}</if> <if test="infoType != null"> AND A.INF_TYPE = #{infoType}</if>

Loading…
Cancel
Save