Commit 767210b9 authored by hkl's avatar hkl

feat:1.代码提交

parent accfedad
......@@ -78,6 +78,12 @@
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.hutool</groupId>-->
<!-- <artifactId>hutool-extra</artifactId>-->
<!-- <version>${hutool.version}</version>-->
<!-- </dependency>-->
<!-- commons -->
<dependency>
<groupId>commons-io</groupId>
......
package org.jeecg.common.util;
public class EntityUtil {
// public static <T> t
}
......@@ -11,6 +11,11 @@
<artifactId>jeecg-system-biz</artifactId>
<dependencies>
<dependency>
<groupId>io.github.biezhi</groupId>
<artifactId>TinyPinyin</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-local-api</artifactId>
......
package org.jeecg.modules.subwayNetwork.controller;
import java.util.Arrays;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.ObjectUtil;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
......@@ -41,11 +43,6 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
@Autowired
private ILightRailService lightRailService;
/**
* 分页列表查询
*
* @return
*/
@AutoLog(value = "线路车站-轻轨线路-分页列表查询")
@ApiOperation(value = "线路车站-轻轨线路-分页列表查询", notes = "线路车站-轻轨线路-分页列表查询")
@PostMapping(value = "/list")
......@@ -60,7 +57,13 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
@ApiOperation(value = "线路车站-轻轨线路-编辑", notes = "线路车站-轻轨线路-编辑")
@PostMapping(value = "/edit")
public Result<String> edit(@RequestBody LightRail lightRail) {
//获取当前用户
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// lightRail.setUpdateBy(sysUser.getUsername());
lightRail.setUpdateTime(new Date());
if (ObjectUtil.isEmpty(lightRail.getId())) {
// lightRail.setCreateBy(sysUser.getUsername());
lightRail.setCreateTime(new Date());
lightRailService.save(lightRail);
} else {
lightRailService.updateById(lightRail);
......@@ -114,4 +117,20 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
return Result.OK(lightRail);
}
@AutoLog(value = "线路车站-轻轨线路-获取全部线路")
@ApiOperation(value = "线路车站-轻轨线路-获取全部线路", notes = "线路车站-轻轨线路-获取全部线路")
@GetMapping(value = "/listAll")
public Result<List<Map<String, Object>>> listAll() {
List<LightRail> pageList = lightRailService.list();
List<Map<String, Object>> list = new ArrayList<>();
for (LightRail lightRail : pageList) {
Map<String, Object> map = new HashMap<>();
map.put("label", lightRail.getRailLineName());
map.put("value", lightRail.getId() );
list.add(map);
}
return Result.OK(list);
}
}
......@@ -4,9 +4,11 @@ import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionEditDTO;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.SubwaySection;
import org.jeecg.modules.subwayNetwork.service.ISubwaySectionService;
......@@ -16,6 +18,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.subwayNetwork.vo.SubwaySectionVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
......@@ -40,14 +43,9 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
@AutoLog(value = "线路车站-地铁区间-分页列表查询")
@ApiOperation(value = "线路车站-地铁区间-分页列表查询", notes = "线路车站-地铁区间-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<SubwaySection>> queryPageList(SubwaySection subwaySection,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<SubwaySection> queryWrapper = QueryGenerator.initQueryWrapper(subwaySection, req.getParameterMap());
Page<SubwaySection> page = new Page<SubwaySection>(pageNo, pageSize);
IPage<SubwaySection> pageList = subwaySectionService.page(page, queryWrapper);
@PostMapping(value = "/list")
public Result<IPage<SubwaySectionVO>> queryPageList(@RequestBody PageSearch<SubwaySectionQueryDTO> dto) {
IPage<SubwaySectionVO> pageList = subwaySectionService.queryPageList(dto);
return Result.OK(pageList);
}
......@@ -56,13 +54,16 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
@ApiOperation(value = "线路车站-地铁区间-编辑", notes = "线路车站-地铁区间-编辑")
@PostMapping(value = "/edit")
public Result<String> edit(@RequestBody SubwaySectionEditDTO dto) {
subwaySectionService.edit(dto);
return Result.OK("编辑成功!");
}
@AutoLog(value = "线路车站-地铁区间-通过id删除")
@ApiOperation(value = "线路车站-地铁区间-通过id删除", notes = "线路车站-地铁区间-通过id删除")
@DeleteMapping(value = "/delete")
@GetMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
subwaySectionService.removeById(id);
return Result.OK("删除成功!");
......@@ -70,21 +71,10 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
@AutoLog(value = "线路车站-地铁区间-批量删除")
@ApiOperation(value = "线路车站-地铁区间-批量删除", notes = "线路车站-地铁区间-批量删除")
@DeleteMapping(value = "/deleteBatch")
@GetMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.subwaySectionService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
//@AutoLog(value = "线路车站-地铁区间-通过id查询")
@ApiOperation(value = "线路车站-地铁区间-通过id查询", notes = "线路车站-地铁区间-通过id查询")
@GetMapping(value = "/queryById")
public Result<SubwaySection> queryById(@RequestParam(name = "id", required = true) String id) {
SubwaySection subwaySection = subwaySectionService.getById(id);
if (subwaySection == null) {
return Result.error("未找到对应数据");
}
return Result.OK(subwaySection);
}
}
package org.jeecg.modules.subwayNetwork.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -8,14 +9,16 @@ import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.subwayNetwork.dto.TrainStationEditDTO;
import org.jeecg.modules.subwayNetwork.dto.TrainStationQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.TrainStation;
import org.jeecg.modules.subwayNetwork.service.ITrainStationService;
import org.jeecg.modules.subwayNetwork.vo.TrainStationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.*;
/**
* @Description: 线路车站-地铁站
......@@ -33,32 +36,27 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain
@AutoLog(value = "线路车站-地铁站-分页列表查询")
@ApiOperation(value = "线路车站-地铁站-分页列表查询", notes = "线路车站-地铁站-分页列表查询")
@GetMapping(value = "/list")
@PostMapping(value = "/list")
public Result<IPage<TrainStationVO>> queryPageList(@RequestBody PageSearch<TrainStationQueryDTO> dto) {
IPage<TrainStationVO> pageList = trainStationService.queryPageList(dto);
return Result.OK(pageList);
}
@AutoLog(value = "线路车站-地铁站-添加")
@ApiOperation(value = "线路车站-地铁站-添加", notes = "线路车站-地铁站-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody TrainStation trainStation) {
trainStationService.save(trainStation);
return Result.OK("添加成功!");
}
@AutoLog(value = "线路车站-地铁站-编辑")
@ApiOperation(value = "线路车站-地铁站-编辑", notes = "线路车站-地铁站-编辑")
@PostMapping(value = "/edit")
public Result<String> edit(@RequestBody TrainStation trainStation) {
trainStationService.updateById(trainStation);
public Result<String> edit(@RequestBody TrainStationEditDTO dto) {
trainStationService.edit(dto);
return Result.OK("编辑成功!");
}
@AutoLog(value = "线路车站-地铁站-通过id删除")
@ApiOperation(value = "线路车站-地铁站-通过id删除", notes = "线路车站-地铁站-通过id删除")
@DeleteMapping(value = "/delete")
@GetMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
trainStationService.removeById(id);
return Result.OK("删除成功!");
......@@ -67,11 +65,28 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain
@AutoLog(value = "线路车站-地铁站-批量删除")
@ApiOperation(value = "线路车站-地铁站-批量删除", notes = "线路车站-地铁站-批量删除")
@DeleteMapping(value = "/deleteBatch")
@GetMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.trainStationService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@AutoLog(value = "线路车站-地铁站-获取全部车站")
@ApiOperation(value = "线路车站-地铁站-获取全部车站", notes = "线路车站-地铁站-获取全部车站")
@GetMapping(value = "/listAll")
public Result<List<Map<String, Object>>> listAll() {
List<TrainStation> pageList = trainStationService.list();
List<Map<String, Object>> list = new ArrayList<>();
for (TrainStation trainStation : pageList) {
Map<String, Object> map = new HashMap<>();
map.put("label", trainStation.getStationName());
map.put("value", trainStation.getId());
map.put("lightRailId", trainStation.getLightRailId());
list.add(map);
}
return Result.OK(list);
}
}
package org.jeecg.modules.subwayNetwork.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
@ApiModel(value = "SubwaySectionEditDTO编辑")
public class SubwaySectionEditDTO {
private String id;
@ApiModelProperty(value = "轻轨线路ID")
private String lightRailId;
@ApiModelProperty(value = "起始车站Id")
private String startTrainStationId;
@ApiModelProperty(value = "结束车站Id")
private String endTrainStationId;
@ApiModelProperty(value = "区间名")
private String sectionName;
}
......@@ -3,14 +3,11 @@ package org.jeecg.modules.subwayNetwork.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
@ApiModel(value = "区间DTO")
public class SubwaySectionDTO {
@ApiModelProperty(value = "线路id")
private java.lang.String railId;
public class SubwaySectionQueryDTO {
@ApiModelProperty(value = "区间名")
private String sectionName;
}
package org.jeecg.modules.subwayNetwork.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "地铁站编辑DTO")
public class TrainStationEditDTO {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "轻轨线路ID")
private String lightRailId;
@ApiModelProperty(value = "车站名")
private String stationName;
@ApiModelProperty(value = "车站编码")
private String stationCode;
@ApiModelProperty(value = "线别Code")
private String lineAliasCode;
@ApiModelProperty(value = "起始里程")
private BigDecimal startingMileage;
@ApiModelProperty(value = "中心里程")
private BigDecimal centerMileage;
@ApiModelProperty(value = "结束里程")
private BigDecimal endMileage;
@ApiModelProperty(value = "序号")
private Integer seq;
@ApiModelProperty(value = "备注")
private String remark;
}
package org.jeecg.modules.subwayNetwork.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description: 线路车站-地铁区间
* @Author: jeecg-boot
* @Date: 2023-06-15
* @Date: 2023-06-15
* @Version: V1.0
*/
@Data
@TableName("t_sn_subway_section")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="t_sn_subway_section对象", description="线路车站-地铁区间")
@ApiModel(value = "t_sn_subway_section对象", description = "线路车站-地铁区间")
public class SubwaySection implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**区间名*/
@Excel(name = "区间名", width = 15)
@Excel(name = "区间名", width = 15)
@ApiModelProperty(value = "区间名")
private java.lang.String sectionName;
/**区间code*/
@Excel(name = "区间code", width = 15)
@Excel(name = "区间code", width = 15)
@ApiModelProperty(value = "区间code")
private java.lang.String sectionCode;
/**线路id*/
@Excel(name = "线路id", width = 15)
@ApiModelProperty(value = "线路id")
private java.lang.String railId;
@Excel(name = "线路id", width = 15)
@ApiModelProperty(value = "轻轨线路ID")
private String lightRailId;
@ApiModelProperty(value = "起始车站Id")
private String startTrainStationId;
@ApiModelProperty(value = "结束车站Id")
private String endTrainStationId;
}
......@@ -71,34 +71,30 @@ public class TrainStation implements Serializable {
@ApiModelProperty(value = "车站编码")
private String stationCode;
@Excel(name = "线别", width = 15)
@ApiModelProperty(value = "线别")
private String lineAlias;
@ApiModelProperty(value = "线别Code")
private String lineAliasCode;
@Excel(name = "起始里程前缀", width = 15)
@ApiModelProperty(value = "起始里程前缀")
private String startingMileagePrefix;
@Excel(name = "起始里程", width = 15)
@ApiModelProperty(value = "起始里程")
private BigDecimal startingMileage;
@Excel(name = "中心里程前缀", width = 15)
@ApiModelProperty(value = "中心里程前缀")
private String centerMileagePrefix;
@Excel(name = "中心里程", width = 15)
@ApiModelProperty(value = "中心里程")
private BigDecimal centerMileage;
@Excel(name = "结束里程前缀", width = 15)
@ApiModelProperty(value = "结束里程前缀")
private String endMileagePrefix;
@Excel(name = "结束里程", width = 15)
@ApiModelProperty(value = "结束里程")
private BigDecimal endMileage;
@ApiModelProperty(value = "序号")
private Integer seq;
@ApiModelProperty(value = "站长度(m)")
private BigDecimal length;
@ApiModelProperty(value = "备注")
private String remark;
}
package org.jeecg.modules.subwayNetwork.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.SubwaySection;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.subwayNetwork.vo.SubwaySectionVO;
/**
* @Description: 线路车站-地铁区间
......@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface SubwaySectionMapper extends BaseMapper<SubwaySection> {
IPage<SubwaySectionVO> queryPageList(IPage<SubwaySectionVO> page, SubwaySectionQueryDTO query);
}
......@@ -17,7 +17,7 @@
ifnull(sum(t3.end_mileage),0) lineMileage
FROM
t_sn_light_rail t1
LEFT JOIN t_sn_subway_section t2 ON t1.id = t2.rail_id
LEFT JOIN t_sn_subway_section t2 ON t1.id = t2.light_rail_id
LEFT JOIN t_sn_train_station t3 ON t1.id = t3.light_rail_id
<where>
<if test="query.railLineName != null and query.railLineName != ''">
......
......@@ -2,4 +2,22 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.subwayNetwork.mapper.SubwaySectionMapper">
<select id="queryPageList" resultType="org.jeecg.modules.subwayNetwork.vo.SubwaySectionVO">
SELECT
t1.id,
t1.create_by,
t1.create_time,
t1.section_name,
t2.rail_line_name light_rail_name,
t1.light_rail_id,
t1.start_train_station_id,
t1.end_train_station_id
FROM
t_sn_subway_section t1 LEFT JOIN t_sn_light_rail t2 ON t1.light_rail_id = t2.id
<where>
<if test="query.sectionName != null and query.sectionName != ''">
AND t1.section_name like concat('%',#{query.sectionName},'%')
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -4,38 +4,24 @@
<select id="queryPageList" resultType="org.jeecg.modules.subwayNetwork.vo.TrainStationVO">
SELECT
t1.center_mileage,
t1.center_mileage_prefix,
t1.create_by,
t1.create_time,
t1.end_mileage,
t1.end_mileage_prefix,
t1.id,
t1.station_name,
t1.station_code,
t1.light_rail_id,
t1.line_alias,
t2.rail_line_name light_rail_name,
t1.line_alias_code,
t1.starting_mileage,
t1.starting_mileage_prefix,
t1.station_code,
t1.station_name,
t1.update_by,
t1.update_time,
t1.center_mileage,
t1.center_mileage_prefix,
t1.end_mileage,
t1.create_by,
t1.create_time,
t1.end_mileage,
t1.end_mileage_prefix,
t1.id,
t1.light_rail_id,
t1.line_alias,
t1.starting_mileage,
t1.starting_mileage_prefix,
t1.station_code,
t1.station_name,
t1.update_by,
t1.update_time
FROM
t_sn_train_station t1
t1.update_time,
t1.length,
t1.seq,
t1.remark
FROM t_sn_train_station t1
LEFT JOIN t_sn_light_rail t2 ON t1.light_rail_id = t2.id
<where>
<if test="query.stationName !=null and query.stationName!=''">
AND t1.station_name like concat('%',#{query.stationName},'%')
......
package org.jeecg.modules.subwayNetwork.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionEditDTO;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.SubwaySection;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.subwayNetwork.vo.SubwaySectionVO;
/**
* @Description: 线路车站-地铁区间
......@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface ISubwaySectionService extends IService<SubwaySection> {
void edit(SubwaySectionEditDTO dto);
IPage<SubwaySectionVO> queryPageList(PageSearch<SubwaySectionQueryDTO> dto);
}
......@@ -3,6 +3,7 @@ package org.jeecg.modules.subwayNetwork.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.modules.subwayNetwork.dto.TrainStationEditDTO;
import org.jeecg.modules.subwayNetwork.dto.TrainStationQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.TrainStation;
import org.jeecg.modules.subwayNetwork.vo.TrainStationVO;
......@@ -17,4 +18,6 @@ public interface ITrainStationService extends IService<TrainStation> {
IPage<TrainStationVO> queryPageList(PageSearch<TrainStationQueryDTO> dto);
void edit(TrainStationEditDTO dto);
}
package org.jeecg.modules.subwayNetwork.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionEditDTO;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.SubwaySection;
import org.jeecg.modules.subwayNetwork.entity.TrainStation;
import org.jeecg.modules.subwayNetwork.mapper.LightRailMapper;
import org.jeecg.modules.subwayNetwork.mapper.SubwaySectionMapper;
import org.jeecg.modules.subwayNetwork.mapper.TrainStationMapper;
import org.jeecg.modules.subwayNetwork.service.ISubwaySectionService;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SubwaySectionVO;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
/**
* @Description: 线路车站-地铁区间
* @Author: jeecg-boot
* @Date: 2023-06-15
* @Date: 2023-06-15
* @Version: V1.0
*/
@Service
public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, SubwaySection> implements ISubwaySectionService {
@Resource
private LightRailMapper lightRailMapper;
@Resource
private TrainStationMapper trainStationMapper;
@Override
public void edit(SubwaySectionEditDTO dto) {
SubwaySection subwaySection = BeanUtil.copyProperties(dto, SubwaySection.class);
if (ObjectUtil.isEmpty(dto.getId())) {
this.save(subwaySection);
} else {
this.updateById(subwaySection);
}
}
@Override
public IPage<SubwaySectionVO> queryPageList(PageSearch<SubwaySectionQueryDTO> dto) {
// 分页查询
IPage<SubwaySectionVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
page = this.baseMapper.queryPageList(page, dto.getQuery());
return page;
}
}
package org.jeecg.modules.subwayNetwork.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.modules.subwayNetwork.dto.TrainStationEditDTO;
import org.jeecg.modules.subwayNetwork.dto.TrainStationQueryDTO;
import org.jeecg.modules.subwayNetwork.mapper.TrainStationMapper;
import org.jeecg.modules.subwayNetwork.service.ITrainStationService;
......@@ -12,6 +17,8 @@ import org.jeecg.modules.subwayNetwork.vo.TrainStationVO;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.math.BigDecimal;
/**
* @Description: 线路车站-地铁站
* @Author: jeecg-boot
......@@ -24,6 +31,31 @@ public class TrainStationServiceImpl extends ServiceImpl<TrainStationMapper, Tra
@Override
public IPage<TrainStationVO> queryPageList(PageSearch<TrainStationQueryDTO> dto) {
IPage<LightRailQueryVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
return this.baseMapper.queryPageList(page,dto.getQuery());
return this.baseMapper.queryPageList(page, dto.getQuery());
}
@Override
public void edit(TrainStationEditDTO dto) {
// 1.计算当前线路下面有多少个站台
Long count = this.lambdaQuery()
.eq(TrainStation::getLightRailId, dto.getLightRailId())
.count();
// 2.计算站长度:终点里程-起始里程
BigDecimal length = dto.getEndMileage().subtract(dto.getStartingMileage());
// 3.通过id判断是保存还是修改
if (ObjectUtil.isEmpty(dto.getId())) {
TrainStation trainStation = BeanUtil.copyProperties(dto, TrainStation.class);
trainStation.setLength(length);
trainStation.setSeq(count.intValue() + 1);
this.save(trainStation);
} else {
TrainStation trainStation = BeanUtil.copyProperties(dto, TrainStation.class);
trainStation.setLength(length);
trainStation.setSeq(count.intValue() + 1);
this.updateById(trainStation);
}
}
}
package org.jeecg.modules.subwayNetwork.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "区间VO")
public class SubwaySectionVO {
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "创建人")
private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
@ApiModelProperty(value = "更新人")
private String updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
@ApiModelProperty(value = "轻轨线路ID")
private String lightRailId;
@ApiModelProperty(value = "轻轨线路名称")
private String lightRailName;
@ApiModelProperty(value = "起始车站Id")
private String startTrainStationId;
@ApiModelProperty(value = "结束车站Id")
private String endTrainStationId;
@ApiModelProperty(value = "区间名")
private String sectionName;
@ApiModelProperty(value = "区间里程")
private BigDecimal sectionMileage;
@ApiModelProperty(value = "车站数量")
private Integer trainStationNum;
}
package org.jeecg.modules.subwayNetwork.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
......@@ -35,33 +32,36 @@ public class TrainStationVO {
@ApiModelProperty(value = "更新日期")
private Date updateTime;
@ApiModelProperty(value = "轻轨线路ID")
@ApiModelProperty(value = "轻轨线路Id")
private String lightRailId;
@ApiModelProperty(value = "轻轨线路名称")
private String lightRailName;
@ApiModelProperty(value = "车站名")
private String stationName;
@ApiModelProperty(value = "车站编码")
private String stationCode;
@ApiModelProperty(value = "线别")
private String lineAlias;
@ApiModelProperty(value = "起始里程前缀")
private String startingMileagePrefix;
@ApiModelProperty(value = "线别Code")
private String lineAliasCode;
@ApiModelProperty(value = "起始里程")
private BigDecimal startingMileage;
@ApiModelProperty(value = "中心里程前缀")
private String centerMileagePrefix;
@ApiModelProperty(value = "中心里程")
private BigDecimal centerMileage;
@ApiModelProperty(value = "结束里程前缀")
private String endMileagePrefix;
@ApiModelProperty(value = "结束里程")
private BigDecimal endMileage;
@ApiModelProperty(value = "站台长度")
private BigDecimal length;
@ApiModelProperty(value = "顺序")
private Integer seq;
@ApiModelProperty(value = "备注")
private String remark;
}
server:
port: 8080
port: 16888
tomcat:
max-swallow-size: -1
error:
......@@ -7,7 +7,7 @@ server:
include-stacktrace: ALWAYS
include-message: ALWAYS
servlet:
context-path: /jeecg-boot
context-path: /hzsomms/api
compression:
enabled: true
min-response-size: 1024
......
......@@ -131,7 +131,7 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource:
master:
url: jdbc:mysql://47.94.207.62:3306/hzsomms2?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
url: jdbc:mysql://127.0.0.1:3306/hzsomms2?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
username: root
password: superAdmin&321
driver-class-name: com.mysql.jdbc.Driver
......@@ -144,7 +144,7 @@ spring:
#redis 配置
redis:
database: 0
host: 47.94.207.62
host: 127.0.0.1
lettuce:
pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制
......@@ -257,7 +257,7 @@ knife4j:
#开启生产环境屏蔽
production: false
basic:
enable: true
enable: false
username: jeecg
password: jeecg1314
#第三方登录
......
......@@ -35,7 +35,7 @@
<ojdbc6.version>11.2.0.3</ojdbc6.version>
<sqljdbc4.version>4.0</sqljdbc4.version>
<mysql-connector-java.version>8.0.27</mysql-connector-java.version>
<hutool.version>5.3.8</hutool.version>
<hutool.version>5.8.20</hutool.version>
<!-- 持久层 -->
<mybatis-plus.version>3.5.1</mybatis-plus.version>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment