mybatis:查询参数为map,返回值为list

Controller:
@GetMapping("/listInfo")
public IPage<Map<String, Object>> selectPageBySql( @Valid InputDTO inputDTO) {
//.toMaps() 这个是InputDTO继承了项目的基类其中提供的共通方法 也可以自己写一个map转一下
    return  receptionistService.selectPageBysql(page, inputDTO.toMaps());
}
 
ServiceImpl:
public IPage<Map<String, Object>> selectPageBysql(Page page, Map<String, Object> queryCondition) {
List<OutputReceptionistDTO> result = passengerFlowInfoMapper.searchPageBySql(page, queryCondition);

page.setRecords(list);

return page;

}
PassengerFlowInfoMapper:
List<OutputReceptionistDTO> searchPageBySql(Page page, @Param("params") Map<String, Object> queryCondition);

xml:

<select id="searchPageBySql" resultType="OutputDTO" parameterType="java.util.Map">
        
   <include refid="Condition"/>
</select>
 
经验分享 程序员 微信小程序 职场和发展