Commit a2d3e0ae authored by suichenguang's avatar suichenguang

信息管理2.6

parent e86ddf00
...@@ -5,6 +5,7 @@ import com.yxproject.start.service.InfoManagementService; ...@@ -5,6 +5,7 @@ import com.yxproject.start.service.InfoManagementService;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
...@@ -15,11 +16,21 @@ public class InfoManagementApi { ...@@ -15,11 +16,21 @@ public class InfoManagementApi {
@Autowired @Autowired
private InfoManagementService infoManagementService; private InfoManagementService infoManagementService;
@RequestMapping("selectInfoManagement") @RequestMapping("selectInfoManagement")
public List<NewFilesEntity>selectInfoManagement(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate){ public List<NewFilesEntity>selectInfoManagement(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate, @RequestParam("currPage")String currPage, @RequestParam("pageSize")String pageSize){
List<NewFilesEntity> resultList = infoManagementService.selectInfoManagement(beginFileName, endFileName, gajgMc, replaceDate(beginDate), replaceDate(endDate)); List<NewFilesEntity> resultList = infoManagementService.selectInfoManagement(beginFileName, endFileName, gajgMc, replaceDate(beginDate), replaceDate(endDate), Long.valueOf(currPage),Long.valueOf(pageSize));
return resultList; return resultList;
} }
@RequestMapping("selectCount")
public long selectCount(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate){
long count= infoManagementService.count(beginFileName,endFileName,gajgMc,beginDate,endDate);
return count;
}
/** /**
* 去除字符串中中线 * 去除字符串中中线
* @param str * @param str
......
...@@ -11,8 +11,31 @@ import java.util.Map; ...@@ -11,8 +11,31 @@ import java.util.Map;
public interface InfoManagementMapper { public interface InfoManagementMapper {
@Select( "SELECT * FROM " +
" ( " +
" SELECT A.*, ROWNUM RN " +
"<script> " +
"FROM (select * from new_files \n" +
"where 1=1\n" +
"<if test='beginFileName != \"\" '>" +
"and (NEW_FILE_NAME between(#{beginFileName})and (#{endFileName}))\n" +
"</if>" +
"<if test='gajgMc != \"\" '>" +
"and DWMC=#{gajgMc}\n" +
"</if>" +
"<if test='beginDate != \"\" '>" +
"and (subStr(CREATE_DATE,0,8) between(#{beginDate})and(#{endDate}))"+
"</if>" +
") " +
"A" +
")" +
"WHERE RN BETWEEN #{end} AND #{begin}" +
"</script>")
public List<NewFilesEntity> selectInfoManagement(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("begin") long begin, @Param("end") long end);
@Select("<script> " + @Select("<script> " +
"select * from new_files \n" + "SELECT COUNT(*) FROM NEW_FILES \n" +
"where 1=1\n" + "where 1=1\n" +
"<if test='beginFileName != \"\" '>" + "<if test='beginFileName != \"\" '>" +
"and (NEW_FILE_NAME between(#{beginFileName})and (#{endFileName}))\n" + "and (NEW_FILE_NAME between(#{beginFileName})and (#{endFileName}))\n" +
...@@ -24,5 +47,10 @@ public interface InfoManagementMapper { ...@@ -24,5 +47,10 @@ public interface InfoManagementMapper {
"and (subStr(CREATE_DATE,0,8) between(#{beginDate})and(#{endDate}))"+ "and (subStr(CREATE_DATE,0,8) between(#{beginDate})and(#{endDate}))"+
"</if>" + "</if>" +
"</script>") "</script>")
public List<NewFilesEntity> selectInfoManagement(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate); public long count(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate);
} }
...@@ -6,5 +6,9 @@ import org.apache.ibatis.annotations.Param; ...@@ -6,5 +6,9 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface InfoManagementService { public interface InfoManagementService {
public List<NewFilesEntity> selectInfoManagement(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate); public List<NewFilesEntity> selectInfoManagement(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate,@Param("begin")long begin,@Param("end")long end);
public long count(@Param("beginFileName")String beginFileName, @Param("endFileName")String endFileName, @Param("gajgMc") String gajgMc, @Param("beginDate")String beginDate, @Param("endDate")String endDate);
} }
...@@ -15,10 +15,16 @@ public class InfoManagementServiceImpl implements InfoManagementService { ...@@ -15,10 +15,16 @@ public class InfoManagementServiceImpl implements InfoManagementService {
@Override @Override
public List<NewFilesEntity> selectInfoManagement(String beginFileName, String endFileName, String gajgMc, String beginDate, String endDate) { public List<NewFilesEntity> selectInfoManagement(String beginFileName, String endFileName, String gajgMc, String beginDate, String endDate,long currPage,long pageSize) {
List<NewFilesEntity> newFilesEntities = infoManagementMapper.selectInfoManagement(beginFileName, endFileName, gajgMc, beginDate, endDate); List<NewFilesEntity> newFilesEntities = infoManagementMapper.selectInfoManagement(beginFileName, endFileName, gajgMc, beginDate, endDate,currPage * pageSize,(currPage - 1) * pageSize + 1);
return newFilesEntities; return newFilesEntities;
} }
@Override
public long count(String beginFileName, String endFileName, String gajgMc, String beginDate, String endDate) {
long count= infoManagementMapper.count(beginFileName,endFileName,gajgMc,beginDate,endDate);
return count;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment