From 160124b352c5f96ed0546af725620284c66290be Mon Sep 17 00:00:00 2001 From: Steven Moder Date: Wed, 19 Jun 2024 06:22:53 +0800 Subject: [PATCH] style: code clean --- .../controllers/FlightController.java | 5 ++--- .../controllers/GoodsController.java | 4 ++-- .../controllers/RequestController.java | 2 -- .../controllers/TicketController.java | 2 +- .../flightmanagement/pojo/vo/RequestVO.java | 4 ---- .../services/impl/FlightServiceImpl.java | 7 +++---- .../services/impl/GoodsServiceImpl.java | 1 - .../services/impl/TicketServiceImpl.java | 9 ++++----- web/src/views/home/staff/RequestView.vue | 19 +------------------ 9 files changed, 13 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/sakurapuare/flightmanagement/controllers/FlightController.java b/src/main/java/com/sakurapuare/flightmanagement/controllers/FlightController.java index aa88517..086213c 100644 --- a/src/main/java/com/sakurapuare/flightmanagement/controllers/FlightController.java +++ b/src/main/java/com/sakurapuare/flightmanagement/controllers/FlightController.java @@ -7,7 +7,6 @@ import com.sakurapuare.flightmanagement.pojo.vo.FlightVO; import com.sakurapuare.flightmanagement.services.FlightService; import com.sakurapuare.flightmanagement.services.user.AirlineService; - import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; @@ -55,7 +54,7 @@ public Response> getFlightList(@RequestParam("page") int page, @R @GetMapping("/my") public Response> getMyFlightList(@RequestParam("page") int page, @RequestParam("count") int count, - HttpServletRequest request) { + HttpServletRequest request) { Long userId = Long.parseLong(request.getAttribute("userId").toString()); List flightList = flightService.getFlightsByPaginationAndUserId(page, count, userId); @@ -106,7 +105,7 @@ public Response addFlight(@Valid @RequestBody FlightDTO flightDTO, HttpSer @PutMapping("/{id}") public Response updateFlight(@PathVariable(name = "id") long id, @RequestBody FlightDTO flightDTO, - HttpServletRequest request) { + HttpServletRequest request) { Long userId = Long.parseLong(request.getAttribute("userId").toString()); Airline airline = airlineService.getAirlineByUserId(userId); // Airline airline = airlineService.getAirlineById(flightDTO.getAirlineId()); diff --git a/src/main/java/com/sakurapuare/flightmanagement/controllers/GoodsController.java b/src/main/java/com/sakurapuare/flightmanagement/controllers/GoodsController.java index 59ac0a2..23d4e12 100644 --- a/src/main/java/com/sakurapuare/flightmanagement/controllers/GoodsController.java +++ b/src/main/java/com/sakurapuare/flightmanagement/controllers/GoodsController.java @@ -33,7 +33,7 @@ public Response> getGoodList(@RequestParam("page") int page, @Reques @GetMapping("/my") public Response> getMyGoodList(@RequestParam("page") int page, @RequestParam("count") int count, - HttpServletRequest request) { + HttpServletRequest request) { Long userId = Long.parseLong(request.getAttribute("userId").toString()); return Response.success(goodsService.getGoodsByPaginationAndUserId(page, count, userId)); } @@ -79,7 +79,7 @@ public Response addGood(@Valid @RequestBody GoodsDTO goodDTO) { @PutMapping("/{id}") public Response updateGood(@PathVariable(name = "id") long id, - @RequestBody GoodsDTO goodDTO) { + @RequestBody GoodsDTO goodDTO) { Goods good = goodsService.getGoodById(id); if (good == null) { return Response.error("Good not found"); diff --git a/src/main/java/com/sakurapuare/flightmanagement/controllers/RequestController.java b/src/main/java/com/sakurapuare/flightmanagement/controllers/RequestController.java index 1369659..53936a1 100644 --- a/src/main/java/com/sakurapuare/flightmanagement/controllers/RequestController.java +++ b/src/main/java/com/sakurapuare/flightmanagement/controllers/RequestController.java @@ -7,12 +7,10 @@ import com.sakurapuare.flightmanagement.pojo.vo.RequestVO; import com.sakurapuare.flightmanagement.services.RequestService; import com.sakurapuare.flightmanagement.services.user.UserService; - import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; - import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; diff --git a/src/main/java/com/sakurapuare/flightmanagement/controllers/TicketController.java b/src/main/java/com/sakurapuare/flightmanagement/controllers/TicketController.java index 0856b49..5707a82 100644 --- a/src/main/java/com/sakurapuare/flightmanagement/controllers/TicketController.java +++ b/src/main/java/com/sakurapuare/flightmanagement/controllers/TicketController.java @@ -41,7 +41,7 @@ public TicketController(TicketService ticketService, AirlineService airlineServi @GetMapping("/my") public Response> getMyTicketList(@RequestParam("page") int page, @RequestParam("count") int count, - HttpServletRequest request) { + HttpServletRequest request) { Long userId = Long.parseLong(request.getAttribute("userId").toString()); List ticketList = ticketService.getTicketsByPaginationAndUserId(page, count, userId); diff --git a/src/main/java/com/sakurapuare/flightmanagement/pojo/vo/RequestVO.java b/src/main/java/com/sakurapuare/flightmanagement/pojo/vo/RequestVO.java index 826c7d1..e47dec2 100644 --- a/src/main/java/com/sakurapuare/flightmanagement/pojo/vo/RequestVO.java +++ b/src/main/java/com/sakurapuare/flightmanagement/pojo/vo/RequestVO.java @@ -1,9 +1,5 @@ package com.sakurapuare.flightmanagement.pojo.vo; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; - import lombok.Data; @Data diff --git a/src/main/java/com/sakurapuare/flightmanagement/services/impl/FlightServiceImpl.java b/src/main/java/com/sakurapuare/flightmanagement/services/impl/FlightServiceImpl.java index c408c23..0e6be81 100644 --- a/src/main/java/com/sakurapuare/flightmanagement/services/impl/FlightServiceImpl.java +++ b/src/main/java/com/sakurapuare/flightmanagement/services/impl/FlightServiceImpl.java @@ -12,7 +12,6 @@ import com.sakurapuare.flightmanagement.pojo.entity.user.Airline; import com.sakurapuare.flightmanagement.services.FlightService; import com.sakurapuare.flightmanagement.services.user.AirlineService; - import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -33,7 +32,7 @@ public class FlightServiceImpl implements FlightService { private final AirlineService airlineService; public FlightServiceImpl(FlightMapper flightMapper, TicketMapper ticketMapper, OrderMapper orderMapper, - AirlineService airlineService) { + AirlineService airlineService) { this.flightMapper = flightMapper; this.ticketMapper = ticketMapper; this.orderMapper = orderMapper; @@ -110,8 +109,8 @@ public List getFlightsByPaginationAndUserId(int page, int count, Long us Airline airline = airlineService.getAirlineByUserId(userId); Page pagination = new Page<>(page, count); return flightMapper.selectPage(pagination, - new QueryWrapper() - .eq("airline_id", airline.getUserId())) + new QueryWrapper() + .eq("airline_id", airline.getUserId())) .getRecords(); } diff --git a/src/main/java/com/sakurapuare/flightmanagement/services/impl/GoodsServiceImpl.java b/src/main/java/com/sakurapuare/flightmanagement/services/impl/GoodsServiceImpl.java index 809b860..e74b01a 100644 --- a/src/main/java/com/sakurapuare/flightmanagement/services/impl/GoodsServiceImpl.java +++ b/src/main/java/com/sakurapuare/flightmanagement/services/impl/GoodsServiceImpl.java @@ -8,7 +8,6 @@ import com.sakurapuare.flightmanagement.pojo.entity.user.Merchant; import com.sakurapuare.flightmanagement.services.GoodsService; import com.sakurapuare.flightmanagement.services.user.MerchantService; - import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/sakurapuare/flightmanagement/services/impl/TicketServiceImpl.java b/src/main/java/com/sakurapuare/flightmanagement/services/impl/TicketServiceImpl.java index c5dbf8c..5adc234 100644 --- a/src/main/java/com/sakurapuare/flightmanagement/services/impl/TicketServiceImpl.java +++ b/src/main/java/com/sakurapuare/flightmanagement/services/impl/TicketServiceImpl.java @@ -12,7 +12,6 @@ import com.sakurapuare.flightmanagement.services.FlightService; import com.sakurapuare.flightmanagement.services.TicketService; import com.sakurapuare.flightmanagement.services.user.AirlineService; - import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -30,7 +29,7 @@ public class TicketServiceImpl implements TicketService { private FlightService flightService; public TicketServiceImpl(TicketMapper ticketMapper, OrderMapper orderMapper, AirlineService airlineService, - FlightService flightService) { + FlightService flightService) { this.ticketMapper = ticketMapper; this.orderMapper = orderMapper; this.airlineService = airlineService; @@ -122,9 +121,9 @@ public List getTicketsByPaginationAndUserId(int page, int count, Long us List flights = flightService.getFlightsListByAirlineId(airline.getAirlineId()); Page pagination = new Page<>(page, count); return ticketMapper.selectPage(pagination, - new QueryWrapper() - .in("flight_id", flights.stream().map( - Flight::getId).toArray())) + new QueryWrapper() + .in("flight_id", flights.stream().map( + Flight::getId).toArray())) .getRecords(); } diff --git a/web/src/views/home/staff/RequestView.vue b/web/src/views/home/staff/RequestView.vue index 3a3e9e5..ae06dab 100644 --- a/web/src/views/home/staff/RequestView.vue +++ b/web/src/views/home/staff/RequestView.vue @@ -8,33 +8,16 @@ import { TableV2FixedDir } from "element-plus"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { faPlus } from "@fortawesome/free-solid-svg-icons"; import ResizableTableComp from "@/components/ResizableTableComp.vue"; -import { - createRequestRequest, - getRequestResponse, - updateRequestRequest, -} from "@/types/request"; +import { createRequestRequest, getRequestResponse } from "@/types/request"; import { cancelRequestAPI, createRequestAPI, - deleteRequestAPI, getRequestsListAPI, handleRequestAPI, resolveRequestAPI, - updateRequestAPI, } from "@/apis/requests"; import { DateRender } from "@/utils/date"; -// export type Request = { -// userId: number; -// userName: string; -// info: string; -// status: string; -// handlerId: number; -// handlerName: string; -// createdAt: string; -// updatedAt: string; -// }; - const columns = [ { key: "ids",