搜索分页加过滤条件

This commit is contained in:
凌云 2020-04-22 15:00:59 +08:00
parent 1ab727eb3c
commit b400b79cab
5 changed files with 16 additions and 6 deletions

View File

@ -137,7 +137,7 @@ public class JobGroupController {
public ReturnT<String> remove(int id) {
// valid
int count = jobInfoMapper.pageListCount(0, 10, id, -1, null, null, null);
int count = jobInfoMapper.pageListCount(0, 10, id, -1, null, null, null,null);
if (count > 0) {
return new ReturnT<>(500, I18nUtil.getString("jobgroup_del_limit_0"));
}

View File

@ -31,7 +31,8 @@ public interface JobInfoMapper {
@Param("triggerStatus") int triggerStatus,
@Param("jobDesc") String jobDesc,
@Param("glueType") String glueType,
@Param("author") String author);
@Param("authors") String[] authors,
@Param("jobProjects") String[] jobProjects);
List<Object> findAll();

View File

@ -60,7 +60,7 @@ public class JobServiceImpl implements JobService {
// page list
List<JobInfo> list = jobInfoMapper.pageList(start, length, jobGroup, triggerStatus, jobDesc, glueType, authors, jobProjects);
int list_count = jobInfoMapper.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, glueType, author);
int list_count = jobInfoMapper.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, glueType, authors, jobProjects);
// package result
Map<String, Object> maps = new HashMap<String, Object>();

View File

@ -145,8 +145,17 @@
<if test="glueType != null and glueType != ''">
AND t.glue_type like CONCAT(CONCAT('%', #{glueType}), '%')
</if>
<if test="author != null and author != ''">
AND t.author like CONCAT(CONCAT('%', #{author}), '%')
<if test="authors != null">
AND 1=1 AND
<foreach collection="authors" index="index" item="author" open="(" close=")" separator=" OR ">
FIND_IN_SET(#{author},t.author)
</foreach>
</if>
<if test="jobProjects != null">
AND t.job_project IN
<foreach collection="jobProjects" item="jobProject" index="index" open="(" close=")" separator=",">
#{jobProject}
</foreach>
</if>
</trim>
</select>

View File

@ -21,7 +21,7 @@ public class JobInfoMapperTest {
@Test
public void pageList(){
List<JobInfo> list = jobInfoMapper.pageList(0, 20, 0, -1, null, null, null,null);
int list_count = jobInfoMapper.pageListCount(0, 20, 0, -1, null, null, null);
int list_count = jobInfoMapper.pageListCount(0, 20, 0, -1, null, null, null,null);
System.out.println(list);
System.out.println(list_count);