Procházet zdrojové kódy

停车记录编辑

zhupeng před 3 roky
rodič
revize
d8b5f36025

+ 33 - 0
src/main/java/com/charging/chargingparking/modules/backController/BackParkingPayController.java

@@ -14,6 +14,8 @@ import com.charging.chargingparking.service.ParkingRecordService;
 import com.charging.chargingparking.utils.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -32,6 +34,8 @@ import java.util.Map;
 @RequestMapping("/backParkingPay")
 public class BackParkingPayController {
 
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
     @Autowired
     private ParkingRecordService parkingRecordService;
 
@@ -59,6 +63,35 @@ public class BackParkingPayController {
         return messageResult;
     }
 
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<ParkingPay> edit(@PathVariable("id") String id){
+        MessageResult<ParkingPay> msgResult = new MessageResult<>();
+
+        try {
+            ParkingPay parkingPayInfo = parkingPayService.getById(id);
+            ParkingRecord parkingRecord = parkingRecordService.getById(parkingPayInfo.getParkingRecordId());
+            if (parkingRecord != null) {
+                parkingPayInfo.setCarNum(parkingRecord.getCarNum());
+            }
+            if (parkingPayInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(parkingPayInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
     @ApiOperation(value = "列表")
     @RequestMapping(value = "pageList", method = RequestMethod.POST)
     public MessageResult<Map> pageList(

+ 36 - 2
src/main/java/com/charging/chargingparking/modules/backController/BackParkingRecordController.java

@@ -6,6 +6,7 @@ import com.charging.chargingparking.dto.MessageResult;
 import com.charging.chargingparking.dto.PojoUtils;
 import com.charging.chargingparking.entity.ParkingInfo;
 import com.charging.chargingparking.entity.ParkingMember;
+import com.charging.chargingparking.entity.ParkingPay;
 import com.charging.chargingparking.entity.ParkingRecord;
 import com.charging.chargingparking.modules.common.dto.Sort;
 import com.charging.chargingparking.service.ParkingInfoService;
@@ -13,6 +14,8 @@ import com.charging.chargingparking.service.ParkingRecordService;
 import com.charging.chargingparking.utils.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -31,6 +34,8 @@ import java.util.Map;
 @RequestMapping("/backParkingRecord")
 public class BackParkingRecordController {
 
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
     @Autowired
     private ParkingInfoService parkingInfoService;
 
@@ -76,6 +81,35 @@ public class BackParkingRecordController {
         return messageResult;
     }
 
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<ParkingRecord> edit(@PathVariable("id") String id){
+        MessageResult<ParkingRecord> msgResult = new MessageResult<>();
+
+        try {
+            ParkingRecord parkingRecordInfo = parkingRecordService.getById(id);
+            ParkingInfo parkingInfo = parkingInfoService.getById(parkingRecordInfo.getParkId());
+            if (parkingInfo != null) {
+                parkingRecordInfo.setParkName(parkingInfo.getParkingName());
+            }
+            if (parkingRecordInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(parkingRecordInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
     @ApiOperation(value = "列表")
     @RequestMapping(value = "pageList", method = RequestMethod.POST)
     public MessageResult<Map> pageList(
@@ -145,14 +179,14 @@ public class BackParkingRecordController {
         }
 
         com.github.pagehelper.Page<ParkingRecord> page = parkingRecordService.pageSearch(searchParams, pageIndex, pageSize, sortList);
-
+/*
         for (ParkingRecord parkingMember : page) {
             ParkingInfo parkingInfo = parkingInfoService.getById(parkingMember.getParkId());
             if (parkingInfo != null) {
                 parkingMember.setParkName(parkingInfo.getParkingName());
             }
         }
-
+*/
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));
 

+ 2 - 2
src/main/resources/mapper/ParkingRecordMapper.xml

@@ -56,9 +56,9 @@
 
     <select id="search" parameterType="hashmap" resultMap="BaseResultMap">
         <![CDATA[
-			select * from base_parking_record a
+			select a.*,b.parking_name as park_name  from base_parking_record a join base_parking_info b
 		]]>
-        where a.del_flag=false
+        where a.del_flag=false and b.del_flag = false and a.park_id = b.id
         <if test="searchParams.carNum != null">
             and a.car_num like #{searchParams.carNum}
         </if>