不要用它自带的
selectPage方法,会有传参问题
-
- import java.util.Set;
-
-
- @RestController
- @RequiredArgsConstructor
- @RequestMapping("/deviceInfo" )
- public class DeviceInfoController {
-
- private final DeviceInfoService deviceInfoService;
-
-
- /**
- * 分页查询
- * @param page 分页对象
- * @param queryDto 设备信息查询对象
- * @return
- */
- @GetMapping("/page" )
- @PreAuthorize("@pms.hasPermission('proxy_deviceInfo_view')" )
- public R selectPage(Page page, @Validated(value = SelectVerify.class) DeviceInfoDTO queryDto) {
- return R.ok(deviceInfoService.selectForPage(page, queryDto));
- }
-
- }
- public interface DeviceInfoMapper extends BaseMapper
{ -
- IPage
selectForPage(Page page, @Param("queryDto") DeviceInfoDTO queryDto); -
- List
selectList(DeviceInfoDTO queryDto); - }
-
- <resultMap id="deviceInfoVoMap" type="xx.xx.vo.DeviceInfoVO">
- <id property="id" column="id"/>
- <id property="groupId" column="group_id"/>
- <id property="deviceNumber" column="device_number"/>
- <id property="deviceCategory" column="device_category"/>
- <id property="deviceType" column="device_type"/>
- <id property="manufacturer" column="manufacturer"/>
- <id property="deviceModel" column="device_model"/>
- <id property="remark" column="remark"/>
- <id property="createBy" column="create_by"/>
- <id property="createTime" column="create_time"/>
- <id property="updateBy" column="update_by"/>
- <id property="updateTime" column="update_time"/>
- resultMap>
-
-
-
-
- <select id="selectForPage" resultMap="deviceInfoVoMap">
- SELECT
- di.*
- FROM device_info di
-
- <where>
- <if test="queryDto.groupId != null">
- AND di.group_id = #{queryDto.groupId}
- if>
- <if test="queryDto.deviceNumber != null and queryDto.deviceNumber != ''">
- AND di.device_number = #{queryDto.deviceNumber}
- if>
- <if test="queryDto.deviceTypeCollection != null and queryDto.deviceTypeCollection.size > 0">
- AND di.device_type IN
- <foreach collection="queryDto.deviceTypeCollection" index="idx" item="item" separator="," open="(" close=")">
- #{item}
- foreach>
- if>
- where>
- ORDER BY di.device_number ASC
- select>
-
-
-
- public interface DeviceInfoService extends IService
{ -
-
-
- /**
- * 分页查询
- */
- IPage
selectForPage(Page page, DeviceInfoDTO queryDto); -
-
- }
-
- @Service
- @RequiredArgsConstructor
- public class DeviceInfoServiceImpl extends ServiceImpl
implements DeviceInfoService { -
-
-
- public IPage
selectForPage(Page page, DeviceInfoDTO queryDto) { - return baseMapper.selectForPage(page, queryDto);
- }
-
-
- }