当前位置: 首页 > wzjs >正文

郑州学校网站建设今日国际新闻最新消息

郑州学校网站建设,今日国际新闻最新消息,学建站wordpress,免费软件大全网址前面完成了乘车人登录功能的实现,本篇主要是控制台方面的管理 对于整体的控制台的设计,为了能够快速的检验,不进行登录拦截,在控制台的这个模块的controller层增加admin,以及在登录界面的拦截器排除掉admin. 车站 即…

前面完成了乘车人登录功能的实现,本篇主要是控制台方面的管理

对于整体的控制台的设计,为了能够快速的检验,不进行登录拦截,在控制台的这个模块的controller层增加admin,以及在登录界面的拦截器排除掉admin.

车站

即都有那些车站

create table `station` (`id` bigint not null comment 'id',`name` varchar(20) not null comment '站名',`name_pinyin` varchar(50) not null comment '站名拼音',`name_py` varchar(50) not null comment '站名拼音首字母',`create_time` datetime(3) comment '新增时间',`update_time` datetime(3) comment '修改时间',primary key (`id`),unique key `name_unique` (`name`)
) engine=innodb default charset=utf8mb4 comment='车站';

首先,使用bigint类型的id作为主键,可以支持大量的车站记录。使用唯一标识进行每个车站的管理,便于数据库管理和关联其他表。为了方便查询车站,添加了站名,站名拼音和站名拼音首字母。

火车基础数据的管理

就是一辆火车的数据,这里设计如下

drop table if exists `train`;
create table `train` (`id` bigint not null comment 'id',`code` varchar(20) not null comment '车次编号',`type` char(1) not null comment '车次类型|枚举[TrainTypeEnum]',`start` varchar(20) not null comment '始发站',`start_pinyin` varchar(50) not null comment '始发站拼音',`start_time` time not null comment '出发时间',`end` varchar(20) not null comment '终点站',`end_pinyin` varchar(50) not null comment '终点站拼音',`end_time` time not null comment '到站时间',`create_time` datetime(3) comment '新增时间',`update_time` datetime(3) comment '修改时间',primary key (`id`),unique key `code_unique` (`code`)
) engine=innodb default charset=utf8mb4 comment='车次';

其中的车次类型是因为火车不仅仅有动车,还有高铁,普通列车等。可以仿照乘客表的乘客类型来进行车次车次类型的设计。为了计算不同车次的票价,在枚举类中为不同的车次类型增加系数,例如,高铁为1.2,表示票价=1.2*每公里单价*公里,实际上可能更加的复杂。这里只是基础讨论功能的实现。看上面的事件类型发现,出发时间,到站时间和新增时间与修改时间的类型不同,其中datatime类型非常适合需要同时记录具体哪一天的什么时候发生的场景。time类型记录事件发生的具体时间。这样设计是因为此时是基础的数据功能,并不是每日的车次,火车每天出发的时间是一定的,因此不需要记录具体的日期。

为了是选择时间,而不是手动的输入时间,可以在前端增加控件,如果是time类型,增加a-time-picker,如果是time类型,增加a-datepicker,为了方便,可以在自定义的代码生成器实现。

<#elseif field.javaType=='Date'><#if field.type=='time'><a-time-picker v-model:value="${domain}.${field.nameHump}" valueFormat="HH:mm:ss" placeholder="请选择时间" /><#elseif field.type=='date'><a-date-picker v-model:value="${domain}.${field.nameHump}" valueFormat="YYYY-MM-DD" placeholder="请选择日期" /><#else><a-date-picker v-model:value="${domain}.${field.nameHump}" valueFormat="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择日期" /></#if>

火车车站的管理

就是车次的车站,一列火车要经过那些车站。

create table `train_station` (`id` bigint not null comment 'id',`train_code` varchar(20) not null comment '车次编号',`index` int not null comment '站序',`name` varchar(20) not null comment '站名',`name_pinyin` varchar(50) not null comment '站名拼音',`in_time` time comment '进站时间',`out_time` time comment '出站时间',`stop_time` time comment '停站时长',`km` decimal(8, 2) not null comment '里程(公里)|从上一站到本站的距离',`create_time` datetime(3) comment '新增时间',`update_time` datetime(3) comment '修改时间',primary key (`id`),unique key `train_code_index_unique` (`train_code`, `index`),unique key `train_code_name_unique` (`train_code`, `name`)
) engine=innodb default charset=utf8mb4 comment='火车车站';

