4.30
地铁代码
<template> <view class="container"> <view class="example"> <uni-forms ref="form" :model="form" labelWidth="80px"> <uni-forms-item label="线路号" name="lineNo" required > <uni-data-select v-model="form.lineNo" :localdata="routeOptions"></uni-data-select> </uni-forms-item> <uni-forms-item label="全部站点" name="stations" > <uni-easyinput type="textarea" v-model="form.stations" placeholder="请输入全部站点" /> </uni-forms-item> </uni-forms> <view class="button-group"> <button type="default" style="padding:0 3em;font-size:14px" class="button" @click="reset">重置</button> <button type="primary" style="padding:0 3em;font-size:14px" class="button" @click="submit">提交</button> </view> </view> </view></template><script> import { addLines,getLines,listLines } from "@/api/system/lines";export default {components: {},data() { return { //字典类型筛选options routeOptions:[], form: {}, rules: { lineNo: { rules: [{ required: true, errorMessage: "线路号不能为空" }] }, } }},onLoad(option) { //字典类型查询 this.$dataDicts.getDicts("route").then(response => { this.routeOptions = this.$myUtils.getDictOption(response.data,'dictValue','dictLabel'); });},onReady() { this.$refs.form.setRules(this.rules)},methods: { /* 提交*/ submit() { console.log(this.form) this.$refs.form.validate().then(res => { addLines(this.form).then(response => { this.$modal.msgSuccess("新增成功") setTimeout(() => { // 返回到上一级父页面 this.$tab.navigateBack(); },500) }) }) }, /* 表单重置*/ reset(){ this.form = { id: undefined, lineNo: undefined, stations: undefined }; }}}</script><style lang="scss"> page { } .example { padding: 15px; } .button-group { margin-top: 15px; display: flex; justify-content: space-around; }</style>
package com.flx.common.entity.system.system;import org.apache.commons.lang3.builder.ToStringBuilder;import org.apache.commons.lang3.builder.ToStringStyle;import com.flx.common.annotation.Excel;import com.flx.common.entity.common.BaseEntity;/** * 地铁线对象 a_lines * * @author cxk * @date 2024-04-14 */public class ALines extends BaseEntity{ private static final long serialVersionUID = 1L; /** 主键id */ private Long id; /** 线路号 */ @Excel(name = "线路号") private String lineNo; /** 全部站点 */ @Excel(name = "全部站点") private String stations; public void setId(Long id) { this.id = id; } public Long getId() { return id; } public void setLineNo(String lineNo) { this.lineNo = lineNo; } public String getLineNo() { return lineNo; } public void setStations(String stations) { this.stations = stations; } public String getStations() { return stations; } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) .append("lineNo", getLineNo()) .append("stations", getStations()) .toString(); }}
package com.flx.system.project.system.controller;import java.util.List;import javax.servlet.http.HttpServletResponse;import javax.annotation.Resource;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;import com.flx.common.annotation.Log;import com.flx.common.enums.BusinessType;import com.flx.common.entity.system.ALines;import com.flx.system.service.IALinesService;import com.flx.common.response.BaseController;import com.flx.common.entity.common.domain.AjaxResult;import com.flx.common.utils.poi.ExcelUtil;import com.flx.common.entity.common.domain.page.TableDataInfo;import io.swagger.annotations.Api;import io.swagger.annotations.ApiImplicitParam;import io.swagger.annotations.ApiImplicitParams;import io.swagger.annotations.ApiOperation;import org.springframework.web.bind.annotation.*;/** * 地铁线Controller * * @author cxk * @date 2024-04-14 */@Api(tags={"地铁线管理"})@RestController@RequestMapping("/system-manage-service/system/lines")public class ALinesController extends BaseController{ @Resource private IALinesService aLinesService; /** * 查询地铁线列表 */ @ApiOperation(value="查询地铁线列表") @ApiImplicitParams({ @ApiImplicitParam(name = "aLines", value = "地铁线实体", dataType = "ALines", required = false), @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "Integer", defaultValue = "1", required = false), @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", defaultValue = "10", required = false) }) @GetMapping("/list") public TableDataInfo list(ALines aLines) { startPage(); List<ALines> list = aLinesService.selectALinesList(aLines); return getDataTable(list); } /** * 导出地铁线列表 */ @ApiOperation(value="导出地铁线列表") @ApiImplicitParam(name = "aLines", value = "地铁线实体", dataType = "ALines", required = false) @Log(title = "地铁线", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ALines aLines) { List<ALines> list = aLinesService.selectALinesList(aLines); ExcelUtil<ALines> util = new ExcelUtil<ALines>(ALines.class); util.exportExcel(response, list, "地铁线数据"); } /** * 获取地铁线详细信息 */ @ApiOperation(value="获取地铁线详细信息") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "地铁线Id", dataType = "Long", paramType = "query", required = true) }) @GetMapping(value = "/getInfo") public AjaxResult getInfo(@RequestParam Long id) { return success(aLinesService.selectALinesById(id)); } /** * 新增地铁线 */ @ApiOperation(value="新增地铁线") @ApiImplicitParam(name = "aLines", value = "地铁线实体", dataType = "ALines", required = true) @Log(title = "地铁线", businessType = BusinessType.INSERT) @PostMapping("/add") public AjaxResult add(@RequestBody ALines aLines) { return toAjax(aLinesService.insertALines(aLines)); } /** * 修改地铁线 */ @ApiOperation(value="修改地铁线") @ApiImplicitParam(name = "aLines", value = "地铁线实体", dataType = "ALines", required = true) @Log(title = "地铁线", businessType = BusinessType.UPDATE) @PostMapping("/edit") public AjaxResult edit(@RequestBody ALines aLines) { return toAjax(aLinesService.updateALines(aLines)); } /** * 删除地铁线 */ @ApiOperation(value="删除地铁线") @ApiImplicitParam(name = "ids", value = "地铁线数组", dataType = "Long[]", required = true) @Log(title = "地铁线", businessType = BusinessType.DELETE) @PostMapping("/remove") public AjaxResult remove(@RequestParam Long[] ids) { return toAjax(aLinesService.deleteALinesByIds(ids)); } /** * uniapp端删除地铁线 */ @ApiOperation(value="uniapp端删除地铁线") @ApiImplicitParam(name = "ids", value = "地铁线id(多个以逗号分隔)", dataType = "String", required = true) @Log(title = "地铁线", businessType = BusinessType.DELETE) @PostMapping("/delete") public AjaxResult delete(@RequestBody Map<String,String> map) { if(MapUtil.checkContains(map,"ids")){ String[] ids = map.get("ids").split(","); Long[] idArr = new Long[ids.length]; for (int i = 0; i < ids.length; i++) { idArr[i] = Long.parseLong(ids[i]); } return toAjax(aLinesService.deleteALinesByIds(idArr)); } return AjaxResult.error("请先选择地铁线!"); }}

浙公网安备 33010602011771号