Compare commits
13 Commits
Author | SHA1 | Date |
---|---|---|
|
b0241c68f2 | |
|
1268957b82 | |
|
1abb5c0478 | |
|
4b558ab882 | |
|
7b298d7993 | |
|
a669037c02 | |
|
b8ed9c0370 | |
|
7fa35df738 | |
|
4c00a43f89 | |
|
8d8b939cff | |
|
f9d6949bb6 | |
|
44ae184388 | |
|
8964c61eed |
|
@ -9,6 +9,7 @@
|
|||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/bwie-list/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/bwie-user/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/src/main/resources" charset="UTF-8" />
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.bwie.common.pojo.DTO;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DTOLogMake {
|
||||
|
||||
/*
|
||||
预约编号
|
||||
*/
|
||||
private Integer makeId;
|
||||
|
||||
/*
|
||||
车牌号
|
||||
*/
|
||||
private String carNum;
|
||||
|
||||
/*
|
||||
车位状态(空: 1, 已预约: 2, 无: 3)
|
||||
*/
|
||||
private Integer makeState;
|
||||
/*
|
||||
预约时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date makeTime;
|
||||
|
||||
/*
|
||||
停车场id
|
||||
*/
|
||||
private Integer parkingId;
|
||||
|
||||
/*
|
||||
用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.bwie.common.pojo.DTO;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DTOStop {
|
||||
/*
|
||||
停车编号
|
||||
*/
|
||||
private Integer stopId;
|
||||
/*
|
||||
车辆编号
|
||||
*/
|
||||
private Integer carId;
|
||||
/*
|
||||
用户编号
|
||||
*/
|
||||
private Integer userId;
|
||||
/*
|
||||
停车场编号
|
||||
*/
|
||||
private Integer parkingId;
|
||||
/*
|
||||
开始停车时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date stopStart;
|
||||
/*
|
||||
结束停车时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date stopEnd;
|
||||
/*
|
||||
停车时长
|
||||
*/
|
||||
private Integer stopTime;
|
||||
/*
|
||||
停车状态(1-待缴费 2-已交费)
|
||||
*/
|
||||
private Integer stopState;
|
||||
/*
|
||||
停车费用
|
||||
*/
|
||||
private Integer stopPrice;
|
||||
/*
|
||||
停车支付金额
|
||||
*/
|
||||
private Integer stopPay;
|
||||
|
||||
/*
|
||||
计算出来的停车时长
|
||||
*/
|
||||
private Integer time;
|
||||
}
|
|
@ -24,9 +24,10 @@ public class LogMake {
|
|||
*/
|
||||
private Integer makeId;
|
||||
/*
|
||||
车辆编号
|
||||
车牌号
|
||||
*/
|
||||
private Integer carId;
|
||||
private String carNum;
|
||||
|
||||
/*
|
||||
车位状态(空: 1, 已预约: 2, 无: 3)
|
||||
*/
|
||||
|
@ -38,7 +39,15 @@ public class LogMake {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date makeTime;
|
||||
|
||||
/*
|
||||
停车场id
|
||||
*/
|
||||
private Integer parkingId;
|
||||
|
||||
/*
|
||||
用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ public class Parking {
|
|||
*/
|
||||
private String parkingAddress;
|
||||
/*
|
||||
预约编号
|
||||
车位状态(空: 1, 已预约: 2, 无: 3)
|
||||
*/
|
||||
private Integer makeId;
|
||||
private Integer parkingState;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -56,7 +56,11 @@ public class Stop {
|
|||
*/
|
||||
private Integer stopState;
|
||||
/*
|
||||
停车费用
|
||||
停车应支付金额
|
||||
*/
|
||||
private String stopPrice;
|
||||
private Integer stopPrice;
|
||||
/*
|
||||
停车支付金额
|
||||
*/
|
||||
private Integer stopPay;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.bwie.common.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class VOLogMake {
|
||||
|
||||
/*
|
||||
车牌号
|
||||
*/
|
||||
private String carNum;
|
||||
|
||||
/*
|
||||
预约时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date makeTime;
|
||||
|
||||
/*
|
||||
用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.bwie.common.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class VOStop {
|
||||
|
||||
/*
|
||||
车牌号
|
||||
*/
|
||||
private String carNum;
|
||||
/*
|
||||
停车应支付费用
|
||||
*/
|
||||
private Integer stopPrice;
|
||||
/*
|
||||
停车支付金额
|
||||
*/
|
||||
private Integer stopPay;
|
||||
|
||||
public VOStop(String carNum, Integer stopPrice) {
|
||||
this.carNum = carNum;
|
||||
this.stopPrice = stopPrice;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>stopCar</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>bwie-list</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- 系统公共 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>bwie-common</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringBoot Web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!-- Mybatis 依赖配置 -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<!-- Pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.tobato</groupId>
|
||||
<artifactId>fastdfs-client</artifactId>
|
||||
<version>1.26.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
package com.bwie;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ListApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ListApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.bwie.list.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bwie.common.pojo.vo.VOLogMake;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.list.service.ParkingService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
@Log4j2
|
||||
public class ParkingController {
|
||||
@Autowired
|
||||
private ParkingService parkingService;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@PostMapping("/makeAppointment")
|
||||
public Result makeAppointment(@RequestBody VOLogMake voLogMake){
|
||||
log.info("功能名称:预约,请求URI:{},请求方式:{},请求参数:{}",
|
||||
request.getRequestURI(),request.getMethod(),voLogMake);
|
||||
|
||||
Result result = parkingService.makeAppointment(voLogMake);
|
||||
|
||||
log.info("功能名称:预约,请求URI:{},请求方式:{},响应结果:{}",
|
||||
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.bwie.list.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bwie.common.pojo.vo.VOStop;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.list.service.StopService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
@Log4j2
|
||||
public class StopConroller {
|
||||
@Autowired
|
||||
private StopService stopService;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* 回显
|
||||
* @param carNum
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findVOStop")
|
||||
public Result findVOStop(@RequestParam String carNum){
|
||||
log.info("功能名称:回显车牌号和应交停车费,请求URI:{},请求方式:{},请求参数:{}",
|
||||
request.getRequestURI(),request.getMethod(),carNum);
|
||||
Result result = stopService.findVOStop(carNum);
|
||||
log.info("功能名称:回显车牌号和应交停车费,请求URI:{},请求方式:{},响应结果:{}",
|
||||
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付模块
|
||||
* @param voStop
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/takeStopPrice")
|
||||
public Result takeStopPrice(@RequestBody VOStop voStop){
|
||||
log.info("功能名称:支付,请求URI:{},请求方式:{},请求参数:{}",
|
||||
request.getRequestURI(),request.getMethod(),voStop);
|
||||
Result result = stopService.takeStopPrice(voStop);
|
||||
log.info("功能名称:支付,请求URI:{},请求方式:{},响应结果:{}",
|
||||
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bwie.list.mapper;
|
||||
|
||||
import com.bwie.common.pojo.vo.VOLogMake;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ParkingMapper {
|
||||
|
||||
Integer makeAppointment(VOLogMake voLogMake);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.bwie.list.mapper;
|
||||
|
||||
import com.bwie.common.pojo.Car;
|
||||
import com.bwie.common.pojo.DTO.DTOStop;
|
||||
import com.bwie.common.pojo.Stop;
|
||||
import com.bwie.common.pojo.vo.VOStop;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface StopMapper {
|
||||
Car findCarId(VOStop voStop);
|
||||
|
||||
DTOStop findStartDate(@Param("carNum") String carNum);
|
||||
|
||||
Integer updateTime(Stop stop);
|
||||
|
||||
void addPay(@Param("userId") Integer userId, @Param("stopId") Integer stopId);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.bwie.list.service;
|
||||
|
||||
import com.bwie.common.pojo.vo.VOLogMake;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
public interface ParkingService {
|
||||
Result makeAppointment(VOLogMake voLogMake);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.bwie.list.service;
|
||||
|
||||
import com.bwie.common.pojo.vo.VOStop;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
public interface StopService {
|
||||
Result takeStopPrice(VOStop voStop);
|
||||
|
||||
Result findVOStop(String carNum);
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.bwie.list.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.bwie.common.constants.TokenConstants;
|
||||
import com.bwie.common.pojo.User;
|
||||
import com.bwie.common.pojo.vo.VOLogMake;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.common.utils.JwtUtils;
|
||||
import com.bwie.list.mapper.ParkingMapper;
|
||||
import com.bwie.list.service.ParkingService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Service
|
||||
public class ParkingServiceImpl implements ParkingService {
|
||||
@Autowired
|
||||
private ParkingMapper parkingMapper;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
@Autowired
|
||||
private RedisTemplate<String,String> redisTemplate;
|
||||
|
||||
@Override
|
||||
public Result makeAppointment(VOLogMake voLogMake) {
|
||||
|
||||
//1.获取用户信息
|
||||
String token = request.getHeader("token");
|
||||
String userKey = JwtUtils.getUserKey(token);
|
||||
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
||||
User user = JSON.parseObject(s, User.class);
|
||||
if (user != null) {
|
||||
voLogMake.setUserId(user.getUserId());
|
||||
}
|
||||
//2.添加预约信息
|
||||
System.out.println("开始添加");
|
||||
Integer i = parkingMapper.makeAppointment(voLogMake);
|
||||
if (i>0){
|
||||
return Result.success(voLogMake,"预约成功");
|
||||
}
|
||||
|
||||
return Result.error("预约异常");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.bwie.list.service.impl;
|
||||
|
||||
import com.bwie.common.pojo.Car;
|
||||
import com.bwie.common.pojo.DTO.DTOStop;
|
||||
import com.bwie.common.pojo.Stop;
|
||||
import com.bwie.common.pojo.vo.VOStop;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.list.mapper.StopMapper;
|
||||
import com.bwie.list.service.StopService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class StopServiceImpl implements StopService {
|
||||
@Autowired
|
||||
private StopMapper stopMapper;
|
||||
|
||||
@Override
|
||||
public Result takeStopPrice(VOStop voStop) {
|
||||
//1.查找车牌号获取用户信息
|
||||
Car car = stopMapper.findCarId(voStop);
|
||||
System.out.println("hahahha");
|
||||
//2.通过车牌号获取停车信息(得到停车时长)
|
||||
DTOStop dtoStop = stopMapper.findStartDate(voStop.getCarNum());
|
||||
//3.一个小时3元
|
||||
if (dtoStop!=null){
|
||||
Stop stop = new Stop();
|
||||
stop.setStopId(dtoStop.getStopId());
|
||||
stop.setStopTime(dtoStop.getTime());
|
||||
stop.setStopPay(voStop.getStopPay());
|
||||
stop.setStopPrice(voStop.getStopPrice());
|
||||
Integer i = stopMapper.updateTime(stop);
|
||||
if (i>0 && stop.getStopPrice().equals(stop.getStopPay())){
|
||||
//添加日志
|
||||
stopMapper.addPay(car.getUserId(),dtoStop.getStopId());
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success("支付成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findVOStop(String carNum) {
|
||||
DTOStop dtoStop = stopMapper.findStartDate(carNum);
|
||||
if (dtoStop!=null){
|
||||
if (dtoStop.getTime()<1){
|
||||
dtoStop.setStopPrice(3);
|
||||
}else {
|
||||
dtoStop.setStopPrice(dtoStop.getTime()*3);
|
||||
}
|
||||
return Result.success(dtoStop,"回显成功");
|
||||
}
|
||||
return Result.error("失败");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9003
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
application:
|
||||
# 应用名称
|
||||
name: bwie-list
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 82.157.236.130:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 82.157.236.130:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.bwie.list.mapper.ParkingMapper">
|
||||
|
||||
<insert id="makeAppointment">
|
||||
insert into `stop_car`.`log_make` (`car_num`,`make_time`,`user_id`)
|
||||
values (#{carNum},#{makeTime},#{userId})
|
||||
</insert>
|
||||
</mapper>
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.bwie.list.mapper.StopMapper">
|
||||
|
||||
<insert id="addPay">
|
||||
insert into `stop_car`.`log_pay` (`user_id`,`stop_id`,`pay_date`) values (#{userId},#{stopId},NOW())
|
||||
</insert>
|
||||
|
||||
<update id="updateTime">
|
||||
UPDATE `stop_car`.`t_stop` SET`stop_end` = now(), `stop_time` = #{stopTime}, `stop_state` = 2, `stop_price` = #{stopPrice}, `stop_pay` = #{stopPay} WHERE `stop_id` =#{stopId}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="findCarId" resultType="com.bwie.common.pojo.Car">
|
||||
select c.car_id,c.car_name,c.car_num,c.car_card,c.user_id,u.user_name,u.user_sex
|
||||
FROM t_car c
|
||||
LEFT JOIN t_user u on c.user_id = u.user_id
|
||||
where c.car_num=#{carNum}
|
||||
</select>
|
||||
<select id="findStartDate" resultType="com.bwie.common.pojo.DTO.DTOStop">
|
||||
select s.stop_id,s.parking_id,p.parking_name,p.parking_address,s.stop_start,stop_end,stop_time,
|
||||
s.stop_state,s.stop_price,s.car_id,c.car_name,c.car_num,c.car_card,s.user_id,u.user_name,
|
||||
u.user_phone,TIMESTAMPDIFF(HOUR,stop_start,NOW()) `time`
|
||||
FROM t_stop s
|
||||
LEFT JOIN t_car c on s.car_id = c.car_id
|
||||
LEFT JOIN t_user u on s.user_id=u.user_id
|
||||
LEFT JOIN t_parking p on s.parking_id = p.parking_id
|
||||
where c.car_num=#{carNum}
|
||||
</select>
|
||||
<!--
|
||||
select s.stop_id,s.parking_id,s.stop_start,stop_end,stop_time,s.stop_state,
|
||||
s.stop_price,s.car_id,c.car_name,c.car_num,c.car_card,s.user_id,u.user_name,u.user_phone
|
||||
FROM t_stop s
|
||||
LEFT JOIN t_car c on s.car_id = c.car_id
|
||||
LEFT JOIN t_user u on s.user_id=u.user_id
|
||||
-->
|
||||
</mapper>
|
Loading…
Reference in New Issue