Commit db66b0f6 authored by hkl's avatar hkl

feat:1.线路管理

parent 66c23824
package org.jeecg.common.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("统一分页查询")
public class PageSearch<T> {
@ApiModelProperty(value = "当前页码")
private Integer pageNo = 1;
@ApiModelProperty(value = "每页记录数")
private Integer pageSize = 10;
@ApiModelProperty(value = "查询载体")
private T query;
}
//package org.jeecg.config.mybatis;
//
//import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
//import net.sf.jsqlparser.expression.BinaryExpression;
//import net.sf.jsqlparser.expression.Expression;
//import net.sf.jsqlparser.expression.Parenthesis;
//import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
//import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
//import net.sf.jsqlparser.expression.operators.relational.*;
//import net.sf.jsqlparser.schema.Column;
//import net.sf.jsqlparser.schema.Table;
//import net.sf.jsqlparser.statement.select.*;
//
//import java.util.List;
//
///**
// * 复写租户条件
// */
//public class JeecgTenantParser extends TenantSqlParser {
//
// /**
// * @param expression
// * @param table
// * @return
// */
// protected Expression processTableAlias(Expression expression, Table table) {
// String tableAliasName;
// if (table.getAlias() == null) {
// tableAliasName = table.getName();
// } else {
// tableAliasName = table.getAlias().getName();
// }
//
// // in
// if (expression instanceof InExpression) {
// InExpression in = (InExpression) expression;
// if (in.getLeftExpression() instanceof Column) {
// setTableAliasNameForColumn((Column) in.getLeftExpression(), tableAliasName);
// }
//
// // 比较操作
// } else if (expression instanceof BinaryExpression) {
// BinaryExpression compare = (BinaryExpression) expression;
// if (compare.getLeftExpression() instanceof Column) {
// setTableAliasNameForColumn((Column) compare.getLeftExpression(), tableAliasName);
// } else if (compare.getRightExpression() instanceof Column) {
// setTableAliasNameForColumn((Column) compare.getRightExpression(), tableAliasName);
// }
//
// // between
// } else if (expression instanceof Between) {
// Between between = (Between) expression;
// if (between.getLeftExpression() instanceof Column) {
// setTableAliasNameForColumn((Column) between.getLeftExpression(), tableAliasName);
// }
// }
// return expression;
// }
//
// private void setTableAliasNameForColumn(Column column, String tableAliasName) {
// column.setColumnName(tableAliasName + "." + column.getColumnName());
// }
//
// /**
// * 默认是按 tenant_id=1 按等于条件追加
// *
// * @param currentExpression 现有的条件:比如你原来的sql查询条件
// * @param table
// * @return
// */
// @Override
// protected Expression builderExpression(Expression currentExpression, Table table) {
// final Expression tenantExpression = this.getTenantHandler().getTenantId(true);
// Expression appendExpression;
// if (!(tenantExpression instanceof SupportsOldOracleJoinSyntax)) {
// appendExpression = new EqualsTo();
// ((EqualsTo) appendExpression).setLeftExpression(this.getAliasColumn(table));
// ((EqualsTo) appendExpression).setRightExpression(tenantExpression);
// } else {
// appendExpression = processTableAlias(tenantExpression, table);
// }
// if (currentExpression == null) {
// return appendExpression;
// }
// if (currentExpression instanceof BinaryExpression) {
// BinaryExpression binaryExpression = (BinaryExpression) currentExpression;
// if (binaryExpression.getLeftExpression() instanceof FromItem) {
// processFromItem((FromItem) binaryExpression.getLeftExpression());
// }
// if (binaryExpression.getRightExpression() instanceof FromItem) {
// processFromItem((FromItem) binaryExpression.getRightExpression());
// }
// } else if (currentExpression instanceof InExpression) {
// InExpression inExp = (InExpression) currentExpression;
// ItemsList rightItems = inExp.getRightItemsList();
// if (rightItems instanceof SubSelect) {
// processSelectBody(((SubSelect) rightItems).getSelectBody());
// }
// }
// if (currentExpression instanceof OrExpression) {
// return new AndExpression(new Parenthesis(currentExpression), appendExpression);
// } else {
// return new AndExpression(currentExpression, appendExpression);
// }
// }
//
// @Override
// protected void processPlainSelect(PlainSelect plainSelect, boolean addColumn) {
// FromItem fromItem = plainSelect.getFromItem();
// if (fromItem instanceof Table) {
// Table fromTable = (Table) fromItem;
// if (!this.getTenantHandler().doTableFilter(fromTable.getName())) {
// plainSelect.setWhere(builderExpression(plainSelect.getWhere(), fromTable));
// if (addColumn) {
// plainSelect.getSelectItems().add(new SelectExpressionItem(new Column(this.getTenantHandler().getTenantIdColumn())));
// }
// }
// } else {
// processFromItem(fromItem);
// }
// List<Join> joins = plainSelect.getJoins();
// if (joins != null && joins.size() > 0) {
// joins.forEach(j -> {
// processJoin(j);
// processFromItem(j.getRightItem());
// });
// }
// }
//
//}
//package org.jeecg.config.mybatis;
//
//import lombok.extern.slf4j.Slf4j;
//
///**
// * 多租户 tenant_id存储器
// * @author: jeecg-boot
// */
//@Slf4j
//public class TenantContext {
// private static ThreadLocal<String> currentTenant = new ThreadLocal<>();
//
// public static void setTenant(String tenant) {
// log.debug(" setting tenant to " + tenant);
// currentTenant.set(tenant);
// }
//
// public static String getTenant() {
// return currentTenant.get();
// }
//
// public static void clear(){
// currentTenant.remove();
// }
//}
...@@ -4,8 +4,10 @@ import java.util.Arrays; ...@@ -4,8 +4,10 @@ import java.util.Arrays;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail; import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.service.ILightRailService; import org.jeecg.modules.subwayNetwork.service.ILightRailService;
...@@ -15,6 +17,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -15,6 +17,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
...@@ -40,22 +43,13 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe ...@@ -40,22 +43,13 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param lightRail
* @param pageNo
* @param pageSize
* @param req
* @return * @return
*/ */
//@AutoLog(value = "线路车站-轻轨线路-分页列表查询") //@AutoLog(value = "线路车站-轻轨线路-分页列表查询")
@ApiOperation(value = "线路车站-轻轨线路-分页列表查询", notes = "线路车站-轻轨线路-分页列表查询") @ApiOperation(value = "线路车站-轻轨线路-分页列表查询", notes = "线路车站-轻轨线路-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<IPage<LightRail>> queryPageList(LightRail lightRail, public Result<IPage<LightRailQueryVO>> queryPageList(PageSearch<LightRailQueryDTO> dto) {
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, IPage<LightRailQueryVO> pageList = lightRailService.queryPageList(dto);
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<LightRail> queryWrapper = QueryGenerator.initQueryWrapper(lightRail, req.getParameterMap());
Page<LightRail> page = new Page<LightRail>(pageNo, pageSize);
IPage<LightRail> pageList = lightRailService.page(page, queryWrapper);
return Result.OK(pageList); return Result.OK(pageList);
} }
...@@ -98,7 +92,7 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe ...@@ -98,7 +92,7 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
@AutoLog(value = "线路车站-轻轨线路-通过id删除") @AutoLog(value = "线路车站-轻轨线路-通过id删除")
@ApiOperation(value = "线路车站-轻轨线路-通过id删除", notes = "线路车站-轻轨线路-通过id删除") @ApiOperation(value = "线路车站-轻轨线路-通过id删除", notes = "线路车站-轻轨线路-通过id删除")
// @RequiresPermissions("subwayNetwork:t_sn_light_rail:delete") // @RequiresPermissions("subwayNetwork:t_sn_light_rail:delete")
@DeleteMapping(value = "/delete") @GetMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) { public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
lightRailService.removeById(id); lightRailService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
...@@ -113,7 +107,7 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe ...@@ -113,7 +107,7 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
@AutoLog(value = "线路车站-轻轨线路-批量删除") @AutoLog(value = "线路车站-轻轨线路-批量删除")
@ApiOperation(value = "线路车站-轻轨线路-批量删除", notes = "线路车站-轻轨线路-批量删除") @ApiOperation(value = "线路车站-轻轨线路-批量删除", notes = "线路车站-轻轨线路-批量删除")
// @RequiresPermissions("subwayNetwork:t_sn_light_rail:deleteBatch") // @RequiresPermissions("subwayNetwork:t_sn_light_rail:deleteBatch")
@DeleteMapping(value = "/deleteBatch") @GetMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.lightRailService.removeByIds(Arrays.asList(ids.split(","))); this.lightRailService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
......
...@@ -3,6 +3,7 @@ package org.jeecg.modules.subwayNetwork.controller; ...@@ -3,6 +3,7 @@ package org.jeecg.modules.subwayNetwork.controller;
import java.util.Arrays; import java.util.Arrays;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap; import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
...@@ -22,13 +23,13 @@ import io.swagger.annotations.ApiOperation; ...@@ -22,13 +23,13 @@ import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
/** /**
* @Description: 线路车站-区间站点映射 * @Description: 线路车站-区间站点映射
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-06-15 * @Date: 2023-06-15
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="线路车站-区间站点映射") @Api(tags = "线路车站-区间站点映射")
@RestController @RestController
@RequestMapping("/subwayNetwork/sectionStationMap") @RequestMapping("/subwayNetwork/sectionStationMap")
@Slf4j @Slf4j
...@@ -46,11 +47,11 @@ public class SectionStationMapController extends JeecgController<SectionStationM ...@@ -46,11 +47,11 @@ public class SectionStationMapController extends JeecgController<SectionStationM
* @return * @return
*/ */
//@AutoLog(value = "线路车站-区间站点映射-分页列表查询") //@AutoLog(value = "线路车站-区间站点映射-分页列表查询")
@ApiOperation(value="线路车站-区间站点映射-分页列表查询", notes="线路车站-区间站点映射-分页列表查询") @ApiOperation(value = "线路车站-区间站点映射-分页列表查询", notes = "线路车站-区间站点映射-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<IPage<SectionStationMap>> queryPageList(SectionStationMap sectionStationMap, public Result<IPage<SectionStationMap>> queryPageList(SectionStationMap sectionStationMap,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<SectionStationMap> queryWrapper = QueryGenerator.initQueryWrapper(sectionStationMap, req.getParameterMap()); QueryWrapper<SectionStationMap> queryWrapper = QueryGenerator.initQueryWrapper(sectionStationMap, req.getParameterMap());
Page<SectionStationMap> page = new Page<SectionStationMap>(pageNo, pageSize); Page<SectionStationMap> page = new Page<SectionStationMap>(pageNo, pageSize);
...@@ -65,8 +66,8 @@ public class SectionStationMapController extends JeecgController<SectionStationM ...@@ -65,8 +66,8 @@ public class SectionStationMapController extends JeecgController<SectionStationM
* @return * @return
*/ */
@AutoLog(value = "线路车站-区间站点映射-添加") @AutoLog(value = "线路车站-区间站点映射-添加")
@ApiOperation(value="线路车站-区间站点映射-添加", notes="线路车站-区间站点映射-添加") @ApiOperation(value = "线路车站-区间站点映射-添加", notes = "线路车站-区间站点映射-添加")
@RequiresPermissions("subwayNetwork:t_sn_section_station_map:add") // @RequiresPermissions("subwayNetwork:t_sn_section_station_map:add")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody SectionStationMap sectionStationMap) { public Result<String> add(@RequestBody SectionStationMap sectionStationMap) {
sectionStationMapService.save(sectionStationMap); sectionStationMapService.save(sectionStationMap);
...@@ -80,9 +81,9 @@ public class SectionStationMapController extends JeecgController<SectionStationM ...@@ -80,9 +81,9 @@ public class SectionStationMapController extends JeecgController<SectionStationM
* @return * @return
*/ */
@AutoLog(value = "线路车站-区间站点映射-编辑") @AutoLog(value = "线路车站-区间站点映射-编辑")
@ApiOperation(value="线路车站-区间站点映射-编辑", notes="线路车站-区间站点映射-编辑") @ApiOperation(value = "线路车站-区间站点映射-编辑", notes = "线路车站-区间站点映射-编辑")
@RequiresPermissions("subwayNetwork:t_sn_section_station_map:edit") // @RequiresPermissions("subwayNetwork:t_sn_section_station_map:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) @RequestMapping(value = "/edit", method = RequestMethod.POST)
public Result<String> edit(@RequestBody SectionStationMap sectionStationMap) { public Result<String> edit(@RequestBody SectionStationMap sectionStationMap) {
sectionStationMapService.updateById(sectionStationMap); sectionStationMapService.updateById(sectionStationMap);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
...@@ -95,10 +96,10 @@ public class SectionStationMapController extends JeecgController<SectionStationM ...@@ -95,10 +96,10 @@ public class SectionStationMapController extends JeecgController<SectionStationM
* @return * @return
*/ */
@AutoLog(value = "线路车站-区间站点映射-通过id删除") @AutoLog(value = "线路车站-区间站点映射-通过id删除")
@ApiOperation(value="线路车站-区间站点映射-通过id删除", notes="线路车站-区间站点映射-通过id删除") @ApiOperation(value = "线路车站-区间站点映射-通过id删除", notes = "线路车站-区间站点映射-通过id删除")
@RequiresPermissions("subwayNetwork:t_sn_section_station_map:delete") // @RequiresPermissions("subwayNetwork:t_sn_section_station_map:delete")
@DeleteMapping(value = "/delete") @GetMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) { public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
sectionStationMapService.removeById(id); sectionStationMapService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
...@@ -110,10 +111,10 @@ public class SectionStationMapController extends JeecgController<SectionStationM ...@@ -110,10 +111,10 @@ public class SectionStationMapController extends JeecgController<SectionStationM
* @return * @return
*/ */
@AutoLog(value = "线路车站-区间站点映射-批量删除") @AutoLog(value = "线路车站-区间站点映射-批量删除")
@ApiOperation(value="线路车站-区间站点映射-批量删除", notes="线路车站-区间站点映射-批量删除") @ApiOperation(value = "线路车站-区间站点映射-批量删除", notes = "线路车站-区间站点映射-批量删除")
@RequiresPermissions("subwayNetwork:t_sn_section_station_map:deleteBatch") @RequiresPermissions("subwayNetwork:t_sn_section_station_map:deleteBatch")
@DeleteMapping(value = "/deleteBatch") @GetMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.sectionStationMapService.removeByIds(Arrays.asList(ids.split(","))); this.sectionStationMapService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
...@@ -125,11 +126,11 @@ public class SectionStationMapController extends JeecgController<SectionStationM ...@@ -125,11 +126,11 @@ public class SectionStationMapController extends JeecgController<SectionStationM
* @return * @return
*/ */
//@AutoLog(value = "线路车站-区间站点映射-通过id查询") //@AutoLog(value = "线路车站-区间站点映射-通过id查询")
@ApiOperation(value="线路车站-区间站点映射-通过id查询", notes="线路车站-区间站点映射-通过id查询") @ApiOperation(value = "线路车站-区间站点映射-通过id查询", notes = "线路车站-区间站点映射-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<SectionStationMap> queryById(@RequestParam(name="id",required=true) String id) { public Result<SectionStationMap> queryById(@RequestParam(name = "id", required = true) String id) {
SectionStationMap sectionStationMap = sectionStationMapService.getById(id); SectionStationMap sectionStationMap = sectionStationMapService.getById(id);
if(sectionStationMap==null) { if (sectionStationMap == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
return Result.OK(sectionStationMap); return Result.OK(sectionStationMap);
...@@ -141,7 +142,7 @@ public class SectionStationMapController extends JeecgController<SectionStationM ...@@ -141,7 +142,7 @@ public class SectionStationMapController extends JeecgController<SectionStationM
* @param request * @param request
* @param sectionStationMap * @param sectionStationMap
*/ */
@RequiresPermissions("subwayNetwork:t_sn_section_station_map:exportXls") // @RequiresPermissions("subwayNetwork:t_sn_section_station_map:exportXls")
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SectionStationMap sectionStationMap) { public ModelAndView exportXls(HttpServletRequest request, SectionStationMap sectionStationMap) {
return super.exportXls(request, sectionStationMap, SectionStationMap.class, "线路车站-区间站点映射"); return super.exportXls(request, sectionStationMap, SectionStationMap.class, "线路车站-区间站点映射");
...@@ -154,7 +155,7 @@ public class SectionStationMapController extends JeecgController<SectionStationM ...@@ -154,7 +155,7 @@ public class SectionStationMapController extends JeecgController<SectionStationM
* @param response * @param response
* @return * @return
*/ */
@RequiresPermissions("subwayNetwork:t_sn_section_station_map:importExcel") // @RequiresPermissions("subwayNetwork:t_sn_section_station_map:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, SectionStationMap.class); return super.importExcel(request, response, SectionStationMap.class);
......
package org.jeecg.modules.subwayNetwork.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "线路DTO")
public class LightRailQueryDTO {
@ApiModelProperty(value = "线路code")
private String railLineCode;
@ApiModelProperty(value = "状态")
private String status;
}
...@@ -4,10 +4,8 @@ import java.io.Serializable; ...@@ -4,10 +4,8 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
...@@ -28,40 +26,57 @@ import lombok.experimental.Accessors; ...@@ -28,40 +26,57 @@ import lombok.experimental.Accessors;
@TableName("t_sn_light_rail") @TableName("t_sn_light_rail")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="t_sn_light_rail对象", description="线路车站-轻轨线路") @ApiModel(value = "t_sn_light_rail对象", description = "线路车站-轻轨线路")
public class LightRail implements Serializable { public class LightRail implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
private java.lang.String id; private java.lang.String id;
/**创建人*/ /**
* 创建人
*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private java.lang.String createBy; 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 = "创建日期") @ApiModelProperty(value = "创建日期")
private java.util.Date createTime; private java.util.Date createTime;
/**更新人*/ /**
* 更新人
*/
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private java.lang.String updateBy; 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 = "更新日期") @ApiModelProperty(value = "更新日期")
private java.util.Date updateTime; private java.util.Date updateTime;
/**线路名称*/ /**
* 线路名称
*/
@Excel(name = "线路名称", width = 15) @Excel(name = "线路名称", width = 15)
@ApiModelProperty(value = "线路名称") @ApiModelProperty(value = "线路名称")
private java.lang.String railLineName; private java.lang.String railLineName;
/**线路code*/ /**
* 线路code
*/
@Excel(name = "线路code", width = 15) @Excel(name = "线路code", width = 15)
@ApiModelProperty(value = "线路code") @ApiModelProperty(value = "线路code")
private java.lang.String railLineCode; private java.lang.String railLineCode;
/**状态*/ /**
* 状态
*/
@Excel(name = "状态", width = 15) @Excel(name = "状态", width = 15)
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
private java.lang.String status; private java.lang.String status;
} }
package org.jeecg.modules.subwayNetwork.mapper; package org.jeecg.modules.subwayNetwork.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail; import org.jeecg.modules.subwayNetwork.entity.LightRail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
/** /**
* @Description: 线路车站-轻轨线路 * @Description: 线路车站-轻轨线路
...@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface LightRailMapper extends BaseMapper<LightRail> { public interface LightRailMapper extends BaseMapper<LightRail> {
IPage<LightRailQueryVO> queryPageList(IPage<LightRailQueryVO> page, LightRailQueryDTO query);
} }
...@@ -2,4 +2,25 @@ ...@@ -2,4 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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.LightRailMapper"> <mapper namespace="org.jeecg.modules.subwayNetwork.mapper.LightRailMapper">
<select id="queryPageList" resultType="org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO">
SELECT
t1.create_by,
t1.create_time,
t1.id,
t1.rail_line_code,
t1.rail_line_name,
t1.status,
t1.update_by,
t1.update_time,
count(t2.id) subwaySectionNum,
count(t3.id) trainStationNum,
sum(t3.end_mileage) lineMileage
FROM
t_sn_light_rail t1
LEFT JOIN t_sn_subway_section t2 ON t1.id = t2.rail_id
LEFT JOIN t_sn_train_station t3 ON t1.id = t3.light_rail_id
WHERE 1=1
GROUP BY t1.id
</select>
</mapper> </mapper>
\ No newline at end of file
package org.jeecg.modules.subwayNetwork.service; 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.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail; import org.jeecg.modules.subwayNetwork.entity.LightRail;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
/** /**
* @Description: 线路车站-轻轨线路 * @Description: 线路车站-轻轨线路
...@@ -11,4 +15,11 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -11,4 +15,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface ILightRailService extends IService<LightRail> { public interface ILightRailService extends IService<LightRail> {
/**
* 分页查询
*
* @param dto
* @return
*/
IPage<LightRailQueryVO> queryPageList(PageSearch<LightRailQueryDTO> dto);
} }
package org.jeecg.modules.subwayNetwork.service.impl; package org.jeecg.modules.subwayNetwork.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail; import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
import org.jeecg.modules.subwayNetwork.mapper.LightRailMapper; import org.jeecg.modules.subwayNetwork.mapper.LightRailMapper;
import org.jeecg.modules.subwayNetwork.service.ILightRailService; import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/** /**
* @Description: 线路车站-轻轨线路 * @Description: 线路车站-轻轨线路
* @Author: jeecg-boot * @Author: jeecg-boot
...@@ -16,4 +21,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -16,4 +21,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service @Service
public class LightRailServiceImpl extends ServiceImpl<LightRailMapper, LightRail> implements ILightRailService { public class LightRailServiceImpl extends ServiceImpl<LightRailMapper, LightRail> implements ILightRailService {
@Override
public IPage<LightRailQueryVO> queryPageList(PageSearch<LightRailQueryDTO> dto) {
IPage<LightRailQueryVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
page = this.baseMapper.queryPageList(page, dto.getQuery());
return page;
}
} }
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.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "线路VO")
public class LightRailQueryVO {
private static final long serialVersionUID = 1L;
@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 = "线路名称")
private java.lang.String railLineName;
@ApiModelProperty(value = "线路code")
private java.lang.String railLineCode;
@ApiModelProperty(value = "状态")
private java.lang.String status;
@ApiModelProperty(value = "区间数量")
private Integer subwaySectionNum;
@ApiModelProperty(value = "车站数量")
private Integer trainStationNum;
@ApiModelProperty(value = "线路里程")
private BigDecimal lineMileage;
}
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