其中的车次编号和某辆火车进行关联,站序指的是从始发站到终点站经过的车站顺序的排列。停站时常是可以通过进站和出站时间进行计算,为了方便查询,将id作为主键。在实际的情况中,一辆火车从起点到终点不会经过某个站两次,因此需要增加唯一键来进行数据的检验。如何将这两张表进行关联呢,在train表中一个唯一键code,使用唯一键进行关联,方便业务上的一些功能,train_code的起名就是和train这张表的code字段进行关联。当然如果没有设计唯一键,可以考虑使用id进行关联。

火车车厢

create table `train_carriage` (`id` bigint not null comment 'id',`train_code` varchar(20) not null comment '车次编号',`index` int not null comment '厢号',`seat_type` char(1) not null comment '座位类型|枚举[SeatTypeEnum]',`seat_count` int not null comment '座位数',`row_count` int not null comment '排数',`col_count` int not null comment '列数',`create_time` datetime(3) comment '新增时间',`update_time` datetime(3) comment '修改时间',unique key `train_code_index_unique` (`train_code`, `index`),primary key (`id`)
) engine=innodb default charset=utf8mb4 comment='火车车厢';

每一列车厢都要对应一列火车,因此需要根火车表进行关联,即train_index,由于不可能发生一列火车有两个相同编号的车厢,因此需要进行车次编号和厢号的关联。由于不同的车厢有不同的作为类型,因此可以将其进行枚举。

座位表

        对于一辆火车来说,没有座位表是不完整的,由于座位属于某个车次,因此需要和火车进行关联,座位应该属于某个车厢,因此应该和车厢有所关联。同车厢内,每个座位可以按照行和列进行唯一的查找,每一个车厢都是从123往后排的,因此需要一个同车厢坐序。

        在进行枚举座位行类中,设定一等座一排四个,二等座一排5个,增加code和desc,最后要增加一个type,来描述是什么类型。这个type就是对于的SeatType的枚举类,假设传入一个一等座,可以根据type等于1查出一等座对应的列,这样前端做一些下拉框就比较方便,知道一等座,就能知道有那些可以选择。

    /*** 根据车箱的座位类型,筛选出所有的列,比如车箱类型是一等座,则筛选出columnList={ACDF}*/public static List<SeatColEnum> getColsByType(String seatType) {List<SeatColEnum> colList = new ArrayList<>();EnumSet<SeatColEnum> seatColEnums = EnumSet.allOf(SeatColEnum.class);for (SeatColEnum anEnum : seatColEnums) {if (seatType.equals(anEnum.getType())) {colList.add(anEnum);}}return colList;}

优化

输入车站名称后自动显示拼音,前端可以引入"pinyin-pro"组件

watch(()=> station.value.name, () => {if (Tool.isNotEmpty(station.value.name)) {station.value.namePinyin = pinyin(station.value.name, {toneType: 'none'}).replaceAll(" ", "");station.value.namePy = pinyin(station.value.name, {pattern: 'first',toneType: 'none'}).replaceAll(" ","");}},{immediate: true});

利用watch函数监听响应式数据的变化。监听的是station.value.name的变化,并在变化时更新station.value.namePinyinstation.value.namePy两个属性。第一个参数是要监听的数据,第二个参数是回调函数,表示如果发生变换,立即执行回调函数

火车车站的车次编号应该座位下拉框:首先后端提供一个接口查询所有的车次,然后前端界面的更改。对于查询接口来说,不需要参数,将查到的车站按照降序排列,以List形式进行返回。

    public List<TrainQueryResp> queryAll() {TrainExample trainExample = new TrainExample();trainExample.setOrderByClause("code desc");List<Train> trainList= trainMapper.selectByExample(trainExample);return BeanUtil.copyToList(trainList, TrainQueryResp.class);}@GetMapping("/query-all")public CommonResp<List<TrainQueryResp>> queryList() {List<TrainQueryResp> list = trainService.queryAll();return new CommonResp<>(list);}

然后前端去拿到后端的数据

