pageWithAttrs 非中文数量不正确的处理

This commit is contained in:
wangliwen 2022-10-27 11:34:36 +08:00
parent f39b22751f
commit d07548e6eb
3 changed files with 12 additions and 9 deletions

View File

@ -53,7 +53,7 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
*/ */
List<Map> selectDTOPageSpecilTotal(@Param("dto") ResourceDTO resourceDTO); List<Map> selectDTOPageSpecilTotal(@Param("dto") ResourceDTO resourceDTO);
Long selectDTOPageCount(@Param("dto") ResourceDTO resourceDTO); Long selectDTOPageCount(@Param("dto") ResourceDTO resourceDTO, @Param("nonChinese") Boolean nonChinese);
List<Map> selectApplyArea(Long userId); List<Map> selectApplyArea(Long userId);

View File

@ -554,7 +554,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType, null, nonChinese); resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType, null, nonChinese);
} }
resultPage.setRecords(resourceDTOS); resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO)); resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO, nonChinese));
} else { } else {
logger.info("排序要求 orderField:{} orderType:{}", orderField, orderType); logger.info("排序要求 orderField:{} orderType:{}", orderField, orderType);
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType, nonChinese); List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType, nonChinese);

View File

@ -539,9 +539,12 @@
WHERE WHERE
1 = 1 1 = 1
AND tdr.del_flag = 0 AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''"> <if test="dto.name != null and dto.name != '' and nonChinese == false">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE) AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
</if> </if>
<if test="dto.name != null and dto.name != '' and nonChinese == true">
AND tdr.name LIKE CONCAT( '%', #{dto.name}, '%' )
</if>
<if test="dto.type != null and dto.type != ''"> <if test="dto.type != null and dto.type != ''">
AND tdr.type = #{dto.type} AND tdr.type = #{dto.type}
</if> </if>