Compare commits
2 Commits
e0494fc9a0
...
a8191b93f6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a8191b93f6 | ||
![]() |
ca19c6a0bc |
@ -54,19 +54,19 @@ public class CpRouteController {
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@ApiOperation(value = "分页查询路线(支持路线名模糊查询)", notes = "分页查询路线,可根据路线名称进行模糊搜索")
|
||||
@ApiOperation(value = "分页查询路线(name模糊查询)", notes = "分页查询路线,可根据路线名称进行模糊搜索")
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "size", value = "分页大小", paramType = "query"),
|
||||
@ApiImplicitParam(name = "current", value = "当前页面:从1开始", paramType = "query"),
|
||||
@ApiImplicitParam(name = "routeName", value = "路线名称关键词,用于模糊查询", paramType = "query")
|
||||
@ApiImplicitParam(name = "name", value = "路线名称关键词,用于模糊查询", paramType = "query"),
|
||||
@ApiImplicitParam(name = "areaId", value = "通过区域id查询路线", paramType = "query"),
|
||||
@ApiImplicitParam(name = "scenicId", value = "通过景区id查询路线", paramType = "query")
|
||||
})
|
||||
public ResponseEntity<IPage<CpRouteVo>> findByPage(
|
||||
final Page<CpRouteVo> page,
|
||||
@RequestParam(required = false) String routeName
|
||||
) {
|
||||
final Page<CpRouteVo> page, CpRouteDTO cpRouteDTO) {
|
||||
try {
|
||||
IPage<CpRouteVo> records = entityService.findByPage(page,routeName);
|
||||
IPage<CpRouteVo> records = entityService.findByPage(page, cpRouteDTO);
|
||||
return new ResponseEntity<>(records, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
LOG.error("分页查询路线时出错", e);
|
||||
@ -214,7 +214,7 @@ public class CpRouteController {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据景区获取景区下的所有路线")
|
||||
@ApiOperation(value = "根据景区id获取景区下的所有路线")
|
||||
@RequestMapping(value = "getByAreaId", method = RequestMethod.GET)
|
||||
public ResponseEntity<List<CpRoute>> getRouteByEmAreaId(
|
||||
@ApiParam(value = "景区ID", required = true)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aircraft.modules.route.mapper;
|
||||
|
||||
import com.aircraft.modules.route.domain.CpRoute;
|
||||
import com.aircraft.modules.route.domain.dto.CpRouteDTO;
|
||||
import com.aircraft.modules.route.domain.dto.CpRouteVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -29,5 +30,5 @@ public interface CpRouteMapper extends BaseMapper<CpRoute> {
|
||||
|
||||
List<CpRoute> listRoutesByIds(List<Long> routeIds);
|
||||
|
||||
IPage<CpRouteVo> selectVoPage(Page<CpRouteVo> page, String routeName);
|
||||
IPage<CpRouteVo> selectVoPage(Page<CpRouteVo> page, CpRouteDTO dto);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aircraft.modules.route.service;
|
||||
|
||||
import com.aircraft.modules.route.domain.CpRoute;
|
||||
import com.aircraft.modules.route.domain.dto.CpRouteDTO;
|
||||
import com.aircraft.modules.route.domain.dto.CpRouteVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -20,7 +21,7 @@ public interface CpRouteService extends IService<CpRoute> {
|
||||
|
||||
void updateDelFlagById(Long id, Integer delFlag);
|
||||
|
||||
IPage<CpRouteVo> findByPage(Page<CpRouteVo> page, String routeName);
|
||||
IPage<CpRouteVo> findByPage(Page<CpRouteVo> page, CpRouteDTO cpRouteDTO);
|
||||
|
||||
/**
|
||||
* 获取所有路线信息
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aircraft.modules.route.service.impl;
|
||||
|
||||
import com.aircraft.modules.route.domain.CpRoute;
|
||||
import com.aircraft.modules.route.domain.dto.CpRouteDTO;
|
||||
import com.aircraft.modules.route.domain.dto.CpRouteVo;
|
||||
import com.aircraft.modules.route.mapper.CpRouteMapper;
|
||||
import com.aircraft.modules.route.service.CpRouteService;
|
||||
@ -31,8 +32,8 @@ public class CpRouteServiceImpl extends ServiceImpl<CpRouteMapper, CpRoute> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CpRouteVo> findByPage(Page<CpRouteVo> page, String routeName) {
|
||||
return cpRouteMapper.selectVoPage(page, routeName);
|
||||
public IPage<CpRouteVo> findByPage(Page<CpRouteVo> page, CpRouteDTO cpRouteDTO) {
|
||||
return cpRouteMapper.selectVoPage(page, cpRouteDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,15 +5,21 @@
|
||||
<!-- 分页查询路线,可通过路线名模糊查询 -->
|
||||
<select id="selectVoPage" resultType="com.aircraft.modules.route.domain.dto.CpRouteVo">
|
||||
SELECT
|
||||
r.*, -- 路线基础字段
|
||||
a.name AS areaName, -- 区域名称
|
||||
r.*, -- 路线基础字段
|
||||
a.name AS areaName, -- 区域名称
|
||||
s.name AS scenicName -- 景区名称
|
||||
FROM cp_route r
|
||||
LEFT JOIN em_area a ON r.area_id = a.id -- 关联区域表
|
||||
LEFT JOIN em_scenic s ON r.scenic_id = s.id -- 关联景区表
|
||||
LEFT JOIN em_area a ON r.area_id = a.id -- 关联区域表
|
||||
LEFT JOIN em_scenic s ON r.scenic_id = s.id -- 关联景区表
|
||||
WHERE r.del_flag = 0
|
||||
<if test="routeName != null and routeName != ''">
|
||||
AND r.name LIKE CONCAT('%', #{routeName}, '%')
|
||||
<if test="dto.name != null and dto.name != ''">
|
||||
AND r.name LIKE CONCAT('%', #{dto.name}, '%')
|
||||
</if>
|
||||
<if test="dto.areaId != null ">
|
||||
AND r.area_id =#{dto.areaId}
|
||||
</if>
|
||||
<if test="dto.scenicId != null ">
|
||||
AND r.scenic_id=#{dto.scenicId}
|
||||
</if>
|
||||
ORDER BY r.create_time DESC
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user