const queryTrainCode = () => {axios.get("/business/admin/train/query-all").then((response) => {let data = response.data;if (data.success) {console.log(data.content);} else {notification.error({description: data.message});}});};
        <a-select v-model:value="trainStation.trainCode" show-search:filterOption="filterTrainCodeOption"><a-select-option v-for="item in trains" :key="item.code" :value="item.code" :label="item.code + item.start + item.end">{{item.code}} | {{item.start}} ~ {{item.end}}</a-select-option></a-select>const filterTrainCodeOption = (input, option) => {console.log(input, option)return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;};
  • v-model:value="trainStation.trainCode": 将选择器的值绑定到trainStation对象的trainCode属性上,当选择一个选项时,trainStation.trainCode会自动更新为所选的值。
  • show-search: 启用搜索框,允许通过输入来过滤列表中的选项。
  • :filterOption="filterTrainCodeOption": 使用自定义的过滤函数filterTrainCodeOption来决定哪些选项应该在用户输入时显示。
  • v-for="item in trains": 遍历trains数组
  • :key="item.code": 为每个选项指定一个唯一的键,这里使用的是列车代码。
  • :value="item.code": 设置选项的值为列车代码,这将与v-model绑定的值对应。
  • :label="item.code + item.start + item.end": 定义选项的标签,这里是将列车代码、始发站和终点站的信息组合起来作为选项的显示文本。
  • {{item.code}} | {{item.start}} ~ {{item.end}}: 更好地显示
  • filterTrainCodeOption筛选列车选项的函数

为了方便,可以将车次制作成一个组件,然后引入到各个模块,然后车站也可以做出下拉框组件,引入到各个模块。限于篇幅,这里不在赘述。

查询

        由于火车各部分的数据量庞大,如果将所有数据全部显示,将会给系统带来显著的性能压力,并可能影响体验。因此,引入了条件查询机制,以便根据用户的具体需求动态加载和展示相关数据,从而优化性能并提升系统的响应速度。

对于后端的车站查询接口来说,如果是传入的train_code不为空,就根据请求参数得到的trainCode来进行查询,座位和车厢同理,只需要修改service层代码,以及增加参数的请求类型。

if(ObjectUtil.isNotEmpty(req.getTrainCode())) {criteria.andTrainCodeEqualTo(req.getTrainCode());
}package com.month.train.business.req;import com.month.train.common.req.PageReq;public class TrainSeatQueryReq extends PageReq {private String trainCode;public String getTrainCode() {return trainCode;}public void setTrainCode(String trainCode) {this.trainCode = trainCode;}@Overridepublic String toString() {return "TrainSeatQueryReq{" +"trainCode='" + trainCode + '\'' +"} " + super.toString();}
}

http://www.dtcms.com/wzjs/90051.html

相关文章:

  • 汕头企业制作网站品牌推广计划
  • 做网站建设网站制作互联网宣传推广
  • 长春火车站出站要求优化王
  • b站推广网站2024不用下载免费网站服务器
  • 自己建网站流程要学什么百度认证怎么认证
  • 代购网站怎么做的google ads 推广
  • 网站服务器规划 用户数网站如何做优化排名
  • 做淘宝客怎么建网站站长工具网址是多少
  • 微网站风格焦作网站seo
  • 做旅游网站多少钱怎么自己搭建网站
  • 哪里可以在百度做网站下载班级优化大师app
  • 哪个网站可以做加工代理的站长工具综合查询2020
  • 杭州做网站haomae运用搜索引擎营销的案例
  • 手机游戏的官方网站开发是同步进行的么share群组链接分享
  • 百度做的网站地推团队如何收费
  • expedia电子商务网站建设seo整站优化哪家好
  • 深圳英文网站制作免费放单平台无需垫付
  • 网站程序授权码天津seo排名扣费
  • 百度云 wordpress 教程西安市seo排名按天优化
  • 做百科权威网站有哪些地推平台去哪里找
  • 防城港做网站google浏览器下载
  • 怎么做公司展示网站万网查询
  • 哪个公司制作企业网站子域名查询工具
  • 自己做的电商网站要多少钱网店营销的推广方法有哪些
  • 装饰工程 技术支持 东莞网站建设重大新闻事件2023
  • Adobe Muse 商业网站sem推广竞价托管
  • web网站开发实例友情链接图片
  • 做b站类似的网站成都网站seo
  • 成都网站建设前50强百度问一问付费咨询
  • cms网站内容管理系统个人网站模板免费下载