Commit ab1f5566 authored by hkl's avatar hkl

feat:1.代码提交

parent 9cdfe589
......@@ -87,38 +87,4 @@ public class SwitchManagementController extends JeecgController<SwitchManagement
return Result.OK("批量删除成功!");
}
// /**
// * 通过id查询
// *
// * @param id
// * @return
// */
// @AutoLog(value = "线路车站-轻轨线路-通过id查询")
// @ApiOperation(value = "线路车站-轻轨线路-通过id查询", notes = "线路车站-轻轨线路-通过id查询")
// @GetMapping(value = "/queryById")
// public Result<LightRail> queryById(@RequestParam(name = "id", required = true) String id) {
// LightRail lightRail = lightRailService.getById(id);
// if (lightRail == null) {
// return Result.error("未找到对应数据");
// }
// 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);
// }
}
......@@ -11,6 +11,4 @@ public class SwitchManagementQueryDTO {
@ApiModelProperty(value = "线路name")
private String railLineName;
@ApiModelProperty(value = "状态")
private String status;
}
......@@ -69,7 +69,7 @@ public class SwitchManagement implements Serializable {
private BigDecimal byroadEndMileage;
@ApiModelProperty(value = "区间车站mapId")
private String byroadTrainStationId;
private String sectionStationMapId;
@ApiModelProperty(value = "备注")
private String remark;
......
......@@ -4,6 +4,10 @@
<select id="queryPageList" resultType="org.jeecg.modules.deviceAsset.vo.SwitchManagementQueryVO">
SELECT * FROM t_da_switch_management
SELECT
t1.*,
t2.*
FROM
t_da_switch_management t1 LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
</select>
</mapper>
\ No newline at end of file
......@@ -59,7 +59,25 @@ public class SwitchManagementQueryVO {
private BigDecimal byroadEndMileage;
@ApiModelProperty(value = "区间车站mapId")
private String byroadTrainStationId;
private String sectionStationMapId;
@ApiModelProperty(value = "线路id")
private String lightRailId;
@ApiModelProperty(value = "线路名称")
private String lightRailName;
@ApiModelProperty(value = "区间id")
private String sectionId;
@ApiModelProperty(value = "区间名称")
private String sectionName;
@ApiModelProperty(value = "车站id")
private String stationId;
@ApiModelProperty(value = "车站名称")
private String stationName;
@ApiModelProperty(value = "备注")
private String remark;
......
......@@ -6,20 +6,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.deviceAsset.dto.SwitchManagementQueryDTO;
import org.jeecg.modules.deviceAsset.vo.SwitchManagementQueryVO;
import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.dto.LineAliasQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.service.ILineAliasService;
import org.jeecg.modules.subwayNetwork.vo.LightAliasQueryVO;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -100,10 +94,20 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS
List<Map<String, Object>> list = new ArrayList<>();
for (LineAlias alias : records) {
Map<String, Object> map = new HashMap<>();
map.put("label", alias.getLineAliasCode());
map.put("value", alias.getLineAliasName());
map.put("label", alias.getLineAliasName());
map.put("code", alias.getLineAliasCode());
map.put("value", alias.getId());
list.add(map);
}
return Result.OK(list);
}
@AutoLog(value = "线路车站-线别管理-获取区间车站映射")
@ApiOperation(value = "线路车站-线别管理-获取区间车站映射", notes = "线路车站-线别管理-获取区间车站映射")
@GetMapping(value = "/getSectionStation")
public Result<List<SectionStationMapVO>> getSectionStation() {
return Result.OK(lineAliasService.getSectionStation());
}
}
package org.jeecg.modules.subwayNetwork.controller;
import java.util.Arrays;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -9,6 +9,7 @@ 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.LightRail;
import org.jeecg.modules.subwayNetwork.entity.SubwaySection;
import org.jeecg.modules.subwayNetwork.service.ISubwaySectionService;
......@@ -77,4 +78,21 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
return Result.OK("批量删除成功!");
}
@AutoLog(value = "线路车站-轻轨线路-获取全部线路")
@ApiOperation(value = "线路车站-轻轨线路-获取全部线路", notes = "线路车站-轻轨线路-获取全部线路")
@GetMapping(value = "/listAll")
public Result<List<Map<String, Object>>> listAll() {
List<SubwaySection> subwaySections = subwaySectionService.list();
List<Map<String, Object>> list = new ArrayList<>();
for (SubwaySection subwaySection : subwaySections) {
Map<String, Object> map = new HashMap<>();
map.put("label", subwaySection.getSectionName());
map.put("value", subwaySection.getId());
map.put("parentId", subwaySection.getLightRailId());
list.add(map);
}
return Result.OK(list);
}
}
package org.jeecg.modules.subwayNetwork.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@TableName("t_sn_section_station_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "t_sn_section_station_map对象", description = "线路车站-区间线路关联")
public class SectionStationMap {
@TableId(type = IdType.ASSIGN_ID)
@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 sectionId;
@ApiModelProperty(value = "区间名称")
private String sectionName;
@ApiModelProperty(value = "车站id")
private String stationId;
@ApiModelProperty(value = "车站名称")
private String stationName;
}
......@@ -6,7 +6,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.subwayNetwork.dto.LineAliasQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.vo.LightAliasQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import java.util.List;
public interface LineAliasMapper extends BaseMapper<LineAlias> {
IPage<LightAliasQueryVO> queryPageList(Page<LightAliasQueryVO> pageData, LineAliasQueryDTO dto);
List<SectionStationMapVO> getSectionStation();
}
package org.jeecg.modules.subwayNetwork.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
/**
* @Description: 线路车站-区间线路关联
*/
public interface SectionStationMapMapper extends BaseMapper<SectionStationMap> {
}
......@@ -5,4 +5,16 @@
<select id="queryPageList" resultType="org.jeecg.modules.subwayNetwork.vo.LightAliasQueryVO">
select * from t_sn_line_alias
</select>
<select id="getSectionStation" resultType="org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO">
SELECT
id,
light_rail_id,
light_rail_name,
section_name ,
section_id ,
station_id,
station_name
FROM
t_sn_section_station_map
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!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.SectionStationMapMapper">
</mapper>
\ No newline at end of file
......@@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.subwayNetwork.dto.LineAliasQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
import org.jeecg.modules.subwayNetwork.vo.LightAliasQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import java.util.List;
/**
* @Description: 线路车站-线别管理
......@@ -14,4 +18,6 @@ import org.jeecg.modules.subwayNetwork.vo.LightAliasQueryVO;
public interface ILineAliasService extends IService<LineAlias> {
IPage<LightAliasQueryVO> queryPageList(Page<LightAliasQueryVO> pageData, LineAliasQueryDTO dto);
List<SectionStationMapVO> getSectionStation();
}
......@@ -8,8 +8,11 @@ import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.mapper.LineAliasMapper;
import org.jeecg.modules.subwayNetwork.service.ILineAliasService;
import org.jeecg.modules.subwayNetwork.vo.LightAliasQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 线路车站-轻轨线路
* @Author: jeecg-boot
......@@ -21,6 +24,11 @@ public class LightAliasServiceImpl extends ServiceImpl<LineAliasMapper, LineAlia
@Override
public IPage<LightAliasQueryVO> queryPageList(Page<LightAliasQueryVO> pageData, LineAliasQueryDTO dto) {
return this.baseMapper.queryPageList(pageData,dto);
return this.baseMapper.queryPageList(pageData, dto);
}
@Override
public List<SectionStationMapVO> getSectionStation() {
return this.baseMapper.getSectionStation();
}
}
......@@ -2,6 +2,7 @@ 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -9,8 +10,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.SectionStationMap;
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.SectionStationMapMapper;
import org.jeecg.modules.subwayNetwork.mapper.SubwaySectionMapper;
import org.jeecg.modules.subwayNetwork.mapper.TrainStationMapper;
import org.jeecg.modules.subwayNetwork.service.ISubwaySectionService;
......@@ -19,6 +24,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 线路车站-地铁区间
......@@ -30,9 +37,14 @@ import java.math.BigDecimal;
public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, SubwaySection> implements ISubwaySectionService {
@Resource
private LightRailMapper lightRailMapper;
@Resource
private TrainStationMapper trainStationMapper;
@Resource
private SectionStationMapMapper sectionStationMapMapper;
@Override
public void edit(SubwaySectionEditDTO dto) {
......@@ -43,6 +55,36 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
this.updateById(subwaySection);
}
// 先删除
LambdaQueryWrapper<SectionStationMap> ssmQueryWrapper = new LambdaQueryWrapper<>();
ssmQueryWrapper.eq(SectionStationMap::getSectionId, subwaySection.getId());
sectionStationMapMapper.delete(ssmQueryWrapper);
// 查询这个区间的车站
TrainStation startTrainStation = trainStationMapper.selectById(subwaySection.getStartTrainStationId());
TrainStation endTrainStation = trainStationMapper.selectById(subwaySection.getEndTrainStationId());
QueryWrapper<TrainStation> tsQueryWrapper = new QueryWrapper<>();
tsQueryWrapper.select("DISTINCT line_alias_code line_alias_code", "id", "station_name");
tsQueryWrapper.lambda().ge(TrainStation::getSeq, startTrainStation.getSeq())
.le(TrainStation::getSeq, endTrainStation.getSeq())
.eq(TrainStation::getLightRailId, subwaySection.getLightRailId());
List<TrainStation> trainStations = trainStationMapper.selectList(tsQueryWrapper);
LightRail lightRail = lightRailMapper.selectById(subwaySection.getLightRailId());
// 后新增
for (TrainStation trainStation : trainStations) {
SectionStationMap sectionStationMap = new SectionStationMap();
sectionStationMap.setLightRailId(lightRail.getId());// 车站id
sectionStationMap.setLightRailName(lightRail.getRailLineName()); // 车站名称
sectionStationMap.setSectionId(subwaySection.getId());
sectionStationMap.setSectionName(subwaySection.getSectionName());
sectionStationMap.setStationId(trainStation.getId());
sectionStationMap.setStationName(trainStation.getStationName());
sectionStationMapMapper.insert(sectionStationMap);
}
}
@Override
......
......@@ -43,7 +43,6 @@ public class TrainStationServiceImpl extends ServiceImpl<TrainStationMapper, Tra
// 2.通过id判断是保存还是修改
if (ObjectUtil.isEmpty(dto.getId())) {
//
Integer seq = 1;
TrainStation exist = this.lambdaQuery().eq(TrainStation::getLightRailId, dto.getLightRailId())
.eq(TrainStation::getStationName, dto.getStationName())
......@@ -69,6 +68,8 @@ public class TrainStationServiceImpl extends ServiceImpl<TrainStationMapper, Tra
trainStation.setLength(length);
this.updateById(trainStation);
}
}
}
package org.jeecg.modules.subwayNetwork.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "线路区间车站映射VO")
public class SectionStationMapVO {
private String id;
@ApiModelProperty(value = "线路id")
private String lightRailId;
@ApiModelProperty(value = "线路名称")
private String lightRailName;
@ApiModelProperty(value = "区间id")
private String sectionId;
@ApiModelProperty(value = "区间名称")
private String sectionName;
@ApiModelProperty(value = "车站id")
private String stationId;
@ApiModelProperty(value = "车站名称")
private String stationName;
}
......@@ -18,11 +18,11 @@
<artifactId>jeecg-system-biz</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
<!-- DEMO 示例模块 -->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-demo</artifactId>
<version>${jeecgboot.version}</version>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.5.1</version>
</dependency>
</dependencies>
......
package org.jeecg.codegenerate;
import java.math.BigDecimal;
public class CodeGenerate {
public static void main(String[] args) {
BigDecimal divide = new BigDecimal(128).divide(new BigDecimal(2.58), 6, BigDecimal.ROUND_HALF_UP);
System.out.println("divide.setScale(0,BigDecimal.ROUND_UP).intValue() = " + divide.setScale(0, BigDecimal.ROUND_UP).intValue());
// 数据源
// DataSourceConfig.Builder dataSourceConfig = new DataSourceConfig.Builder("jdbc:mysql://47.94.207.62:3306/hzsomms?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull",
// "root",
// "superAdmin&321")
// .dbQuery(new MySqlQuery())
// .schema("mybatis-plus")
// .typeConvert(new MySqlTypeConvert())
// .keyWordsHandler(new MySqlKeyWordsHandler())
// .build();
//
//
// // 全局配置
// GlobalConfig globalConfig = new GlobalConfig.Builder()
// .fileOverride()
// .outputDir("/opt/baomidou")
// .author("baomidou")
// .enableKotlin()
// .enableSwagger()
// .dateType(DateType.TIME_PACK)1
// .commentDate("yyyy-MM-dd")
// .build();
//
// FastAutoGenerator.create(dataSourceConfig)
// .execute();
}
}
......@@ -167,9 +167,11 @@ mybatis-plus:
table-underline: true
configuration:
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls: true
# 驼峰
map-underscore-to-camel-case: true
#jeecg专用配置
minidao:
base-package: org.jeecg.modules.jmreport.*
......
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