feat:添加schoolId字段--修改了根据schoolId分页查询路线---添加了路线类型枚举类

This commit is contained in:
lqy 2024-12-05 20:17:44 +08:00
parent 5b8da4931f
commit 92c3ef8388
5 changed files with 66 additions and 12 deletions

View file

@ -35,11 +35,11 @@ public class RouteController {
routeService.saveOrUpdateEntity(inputObject, outputObject);
}
@ApiOperation(id = "queryRouteList", value = "查询路线列表", method = "POST", allUse = "2")
@ApiOperation(id = "queryRouteList", value = "除分页参数还需要holderId(schoolId)查询路线列表", method = "POST", allUse = "2")
@ApiImplicitParams(classBean = CommonPageInfo.class)
@RequestMapping("/post/RouteController/queryRouteList")
public void queryRouteList(InputObject inputObject, OutputObject outputObject) {
routeService.queryPageList(inputObject, outputObject);
routeService.queryPageListBySchoolId(inputObject, outputObject);
}
@ApiOperation(id = "deleteRouteById", value = "根据id删除路线", method = "DELETE", allUse = "2")
@ -54,7 +54,8 @@ public class RouteController {
@ApiOperation(id = "queryRoutesByStartAndEnd", value = "根据起点id--终点id 根据路线长度升序排序", method = "GET", allUse = "2")
@ApiImplicitParams({
@ApiImplicitParam(id = "startId", name = "startId", value = "起点id", required = "required"),
@ApiImplicitParam(id = "endId", name = "endId", value = "终点id", required = "required")
@ApiImplicitParam(id = "endId", name = "endId", value = "终点id", required = "required"),
@ApiImplicitParam(id = "schoolId", name = "schoolId", value = "学校id", required = "required"),
})
@RequestMapping("/post/RouteController/queryRoutesByStartAndEnd")
public void queryRoutesByStartAndEnd(InputObject inputObject, OutputObject outputObject) {

View file

@ -28,6 +28,10 @@ public class Routes extends OperatorUserInfo {
@ApiModelProperty(value = "主键id。为空时新增不为空时编辑")
private String id;
@TableField("school_id")
@ApiModelProperty(value = "学校id",required = "required")
private String schoolId;
@TableField("start_id")
@ApiModelProperty(value = "起始地点id",required = "required")
private String startId;

View file

@ -0,0 +1,35 @@
package com.skyeye.school.route.routeenum;
import com.skyeye.common.base.classenum.SkyeyeEnumClass;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
/**
* @ClassName: RouteTypeEnum
* @Description: 路由类型枚举
* @author: lqu
* @date: 2023/9/5 17:16
* @Copyright: 2023 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum RouteTypeEnum implements SkyeyeEnumClass {
ROUTE_TYPE_WALK(1,"步行",true,true),
ROUTE_TYPE_CAR(2,"驾车",true,false),
ROUTE_TYPE_EV(3,"电动车",true,false),
ROUTE_TYPE_RIDE(4,"骑行",true,false);
private Integer key;
private String value;
private Boolean show;
private Boolean isDefault;
}

View file

@ -17,4 +17,5 @@ public interface RoutesService extends SkyeyeBusinessService<Routes> {
void queryRoutesByStartAndEnd(InputObject inputObject, OutputObject outputObject);
void queryPageListBySchoolId(InputObject inputObject, OutputObject outputObject);
}

View file

@ -1,11 +1,15 @@
package com.skyeye.school.route.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.skyeye.annotation.service.SkyeyeService;
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
import com.skyeye.common.entity.search.CommonPageInfo;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import com.skyeye.eve.service.IAuthUserService;
import com.skyeye.rest.wall.user.service.IUserService;
import com.skyeye.school.building.entity.TeachBuilding;
import com.skyeye.school.building.service.TeachBuildingService;
@ -38,18 +42,11 @@ public class RouteServiceImpl extends SkyeyeBusinessServiceImpl<RoutesDao, Route
@Autowired
private RouteStopService routeStopService;
@Autowired
private IUserService userService;
@Autowired
private TeachBuildingService teachBuildingService;
@Override
public List<Map<String, Object>> queryPageDataList(InputObject inputObject) {
List<Map<String, Object>> beans = super.queryPageDataList(inputObject);
userService.setMationForMap(beans, "createId", "createMation");
return beans;
}
@Autowired
private IAuthUserService iAuthUserService;
@Override
@Transactional
@ -65,9 +62,11 @@ public class RouteServiceImpl extends SkyeyeBusinessServiceImpl<RoutesDao, Route
Map params = inputObject.getParams();
String startId = (String) params.get("startId");
String endId = (String) params.get("endId");
String schoolId = (String) params.get("schoolId");
QueryWrapper<Routes> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(MybatisPlusUtil.toColumns(Routes::getStartId), startId)
.eq(MybatisPlusUtil.toColumns(Routes::getEndId), endId)
.eq(MybatisPlusUtil.toColumns(Routes::getSchoolId),schoolId)
.orderByAsc(MybatisPlusUtil.toColumns(Routes::getRouteLength));
List<Routes> bean = list(queryWrapper);
for (Routes routes : bean) {
@ -81,6 +80,20 @@ public class RouteServiceImpl extends SkyeyeBusinessServiceImpl<RoutesDao, Route
outputObject.settotal(bean.size());
}
@Override
public void queryPageListBySchoolId(InputObject inputObject, OutputObject outputObject) {
CommonPageInfo commonPageInfo = inputObject.getParams(CommonPageInfo.class);
String schoolId = commonPageInfo.getHolderId();
Page page = PageHelper.startPage(commonPageInfo.getPage(), commonPageInfo.getLimit());
QueryWrapper<Routes> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(MybatisPlusUtil.toColumns(Routes::getSchoolId), schoolId);
List<Routes> bean = list(queryWrapper);
iAuthUserService.setName(bean,"createId","createName");
iAuthUserService.setName(bean,"lastUpdateId","lastUpdateName");
outputObject.setBeans(bean);
outputObject.settotal(page.getTotal());
}
@Override
public void createPostpose(Routes entity, String userId) {
String startName= teachBuildingService.selectById(entity.getStartId()).getName();