Commit 909a633c authored by tangwei's avatar tangwei

增加模糊查询

parent bd79acac
...@@ -22,16 +22,16 @@ public interface FireStationMapper extends BaseMapper<FireStation> { ...@@ -22,16 +22,16 @@ public interface FireStationMapper extends BaseMapper<FireStation> {
@Select("<script>" @Select("<script>"
+ "select * from cb_fire_station where cb_fire_station.is_delete=0 " + "select * from cb_fire_station where cb_fire_station.is_delete=0 "
+ "<if test='par.name!=null'> and cb_fire_station.name like '%'#{par.name}'%' </if>" + "<if test='par.name!=null'> and cb_fire_station.name like CONCAT('%',#{par.name},'%') </if>"
+ "<if test='par.bizCompanyId!=null'> and cb_fire_station.biz_company_id = #{par.bizCompanyId} </if>" + "<if test='par.bizCompanyId!=null'> and cb_fire_station.biz_company_id = #{par.bizCompanyId} </if>"
+"limit #{pageNum},#{pageSize}" +"limit #{pageNum},#{pageSize}"
+ "</script>") + "</script>")
List<FireStationDto>getFireStation(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FireStationDto par); List<FireStationDto>getFireStation(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FireStationDto par);
@Select("<script>" @Select("<script>"
+ "select COUNT(cb_fire_station.sequence_nbr) num from cb_fire_station where cb_fire_station.is_delete=0 " + "select COUNT(cb_fire_station.sequence_nbr) num from cb_fire_station where cb_fire_station.is_delete=0 "
+ "<if test='par.name!=null'> and cb_fire_station.name like '%'#{par.name}'%' </if>" + "<if test='par.name!=null'> and cb_fire_station.name like CONCAT('%',#{par.name},'%') </if>"
+ "<if test='par.bizCompanyId!=null'> and cb_fire_station.biz_company_id = #{par.bizCompanyId} </if>" + "<if test='par.bizCompanyId!=null'> and cb_fire_station.biz_company_id = #{par.bizCompanyId} </if>"
+ "</script>") + "</script>")
Map<String, Long> getFireStationCount(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FireStationDto par); Map<String, Long> getFireStationCount(@Param("par")FireStationDto par);
} }
...@@ -53,7 +53,7 @@ public class FireStationServiceImpl extends BaseService<FireStationDto,FireStati ...@@ -53,7 +53,7 @@ public class FireStationServiceImpl extends BaseService<FireStationDto,FireStati
@Override @Override
public Page<FireStationDto> getFirefighters(int pageNum, int pageSize, FireStationDto par) { public Page<FireStationDto> getFirefighters(int pageNum, int pageSize, FireStationDto par) {
List<FireStationDto> list = fireStationMapper.getFireStation((pageNum - 1) * pageSize, pageSize, par); List<FireStationDto> list = fireStationMapper.getFireStation((pageNum - 1) * pageSize, pageSize, par);
Map<String, Long> num = fireStationMapper.getFireStationCount((pageNum - 1) * pageSize, pageSize, par); Map<String, Long> num = fireStationMapper.getFireStationCount( par);
Page<FireStationDto> pageBean = new Page<>(pageNum, pageSize, num.get("num")); Page<FireStationDto> pageBean = new Page<>(pageNum, pageSize, num.get("num"));
return pageBean.setRecords(list); return pageBean.setRecords(list);
} }
......
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