├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── src └── main │ ├── resources │ ├── static │ │ ├── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ │ ├── css │ │ │ ├── index.css │ │ │ ├── showForm.css │ │ │ └── navgation.css │ │ ├── managerUser.html │ │ ├── html │ │ │ ├── userPage.html │ │ │ └── test.html │ │ ├── js │ │ │ ├── addFlight.js │ │ │ ├── alterTicket.js │ │ │ ├── login.js │ │ │ ├── showTicket.js │ │ │ ├── showForm.js │ │ │ ├── alterFlight.js │ │ │ ├── order.js │ │ │ ├── showFlight.js │ │ │ ├── managerTicket.js │ │ │ └── managerFlight.js │ │ ├── index.html │ │ ├── showTicket.html │ │ ├── showForm.html │ │ ├── managerTicket.html │ │ ├── managerFlight.html │ │ ├── alterTicket.html │ │ ├── order.html │ │ ├── showFlight.html │ │ ├── alterFlight.html │ │ ├── addFlight.html │ │ └── dist │ │ │ ├── js │ │ │ └── jquery.cookie.js │ │ │ └── css │ │ │ ├── bootstrap-reboot.min.css │ │ │ └── bootstrap-reboot.css │ ├── application.yml │ └── mybatis-generator.xml │ └── java │ └── com │ └── ticketsystem │ ├── TicketSystemApplication.java │ ├── controller │ ├── loginController.java │ ├── TicketController.java │ ├── FlightController.java │ └── OrderFormController.java │ ├── service │ ├── CheckService.java │ ├── FlightService.java │ ├── TicketService.java │ └── FormService.java │ ├── model │ ├── OrderForm.java │ ├── User.java │ ├── Ticket.java │ ├── Flight.java │ ├── OrderFormExample.java │ ├── UserExample.java │ └── TicketExample.java │ └── dao │ ├── UserMapper.java │ ├── OrderFormMapper.java │ ├── TicketMapper.java │ ├── FlightMapper.java │ ├── UserSqlProvider.java │ ├── OrderFormSqlProvider.java │ ├── TicketSqlProvider.java │ └── FlightSqlProvider.java ├── README.md ├── .gitignore ├── pom.xml ├── mvnw.cmd └── mvnw /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Guns-Roses/airplane/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /src/main/resources/static/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Guns-Roses/airplane/HEAD/src/main/resources/static/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /src/main/resources/static/css/index.css: -------------------------------------------------------------------------------- 1 | .center{ 2 | text-align: center; 3 | vertical-align: center; 4 | } 5 | #navigation{ 6 | height: 100px; 7 | } -------------------------------------------------------------------------------- /src/main/resources/static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Guns-Roses/airplane/HEAD/src/main/resources/static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /src/main/resources/static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Guns-Roses/airplane/HEAD/src/main/resources/static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /src/main/resources/static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Guns-Roses/airplane/HEAD/src/main/resources/static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /src/main/resources/static/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Guns-Roses/airplane/HEAD/src/main/resources/static/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 毕业设计-飞机订票系统 2 | 3 | ## 1.开发环境 4 | 5 | 操作系统:win10
6 | 数据库:mysql——5.6.7
7 | 开发语言:java(jdk8)
8 | 开发工具:IDEA
9 | 代码管理工具:GitHub
10 | -------------------------------------------------------------------------------- /src/main/resources/static/css/showForm.css: -------------------------------------------------------------------------------- 1 | table a:link{ 2 | color: black; 3 | } 4 | table a:hover{ 5 | text-decoration: none; 6 | } 7 | table a:visited{ 8 | color:black; 9 | } -------------------------------------------------------------------------------- /src/main/resources/static/managerUser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9999 3 | 4 | spring: 5 | datasource: 6 | driver-class-name: com.mysql.jdbc.Driver 7 | url: jdbc:mysql://127.0.0.1:3306/ticket?useSSL=false 8 | username: root 9 | password: root 10 | 11 | mybatis: 12 | type-aliases-package: com.ticketsystem.entity 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /src/main/resources/static/css/navgation.css: -------------------------------------------------------------------------------- 1 | li.nav-font{ 2 | padding-bottom: 10px; 3 | padding-top: 10px; 4 | } 5 | li.nav-font a:link{ 6 | color: white; 7 | } 8 | li.nav-font a:hover{ 9 | text-decoration: none; 10 | } 11 | li.nav-font a:visited{ 12 | color: white; 13 | } 14 | li.nav-font a{ 15 | border-bottom-color: black; 16 | } 17 | 18 | #center-content-nav{ 19 | height: 700px; 20 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/TicketSystemApplication.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("com.ticketsystem.dao") 9 | public class TicketSystemApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(TicketSystemApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/static/html/userPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 18 | 19 | 20 |

21 | 22 | -------------------------------------------------------------------------------- /src/main/resources/static/js/addFlight.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | $("#submitAddFlight").click(function () { 3 | var jsonObj = new Object(); 4 | jsonObj.flightId = $("#filghtId").val(); 5 | jsonObj.startCity = $("#startCity").val(); 6 | jsonObj.endCity = $("#endCity").val(); 7 | jsonObj.startTime = $("#startTime").val(); 8 | jsonObj.peopleNumber = $("#peopleNum").val(); 9 | jsonObj.leftTicket = $("#leftTicket").val(); 10 | jsonObj.ticketPrice = $("#price").val(); 11 | 12 | $.ajax({ 13 | url:"/flight/add", 14 | contentType:"application/json;charset=utf-8", 15 | type:"POST", 16 | data:JSON.stringify(jsonObj), 17 | success:function () { 18 | alert("提交成功") 19 | } 20 | }) 21 | }) 22 | }) -------------------------------------------------------------------------------- /src/main/resources/static/html/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 菜鸟教程(runoob.com) 6 | 8 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/controller/loginController.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.controller; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.alibaba.fastjson.TypeReference; 6 | import com.ticketsystem.model.User; 7 | import com.ticketsystem.service.CheckService; 8 | import org.mybatis.spring.annotation.MapperScan; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | 15 | @RestController 16 | @MapperScan("com.ticketsystem.dao") 17 | public class loginController { 18 | 19 | @Autowired 20 | private CheckService checkService; 21 | 22 | @RequestMapping("/user") 23 | @ResponseBody 24 | public User token(@RequestBody Map param){ 25 | String username = param.get("username"); 26 | String password = param.get("password"); 27 | User user = new User(); 28 | user.setUserName(username); 29 | user.setUserPassword(password); 30 | return checkService.getToken(user); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/resources/static/js/alterTicket.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | var ticketId = location.search.split("ticketId=")[1]; 3 | var jsonObj = new Object(); 4 | jsonObj.ticketId = ticketId; 5 | 6 | $.ajax({ 7 | url:"/ticket/ticketId", 8 | contentType:"application/json;charset=utf-8", 9 | type:"POST", 10 | data:JSON.stringify(jsonObj), 11 | success:function (data) { 12 | $("#flightId").val(data.flightId); 13 | $("#passengerName").val(data.passengerName); 14 | $("#price").val(data.price); 15 | } 16 | }); 17 | 18 | $("#submitAltTicket").click(function () { 19 | jsonObj.flightId = $("#flightId").val(); 20 | jsonObj.passengerName = $("#passengerName").val(); 21 | jsonObj.price = $("#price").val(); 22 | 23 | $.ajax({ 24 | url:"/ticket/altTicket", 25 | type:"POST", 26 | contentType:"application/json;charset=utf8", 27 | data:JSON.stringify(jsonObj), 28 | success:function () { 29 | alert("修改成功"); 30 | } 31 | }) 32 | }) 33 | }) -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/service/CheckService.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.service; 2 | 3 | import com.ticketsystem.dao.UserMapper; 4 | import com.ticketsystem.model.User; 5 | import com.ticketsystem.model.UserExample; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class CheckService { 11 | 12 | @Autowired 13 | private UserMapper userMapper; 14 | 15 | public User getToken(User user){ 16 | UserExample userExample = new UserExample(); 17 | UserExample.Criteria criteria = userExample.createCriteria(); 18 | criteria.andUserNameEqualTo(user.getUserName()); 19 | if(userMapper.selectByExample(userExample).size() != 0){ 20 | criteria.andUserPasswordEqualTo(user.getUserPassword()); 21 | if(userMapper.selectByExample(userExample).size() != 0){ 22 | user = userMapper.selectByExample(userExample).get(0); 23 | return user; 24 | } 25 | else 26 | return null; 27 | }else { 28 | return null; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/static/js/login.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | $("#login-btn").click(function () { 3 | var name = $("#name").val(); 4 | var pwd = $("#pwd").val(); 5 | var jsonObj = new Object(); 6 | jsonObj.username = name; 7 | jsonObj.password = pwd; 8 | $.ajax({ 9 | url:"/user", 10 | data:JSON.stringify(jsonObj), 11 | type:"POST", 12 | contentType:"application/json; charset=utf-8", 13 | success:function (data) { 14 | if(data == null) 15 | alert("登录失败"); 16 | else{ 17 | alert("登录成功"); 18 | $.cookie("username",name); 19 | if(data.isManager == 1) 20 | window.location = "managerFlight.html"; 21 | else if(data.isVip == 1) { 22 | window.location = "showFlight.html"; 23 | alert("尊敬的会员,您可以享受八折优惠"); 24 | }else { 25 | window.location = "showFlight.html"; 26 | } 27 | } 28 | } 29 | }); 30 | //这里的post地址是本地的,记得后面修改 31 | }) 32 | }) -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/model/OrderForm.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.model; 2 | 3 | import java.util.Date; 4 | 5 | public class OrderForm { 6 | private Integer orderFormId; 7 | 8 | private Integer userId; 9 | 10 | private Integer ticketNumber; 11 | 12 | private Float totalPrice; 13 | 14 | private Date orderTime; 15 | 16 | public Integer getOrderFormId() { 17 | return orderFormId; 18 | } 19 | 20 | public void setOrderFormId(Integer orderFormId) { 21 | this.orderFormId = orderFormId; 22 | } 23 | 24 | public Integer getUserId() { 25 | return userId; 26 | } 27 | 28 | public void setUserId(Integer userId) { 29 | this.userId = userId; 30 | } 31 | 32 | public Integer getTicketNumber() { 33 | return ticketNumber; 34 | } 35 | 36 | public void setTicketNumber(Integer ticketNumber) { 37 | this.ticketNumber = ticketNumber; 38 | } 39 | 40 | public Float getTotalPrice() { 41 | return totalPrice; 42 | } 43 | 44 | public void setTotalPrice(Float totalPrice) { 45 | this.totalPrice = totalPrice; 46 | } 47 | 48 | public Date getOrderTime() { 49 | return orderTime; 50 | } 51 | 52 | public void setOrderTime(Date orderTime) { 53 | this.orderTime = orderTime; 54 | } 55 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/model/User.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.model; 2 | 3 | public class User { 4 | private Integer userId; 5 | 6 | private String isManager; 7 | 8 | private String userName; 9 | 10 | private String userPassword; 11 | 12 | private Short isVip; 13 | 14 | public Integer getUserId() { 15 | return userId; 16 | } 17 | 18 | public void setUserId(Integer userId) { 19 | this.userId = userId; 20 | } 21 | 22 | public String getIsManager() { 23 | return isManager; 24 | } 25 | 26 | public void setIsManager(String isManager) { 27 | this.isManager = isManager == null ? null : isManager.trim(); 28 | } 29 | 30 | public String getUserName() { 31 | return userName; 32 | } 33 | 34 | public void setUserName(String userName) { 35 | this.userName = userName == null ? null : userName.trim(); 36 | } 37 | 38 | public String getUserPassword() { 39 | return userPassword; 40 | } 41 | 42 | public void setUserPassword(String userPassword) { 43 | this.userPassword = userPassword == null ? null : userPassword.trim(); 44 | } 45 | 46 | public Short getIsVip() { 47 | return isVip; 48 | } 49 | 50 | public void setIsVip(Short isVip) { 51 | this.isVip = isVip; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/resources/static/js/showTicket.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | var orderFormId = location.search.split("orderFormId=")[1]; 3 | var jsonObj = new Object(); 4 | jsonObj.orderFormId = orderFormId; 5 | $.ajax({ 6 | url:"/ticket/formId", 7 | contentType:"application/json;charset=utf-8", 8 | type:"POST", 9 | data:JSON.stringify(jsonObj), 10 | success:function (data) { 11 | showData(data); 12 | } 13 | }) 14 | }); 15 | 16 | 17 | function showData(data){ 18 | /*"ticketId": 1, 19 | "flightId": 1, 20 | "orderFormId": 1, 21 | "price": 1000, 22 | "discount": 1, 23 | "passengerName": "liu", 24 | "passengeId": null*/ 25 | for(var i = 0; i < data.length; i++){ 26 | var tr = document.createElement("tr"); 27 | var flightIdTd = document.createElement("td"); 28 | flightIdTd.append(data[i].flightId); 29 | var priceTd = document.createElement("td"); 30 | priceTd.append(data[i].price); 31 | var passengerName = document.createElement("td"); 32 | passengerName.append(data[i].passengerName); 33 | var operateTd = document.createElement("td"); 34 | tr.appendChild(flightIdTd); 35 | tr.appendChild(passengerName); 36 | tr.appendChild(priceTd); 37 | $("#tbody-ticket").append(tr); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/model/Ticket.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.model; 2 | 3 | public class Ticket { 4 | private Integer ticketId; 5 | 6 | private Integer flightId; 7 | 8 | private Integer orderFormId; 9 | 10 | private Float price; 11 | 12 | private Float discount; 13 | 14 | private String passengerName; 15 | 16 | public Integer getTicketId() { 17 | return ticketId; 18 | } 19 | 20 | public void setTicketId(Integer ticketId) { 21 | this.ticketId = ticketId; 22 | } 23 | 24 | public Integer getFlightId() { 25 | return flightId; 26 | } 27 | 28 | public void setFlightId(Integer flightId) { 29 | this.flightId = flightId; 30 | } 31 | 32 | public Integer getOrderFormId() { 33 | return orderFormId; 34 | } 35 | 36 | public void setOrderFormId(Integer orderFormId) { 37 | this.orderFormId = orderFormId; 38 | } 39 | 40 | public Float getPrice() { 41 | return price; 42 | } 43 | 44 | public void setPrice(Float price) { 45 | this.price = price; 46 | } 47 | 48 | public Float getDiscount() { 49 | return discount; 50 | } 51 | 52 | public void setDiscount(Float discount) { 53 | this.discount = discount; 54 | } 55 | 56 | public String getPassengerName() { 57 | return passengerName; 58 | } 59 | 60 | public void setPassengerName(String passengerName) { 61 | this.passengerName = passengerName == null ? null : passengerName.trim(); 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/resources/static/js/showForm.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | var jsonObj = new Object(); 3 | jsonObj.username = $.cookie("username");//cookie 4 | $.ajax({ 5 | url:"/form/all", 6 | data:JSON.stringify(jsonObj), 7 | type:"POST", 8 | contentType:"application/json;charset=utf-8", 9 | success:function (data) { 10 | showData(data); 11 | } 12 | }) 13 | 14 | }); 15 | 16 | function showData(data) { 17 | /*"orderFormId": 1, 18 | "userId": 1, 19 | "ticketNumber": 1, 20 | "totalPrice": 1000, 21 | "orderTime": "2018-06-03T07:47:54.000+0000"*/ 22 | for(var i = 0;i < data.length; i++){ 23 | var tr = document.createElement('tr'); 24 | var orderTTd = document.createElement('td'); 25 | orderTTd.append(data[i].orderTime); 26 | var ticketNTd = document.createElement('td'); 27 | ticketNTd.append(data[i].ticketNumber); 28 | var totalPTd = document.createElement('td'); 29 | totalPTd.append(data[i].totalPrice); 30 | var operateTd = document.createElement("td"); 31 | var orderOpe = document.createElement('a'); 32 | orderOpe.innerText = "查看"; 33 | orderOpe.href = "showTicket.html?orderFormId=" + data[i].orderFormId; 34 | operateTd.append(orderOpe); 35 | tr.appendChild(orderTTd); 36 | tr.appendChild(ticketNTd); 37 | tr.appendChild(totalPTd); 38 | tr.appendChild(operateTd); 39 | $("#tbody-form").append(tr); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/service/FlightService.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.service; 2 | 3 | import com.ticketsystem.dao.FlightMapper; 4 | import com.ticketsystem.model.Flight; 5 | import com.ticketsystem.model.FlightExample; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | @Service 12 | public class FlightService { 13 | 14 | @Autowired 15 | private FlightMapper flightMapper; 16 | 17 | public List getAllFlight(){ 18 | return flightMapper.selectByExample(new FlightExample()); 19 | } 20 | 21 | public Flight getFlightById(int flightId){ 22 | return flightMapper.selectByPrimaryKey(flightId); 23 | } 24 | 25 | public void altFlight(Flight flight){ 26 | flightMapper.updateByPrimaryKeySelective(flight); 27 | } 28 | 29 | public void delFlight(int flightId){ 30 | flightMapper.deleteByPrimaryKey(flightId); 31 | } 32 | 33 | public List queryByCity(String startCity, String endCity){ 34 | FlightExample flightExample = new FlightExample(); 35 | FlightExample.Criteria criteria = flightExample.createCriteria(); 36 | if(startCity != "") 37 | criteria.andStartCityEqualTo(startCity); 38 | if(endCity != "") 39 | criteria.andEndCityEqualTo(endCity); 40 | return flightMapper.selectByExample(flightExample); 41 | } 42 | 43 | public void addFlight(Flight flight){ 44 | flightMapper.insert(flight); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/resources/static/js/alterFlight.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | var flightId = location.search.split("flightId=")[1]; 3 | var jsonObj = new Object(); 4 | jsonObj.flightId = flightId; 5 | 6 | $.ajax({ 7 | url:"flight/flightId", 8 | contentType:"application/json;charset=utf-8", 9 | type:"POST", 10 | data:JSON.stringify(jsonObj), 11 | success:function (data) { 12 | /* 13 | "flightId": 1, 14 | "startTime": "2018-06-08T13:00:50.000+0000", 15 | "startCity": "shanghai", 16 | "endCity": "beijing", 17 | "peopleNumber": 100, 18 | "leftTicket": 50, 19 | "ticketPrice": 1000*/ 20 | $("#startTime").val(data.startTime); 21 | $("#startCity").val(data.startCity); 22 | $("#endCity").val(data.endCity); 23 | $("#peopleNum").val(data.peopleNumber); 24 | $("#leftTicket").val(data.leftTicket); 25 | $("#price").val(data.ticketPrice); 26 | } 27 | }); 28 | 29 | $("#submitAltFlight").click(function () { 30 | jsonObj.startTime = $("#startTime").val(); 31 | jsonObj.startCity = $("#startCity").val(); 32 | jsonObj.endCity = $("#endCity").val(); 33 | jsonObj.peopleNumber = $("#peopleNum").val(); 34 | jsonObj.leftTicket = $("#leftTicket").val(); 35 | jsonObj.ticketPrice = $("#price").val(); 36 | 37 | $.ajax({ 38 | url:"/flight/altFlight", 39 | contentType:"application/json;charset=utf-8", 40 | type:"POST", 41 | data:JSON.stringify(jsonObj), 42 | success:function () { 43 | alert("修改成功"); 44 | } 45 | }) 46 | }) 47 | }) -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/model/Flight.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.model; 2 | 3 | import java.util.Date; 4 | 5 | public class Flight { 6 | private Integer flightId; 7 | 8 | private Date startTime; 9 | 10 | private String startCity; 11 | 12 | private String endCity; 13 | 14 | private Integer peopleNumber; 15 | 16 | private Integer leftTicket; 17 | 18 | private Float ticketPrice; 19 | 20 | public Integer getFlightId() { 21 | return flightId; 22 | } 23 | 24 | public void setFlightId(Integer flightId) { 25 | this.flightId = flightId; 26 | } 27 | 28 | public Date getStartTime() { 29 | return startTime; 30 | } 31 | 32 | public void setStartTime(Date startTime) { 33 | this.startTime = startTime; 34 | } 35 | 36 | public String getStartCity() { 37 | return startCity; 38 | } 39 | 40 | public void setStartCity(String startCity) { 41 | this.startCity = startCity == null ? null : startCity.trim(); 42 | } 43 | 44 | public String getEndCity() { 45 | return endCity; 46 | } 47 | 48 | public void setEndCity(String endCity) { 49 | this.endCity = endCity == null ? null : endCity.trim(); 50 | } 51 | 52 | public Integer getPeopleNumber() { 53 | return peopleNumber; 54 | } 55 | 56 | public void setPeopleNumber(Integer peopleNumber) { 57 | this.peopleNumber = peopleNumber; 58 | } 59 | 60 | public Integer getLeftTicket() { 61 | return leftTicket; 62 | } 63 | 64 | public void setLeftTicket(Integer leftTicket) { 65 | this.leftTicket = leftTicket; 66 | } 67 | 68 | public Float getTicketPrice() { 69 | return ticketPrice; 70 | } 71 | 72 | public void setTicketPrice(Float ticketPrice) { 73 | this.ticketPrice = ticketPrice; 74 | } 75 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/controller/TicketController.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.ticketsystem.model.Ticket; 5 | import com.ticketsystem.service.TicketService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | @RestController 16 | @RequestMapping("/ticket") 17 | public class TicketController { 18 | @Autowired 19 | TicketService ticketService; 20 | 21 | @RequestMapping("/all") 22 | public List getAll(){ 23 | return ticketService.getAllTicket(); 24 | } 25 | 26 | @RequestMapping("/formId") 27 | public List getByFormId(@RequestBody Map map){ 28 | return ticketService.getTicketByFormId(Integer.parseInt(map.get("orderFormId"))); 29 | } 30 | 31 | @RequestMapping("ticketId") 32 | public Ticket getById(@RequestBody Map map){ 33 | int id = Integer.parseInt(map.get("ticketId")); 34 | return ticketService.getTicketById(id); 35 | } 36 | 37 | @RequestMapping("altTicket") 38 | public void alterTicket(@RequestBody Map map){ 39 | int flightId = Integer.parseInt(map.get("flightId")); 40 | String passengerName = map.get("passengerName"); 41 | float price = Float.parseFloat(map.get("price")); 42 | int ticketId = Integer.parseInt(map.get("ticketId")); 43 | ticketService.altTicket(ticketId,flightId,passengerName,price); 44 | } 45 | 46 | @RequestMapping("deleteById") 47 | public void deleteTicket(@RequestBody JSONObject jsonObject){ 48 | int ticketId = jsonObject.getInteger("ticketId"); 49 | ticketService.deleteById(ticketId); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/controller/FlightController.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.controller; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.ticketsystem.model.Flight; 6 | import com.ticketsystem.service.FlightService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | @RestController 16 | @RequestMapping("/flight") 17 | public class FlightController { 18 | 19 | @Autowired 20 | private FlightService flightService; 21 | 22 | @RequestMapping("all") 23 | public List getAllFlight(){ 24 | return flightService.getAllFlight(); 25 | } 26 | 27 | @RequestMapping("flightId") 28 | public Flight getFlightById(@RequestBody Map map){ 29 | int flightId = Integer.parseInt(map.get("flightId")); 30 | return flightService.getFlightById(flightId); 31 | } 32 | 33 | @RequestMapping("city") 34 | public List getByCity(@RequestBody JSONObject jsonObject){ 35 | return flightService.queryByCity(jsonObject.getString("startCity"),jsonObject.getString("endCity")); 36 | } 37 | 38 | @RequestMapping("altFlight") 39 | public void altFlight(@RequestBody JSONObject jsonObject){ 40 | Flight flight = JSONObject.parseObject(jsonObject.toJSONString(),Flight.class); 41 | flightService.altFlight(flight); 42 | } 43 | 44 | @RequestMapping("deleteById") 45 | public void delFlight(@RequestBody JSONObject jsonObject){ 46 | int id = jsonObject.getInteger("flightId"); 47 | flightService.delFlight(id); 48 | } 49 | 50 | @RequestMapping("add") 51 | public void addFlight(@RequestBody JSONObject jsonObject){ 52 | Flight flight = JSONObject.parseObject(jsonObject.toJSONString(),Flight.class); 53 | flightService.addFlight(flight); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/resources/static/js/order.js: -------------------------------------------------------------------------------- 1 | var jsonObj = new Object(); 2 | 3 | $(document).ready(function () { 4 | var url = location.search; 5 | var flightId = url.split("flightId=")[1]; 6 | var i = 1; 7 | 8 | $("#addBtn").click(function () { 9 | i++; 10 | var div = document.createElement('div'); 11 | div.className = "form-group"; 12 | var label = document.createElement('label'); 13 | label.innerText = "乘客姓名"; 14 | var input = document.createElement('input'); 15 | input.type = "text"; 16 | input.className = "form-control"; 17 | input.id = "passengerName" + i; 18 | div.append(label); 19 | div.append(input); 20 | $("#formOrder").append(div); 21 | }); 22 | 23 | /* { 24 | "username":"admin", 25 | "flightId":"1", 26 | "ticketNumber":"2", 27 | "passengerNames":[{ 28 | "passengerName":"liu" 29 | },{ 30 | "passengerName":"zhao" 31 | }] 32 | }*/ 33 | 34 | $("#submit").click(function () { 35 | jsonObj.username = $.cookie("username"); 36 | jsonObj.flightId = flightId; 37 | jsonObj.ticketNumber = i; 38 | jsonObj.passengerNames = new Array(); 39 | for(var j = 0; j < i; j++){ 40 | jsonObj.passengerNames[j] = new Object(); 41 | jsonObj.passengerNames[j].passengerName = $("#passengerName" + (j+1)).val(); 42 | } 43 | $.ajax({ 44 | url:"/form/price", 45 | contentType:"application/json;charset=utf-8", 46 | data:JSON.stringify(jsonObj), 47 | type:"POST", 48 | success:function (data) { 49 | var con = confirm("总价格为" + data.totalPrice + "是否支付?"); 50 | if(con == true) 51 | order(); 52 | } 53 | }) 54 | }) 55 | }); 56 | 57 | function order() { 58 | $.ajax({ 59 | url:"/form/order", 60 | contentType:"application/json;charset=utf-8", 61 | data:JSON.stringify(jsonObj), 62 | type:"POST", 63 | success:function (data) { 64 | alert("支付成功"); 65 | } 66 | }) 67 | } -------------------------------------------------------------------------------- /src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | login 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 |
28 |

机票管理系统登陆界面

29 |
30 |
31 |
32 | 33 | 34 |
35 |
36 | 37 | 38 |
39 |
40 | 41 |
42 |
43 |
44 |
45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/resources/static/js/showFlight.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | 3 | //加载表格数据 4 | $.get("/flight/all",function (data) { 5 | show(data); 6 | }); 7 | 8 | $("#queryFlight").click(function () { 9 | var jsonObj = new Object(); 10 | jsonObj.startCity = $("#queryStart").val(); 11 | jsonObj.endCity = $("#queryEnd").val(); 12 | $.ajax({ 13 | url:"flight/city", 14 | contentType:"application/json;charset=utf-8", 15 | type:"POST", 16 | data:JSON.stringify(jsonObj), 17 | success:function (data) { 18 | $("#tbody-flight").empty(); 19 | show(data); 20 | } 21 | 22 | }) 23 | }) 24 | }); 25 | 26 | function show(data) { 27 | for(var i = 0;i < data.length;i++){ 28 | var tr = document.createElement('tr'); 29 | // "flightId": 1, 30 | // "startTime": "2018-06-02T13:52:00.000+0000", 31 | // "startCity": "北京", 32 | // "endCity": "上海", 33 | // "peopleNumber": 100, 34 | // "leftTicket": 50, 35 | // "ticketPrice": 1000 36 | var startTTd = document.createElement('td'); 37 | startTTd.append(data[i].startTime); 38 | var startCTd = document.createElement('td'); 39 | startCTd.append(data[i].startCity); 40 | var endCTd = document.createElement('td'); 41 | endCTd.append(data[i].endCity); 42 | var leftTicketTd = document.createElement('td'); 43 | leftTicketTd.append(data[i].leftTicket); 44 | var ticketPriceTd = document.createElement('td'); 45 | ticketPriceTd.append(data[i].ticketPrice); 46 | tr.appendChild(startCTd); 47 | tr.appendChild(endCTd); 48 | tr.appendChild(startTTd); 49 | tr.appendChild(leftTicketTd); 50 | tr.appendChild(ticketPriceTd); 51 | var operateTd = document.createElement('td'); 52 | var addA = document.createElement('a'); 53 | addA.innerText = "订票"; 54 | addA.href = "order.html?flightId=" + data[i].flightId; 55 | operateTd.appendChild(addA); 56 | tr.appendChild(operateTd); 57 | $("#tbody-flight").append(tr); 58 | } 59 | } -------------------------------------------------------------------------------- /src/main/resources/static/showTicket.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 |
22 |
23 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
航班号乘客价格
49 |
50 |
51 | 52 | -------------------------------------------------------------------------------- /src/main/resources/static/showForm.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 |
24 |
25 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
预定时间机票数量总金额操作
49 |
50 |
51 | 52 | -------------------------------------------------------------------------------- /src/main/resources/static/managerTicket.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 |
22 |
23 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
航班号乘客价格是否折扣操作
51 |
52 |
53 | 54 | -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/controller/OrderFormController.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.controller; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONArray; 5 | import com.alibaba.fastjson.JSONObject; 6 | import com.ticketsystem.model.OrderForm; 7 | import com.ticketsystem.model.Ticket; 8 | import com.ticketsystem.service.FormService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | @RestController 18 | @RequestMapping("/form") 19 | public class OrderFormController { 20 | @Autowired 21 | private FormService formService; 22 | 23 | @RequestMapping("/all") 24 | public List getAll(@RequestBody Map data) { 25 | String username = data.get("username"); 26 | return formService.getAll(username); 27 | } 28 | 29 | @RequestMapping("/price") 30 | public Map price(@RequestBody JSONObject jsonObject){ 31 | String username = jsonObject.getString("username"); 32 | int flightId = jsonObject.getInteger("flightId"); 33 | int ticketNum = jsonObject.getInteger("ticketNumber"); 34 | float allPrice = formService.getAllPrice(username,ticketNum,flightId); 35 | return new HashMap(){{ 36 | put("totalPrice",allPrice); 37 | } 38 | }; 39 | } 40 | 41 | @RequestMapping("/order") 42 | @ResponseBody 43 | public Map order(@RequestBody JSONObject jsonObject){ 44 | /* 45 | username 46 | flightId 47 | ticketNumber 48 | passengerNames 49 | */ 50 | String username = jsonObject.getString("username"); 51 | int flightId = jsonObject.getInteger("flightId"); 52 | int ticketNum = jsonObject.getInteger("ticketNumber"); 53 | JSONArray passengerArr = jsonObject.getJSONArray("passengerNames"); 54 | String passStr = passengerArr.toJSONString(); 55 | List tickets = JSONObject.parseArray(passStr,Ticket.class); 56 | for(Ticket ticket : tickets){ 57 | ticket.setFlightId(flightId); 58 | } 59 | Map map1 = new HashMap<>(); 60 | float totalPrice = formService.order(username,ticketNum,tickets); 61 | map1.put("totalPrice",totalPrice); 62 | return map1; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/resources/static/managerFlight.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Title 16 | 17 | 18 | 19 | 20 | 22 |
23 |
24 | 36 |
37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
起飞城市到达城市起飞时间剩余票数票价操作
52 | 53 |
54 | 55 |
56 |
57 |
58 | 59 | -------------------------------------------------------------------------------- /src/main/resources/static/js/managerTicket.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | var orderFormId = location.search.split("orderFormId=")[1]; 3 | var jsonObj = new Object(); 4 | jsonObj.orderFormId = orderFormId; 5 | $.get("/ticket/all",function (data) { 6 | showData(data); 7 | }) 8 | }); 9 | 10 | 11 | function showData(data){ 12 | /*"ticketId": 1, 13 | "flightId": 1, 14 | "orderFormId": 1, 15 | "price": 1000, 16 | "discount": 1, 17 | "passengerName": "liu"*/ 18 | for(var i = 0; i < data.length; i++){ 19 | var tr = document.createElement("tr"); 20 | var flightIdTd = document.createElement("td"); 21 | flightIdTd.append(data[i].flightId); 22 | var priceTd = document.createElement("td"); 23 | priceTd.append(data[i].price); 24 | var passengerName = document.createElement("td"); 25 | passengerName.append(data[i].passengerName); 26 | var discountTd = document.createElement('td'); 27 | if(data[i].discount == 0.8) 28 | discountTd.append("是"); 29 | else discountTd.append("否"); 30 | var operateTd = document.createElement("td"); 31 | var addA = document.createElement('a'); 32 | addA.innerText = "修改"; 33 | addA.href = "alterTicket.html?ticketId=" + data[i].ticketId; 34 | var delA = document.createElement('a'); 35 | delA.innerText = "删除"; 36 | delA.id = "del" + data[i].ticketId; 37 | delA.href = "#"; 38 | operateTd.append(addA); 39 | operateTd.append(" "); 40 | operateTd.append(delA); 41 | tr.appendChild(flightIdTd); 42 | tr.appendChild(passengerName); 43 | tr.appendChild(priceTd); 44 | tr.appendChild(discountTd); 45 | tr.appendChild(operateTd); 46 | $("#tbody-ticket").append(tr); 47 | $("#del" + data[i].ticketId).attr("onclick","deleteTicket(" + data[i].ticketId + ")"); 48 | } 49 | } 50 | 51 | 52 | 53 | function deleteTicket(ticketId) { 54 | var jsonObj = new Object(); 55 | jsonObj.ticketId = ticketId; 56 | 57 | $.ajax({ 58 | url:"ticket/deleteById", 59 | contentType:"application/json;charset=utf-8", 60 | type:"POST", 61 | data:JSON.stringify(jsonObj), 62 | success:function () { 63 | var con = confirm("是否删除?"); 64 | if(con == true){ 65 | alert("删除成功"); 66 | window.location.reload(); 67 | } 68 | } 69 | }) 70 | } -------------------------------------------------------------------------------- /src/main/resources/static/alterTicket.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 |
23 |
24 | 36 |
37 |
38 |
39 | 40 | 41 |
42 |
43 | 44 | 45 |
46 |
47 | 48 | 49 |
50 |
51 | 52 |
53 |
54 |
55 | 56 | -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/service/TicketService.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.service; 2 | 3 | import com.ticketsystem.dao.FlightMapper; 4 | import com.ticketsystem.dao.OrderFormMapper; 5 | import com.ticketsystem.dao.TicketMapper; 6 | import com.ticketsystem.model.*; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | @Service 13 | public class TicketService { 14 | @Autowired 15 | private TicketMapper ticketMapper; 16 | 17 | @Autowired 18 | private OrderFormMapper orderFormMapper; 19 | 20 | @Autowired 21 | private FlightMapper flightMapper; 22 | 23 | public List getAllTicket(){ 24 | TicketExample ticketExample = new TicketExample(); 25 | ticketExample.createCriteria(); 26 | return ticketMapper.selectByExample(ticketExample); 27 | } 28 | 29 | public List getTicketByFormId(int id){ 30 | TicketExample ticketExample = new TicketExample(); 31 | ticketExample.createCriteria().andOrderFormIdEqualTo(id); 32 | return ticketMapper.selectByExample(ticketExample); 33 | } 34 | 35 | public Ticket getTicketById(int ticketId){ 36 | return ticketMapper.selectByPrimaryKey(ticketId); 37 | } 38 | 39 | public void altTicket(int ticketId, int flightId, String passengerName, float price){ 40 | Ticket ticket = new Ticket(); 41 | ticket.setPrice(price); 42 | ticket.setFlightId(flightId); 43 | ticket.setPassengerName(passengerName); 44 | ticket.setTicketId(ticketId); 45 | ticketMapper.updateByPrimaryKeySelective(ticket); 46 | } 47 | 48 | public void deleteById(int ticketId){ 49 | Ticket ticket = ticketMapper.selectByPrimaryKey(ticketId); 50 | ticketMapper.deleteByPrimaryKey(ticketId); 51 | OrderForm orderForm = orderFormMapper.selectByPrimaryKey(ticket.getOrderFormId()); 52 | orderForm.setTicketNumber(orderForm.getTicketNumber() - 1); 53 | if(orderForm.getTicketNumber() == 0){ 54 | orderFormMapper.deleteByPrimaryKey(orderForm.getOrderFormId()); 55 | } 56 | else { 57 | orderForm.setTotalPrice(orderForm.getTotalPrice() - ticket.getPrice() * ticket.getDiscount()); 58 | orderFormMapper.updateByPrimaryKeySelective(orderForm); 59 | } 60 | Flight flight = flightMapper.selectByPrimaryKey(ticket.getFlightId()); 61 | flight.setLeftTicket(flight.getLeftTicket() + 1); 62 | flightMapper.updateByPrimaryKey(flight); 63 | ticketMapper.deleteByPrimaryKey(ticketId); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/resources/static/order.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | login 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 |
24 |
25 | 40 |
41 |
42 |
43 |
44 |
45 | 46 | 47 |
48 |
49 |
50 | 51 | 52 |
53 |
54 |
55 |
56 | 57 | -------------------------------------------------------------------------------- /src/main/resources/static/js/managerFlight.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | 3 | //加载表格数据 4 | $.get("/flight/all",function (data) { 5 | for(var i = 0;i < data.length;i++){ 6 | var tr = document.createElement('tr'); 7 | // "flightId": 1, 8 | // "startTime": "2018-06-02T13:52:00.000+0000", 9 | // "startCity": "北京", 10 | // "endCity": "上海", 11 | // "peopleNumber": 100, 12 | // "leftTicket": 50, 13 | // "ticketPrice": 1000 14 | var startTTd = document.createElement('td'); 15 | startTTd.append(data[i].startTime); 16 | var startCTd = document.createElement('td'); 17 | startCTd.append(data[i].startCity); 18 | var endCTd = document.createElement('td'); 19 | endCTd.append(data[i].endCity); 20 | var leftTicketTd = document.createElement('td'); 21 | leftTicketTd.append(data[i].leftTicket); 22 | var ticketPriceTd = document.createElement('td'); 23 | ticketPriceTd.append(data[i].ticketPrice); 24 | tr.appendChild(startCTd); 25 | tr.appendChild(endCTd); 26 | tr.appendChild(startTTd); 27 | tr.appendChild(leftTicketTd); 28 | tr.appendChild(ticketPriceTd); 29 | var operateTd = document.createElement('td'); 30 | var addA = document.createElement('a'); 31 | addA.innerText = "修改"; 32 | addA.href = "alterFlight.html?flightId=" + data[i].flightId; 33 | var delA = document.createElement('a'); 34 | delA.innerText = "删除"; 35 | delA.href = "#"; 36 | delA.id = "delFlight" + data[i].flightId; 37 | operateTd.appendChild(addA); 38 | operateTd.append(" "); 39 | operateTd.appendChild(delA); 40 | tr.appendChild(operateTd); 41 | $("#tbody-flight").append(tr); 42 | $("#delFlight" + data[i].flightId).attr("onclick","deleteFlight(" + data[i].flightId + ")"); 43 | } 44 | }) 45 | 46 | $("#addFlight").click(function () { 47 | window.location = "addFlight.html"; 48 | }) 49 | }); 50 | 51 | function deleteFlight(flightId) { 52 | var con = confirm("是否删除?"); 53 | if(con == true){ 54 | var jsonObj = new Object(); 55 | jsonObj.flightId = flightId; 56 | 57 | $.ajax({ 58 | url:"/flight/deleteById", 59 | type:"POST", 60 | contentType:"application/json;charset=utf-8", 61 | data:JSON.stringify(jsonObj), 62 | success:function () { 63 | alert("删除成功"); 64 | window.location.reload(); 65 | } 66 | }) 67 | } 68 | } -------------------------------------------------------------------------------- /src/main/resources/mybatis-generator.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 |
41 |
42 |
-------------------------------------------------------------------------------- /src/main/resources/static/showFlight.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Title 16 | 17 | 18 | 19 | 20 | 22 |
23 |
24 | 34 |
35 |
36 |
37 | 41 | 46 |
47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
起飞城市到达城市起飞时间剩余票数票价操作
61 |
62 |
63 | 64 | -------------------------------------------------------------------------------- /src/main/resources/static/alterFlight.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 |
23 |
24 | 36 |
37 |
38 |
39 | 40 | 41 |
42 |
43 | 44 | 45 |
46 |
47 | 48 | 49 |
50 | 51 |
52 | 53 | 54 |
55 | 56 |
57 | 58 | 59 |
60 | 61 |
62 | 63 | 64 |
65 | 66 |
67 | 68 |
69 |
70 |
71 | 72 | -------------------------------------------------------------------------------- /src/main/resources/static/addFlight.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 |
23 |
24 | 36 |
37 |
38 |
39 | 40 | 41 |
42 |
43 | 44 | 45 |
46 |
47 | 48 | 49 |
50 |
51 | 52 | 53 |
54 | 55 |
56 | 57 | 58 |
59 | 60 |
61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 |
69 | 70 |
71 | 72 |
73 |
74 |
75 | 76 | -------------------------------------------------------------------------------- /src/main/resources/static/dist/js/jquery.cookie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Cookie Plugin v1.4.0 3 | * https://github.com/carhartl/jquery-cookie 4 | * 5 | * Copyright 2013 Klaus Hartl 6 | * Released under the MIT license 7 | */ 8 | (function (factory) { 9 | if (typeof define === 'function' && define.amd) { 10 | // AMD. Register as anonymous module. 11 | define(['jquery'], factory); 12 | } else { 13 | // Browser globals. 14 | factory(jQuery); 15 | } 16 | }(function ($) { 17 | 18 | var pluses = /\+/g; 19 | 20 | function encode(s) { 21 | return config.raw ? s : encodeURIComponent(s); 22 | } 23 | 24 | function decode(s) { 25 | return config.raw ? s : decodeURIComponent(s); 26 | } 27 | 28 | function stringifyCookieValue(value) { 29 | return encode(config.json ? JSON.stringify(value) : String(value)); 30 | } 31 | 32 | function parseCookieValue(s) { 33 | if (s.indexOf('"') === 0) { 34 | // This is a quoted cookie as according to RFC2068, unescape... 35 | s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 36 | } 37 | 38 | try { 39 | // Replace server-side written pluses with spaces. 40 | // If we can't decode the cookie, ignore it, it's unusable. 41 | s = decodeURIComponent(s.replace(pluses, ' ')); 42 | } catch(e) { 43 | return; 44 | } 45 | 46 | try { 47 | // If we can't parse the cookie, ignore it, it's unusable. 48 | return config.json ? JSON.parse(s) : s; 49 | } catch(e) {} 50 | } 51 | 52 | function read(s, converter) { 53 | var value = config.raw ? s : parseCookieValue(s); 54 | return $.isFunction(converter) ? converter(value) : value; 55 | } 56 | 57 | var config = $.cookie = function (key, value, options) { 58 | 59 | // Write 60 | if (value !== undefined && !$.isFunction(value)) { 61 | options = $.extend({}, config.defaults, options); 62 | 63 | if (typeof options.expires === 'number') { 64 | var days = options.expires, t = options.expires = new Date(); 65 | t.setDate(t.getDate() + days); 66 | } 67 | 68 | return (document.cookie = [ 69 | encode(key), '=', stringifyCookieValue(value), 70 | options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 71 | options.path ? '; path=' + options.path : '', 72 | options.domain ? '; domain=' + options.domain : '', 73 | options.secure ? '; secure' : '' 74 | ].join('')); 75 | } 76 | 77 | // Read 78 | 79 | var result = key ? undefined : {}; 80 | 81 | // To prevent the for loop in the first place assign an empty array 82 | // in case there are no cookies at all. Also prevents odd result when 83 | // calling $.cookie(). 84 | var cookies = document.cookie ? document.cookie.split('; ') : []; 85 | 86 | for (var i = 0, l = cookies.length; i < l; i++) { 87 | var parts = cookies[i].split('='); 88 | var name = decode(parts.shift()); 89 | var cookie = parts.join('='); 90 | 91 | if (key && key === name) { 92 | // If second argument (value) is a function it's a converter... 93 | result = read(cookie, value); 94 | break; 95 | } 96 | 97 | // Prevent storing a cookie that we couldn't decode. 98 | if (!key && (cookie = read(cookie)) !== undefined) { 99 | result[name] = cookie; 100 | } 101 | } 102 | 103 | return result; 104 | }; 105 | 106 | config.defaults = {}; 107 | 108 | $.removeCookie = function (key, options) { 109 | if ($.cookie(key) !== undefined) { 110 | // Must not alter options, thus extending a fresh object... 111 | $.cookie(key, '', $.extend({}, options, { expires: -1 })); 112 | return true; 113 | } 114 | return false; 115 | }; 116 | 117 | })); 118 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com 7 | ticket-system 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | ticket-system 12 | The flight ticket system project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.0.1.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-web 31 | 32 | 33 | org.mybatis.spring.boot 34 | mybatis-spring-boot-starter 35 | 1.3.2 36 | 37 | 38 | 39 | mysql 40 | mysql-connector-java 41 | runtime 42 | 43 | 44 | org.springframework.boot 45 | spring-boot-starter-test 46 | test 47 | 48 | 49 | com.alibaba 50 | fastjson 51 | 1.2.7 52 | 53 | 54 | org.springframework.boot 55 | spring-boot-starter-test 56 | 57 | 58 | org.springframework.boot 59 | spring-boot-devtools 60 | true 61 | 62 | 63 | junit 64 | junit 65 | 4.12 66 | 67 | 68 | 69 | 70 | 71 | 72 | org.springframework.boot 73 | spring-boot-maven-plugin 74 | 75 | 76 | org.mybatis.generator 77 | mybatis-generator-maven-plugin 78 | 79 | 80 | 81 | mysql 82 | mysql-connector-java 83 | 84 | 85 | org.mybatis.generator 86 | mybatis-generator-core 87 | 88 | 89 | 90 | 91 | 92 | Generate MyBatis Artifacts 93 | package 94 | 95 | generate 96 | 97 | 98 | 99 | 100 | 101 | true 102 | 103 | true 104 | 105 | 106 | src/main/resources/mybatis-generator.xml 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /src/main/resources/static/dist/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.1.0 (https://getbootstrap.com/) 3 | * Copyright 2011-2018 The Bootstrap Authors 4 | * Copyright 2011-2018 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg:not(:root){overflow:hidden}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/dao/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.dao; 2 | 3 | import com.ticketsystem.model.User; 4 | import com.ticketsystem.model.UserExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Delete; 7 | import org.apache.ibatis.annotations.DeleteProvider; 8 | import org.apache.ibatis.annotations.Insert; 9 | import org.apache.ibatis.annotations.InsertProvider; 10 | import org.apache.ibatis.annotations.Param; 11 | import org.apache.ibatis.annotations.Result; 12 | import org.apache.ibatis.annotations.Results; 13 | import org.apache.ibatis.annotations.Select; 14 | import org.apache.ibatis.annotations.SelectProvider; 15 | import org.apache.ibatis.annotations.Update; 16 | import org.apache.ibatis.annotations.UpdateProvider; 17 | import org.apache.ibatis.type.JdbcType; 18 | import org.springframework.stereotype.Repository; 19 | 20 | @Repository 21 | public interface UserMapper { 22 | @SelectProvider(type=UserSqlProvider.class, method="countByExample") 23 | long countByExample(UserExample example); 24 | 25 | @DeleteProvider(type=UserSqlProvider.class, method="deleteByExample") 26 | int deleteByExample(UserExample example); 27 | 28 | @Delete({ 29 | "delete from user", 30 | "where user_id = #{userId,jdbcType=INTEGER}" 31 | }) 32 | int deleteByPrimaryKey(Integer userId); 33 | 34 | @Insert({ 35 | "insert into user (user_id, is_manager, ", 36 | "user_name, user_password, ", 37 | "is_VIP)", 38 | "values (#{userId,jdbcType=INTEGER}, #{isManager,jdbcType=VARCHAR}, ", 39 | "#{userName,jdbcType=CHAR}, #{userPassword,jdbcType=CHAR}, ", 40 | "#{isVip,jdbcType=DECIMAL})" 41 | }) 42 | int insert(User record); 43 | 44 | @InsertProvider(type=UserSqlProvider.class, method="insertSelective") 45 | int insertSelective(User record); 46 | 47 | @SelectProvider(type=UserSqlProvider.class, method="selectByExample") 48 | @Results({ 49 | @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER, id=true), 50 | @Result(column="is_manager", property="isManager", jdbcType=JdbcType.VARCHAR), 51 | @Result(column="user_name", property="userName", jdbcType=JdbcType.CHAR), 52 | @Result(column="user_password", property="userPassword", jdbcType=JdbcType.CHAR), 53 | @Result(column="is_VIP", property="isVip", jdbcType=JdbcType.DECIMAL) 54 | }) 55 | List selectByExample(UserExample example); 56 | 57 | @Select({ 58 | "select", 59 | "user_id, is_manager, user_name, user_password, is_VIP", 60 | "from user", 61 | "where user_id = #{userId,jdbcType=INTEGER}" 62 | }) 63 | @Results({ 64 | @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER, id=true), 65 | @Result(column="is_manager", property="isManager", jdbcType=JdbcType.VARCHAR), 66 | @Result(column="user_name", property="userName", jdbcType=JdbcType.CHAR), 67 | @Result(column="user_password", property="userPassword", jdbcType=JdbcType.CHAR), 68 | @Result(column="is_VIP", property="isVip", jdbcType=JdbcType.DECIMAL) 69 | }) 70 | User selectByPrimaryKey(Integer userId); 71 | 72 | @UpdateProvider(type=UserSqlProvider.class, method="updateByExampleSelective") 73 | int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); 74 | 75 | @UpdateProvider(type=UserSqlProvider.class, method="updateByExample") 76 | int updateByExample(@Param("record") User record, @Param("example") UserExample example); 77 | 78 | @UpdateProvider(type=UserSqlProvider.class, method="updateByPrimaryKeySelective") 79 | int updateByPrimaryKeySelective(User record); 80 | 81 | @Update({ 82 | "update user", 83 | "set is_manager = #{isManager,jdbcType=VARCHAR},", 84 | "user_name = #{userName,jdbcType=CHAR},", 85 | "user_password = #{userPassword,jdbcType=CHAR},", 86 | "is_VIP = #{isVip,jdbcType=DECIMAL}", 87 | "where user_id = #{userId,jdbcType=INTEGER}" 88 | }) 89 | int updateByPrimaryKey(User record); 90 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/service/FormService.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.service; 2 | 3 | import com.ticketsystem.dao.FlightMapper; 4 | import com.ticketsystem.dao.OrderFormMapper; 5 | import com.ticketsystem.dao.TicketMapper; 6 | import com.ticketsystem.dao.UserMapper; 7 | import com.ticketsystem.model.*; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.Calendar; 12 | import java.util.Date; 13 | import java.util.List; 14 | 15 | @Service 16 | public class FormService { 17 | 18 | @Autowired 19 | private OrderFormMapper orderFormMapper; 20 | 21 | @Autowired 22 | private UserMapper userMapper; 23 | 24 | @Autowired 25 | private TicketMapper ticketMapper; 26 | 27 | @Autowired 28 | private FlightMapper flightMapper; 29 | 30 | public List getAll(String username){ 31 | UserExample userExample = new UserExample(); 32 | userExample.createCriteria().andUserNameEqualTo(username); 33 | User user = userMapper.selectByExample(userExample).get(0); 34 | OrderFormExample orderFormExample = new OrderFormExample(); 35 | OrderFormExample.Criteria criteria = orderFormExample.createCriteria(); 36 | criteria.andUserIdEqualTo(user.getUserId()); 37 | return orderFormMapper.selectByExample(orderFormExample); 38 | } 39 | 40 | public float getAllPrice(String username,int ticketNum,int flightId){ 41 | UserExample userExample = new UserExample(); 42 | userExample.createCriteria().andUserNameEqualTo(username); 43 | int isVip = userMapper.selectByExample(userExample).get(0).getIsVip(); 44 | float totalPrice = ticketNum * flightMapper.selectByPrimaryKey(flightId).getTicketPrice(); 45 | if(isVip == 1) 46 | totalPrice = (float)0.8 * totalPrice; 47 | return totalPrice; 48 | } 49 | 50 | public float order(String username,int ticketNum,List tickets){ 51 | float totalPrice = 0; 52 | UserExample userExample = new UserExample(); 53 | UserExample.Criteria criteria = userExample.createCriteria(); 54 | criteria.andUserNameEqualTo(username); 55 | User user = userMapper.selectByExample(userExample).get(0); 56 | OrderForm orderForm = new OrderForm(); 57 | Date now = new Date(); 58 | orderForm.setOrderTime(now); 59 | orderForm.setTicketNumber(ticketNum); 60 | if(user.getIsVip() == 1){ 61 | totalPrice = (float) (flightMapper.selectByPrimaryKey(tickets.get(0).getFlightId()).getTicketPrice() * ticketNum * 0.8); 62 | orderForm.setTotalPrice(totalPrice); 63 | 64 | } 65 | orderForm.setUserId(user.getUserId()); 66 | orderFormMapper.insert(orderForm); 67 | OrderFormExample orderFormExample = new OrderFormExample(); 68 | Date now1 = addSecond(now,5); 69 | now = addSecond(now,-1); 70 | OrderFormExample.Criteria orderFormExampleCriteria = orderFormExample.createCriteria(); 71 | orderFormExampleCriteria.andOrderTimeBetween(now,now1); 72 | orderFormExampleCriteria.andUserIdEqualTo(user.getUserId()); 73 | orderForm.setOrderFormId(orderFormMapper.selectByExample(orderFormExample).get(0).getOrderFormId()); 74 | 75 | for(Ticket ticket : tickets){ 76 | ticket.setPrice(flightMapper.selectByPrimaryKey(ticket.getFlightId()).getTicketPrice()); 77 | if(user.getIsVip() == 1) 78 | ticket.setDiscount((float)0.8); 79 | else ticket.setDiscount((float)1); 80 | ticket.setOrderFormId(orderForm.getOrderFormId()); 81 | ticketMapper.insert(ticket); 82 | } 83 | 84 | Flight flight = flightMapper.selectByPrimaryKey(tickets.get(0).getFlightId()); 85 | flight.setLeftTicket(flight.getLeftTicket() - ticketNum); 86 | flightMapper.updateByPrimaryKey(flight); 87 | 88 | return totalPrice; 89 | } 90 | 91 | private Date addSecond(Date date,int second) { 92 | Calendar calendar = Calendar.getInstance(); 93 | calendar.setTime(date); 94 | calendar.add(Calendar.SECOND, second); 95 | return calendar.getTime(); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/dao/OrderFormMapper.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.dao; 2 | 3 | import com.ticketsystem.model.OrderForm; 4 | import com.ticketsystem.model.OrderFormExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Delete; 7 | import org.apache.ibatis.annotations.DeleteProvider; 8 | import org.apache.ibatis.annotations.Insert; 9 | import org.apache.ibatis.annotations.InsertProvider; 10 | import org.apache.ibatis.annotations.Param; 11 | import org.apache.ibatis.annotations.Result; 12 | import org.apache.ibatis.annotations.Results; 13 | import org.apache.ibatis.annotations.Select; 14 | import org.apache.ibatis.annotations.SelectProvider; 15 | import org.apache.ibatis.annotations.Update; 16 | import org.apache.ibatis.annotations.UpdateProvider; 17 | import org.apache.ibatis.type.JdbcType; 18 | import org.springframework.stereotype.Repository; 19 | 20 | @Repository 21 | public interface OrderFormMapper { 22 | @SelectProvider(type=OrderFormSqlProvider.class, method="countByExample") 23 | long countByExample(OrderFormExample example); 24 | 25 | @DeleteProvider(type=OrderFormSqlProvider.class, method="deleteByExample") 26 | int deleteByExample(OrderFormExample example); 27 | 28 | @Delete({ 29 | "delete from order_form", 30 | "where order_form_id = #{orderFormId,jdbcType=INTEGER}" 31 | }) 32 | int deleteByPrimaryKey(Integer orderFormId); 33 | 34 | @Insert({ 35 | "insert into order_form (order_form_id, user_id, ", 36 | "ticket_number, total_price, ", 37 | "order_time)", 38 | "values (#{orderFormId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, ", 39 | "#{ticketNumber,jdbcType=DECIMAL}, #{totalPrice,jdbcType=REAL}, ", 40 | "#{orderTime,jdbcType=TIMESTAMP})" 41 | }) 42 | int insert(OrderForm record); 43 | 44 | @InsertProvider(type=OrderFormSqlProvider.class, method="insertSelective") 45 | int insertSelective(OrderForm record); 46 | 47 | @SelectProvider(type=OrderFormSqlProvider.class, method="selectByExample") 48 | @Results({ 49 | @Result(column="order_form_id", property="orderFormId", jdbcType=JdbcType.INTEGER, id=true), 50 | @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER), 51 | @Result(column="ticket_number", property="ticketNumber", jdbcType=JdbcType.DECIMAL), 52 | @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.REAL), 53 | @Result(column="order_time", property="orderTime", jdbcType=JdbcType.TIMESTAMP) 54 | }) 55 | List selectByExample(OrderFormExample example); 56 | 57 | @Select({ 58 | "select", 59 | "order_form_id, user_id, ticket_number, total_price, order_time", 60 | "from order_form", 61 | "where order_form_id = #{orderFormId,jdbcType=INTEGER}" 62 | }) 63 | @Results({ 64 | @Result(column="order_form_id", property="orderFormId", jdbcType=JdbcType.INTEGER, id=true), 65 | @Result(column="user_id", property="userId", jdbcType=JdbcType.INTEGER), 66 | @Result(column="ticket_number", property="ticketNumber", jdbcType=JdbcType.DECIMAL), 67 | @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.REAL), 68 | @Result(column="order_time", property="orderTime", jdbcType=JdbcType.TIMESTAMP) 69 | }) 70 | OrderForm selectByPrimaryKey(Integer orderFormId); 71 | 72 | @UpdateProvider(type=OrderFormSqlProvider.class, method="updateByExampleSelective") 73 | int updateByExampleSelective(@Param("record") OrderForm record, @Param("example") OrderFormExample example); 74 | 75 | @UpdateProvider(type=OrderFormSqlProvider.class, method="updateByExample") 76 | int updateByExample(@Param("record") OrderForm record, @Param("example") OrderFormExample example); 77 | 78 | @UpdateProvider(type=OrderFormSqlProvider.class, method="updateByPrimaryKeySelective") 79 | int updateByPrimaryKeySelective(OrderForm record); 80 | 81 | @Update({ 82 | "update order_form", 83 | "set user_id = #{userId,jdbcType=INTEGER},", 84 | "ticket_number = #{ticketNumber,jdbcType=DECIMAL},", 85 | "total_price = #{totalPrice,jdbcType=REAL},", 86 | "order_time = #{orderTime,jdbcType=TIMESTAMP}", 87 | "where order_form_id = #{orderFormId,jdbcType=INTEGER}" 88 | }) 89 | int updateByPrimaryKey(OrderForm record); 90 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/dao/TicketMapper.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.dao; 2 | 3 | import com.ticketsystem.model.Ticket; 4 | import com.ticketsystem.model.TicketExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Delete; 7 | import org.apache.ibatis.annotations.DeleteProvider; 8 | import org.apache.ibatis.annotations.Insert; 9 | import org.apache.ibatis.annotations.InsertProvider; 10 | import org.apache.ibatis.annotations.Param; 11 | import org.apache.ibatis.annotations.Result; 12 | import org.apache.ibatis.annotations.Results; 13 | import org.apache.ibatis.annotations.Select; 14 | import org.apache.ibatis.annotations.SelectProvider; 15 | import org.apache.ibatis.annotations.Update; 16 | import org.apache.ibatis.annotations.UpdateProvider; 17 | import org.apache.ibatis.type.JdbcType; 18 | import org.springframework.stereotype.Repository; 19 | 20 | @Repository 21 | public interface TicketMapper { 22 | @SelectProvider(type=TicketSqlProvider.class, method="countByExample") 23 | long countByExample(TicketExample example); 24 | 25 | @DeleteProvider(type=TicketSqlProvider.class, method="deleteByExample") 26 | int deleteByExample(TicketExample example); 27 | 28 | @Delete({ 29 | "delete from ticket", 30 | "where ticket_id = #{ticketId,jdbcType=INTEGER}" 31 | }) 32 | int deleteByPrimaryKey(Integer ticketId); 33 | 34 | @Insert({ 35 | "insert into ticket (ticket_id, flight_id, ", 36 | "order_form_id, price, ", 37 | "discount, passenger_name)", 38 | "values (#{ticketId,jdbcType=INTEGER}, #{flightId,jdbcType=INTEGER}, ", 39 | "#{orderFormId,jdbcType=INTEGER}, #{price,jdbcType=REAL}, ", 40 | "#{discount,jdbcType=REAL}, #{passengerName,jdbcType=CHAR})" 41 | }) 42 | int insert(Ticket record); 43 | 44 | @InsertProvider(type=TicketSqlProvider.class, method="insertSelective") 45 | int insertSelective(Ticket record); 46 | 47 | @SelectProvider(type=TicketSqlProvider.class, method="selectByExample") 48 | @Results({ 49 | @Result(column="ticket_id", property="ticketId", jdbcType=JdbcType.INTEGER, id=true), 50 | @Result(column="flight_id", property="flightId", jdbcType=JdbcType.INTEGER), 51 | @Result(column="order_form_id", property="orderFormId", jdbcType=JdbcType.INTEGER), 52 | @Result(column="price", property="price", jdbcType=JdbcType.REAL), 53 | @Result(column="discount", property="discount", jdbcType=JdbcType.REAL), 54 | @Result(column="passenger_name", property="passengerName", jdbcType=JdbcType.CHAR) 55 | }) 56 | List selectByExample(TicketExample example); 57 | 58 | @Select({ 59 | "select", 60 | "ticket_id, flight_id, order_form_id, price, discount, passenger_name", 61 | "from ticket", 62 | "where ticket_id = #{ticketId,jdbcType=INTEGER}" 63 | }) 64 | @Results({ 65 | @Result(column="ticket_id", property="ticketId", jdbcType=JdbcType.INTEGER, id=true), 66 | @Result(column="flight_id", property="flightId", jdbcType=JdbcType.INTEGER), 67 | @Result(column="order_form_id", property="orderFormId", jdbcType=JdbcType.INTEGER), 68 | @Result(column="price", property="price", jdbcType=JdbcType.REAL), 69 | @Result(column="discount", property="discount", jdbcType=JdbcType.REAL), 70 | @Result(column="passenger_name", property="passengerName", jdbcType=JdbcType.CHAR) 71 | }) 72 | Ticket selectByPrimaryKey(Integer ticketId); 73 | 74 | @UpdateProvider(type=TicketSqlProvider.class, method="updateByExampleSelective") 75 | int updateByExampleSelective(@Param("record") Ticket record, @Param("example") TicketExample example); 76 | 77 | @UpdateProvider(type=TicketSqlProvider.class, method="updateByExample") 78 | int updateByExample(@Param("record") Ticket record, @Param("example") TicketExample example); 79 | 80 | @UpdateProvider(type=TicketSqlProvider.class, method="updateByPrimaryKeySelective") 81 | int updateByPrimaryKeySelective(Ticket record); 82 | 83 | @Update({ 84 | "update ticket", 85 | "set flight_id = #{flightId,jdbcType=INTEGER},", 86 | "order_form_id = #{orderFormId,jdbcType=INTEGER},", 87 | "price = #{price,jdbcType=REAL},", 88 | "discount = #{discount,jdbcType=REAL},", 89 | "passenger_name = #{passengerName,jdbcType=CHAR}", 90 | "where ticket_id = #{ticketId,jdbcType=INTEGER}" 91 | }) 92 | int updateByPrimaryKey(Ticket record); 93 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/dao/FlightMapper.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.dao; 2 | 3 | import com.ticketsystem.model.Flight; 4 | import com.ticketsystem.model.FlightExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Delete; 7 | import org.apache.ibatis.annotations.DeleteProvider; 8 | import org.apache.ibatis.annotations.Insert; 9 | import org.apache.ibatis.annotations.InsertProvider; 10 | import org.apache.ibatis.annotations.Param; 11 | import org.apache.ibatis.annotations.Result; 12 | import org.apache.ibatis.annotations.Results; 13 | import org.apache.ibatis.annotations.Select; 14 | import org.apache.ibatis.annotations.SelectProvider; 15 | import org.apache.ibatis.annotations.Update; 16 | import org.apache.ibatis.annotations.UpdateProvider; 17 | import org.apache.ibatis.type.JdbcType; 18 | import org.springframework.stereotype.Repository; 19 | 20 | @Repository 21 | public interface FlightMapper { 22 | @SelectProvider(type=FlightSqlProvider.class, method="countByExample") 23 | long countByExample(FlightExample example); 24 | 25 | @DeleteProvider(type=FlightSqlProvider.class, method="deleteByExample") 26 | int deleteByExample(FlightExample example); 27 | 28 | @Delete({ 29 | "delete from flight", 30 | "where flight_id = #{flightId,jdbcType=INTEGER}" 31 | }) 32 | int deleteByPrimaryKey(Integer flightId); 33 | 34 | @Insert({ 35 | "insert into flight (flight_id, start_time, ", 36 | "start_city, end_city, people_number, ", 37 | "left_ticket, ticket_price)", 38 | "values (#{flightId,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, ", 39 | "#{startCity,jdbcType=CHAR}, #{endCity,jdbcType=CHAR}, #{peopleNumber,jdbcType=DECIMAL}, ", 40 | "#{leftTicket,jdbcType=DECIMAL}, #{ticketPrice,jdbcType=REAL})" 41 | }) 42 | int insert(Flight record); 43 | 44 | @InsertProvider(type=FlightSqlProvider.class, method="insertSelective") 45 | int insertSelective(Flight record); 46 | 47 | @SelectProvider(type=FlightSqlProvider.class, method="selectByExample") 48 | @Results({ 49 | @Result(column="flight_id", property="flightId", jdbcType=JdbcType.INTEGER, id=true), 50 | @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), 51 | @Result(column="start_city", property="startCity", jdbcType=JdbcType.CHAR), 52 | @Result(column="end_city", property="endCity", jdbcType=JdbcType.CHAR), 53 | @Result(column="people_number", property="peopleNumber", jdbcType=JdbcType.DECIMAL), 54 | @Result(column="left_ticket", property="leftTicket", jdbcType=JdbcType.DECIMAL), 55 | @Result(column="ticket_price", property="ticketPrice", jdbcType=JdbcType.REAL) 56 | }) 57 | List selectByExample(FlightExample example); 58 | 59 | @Select({ 60 | "select", 61 | "flight_id, start_time, start_city, end_city, people_number, left_ticket, ticket_price", 62 | "from flight", 63 | "where flight_id = #{flightId,jdbcType=INTEGER}" 64 | }) 65 | @Results({ 66 | @Result(column="flight_id", property="flightId", jdbcType=JdbcType.INTEGER, id=true), 67 | @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), 68 | @Result(column="start_city", property="startCity", jdbcType=JdbcType.CHAR), 69 | @Result(column="end_city", property="endCity", jdbcType=JdbcType.CHAR), 70 | @Result(column="people_number", property="peopleNumber", jdbcType=JdbcType.DECIMAL), 71 | @Result(column="left_ticket", property="leftTicket", jdbcType=JdbcType.DECIMAL), 72 | @Result(column="ticket_price", property="ticketPrice", jdbcType=JdbcType.REAL) 73 | }) 74 | Flight selectByPrimaryKey(Integer flightId); 75 | 76 | @UpdateProvider(type=FlightSqlProvider.class, method="updateByExampleSelective") 77 | int updateByExampleSelective(@Param("record") Flight record, @Param("example") FlightExample example); 78 | 79 | @UpdateProvider(type=FlightSqlProvider.class, method="updateByExample") 80 | int updateByExample(@Param("record") Flight record, @Param("example") FlightExample example); 81 | 82 | @UpdateProvider(type=FlightSqlProvider.class, method="updateByPrimaryKeySelective") 83 | int updateByPrimaryKeySelective(Flight record); 84 | 85 | @Update({ 86 | "update flight", 87 | "set start_time = #{startTime,jdbcType=TIMESTAMP},", 88 | "start_city = #{startCity,jdbcType=CHAR},", 89 | "end_city = #{endCity,jdbcType=CHAR},", 90 | "people_number = #{peopleNumber,jdbcType=DECIMAL},", 91 | "left_ticket = #{leftTicket,jdbcType=DECIMAL},", 92 | "ticket_price = #{ticketPrice,jdbcType=REAL}", 93 | "where flight_id = #{flightId,jdbcType=INTEGER}" 94 | }) 95 | int updateByPrimaryKey(Flight record); 96 | } -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /src/main/resources/static/dist/css/bootstrap-reboot.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.1.0 (https://getbootstrap.com/) 3 | * Copyright 2011-2018 The Bootstrap Authors 4 | * Copyright 2011-2018 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */ 8 | *, 9 | *::before, 10 | *::after { 11 | box-sizing: border-box; 12 | } 13 | 14 | html { 15 | font-family: sans-serif; 16 | line-height: 1.15; 17 | -webkit-text-size-adjust: 100%; 18 | -ms-text-size-adjust: 100%; 19 | -ms-overflow-style: scrollbar; 20 | -webkit-tap-highlight-color: transparent; 21 | } 22 | 23 | @-ms-viewport { 24 | width: device-width; 25 | } 26 | 27 | article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section { 28 | display: block; 29 | } 30 | 31 | body { 32 | margin: 0; 33 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; 34 | font-size: 1rem; 35 | font-weight: 400; 36 | line-height: 1.5; 37 | color: #212529; 38 | text-align: left; 39 | background-color: #fff; 40 | } 41 | 42 | [tabindex="-1"]:focus { 43 | outline: 0 !important; 44 | } 45 | 46 | hr { 47 | box-sizing: content-box; 48 | height: 0; 49 | overflow: visible; 50 | } 51 | 52 | h1, h2, h3, h4, h5, h6 { 53 | margin-top: 0; 54 | margin-bottom: 0.5rem; 55 | } 56 | 57 | p { 58 | margin-top: 0; 59 | margin-bottom: 1rem; 60 | } 61 | 62 | abbr[title], 63 | abbr[data-original-title] { 64 | text-decoration: underline; 65 | -webkit-text-decoration: underline dotted; 66 | text-decoration: underline dotted; 67 | cursor: help; 68 | border-bottom: 0; 69 | } 70 | 71 | address { 72 | margin-bottom: 1rem; 73 | font-style: normal; 74 | line-height: inherit; 75 | } 76 | 77 | ol, 78 | ul, 79 | dl { 80 | margin-top: 0; 81 | margin-bottom: 1rem; 82 | } 83 | 84 | ol ol, 85 | ul ul, 86 | ol ul, 87 | ul ol { 88 | margin-bottom: 0; 89 | } 90 | 91 | dt { 92 | font-weight: 700; 93 | } 94 | 95 | dd { 96 | margin-bottom: .5rem; 97 | margin-left: 0; 98 | } 99 | 100 | blockquote { 101 | margin: 0 0 1rem; 102 | } 103 | 104 | dfn { 105 | font-style: italic; 106 | } 107 | 108 | b, 109 | strong { 110 | font-weight: bolder; 111 | } 112 | 113 | small { 114 | font-size: 80%; 115 | } 116 | 117 | sub, 118 | sup { 119 | position: relative; 120 | font-size: 75%; 121 | line-height: 0; 122 | vertical-align: baseline; 123 | } 124 | 125 | sub { 126 | bottom: -.25em; 127 | } 128 | 129 | sup { 130 | top: -.5em; 131 | } 132 | 133 | a { 134 | color: #007bff; 135 | text-decoration: none; 136 | background-color: transparent; 137 | -webkit-text-decoration-skip: objects; 138 | } 139 | 140 | a:hover { 141 | color: #0056b3; 142 | text-decoration: underline; 143 | } 144 | 145 | a:not([href]):not([tabindex]) { 146 | color: inherit; 147 | text-decoration: none; 148 | } 149 | 150 | a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { 151 | color: inherit; 152 | text-decoration: none; 153 | } 154 | 155 | a:not([href]):not([tabindex]):focus { 156 | outline: 0; 157 | } 158 | 159 | pre, 160 | code, 161 | kbd, 162 | samp { 163 | font-family: monospace, monospace; 164 | font-size: 1em; 165 | } 166 | 167 | pre { 168 | margin-top: 0; 169 | margin-bottom: 1rem; 170 | overflow: auto; 171 | -ms-overflow-style: scrollbar; 172 | } 173 | 174 | figure { 175 | margin: 0 0 1rem; 176 | } 177 | 178 | img { 179 | vertical-align: middle; 180 | border-style: none; 181 | } 182 | 183 | svg:not(:root) { 184 | overflow: hidden; 185 | } 186 | 187 | table { 188 | border-collapse: collapse; 189 | } 190 | 191 | caption { 192 | padding-top: 0.75rem; 193 | padding-bottom: 0.75rem; 194 | color: #6c757d; 195 | text-align: left; 196 | caption-side: bottom; 197 | } 198 | 199 | th { 200 | text-align: inherit; 201 | } 202 | 203 | label { 204 | display: inline-block; 205 | margin-bottom: 0.5rem; 206 | } 207 | 208 | button { 209 | border-radius: 0; 210 | } 211 | 212 | button:focus { 213 | outline: 1px dotted; 214 | outline: 5px auto -webkit-focus-ring-color; 215 | } 216 | 217 | input, 218 | button, 219 | select, 220 | optgroup, 221 | textarea { 222 | margin: 0; 223 | font-family: inherit; 224 | font-size: inherit; 225 | line-height: inherit; 226 | } 227 | 228 | button, 229 | input { 230 | overflow: visible; 231 | } 232 | 233 | button, 234 | select { 235 | text-transform: none; 236 | } 237 | 238 | button, 239 | html [type="button"], 240 | [type="reset"], 241 | [type="submit"] { 242 | -webkit-appearance: button; 243 | } 244 | 245 | button::-moz-focus-inner, 246 | [type="button"]::-moz-focus-inner, 247 | [type="reset"]::-moz-focus-inner, 248 | [type="submit"]::-moz-focus-inner { 249 | padding: 0; 250 | border-style: none; 251 | } 252 | 253 | input[type="radio"], 254 | input[type="checkbox"] { 255 | box-sizing: border-box; 256 | padding: 0; 257 | } 258 | 259 | input[type="date"], 260 | input[type="time"], 261 | input[type="datetime-local"], 262 | input[type="month"] { 263 | -webkit-appearance: listbox; 264 | } 265 | 266 | textarea { 267 | overflow: auto; 268 | resize: vertical; 269 | } 270 | 271 | fieldset { 272 | min-width: 0; 273 | padding: 0; 274 | margin: 0; 275 | border: 0; 276 | } 277 | 278 | legend { 279 | display: block; 280 | width: 100%; 281 | max-width: 100%; 282 | padding: 0; 283 | margin-bottom: .5rem; 284 | font-size: 1.5rem; 285 | line-height: inherit; 286 | color: inherit; 287 | white-space: normal; 288 | } 289 | 290 | progress { 291 | vertical-align: baseline; 292 | } 293 | 294 | [type="number"]::-webkit-inner-spin-button, 295 | [type="number"]::-webkit-outer-spin-button { 296 | height: auto; 297 | } 298 | 299 | [type="search"] { 300 | outline-offset: -2px; 301 | -webkit-appearance: none; 302 | } 303 | 304 | [type="search"]::-webkit-search-cancel-button, 305 | [type="search"]::-webkit-search-decoration { 306 | -webkit-appearance: none; 307 | } 308 | 309 | ::-webkit-file-upload-button { 310 | font: inherit; 311 | -webkit-appearance: button; 312 | } 313 | 314 | output { 315 | display: inline-block; 316 | } 317 | 318 | summary { 319 | display: list-item; 320 | cursor: pointer; 321 | } 322 | 323 | template { 324 | display: none; 325 | } 326 | 327 | [hidden] { 328 | display: none !important; 329 | } 330 | /*# sourceMappingURL=bootstrap-reboot.css.map */ -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Migwn, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | # TODO classpath? 118 | fi 119 | 120 | if [ -z "$JAVA_HOME" ]; then 121 | javaExecutable="`which javac`" 122 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 123 | # readlink(1) is not available as standard on Solaris 10. 124 | readLink=`which readlink` 125 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 126 | if $darwin ; then 127 | javaHome="`dirname \"$javaExecutable\"`" 128 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 129 | else 130 | javaExecutable="`readlink -f \"$javaExecutable\"`" 131 | fi 132 | javaHome="`dirname \"$javaExecutable\"`" 133 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 134 | JAVA_HOME="$javaHome" 135 | export JAVA_HOME 136 | fi 137 | fi 138 | fi 139 | 140 | if [ -z "$JAVACMD" ] ; then 141 | if [ -n "$JAVA_HOME" ] ; then 142 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 143 | # IBM's JDK on AIX uses strange locations for the executables 144 | JAVACMD="$JAVA_HOME/jre/sh/java" 145 | else 146 | JAVACMD="$JAVA_HOME/bin/java" 147 | fi 148 | else 149 | JAVACMD="`which java`" 150 | fi 151 | fi 152 | 153 | if [ ! -x "$JAVACMD" ] ; then 154 | echo "Error: JAVA_HOME is not defined correctly." >&2 155 | echo " We cannot execute $JAVACMD" >&2 156 | exit 1 157 | fi 158 | 159 | if [ -z "$JAVA_HOME" ] ; then 160 | echo "Warning: JAVA_HOME environment variable is not set." 161 | fi 162 | 163 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 164 | 165 | # traverses directory structure from process work directory to filesystem root 166 | # first directory with .mvn subdirectory is considered project base directory 167 | find_maven_basedir() { 168 | 169 | if [ -z "$1" ] 170 | then 171 | echo "Path not specified to find_maven_basedir" 172 | return 1 173 | fi 174 | 175 | basedir="$1" 176 | wdir="$1" 177 | while [ "$wdir" != '/' ] ; do 178 | if [ -d "$wdir"/.mvn ] ; then 179 | basedir=$wdir 180 | break 181 | fi 182 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 183 | if [ -d "${wdir}" ]; then 184 | wdir=`cd "$wdir/.."; pwd` 185 | fi 186 | # end of workaround 187 | done 188 | echo "${basedir}" 189 | } 190 | 191 | # concatenates all lines of a file 192 | concat_lines() { 193 | if [ -f "$1" ]; then 194 | echo "$(tr -s '\n' ' ' < "$1")" 195 | fi 196 | } 197 | 198 | BASE_DIR=`find_maven_basedir "$(pwd)"` 199 | if [ -z "$BASE_DIR" ]; then 200 | exit 1; 201 | fi 202 | 203 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 204 | echo $MAVEN_PROJECTBASEDIR 205 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 206 | 207 | # For Cygwin, switch paths to Windows format before running java 208 | if $cygwin; then 209 | [ -n "$M2_HOME" ] && 210 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 211 | [ -n "$JAVA_HOME" ] && 212 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 213 | [ -n "$CLASSPATH" ] && 214 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 215 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 216 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 217 | fi 218 | 219 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 220 | 221 | exec "$JAVACMD" \ 222 | $MAVEN_OPTS \ 223 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 224 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 225 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 226 | -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/dao/UserSqlProvider.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.dao; 2 | 3 | import com.ticketsystem.model.User; 4 | import com.ticketsystem.model.UserExample.Criteria; 5 | import com.ticketsystem.model.UserExample.Criterion; 6 | import com.ticketsystem.model.UserExample; 7 | import java.util.List; 8 | import java.util.Map; 9 | import org.apache.ibatis.jdbc.SQL; 10 | 11 | public class UserSqlProvider { 12 | 13 | public String countByExample(UserExample example) { 14 | SQL sql = new SQL(); 15 | sql.SELECT("count(*)").FROM("user"); 16 | applyWhere(sql, example, false); 17 | return sql.toString(); 18 | } 19 | 20 | public String deleteByExample(UserExample example) { 21 | SQL sql = new SQL(); 22 | sql.DELETE_FROM("user"); 23 | applyWhere(sql, example, false); 24 | return sql.toString(); 25 | } 26 | 27 | public String insertSelective(User record) { 28 | SQL sql = new SQL(); 29 | sql.INSERT_INTO("user"); 30 | 31 | if (record.getUserId() != null) { 32 | sql.VALUES("user_id", "#{userId,jdbcType=INTEGER}"); 33 | } 34 | 35 | if (record.getIsManager() != null) { 36 | sql.VALUES("is_manager", "#{isManager,jdbcType=VARCHAR}"); 37 | } 38 | 39 | if (record.getUserName() != null) { 40 | sql.VALUES("user_name", "#{userName,jdbcType=CHAR}"); 41 | } 42 | 43 | if (record.getUserPassword() != null) { 44 | sql.VALUES("user_password", "#{userPassword,jdbcType=CHAR}"); 45 | } 46 | 47 | if (record.getIsVip() != null) { 48 | sql.VALUES("is_VIP", "#{isVip,jdbcType=DECIMAL}"); 49 | } 50 | 51 | return sql.toString(); 52 | } 53 | 54 | public String selectByExample(UserExample example) { 55 | SQL sql = new SQL(); 56 | if (example != null && example.isDistinct()) { 57 | sql.SELECT_DISTINCT("user_id"); 58 | } else { 59 | sql.SELECT("user_id"); 60 | } 61 | sql.SELECT("is_manager"); 62 | sql.SELECT("user_name"); 63 | sql.SELECT("user_password"); 64 | sql.SELECT("is_VIP"); 65 | sql.FROM("user"); 66 | applyWhere(sql, example, false); 67 | 68 | if (example != null && example.getOrderByClause() != null) { 69 | sql.ORDER_BY(example.getOrderByClause()); 70 | } 71 | 72 | return sql.toString(); 73 | } 74 | 75 | public String updateByExampleSelective(Map parameter) { 76 | User record = (User) parameter.get("record"); 77 | UserExample example = (UserExample) parameter.get("example"); 78 | 79 | SQL sql = new SQL(); 80 | sql.UPDATE("user"); 81 | 82 | if (record.getUserId() != null) { 83 | sql.SET("user_id = #{record.userId,jdbcType=INTEGER}"); 84 | } 85 | 86 | if (record.getIsManager() != null) { 87 | sql.SET("is_manager = #{record.isManager,jdbcType=VARCHAR}"); 88 | } 89 | 90 | if (record.getUserName() != null) { 91 | sql.SET("user_name = #{record.userName,jdbcType=CHAR}"); 92 | } 93 | 94 | if (record.getUserPassword() != null) { 95 | sql.SET("user_password = #{record.userPassword,jdbcType=CHAR}"); 96 | } 97 | 98 | if (record.getIsVip() != null) { 99 | sql.SET("is_VIP = #{record.isVip,jdbcType=DECIMAL}"); 100 | } 101 | 102 | applyWhere(sql, example, true); 103 | return sql.toString(); 104 | } 105 | 106 | public String updateByExample(Map parameter) { 107 | SQL sql = new SQL(); 108 | sql.UPDATE("user"); 109 | 110 | sql.SET("user_id = #{record.userId,jdbcType=INTEGER}"); 111 | sql.SET("is_manager = #{record.isManager,jdbcType=VARCHAR}"); 112 | sql.SET("user_name = #{record.userName,jdbcType=CHAR}"); 113 | sql.SET("user_password = #{record.userPassword,jdbcType=CHAR}"); 114 | sql.SET("is_VIP = #{record.isVip,jdbcType=DECIMAL}"); 115 | 116 | UserExample example = (UserExample) parameter.get("example"); 117 | applyWhere(sql, example, true); 118 | return sql.toString(); 119 | } 120 | 121 | public String updateByPrimaryKeySelective(User record) { 122 | SQL sql = new SQL(); 123 | sql.UPDATE("user"); 124 | 125 | if (record.getIsManager() != null) { 126 | sql.SET("is_manager = #{isManager,jdbcType=VARCHAR}"); 127 | } 128 | 129 | if (record.getUserName() != null) { 130 | sql.SET("user_name = #{userName,jdbcType=CHAR}"); 131 | } 132 | 133 | if (record.getUserPassword() != null) { 134 | sql.SET("user_password = #{userPassword,jdbcType=CHAR}"); 135 | } 136 | 137 | if (record.getIsVip() != null) { 138 | sql.SET("is_VIP = #{isVip,jdbcType=DECIMAL}"); 139 | } 140 | 141 | sql.WHERE("user_id = #{userId,jdbcType=INTEGER}"); 142 | 143 | return sql.toString(); 144 | } 145 | 146 | protected void applyWhere(SQL sql, UserExample example, boolean includeExamplePhrase) { 147 | if (example == null) { 148 | return; 149 | } 150 | 151 | String parmPhrase1; 152 | String parmPhrase1_th; 153 | String parmPhrase2; 154 | String parmPhrase2_th; 155 | String parmPhrase3; 156 | String parmPhrase3_th; 157 | if (includeExamplePhrase) { 158 | parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; 159 | parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; 160 | parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; 161 | parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; 162 | parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; 163 | parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; 164 | } else { 165 | parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; 166 | parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; 167 | parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; 168 | parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; 169 | parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; 170 | parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; 171 | } 172 | 173 | StringBuilder sb = new StringBuilder(); 174 | List oredCriteria = example.getOredCriteria(); 175 | boolean firstCriteria = true; 176 | for (int i = 0; i < oredCriteria.size(); i++) { 177 | Criteria criteria = oredCriteria.get(i); 178 | if (criteria.isValid()) { 179 | if (firstCriteria) { 180 | firstCriteria = false; 181 | } else { 182 | sb.append(" or "); 183 | } 184 | 185 | sb.append('('); 186 | List criterions = criteria.getAllCriteria(); 187 | boolean firstCriterion = true; 188 | for (int j = 0; j < criterions.size(); j++) { 189 | Criterion criterion = criterions.get(j); 190 | if (firstCriterion) { 191 | firstCriterion = false; 192 | } else { 193 | sb.append(" and "); 194 | } 195 | 196 | if (criterion.isNoValue()) { 197 | sb.append(criterion.getCondition()); 198 | } else if (criterion.isSingleValue()) { 199 | if (criterion.getTypeHandler() == null) { 200 | sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); 201 | } else { 202 | sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); 203 | } 204 | } else if (criterion.isBetweenValue()) { 205 | if (criterion.getTypeHandler() == null) { 206 | sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); 207 | } else { 208 | sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); 209 | } 210 | } else if (criterion.isListValue()) { 211 | sb.append(criterion.getCondition()); 212 | sb.append(" ("); 213 | List listItems = (List) criterion.getValue(); 214 | boolean comma = false; 215 | for (int k = 0; k < listItems.size(); k++) { 216 | if (comma) { 217 | sb.append(", "); 218 | } else { 219 | comma = true; 220 | } 221 | if (criterion.getTypeHandler() == null) { 222 | sb.append(String.format(parmPhrase3, i, j, k)); 223 | } else { 224 | sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); 225 | } 226 | } 227 | sb.append(')'); 228 | } 229 | } 230 | sb.append(')'); 231 | } 232 | } 233 | 234 | if (sb.length() > 0) { 235 | sql.WHERE(sb.toString()); 236 | } 237 | } 238 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/dao/OrderFormSqlProvider.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.dao; 2 | 3 | import com.ticketsystem.model.OrderForm; 4 | import com.ticketsystem.model.OrderFormExample.Criteria; 5 | import com.ticketsystem.model.OrderFormExample.Criterion; 6 | import com.ticketsystem.model.OrderFormExample; 7 | import java.util.List; 8 | import java.util.Map; 9 | import org.apache.ibatis.jdbc.SQL; 10 | 11 | public class OrderFormSqlProvider { 12 | 13 | public String countByExample(OrderFormExample example) { 14 | SQL sql = new SQL(); 15 | sql.SELECT("count(*)").FROM("order_form"); 16 | applyWhere(sql, example, false); 17 | return sql.toString(); 18 | } 19 | 20 | public String deleteByExample(OrderFormExample example) { 21 | SQL sql = new SQL(); 22 | sql.DELETE_FROM("order_form"); 23 | applyWhere(sql, example, false); 24 | return sql.toString(); 25 | } 26 | 27 | public String insertSelective(OrderForm record) { 28 | SQL sql = new SQL(); 29 | sql.INSERT_INTO("order_form"); 30 | 31 | if (record.getOrderFormId() != null) { 32 | sql.VALUES("order_form_id", "#{orderFormId,jdbcType=INTEGER}"); 33 | } 34 | 35 | if (record.getUserId() != null) { 36 | sql.VALUES("user_id", "#{userId,jdbcType=INTEGER}"); 37 | } 38 | 39 | if (record.getTicketNumber() != null) { 40 | sql.VALUES("ticket_number", "#{ticketNumber,jdbcType=DECIMAL}"); 41 | } 42 | 43 | if (record.getTotalPrice() != null) { 44 | sql.VALUES("total_price", "#{totalPrice,jdbcType=REAL}"); 45 | } 46 | 47 | if (record.getOrderTime() != null) { 48 | sql.VALUES("order_time", "#{orderTime,jdbcType=TIMESTAMP}"); 49 | } 50 | 51 | return sql.toString(); 52 | } 53 | 54 | public String selectByExample(OrderFormExample example) { 55 | SQL sql = new SQL(); 56 | if (example != null && example.isDistinct()) { 57 | sql.SELECT_DISTINCT("order_form_id"); 58 | } else { 59 | sql.SELECT("order_form_id"); 60 | } 61 | sql.SELECT("user_id"); 62 | sql.SELECT("ticket_number"); 63 | sql.SELECT("total_price"); 64 | sql.SELECT("order_time"); 65 | sql.FROM("order_form"); 66 | applyWhere(sql, example, false); 67 | 68 | if (example != null && example.getOrderByClause() != null) { 69 | sql.ORDER_BY(example.getOrderByClause()); 70 | } 71 | 72 | return sql.toString(); 73 | } 74 | 75 | public String updateByExampleSelective(Map parameter) { 76 | OrderForm record = (OrderForm) parameter.get("record"); 77 | OrderFormExample example = (OrderFormExample) parameter.get("example"); 78 | 79 | SQL sql = new SQL(); 80 | sql.UPDATE("order_form"); 81 | 82 | if (record.getOrderFormId() != null) { 83 | sql.SET("order_form_id = #{record.orderFormId,jdbcType=INTEGER}"); 84 | } 85 | 86 | if (record.getUserId() != null) { 87 | sql.SET("user_id = #{record.userId,jdbcType=INTEGER}"); 88 | } 89 | 90 | if (record.getTicketNumber() != null) { 91 | sql.SET("ticket_number = #{record.ticketNumber,jdbcType=DECIMAL}"); 92 | } 93 | 94 | if (record.getTotalPrice() != null) { 95 | sql.SET("total_price = #{record.totalPrice,jdbcType=REAL}"); 96 | } 97 | 98 | if (record.getOrderTime() != null) { 99 | sql.SET("order_time = #{record.orderTime,jdbcType=TIMESTAMP}"); 100 | } 101 | 102 | applyWhere(sql, example, true); 103 | return sql.toString(); 104 | } 105 | 106 | public String updateByExample(Map parameter) { 107 | SQL sql = new SQL(); 108 | sql.UPDATE("order_form"); 109 | 110 | sql.SET("order_form_id = #{record.orderFormId,jdbcType=INTEGER}"); 111 | sql.SET("user_id = #{record.userId,jdbcType=INTEGER}"); 112 | sql.SET("ticket_number = #{record.ticketNumber,jdbcType=DECIMAL}"); 113 | sql.SET("total_price = #{record.totalPrice,jdbcType=REAL}"); 114 | sql.SET("order_time = #{record.orderTime,jdbcType=TIMESTAMP}"); 115 | 116 | OrderFormExample example = (OrderFormExample) parameter.get("example"); 117 | applyWhere(sql, example, true); 118 | return sql.toString(); 119 | } 120 | 121 | public String updateByPrimaryKeySelective(OrderForm record) { 122 | SQL sql = new SQL(); 123 | sql.UPDATE("order_form"); 124 | 125 | if (record.getUserId() != null) { 126 | sql.SET("user_id = #{userId,jdbcType=INTEGER}"); 127 | } 128 | 129 | if (record.getTicketNumber() != null) { 130 | sql.SET("ticket_number = #{ticketNumber,jdbcType=DECIMAL}"); 131 | } 132 | 133 | if (record.getTotalPrice() != null) { 134 | sql.SET("total_price = #{totalPrice,jdbcType=REAL}"); 135 | } 136 | 137 | if (record.getOrderTime() != null) { 138 | sql.SET("order_time = #{orderTime,jdbcType=TIMESTAMP}"); 139 | } 140 | 141 | sql.WHERE("order_form_id = #{orderFormId,jdbcType=INTEGER}"); 142 | 143 | return sql.toString(); 144 | } 145 | 146 | protected void applyWhere(SQL sql, OrderFormExample example, boolean includeExamplePhrase) { 147 | if (example == null) { 148 | return; 149 | } 150 | 151 | String parmPhrase1; 152 | String parmPhrase1_th; 153 | String parmPhrase2; 154 | String parmPhrase2_th; 155 | String parmPhrase3; 156 | String parmPhrase3_th; 157 | if (includeExamplePhrase) { 158 | parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; 159 | parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; 160 | parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; 161 | parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; 162 | parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; 163 | parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; 164 | } else { 165 | parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; 166 | parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; 167 | parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; 168 | parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; 169 | parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; 170 | parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; 171 | } 172 | 173 | StringBuilder sb = new StringBuilder(); 174 | List oredCriteria = example.getOredCriteria(); 175 | boolean firstCriteria = true; 176 | for (int i = 0; i < oredCriteria.size(); i++) { 177 | Criteria criteria = oredCriteria.get(i); 178 | if (criteria.isValid()) { 179 | if (firstCriteria) { 180 | firstCriteria = false; 181 | } else { 182 | sb.append(" or "); 183 | } 184 | 185 | sb.append('('); 186 | List criterions = criteria.getAllCriteria(); 187 | boolean firstCriterion = true; 188 | for (int j = 0; j < criterions.size(); j++) { 189 | Criterion criterion = criterions.get(j); 190 | if (firstCriterion) { 191 | firstCriterion = false; 192 | } else { 193 | sb.append(" and "); 194 | } 195 | 196 | if (criterion.isNoValue()) { 197 | sb.append(criterion.getCondition()); 198 | } else if (criterion.isSingleValue()) { 199 | if (criterion.getTypeHandler() == null) { 200 | sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); 201 | } else { 202 | sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); 203 | } 204 | } else if (criterion.isBetweenValue()) { 205 | if (criterion.getTypeHandler() == null) { 206 | sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); 207 | } else { 208 | sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); 209 | } 210 | } else if (criterion.isListValue()) { 211 | sb.append(criterion.getCondition()); 212 | sb.append(" ("); 213 | List listItems = (List) criterion.getValue(); 214 | boolean comma = false; 215 | for (int k = 0; k < listItems.size(); k++) { 216 | if (comma) { 217 | sb.append(", "); 218 | } else { 219 | comma = true; 220 | } 221 | if (criterion.getTypeHandler() == null) { 222 | sb.append(String.format(parmPhrase3, i, j, k)); 223 | } else { 224 | sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); 225 | } 226 | } 227 | sb.append(')'); 228 | } 229 | } 230 | sb.append(')'); 231 | } 232 | } 233 | 234 | if (sb.length() > 0) { 235 | sql.WHERE(sb.toString()); 236 | } 237 | } 238 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/dao/TicketSqlProvider.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.dao; 2 | 3 | import com.ticketsystem.model.Ticket; 4 | import com.ticketsystem.model.TicketExample.Criteria; 5 | import com.ticketsystem.model.TicketExample.Criterion; 6 | import com.ticketsystem.model.TicketExample; 7 | import java.util.List; 8 | import java.util.Map; 9 | import org.apache.ibatis.jdbc.SQL; 10 | 11 | public class TicketSqlProvider { 12 | 13 | public String countByExample(TicketExample example) { 14 | SQL sql = new SQL(); 15 | sql.SELECT("count(*)").FROM("ticket"); 16 | applyWhere(sql, example, false); 17 | return sql.toString(); 18 | } 19 | 20 | public String deleteByExample(TicketExample example) { 21 | SQL sql = new SQL(); 22 | sql.DELETE_FROM("ticket"); 23 | applyWhere(sql, example, false); 24 | return sql.toString(); 25 | } 26 | 27 | public String insertSelective(Ticket record) { 28 | SQL sql = new SQL(); 29 | sql.INSERT_INTO("ticket"); 30 | 31 | if (record.getTicketId() != null) { 32 | sql.VALUES("ticket_id", "#{ticketId,jdbcType=INTEGER}"); 33 | } 34 | 35 | if (record.getFlightId() != null) { 36 | sql.VALUES("flight_id", "#{flightId,jdbcType=INTEGER}"); 37 | } 38 | 39 | if (record.getOrderFormId() != null) { 40 | sql.VALUES("order_form_id", "#{orderFormId,jdbcType=INTEGER}"); 41 | } 42 | 43 | if (record.getPrice() != null) { 44 | sql.VALUES("price", "#{price,jdbcType=REAL}"); 45 | } 46 | 47 | if (record.getDiscount() != null) { 48 | sql.VALUES("discount", "#{discount,jdbcType=REAL}"); 49 | } 50 | 51 | if (record.getPassengerName() != null) { 52 | sql.VALUES("passenger_name", "#{passengerName,jdbcType=CHAR}"); 53 | } 54 | 55 | return sql.toString(); 56 | } 57 | 58 | public String selectByExample(TicketExample example) { 59 | SQL sql = new SQL(); 60 | if (example != null && example.isDistinct()) { 61 | sql.SELECT_DISTINCT("ticket_id"); 62 | } else { 63 | sql.SELECT("ticket_id"); 64 | } 65 | sql.SELECT("flight_id"); 66 | sql.SELECT("order_form_id"); 67 | sql.SELECT("price"); 68 | sql.SELECT("discount"); 69 | sql.SELECT("passenger_name"); 70 | sql.FROM("ticket"); 71 | applyWhere(sql, example, false); 72 | 73 | if (example != null && example.getOrderByClause() != null) { 74 | sql.ORDER_BY(example.getOrderByClause()); 75 | } 76 | 77 | return sql.toString(); 78 | } 79 | 80 | public String updateByExampleSelective(Map parameter) { 81 | Ticket record = (Ticket) parameter.get("record"); 82 | TicketExample example = (TicketExample) parameter.get("example"); 83 | 84 | SQL sql = new SQL(); 85 | sql.UPDATE("ticket"); 86 | 87 | if (record.getTicketId() != null) { 88 | sql.SET("ticket_id = #{record.ticketId,jdbcType=INTEGER}"); 89 | } 90 | 91 | if (record.getFlightId() != null) { 92 | sql.SET("flight_id = #{record.flightId,jdbcType=INTEGER}"); 93 | } 94 | 95 | if (record.getOrderFormId() != null) { 96 | sql.SET("order_form_id = #{record.orderFormId,jdbcType=INTEGER}"); 97 | } 98 | 99 | if (record.getPrice() != null) { 100 | sql.SET("price = #{record.price,jdbcType=REAL}"); 101 | } 102 | 103 | if (record.getDiscount() != null) { 104 | sql.SET("discount = #{record.discount,jdbcType=REAL}"); 105 | } 106 | 107 | if (record.getPassengerName() != null) { 108 | sql.SET("passenger_name = #{record.passengerName,jdbcType=CHAR}"); 109 | } 110 | 111 | applyWhere(sql, example, true); 112 | return sql.toString(); 113 | } 114 | 115 | public String updateByExample(Map parameter) { 116 | SQL sql = new SQL(); 117 | sql.UPDATE("ticket"); 118 | 119 | sql.SET("ticket_id = #{record.ticketId,jdbcType=INTEGER}"); 120 | sql.SET("flight_id = #{record.flightId,jdbcType=INTEGER}"); 121 | sql.SET("order_form_id = #{record.orderFormId,jdbcType=INTEGER}"); 122 | sql.SET("price = #{record.price,jdbcType=REAL}"); 123 | sql.SET("discount = #{record.discount,jdbcType=REAL}"); 124 | sql.SET("passenger_name = #{record.passengerName,jdbcType=CHAR}"); 125 | 126 | TicketExample example = (TicketExample) parameter.get("example"); 127 | applyWhere(sql, example, true); 128 | return sql.toString(); 129 | } 130 | 131 | public String updateByPrimaryKeySelective(Ticket record) { 132 | SQL sql = new SQL(); 133 | sql.UPDATE("ticket"); 134 | 135 | if (record.getFlightId() != null) { 136 | sql.SET("flight_id = #{flightId,jdbcType=INTEGER}"); 137 | } 138 | 139 | if (record.getOrderFormId() != null) { 140 | sql.SET("order_form_id = #{orderFormId,jdbcType=INTEGER}"); 141 | } 142 | 143 | if (record.getPrice() != null) { 144 | sql.SET("price = #{price,jdbcType=REAL}"); 145 | } 146 | 147 | if (record.getDiscount() != null) { 148 | sql.SET("discount = #{discount,jdbcType=REAL}"); 149 | } 150 | 151 | if (record.getPassengerName() != null) { 152 | sql.SET("passenger_name = #{passengerName,jdbcType=CHAR}"); 153 | } 154 | 155 | sql.WHERE("ticket_id = #{ticketId,jdbcType=INTEGER}"); 156 | 157 | return sql.toString(); 158 | } 159 | 160 | protected void applyWhere(SQL sql, TicketExample example, boolean includeExamplePhrase) { 161 | if (example == null) { 162 | return; 163 | } 164 | 165 | String parmPhrase1; 166 | String parmPhrase1_th; 167 | String parmPhrase2; 168 | String parmPhrase2_th; 169 | String parmPhrase3; 170 | String parmPhrase3_th; 171 | if (includeExamplePhrase) { 172 | parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; 173 | parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; 174 | parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; 175 | parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; 176 | parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; 177 | parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; 178 | } else { 179 | parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; 180 | parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; 181 | parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; 182 | parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; 183 | parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; 184 | parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; 185 | } 186 | 187 | StringBuilder sb = new StringBuilder(); 188 | List oredCriteria = example.getOredCriteria(); 189 | boolean firstCriteria = true; 190 | for (int i = 0; i < oredCriteria.size(); i++) { 191 | Criteria criteria = oredCriteria.get(i); 192 | if (criteria.isValid()) { 193 | if (firstCriteria) { 194 | firstCriteria = false; 195 | } else { 196 | sb.append(" or "); 197 | } 198 | 199 | sb.append('('); 200 | List criterions = criteria.getAllCriteria(); 201 | boolean firstCriterion = true; 202 | for (int j = 0; j < criterions.size(); j++) { 203 | Criterion criterion = criterions.get(j); 204 | if (firstCriterion) { 205 | firstCriterion = false; 206 | } else { 207 | sb.append(" and "); 208 | } 209 | 210 | if (criterion.isNoValue()) { 211 | sb.append(criterion.getCondition()); 212 | } else if (criterion.isSingleValue()) { 213 | if (criterion.getTypeHandler() == null) { 214 | sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); 215 | } else { 216 | sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); 217 | } 218 | } else if (criterion.isBetweenValue()) { 219 | if (criterion.getTypeHandler() == null) { 220 | sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); 221 | } else { 222 | sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); 223 | } 224 | } else if (criterion.isListValue()) { 225 | sb.append(criterion.getCondition()); 226 | sb.append(" ("); 227 | List listItems = (List) criterion.getValue(); 228 | boolean comma = false; 229 | for (int k = 0; k < listItems.size(); k++) { 230 | if (comma) { 231 | sb.append(", "); 232 | } else { 233 | comma = true; 234 | } 235 | if (criterion.getTypeHandler() == null) { 236 | sb.append(String.format(parmPhrase3, i, j, k)); 237 | } else { 238 | sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); 239 | } 240 | } 241 | sb.append(')'); 242 | } 243 | } 244 | sb.append(')'); 245 | } 246 | } 247 | 248 | if (sb.length() > 0) { 249 | sql.WHERE(sb.toString()); 250 | } 251 | } 252 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/dao/FlightSqlProvider.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.dao; 2 | 3 | import com.ticketsystem.model.Flight; 4 | import com.ticketsystem.model.FlightExample.Criteria; 5 | import com.ticketsystem.model.FlightExample.Criterion; 6 | import com.ticketsystem.model.FlightExample; 7 | import java.util.List; 8 | import java.util.Map; 9 | import org.apache.ibatis.jdbc.SQL; 10 | 11 | public class FlightSqlProvider { 12 | 13 | public String countByExample(FlightExample example) { 14 | SQL sql = new SQL(); 15 | sql.SELECT("count(*)").FROM("flight"); 16 | applyWhere(sql, example, false); 17 | return sql.toString(); 18 | } 19 | 20 | public String deleteByExample(FlightExample example) { 21 | SQL sql = new SQL(); 22 | sql.DELETE_FROM("flight"); 23 | applyWhere(sql, example, false); 24 | return sql.toString(); 25 | } 26 | 27 | public String insertSelective(Flight record) { 28 | SQL sql = new SQL(); 29 | sql.INSERT_INTO("flight"); 30 | 31 | if (record.getFlightId() != null) { 32 | sql.VALUES("flight_id", "#{flightId,jdbcType=INTEGER}"); 33 | } 34 | 35 | if (record.getStartTime() != null) { 36 | sql.VALUES("start_time", "#{startTime,jdbcType=TIMESTAMP}"); 37 | } 38 | 39 | if (record.getStartCity() != null) { 40 | sql.VALUES("start_city", "#{startCity,jdbcType=CHAR}"); 41 | } 42 | 43 | if (record.getEndCity() != null) { 44 | sql.VALUES("end_city", "#{endCity,jdbcType=CHAR}"); 45 | } 46 | 47 | if (record.getPeopleNumber() != null) { 48 | sql.VALUES("people_number", "#{peopleNumber,jdbcType=DECIMAL}"); 49 | } 50 | 51 | if (record.getLeftTicket() != null) { 52 | sql.VALUES("left_ticket", "#{leftTicket,jdbcType=DECIMAL}"); 53 | } 54 | 55 | if (record.getTicketPrice() != null) { 56 | sql.VALUES("ticket_price", "#{ticketPrice,jdbcType=REAL}"); 57 | } 58 | 59 | return sql.toString(); 60 | } 61 | 62 | public String selectByExample(FlightExample example) { 63 | SQL sql = new SQL(); 64 | if (example != null && example.isDistinct()) { 65 | sql.SELECT_DISTINCT("flight_id"); 66 | } else { 67 | sql.SELECT("flight_id"); 68 | } 69 | sql.SELECT("start_time"); 70 | sql.SELECT("start_city"); 71 | sql.SELECT("end_city"); 72 | sql.SELECT("people_number"); 73 | sql.SELECT("left_ticket"); 74 | sql.SELECT("ticket_price"); 75 | sql.FROM("flight"); 76 | applyWhere(sql, example, false); 77 | 78 | if (example != null && example.getOrderByClause() != null) { 79 | sql.ORDER_BY(example.getOrderByClause()); 80 | } 81 | 82 | return sql.toString(); 83 | } 84 | 85 | public String updateByExampleSelective(Map parameter) { 86 | Flight record = (Flight) parameter.get("record"); 87 | FlightExample example = (FlightExample) parameter.get("example"); 88 | 89 | SQL sql = new SQL(); 90 | sql.UPDATE("flight"); 91 | 92 | if (record.getFlightId() != null) { 93 | sql.SET("flight_id = #{record.flightId,jdbcType=INTEGER}"); 94 | } 95 | 96 | if (record.getStartTime() != null) { 97 | sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); 98 | } 99 | 100 | if (record.getStartCity() != null) { 101 | sql.SET("start_city = #{record.startCity,jdbcType=CHAR}"); 102 | } 103 | 104 | if (record.getEndCity() != null) { 105 | sql.SET("end_city = #{record.endCity,jdbcType=CHAR}"); 106 | } 107 | 108 | if (record.getPeopleNumber() != null) { 109 | sql.SET("people_number = #{record.peopleNumber,jdbcType=DECIMAL}"); 110 | } 111 | 112 | if (record.getLeftTicket() != null) { 113 | sql.SET("left_ticket = #{record.leftTicket,jdbcType=DECIMAL}"); 114 | } 115 | 116 | if (record.getTicketPrice() != null) { 117 | sql.SET("ticket_price = #{record.ticketPrice,jdbcType=REAL}"); 118 | } 119 | 120 | applyWhere(sql, example, true); 121 | return sql.toString(); 122 | } 123 | 124 | public String updateByExample(Map parameter) { 125 | SQL sql = new SQL(); 126 | sql.UPDATE("flight"); 127 | 128 | sql.SET("flight_id = #{record.flightId,jdbcType=INTEGER}"); 129 | sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); 130 | sql.SET("start_city = #{record.startCity,jdbcType=CHAR}"); 131 | sql.SET("end_city = #{record.endCity,jdbcType=CHAR}"); 132 | sql.SET("people_number = #{record.peopleNumber,jdbcType=DECIMAL}"); 133 | sql.SET("left_ticket = #{record.leftTicket,jdbcType=DECIMAL}"); 134 | sql.SET("ticket_price = #{record.ticketPrice,jdbcType=REAL}"); 135 | 136 | FlightExample example = (FlightExample) parameter.get("example"); 137 | applyWhere(sql, example, true); 138 | return sql.toString(); 139 | } 140 | 141 | public String updateByPrimaryKeySelective(Flight record) { 142 | SQL sql = new SQL(); 143 | sql.UPDATE("flight"); 144 | 145 | if (record.getStartTime() != null) { 146 | sql.SET("start_time = #{startTime,jdbcType=TIMESTAMP}"); 147 | } 148 | 149 | if (record.getStartCity() != null) { 150 | sql.SET("start_city = #{startCity,jdbcType=CHAR}"); 151 | } 152 | 153 | if (record.getEndCity() != null) { 154 | sql.SET("end_city = #{endCity,jdbcType=CHAR}"); 155 | } 156 | 157 | if (record.getPeopleNumber() != null) { 158 | sql.SET("people_number = #{peopleNumber,jdbcType=DECIMAL}"); 159 | } 160 | 161 | if (record.getLeftTicket() != null) { 162 | sql.SET("left_ticket = #{leftTicket,jdbcType=DECIMAL}"); 163 | } 164 | 165 | if (record.getTicketPrice() != null) { 166 | sql.SET("ticket_price = #{ticketPrice,jdbcType=REAL}"); 167 | } 168 | 169 | sql.WHERE("flight_id = #{flightId,jdbcType=INTEGER}"); 170 | 171 | return sql.toString(); 172 | } 173 | 174 | protected void applyWhere(SQL sql, FlightExample example, boolean includeExamplePhrase) { 175 | if (example == null) { 176 | return; 177 | } 178 | 179 | String parmPhrase1; 180 | String parmPhrase1_th; 181 | String parmPhrase2; 182 | String parmPhrase2_th; 183 | String parmPhrase3; 184 | String parmPhrase3_th; 185 | if (includeExamplePhrase) { 186 | parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; 187 | parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; 188 | parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; 189 | parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; 190 | parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; 191 | parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; 192 | } else { 193 | parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; 194 | parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; 195 | parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; 196 | parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; 197 | parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; 198 | parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; 199 | } 200 | 201 | StringBuilder sb = new StringBuilder(); 202 | List oredCriteria = example.getOredCriteria(); 203 | boolean firstCriteria = true; 204 | for (int i = 0; i < oredCriteria.size(); i++) { 205 | Criteria criteria = oredCriteria.get(i); 206 | if (criteria.isValid()) { 207 | if (firstCriteria) { 208 | firstCriteria = false; 209 | } else { 210 | sb.append(" or "); 211 | } 212 | 213 | sb.append('('); 214 | List criterions = criteria.getAllCriteria(); 215 | boolean firstCriterion = true; 216 | for (int j = 0; j < criterions.size(); j++) { 217 | Criterion criterion = criterions.get(j); 218 | if (firstCriterion) { 219 | firstCriterion = false; 220 | } else { 221 | sb.append(" and "); 222 | } 223 | 224 | if (criterion.isNoValue()) { 225 | sb.append(criterion.getCondition()); 226 | } else if (criterion.isSingleValue()) { 227 | if (criterion.getTypeHandler() == null) { 228 | sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); 229 | } else { 230 | sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); 231 | } 232 | } else if (criterion.isBetweenValue()) { 233 | if (criterion.getTypeHandler() == null) { 234 | sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); 235 | } else { 236 | sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); 237 | } 238 | } else if (criterion.isListValue()) { 239 | sb.append(criterion.getCondition()); 240 | sb.append(" ("); 241 | List listItems = (List) criterion.getValue(); 242 | boolean comma = false; 243 | for (int k = 0; k < listItems.size(); k++) { 244 | if (comma) { 245 | sb.append(", "); 246 | } else { 247 | comma = true; 248 | } 249 | if (criterion.getTypeHandler() == null) { 250 | sb.append(String.format(parmPhrase3, i, j, k)); 251 | } else { 252 | sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); 253 | } 254 | } 255 | sb.append(')'); 256 | } 257 | } 258 | sb.append(')'); 259 | } 260 | } 261 | 262 | if (sb.length() > 0) { 263 | sql.WHERE(sb.toString()); 264 | } 265 | } 266 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/model/OrderFormExample.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | public class OrderFormExample { 8 | protected String orderByClause; 9 | 10 | protected boolean distinct; 11 | 12 | protected List oredCriteria; 13 | 14 | public OrderFormExample() { 15 | oredCriteria = new ArrayList(); 16 | } 17 | 18 | public void setOrderByClause(String orderByClause) { 19 | this.orderByClause = orderByClause; 20 | } 21 | 22 | public String getOrderByClause() { 23 | return orderByClause; 24 | } 25 | 26 | public void setDistinct(boolean distinct) { 27 | this.distinct = distinct; 28 | } 29 | 30 | public boolean isDistinct() { 31 | return distinct; 32 | } 33 | 34 | public List getOredCriteria() { 35 | return oredCriteria; 36 | } 37 | 38 | public void or(Criteria criteria) { 39 | oredCriteria.add(criteria); 40 | } 41 | 42 | public Criteria or() { 43 | Criteria criteria = createCriteriaInternal(); 44 | oredCriteria.add(criteria); 45 | return criteria; 46 | } 47 | 48 | public Criteria createCriteria() { 49 | Criteria criteria = createCriteriaInternal(); 50 | if (oredCriteria.size() == 0) { 51 | oredCriteria.add(criteria); 52 | } 53 | return criteria; 54 | } 55 | 56 | protected Criteria createCriteriaInternal() { 57 | Criteria criteria = new Criteria(); 58 | return criteria; 59 | } 60 | 61 | public void clear() { 62 | oredCriteria.clear(); 63 | orderByClause = null; 64 | distinct = false; 65 | } 66 | 67 | protected abstract static class GeneratedCriteria { 68 | protected List criteria; 69 | 70 | protected GeneratedCriteria() { 71 | super(); 72 | criteria = new ArrayList(); 73 | } 74 | 75 | public boolean isValid() { 76 | return criteria.size() > 0; 77 | } 78 | 79 | public List getAllCriteria() { 80 | return criteria; 81 | } 82 | 83 | public List getCriteria() { 84 | return criteria; 85 | } 86 | 87 | protected void addCriterion(String condition) { 88 | if (condition == null) { 89 | throw new RuntimeException("Value for condition cannot be null"); 90 | } 91 | criteria.add(new Criterion(condition)); 92 | } 93 | 94 | protected void addCriterion(String condition, Object value, String property) { 95 | if (value == null) { 96 | throw new RuntimeException("Value for " + property + " cannot be null"); 97 | } 98 | criteria.add(new Criterion(condition, value)); 99 | } 100 | 101 | protected void addCriterion(String condition, Object value1, Object value2, String property) { 102 | if (value1 == null || value2 == null) { 103 | throw new RuntimeException("Between values for " + property + " cannot be null"); 104 | } 105 | criteria.add(new Criterion(condition, value1, value2)); 106 | } 107 | 108 | public Criteria andOrderFormIdIsNull() { 109 | addCriterion("order_form_id is null"); 110 | return (Criteria) this; 111 | } 112 | 113 | public Criteria andOrderFormIdIsNotNull() { 114 | addCriterion("order_form_id is not null"); 115 | return (Criteria) this; 116 | } 117 | 118 | public Criteria andOrderFormIdEqualTo(Integer value) { 119 | addCriterion("order_form_id =", value, "orderFormId"); 120 | return (Criteria) this; 121 | } 122 | 123 | public Criteria andOrderFormIdNotEqualTo(Integer value) { 124 | addCriterion("order_form_id <>", value, "orderFormId"); 125 | return (Criteria) this; 126 | } 127 | 128 | public Criteria andOrderFormIdGreaterThan(Integer value) { 129 | addCriterion("order_form_id >", value, "orderFormId"); 130 | return (Criteria) this; 131 | } 132 | 133 | public Criteria andOrderFormIdGreaterThanOrEqualTo(Integer value) { 134 | addCriterion("order_form_id >=", value, "orderFormId"); 135 | return (Criteria) this; 136 | } 137 | 138 | public Criteria andOrderFormIdLessThan(Integer value) { 139 | addCriterion("order_form_id <", value, "orderFormId"); 140 | return (Criteria) this; 141 | } 142 | 143 | public Criteria andOrderFormIdLessThanOrEqualTo(Integer value) { 144 | addCriterion("order_form_id <=", value, "orderFormId"); 145 | return (Criteria) this; 146 | } 147 | 148 | public Criteria andOrderFormIdIn(List values) { 149 | addCriterion("order_form_id in", values, "orderFormId"); 150 | return (Criteria) this; 151 | } 152 | 153 | public Criteria andOrderFormIdNotIn(List values) { 154 | addCriterion("order_form_id not in", values, "orderFormId"); 155 | return (Criteria) this; 156 | } 157 | 158 | public Criteria andOrderFormIdBetween(Integer value1, Integer value2) { 159 | addCriterion("order_form_id between", value1, value2, "orderFormId"); 160 | return (Criteria) this; 161 | } 162 | 163 | public Criteria andOrderFormIdNotBetween(Integer value1, Integer value2) { 164 | addCriterion("order_form_id not between", value1, value2, "orderFormId"); 165 | return (Criteria) this; 166 | } 167 | 168 | public Criteria andUserIdIsNull() { 169 | addCriterion("user_id is null"); 170 | return (Criteria) this; 171 | } 172 | 173 | public Criteria andUserIdIsNotNull() { 174 | addCriterion("user_id is not null"); 175 | return (Criteria) this; 176 | } 177 | 178 | public Criteria andUserIdEqualTo(Integer value) { 179 | addCriterion("user_id =", value, "userId"); 180 | return (Criteria) this; 181 | } 182 | 183 | public Criteria andUserIdNotEqualTo(Integer value) { 184 | addCriterion("user_id <>", value, "userId"); 185 | return (Criteria) this; 186 | } 187 | 188 | public Criteria andUserIdGreaterThan(Integer value) { 189 | addCriterion("user_id >", value, "userId"); 190 | return (Criteria) this; 191 | } 192 | 193 | public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { 194 | addCriterion("user_id >=", value, "userId"); 195 | return (Criteria) this; 196 | } 197 | 198 | public Criteria andUserIdLessThan(Integer value) { 199 | addCriterion("user_id <", value, "userId"); 200 | return (Criteria) this; 201 | } 202 | 203 | public Criteria andUserIdLessThanOrEqualTo(Integer value) { 204 | addCriterion("user_id <=", value, "userId"); 205 | return (Criteria) this; 206 | } 207 | 208 | public Criteria andUserIdIn(List values) { 209 | addCriterion("user_id in", values, "userId"); 210 | return (Criteria) this; 211 | } 212 | 213 | public Criteria andUserIdNotIn(List values) { 214 | addCriterion("user_id not in", values, "userId"); 215 | return (Criteria) this; 216 | } 217 | 218 | public Criteria andUserIdBetween(Integer value1, Integer value2) { 219 | addCriterion("user_id between", value1, value2, "userId"); 220 | return (Criteria) this; 221 | } 222 | 223 | public Criteria andUserIdNotBetween(Integer value1, Integer value2) { 224 | addCriterion("user_id not between", value1, value2, "userId"); 225 | return (Criteria) this; 226 | } 227 | 228 | public Criteria andTicketNumberIsNull() { 229 | addCriterion("ticket_number is null"); 230 | return (Criteria) this; 231 | } 232 | 233 | public Criteria andTicketNumberIsNotNull() { 234 | addCriterion("ticket_number is not null"); 235 | return (Criteria) this; 236 | } 237 | 238 | public Criteria andTicketNumberEqualTo(Integer value) { 239 | addCriterion("ticket_number =", value, "ticketNumber"); 240 | return (Criteria) this; 241 | } 242 | 243 | public Criteria andTicketNumberNotEqualTo(Integer value) { 244 | addCriterion("ticket_number <>", value, "ticketNumber"); 245 | return (Criteria) this; 246 | } 247 | 248 | public Criteria andTicketNumberGreaterThan(Integer value) { 249 | addCriterion("ticket_number >", value, "ticketNumber"); 250 | return (Criteria) this; 251 | } 252 | 253 | public Criteria andTicketNumberGreaterThanOrEqualTo(Integer value) { 254 | addCriterion("ticket_number >=", value, "ticketNumber"); 255 | return (Criteria) this; 256 | } 257 | 258 | public Criteria andTicketNumberLessThan(Integer value) { 259 | addCriterion("ticket_number <", value, "ticketNumber"); 260 | return (Criteria) this; 261 | } 262 | 263 | public Criteria andTicketNumberLessThanOrEqualTo(Integer value) { 264 | addCriterion("ticket_number <=", value, "ticketNumber"); 265 | return (Criteria) this; 266 | } 267 | 268 | public Criteria andTicketNumberIn(List values) { 269 | addCriterion("ticket_number in", values, "ticketNumber"); 270 | return (Criteria) this; 271 | } 272 | 273 | public Criteria andTicketNumberNotIn(List values) { 274 | addCriterion("ticket_number not in", values, "ticketNumber"); 275 | return (Criteria) this; 276 | } 277 | 278 | public Criteria andTicketNumberBetween(Integer value1, Integer value2) { 279 | addCriterion("ticket_number between", value1, value2, "ticketNumber"); 280 | return (Criteria) this; 281 | } 282 | 283 | public Criteria andTicketNumberNotBetween(Integer value1, Integer value2) { 284 | addCriterion("ticket_number not between", value1, value2, "ticketNumber"); 285 | return (Criteria) this; 286 | } 287 | 288 | public Criteria andTotalPriceIsNull() { 289 | addCriterion("total_price is null"); 290 | return (Criteria) this; 291 | } 292 | 293 | public Criteria andTotalPriceIsNotNull() { 294 | addCriterion("total_price is not null"); 295 | return (Criteria) this; 296 | } 297 | 298 | public Criteria andTotalPriceEqualTo(Float value) { 299 | addCriterion("total_price =", value, "totalPrice"); 300 | return (Criteria) this; 301 | } 302 | 303 | public Criteria andTotalPriceNotEqualTo(Float value) { 304 | addCriterion("total_price <>", value, "totalPrice"); 305 | return (Criteria) this; 306 | } 307 | 308 | public Criteria andTotalPriceGreaterThan(Float value) { 309 | addCriterion("total_price >", value, "totalPrice"); 310 | return (Criteria) this; 311 | } 312 | 313 | public Criteria andTotalPriceGreaterThanOrEqualTo(Float value) { 314 | addCriterion("total_price >=", value, "totalPrice"); 315 | return (Criteria) this; 316 | } 317 | 318 | public Criteria andTotalPriceLessThan(Float value) { 319 | addCriterion("total_price <", value, "totalPrice"); 320 | return (Criteria) this; 321 | } 322 | 323 | public Criteria andTotalPriceLessThanOrEqualTo(Float value) { 324 | addCriterion("total_price <=", value, "totalPrice"); 325 | return (Criteria) this; 326 | } 327 | 328 | public Criteria andTotalPriceIn(List values) { 329 | addCriterion("total_price in", values, "totalPrice"); 330 | return (Criteria) this; 331 | } 332 | 333 | public Criteria andTotalPriceNotIn(List values) { 334 | addCriterion("total_price not in", values, "totalPrice"); 335 | return (Criteria) this; 336 | } 337 | 338 | public Criteria andTotalPriceBetween(Float value1, Float value2) { 339 | addCriterion("total_price between", value1, value2, "totalPrice"); 340 | return (Criteria) this; 341 | } 342 | 343 | public Criteria andTotalPriceNotBetween(Float value1, Float value2) { 344 | addCriterion("total_price not between", value1, value2, "totalPrice"); 345 | return (Criteria) this; 346 | } 347 | 348 | public Criteria andOrderTimeIsNull() { 349 | addCriterion("order_time is null"); 350 | return (Criteria) this; 351 | } 352 | 353 | public Criteria andOrderTimeIsNotNull() { 354 | addCriterion("order_time is not null"); 355 | return (Criteria) this; 356 | } 357 | 358 | public Criteria andOrderTimeEqualTo(Date value) { 359 | addCriterion("order_time =", value, "orderTime"); 360 | return (Criteria) this; 361 | } 362 | 363 | public Criteria andOrderTimeNotEqualTo(Date value) { 364 | addCriterion("order_time <>", value, "orderTime"); 365 | return (Criteria) this; 366 | } 367 | 368 | public Criteria andOrderTimeGreaterThan(Date value) { 369 | addCriterion("order_time >", value, "orderTime"); 370 | return (Criteria) this; 371 | } 372 | 373 | public Criteria andOrderTimeGreaterThanOrEqualTo(Date value) { 374 | addCriterion("order_time >=", value, "orderTime"); 375 | return (Criteria) this; 376 | } 377 | 378 | public Criteria andOrderTimeLessThan(Date value) { 379 | addCriterion("order_time <", value, "orderTime"); 380 | return (Criteria) this; 381 | } 382 | 383 | public Criteria andOrderTimeLessThanOrEqualTo(Date value) { 384 | addCriterion("order_time <=", value, "orderTime"); 385 | return (Criteria) this; 386 | } 387 | 388 | public Criteria andOrderTimeIn(List values) { 389 | addCriterion("order_time in", values, "orderTime"); 390 | return (Criteria) this; 391 | } 392 | 393 | public Criteria andOrderTimeNotIn(List values) { 394 | addCriterion("order_time not in", values, "orderTime"); 395 | return (Criteria) this; 396 | } 397 | 398 | public Criteria andOrderTimeBetween(Date value1, Date value2) { 399 | addCriterion("order_time between", value1, value2, "orderTime"); 400 | return (Criteria) this; 401 | } 402 | 403 | public Criteria andOrderTimeNotBetween(Date value1, Date value2) { 404 | addCriterion("order_time not between", value1, value2, "orderTime"); 405 | return (Criteria) this; 406 | } 407 | } 408 | 409 | public static class Criteria extends GeneratedCriteria { 410 | 411 | protected Criteria() { 412 | super(); 413 | } 414 | } 415 | 416 | public static class Criterion { 417 | private String condition; 418 | 419 | private Object value; 420 | 421 | private Object secondValue; 422 | 423 | private boolean noValue; 424 | 425 | private boolean singleValue; 426 | 427 | private boolean betweenValue; 428 | 429 | private boolean listValue; 430 | 431 | private String typeHandler; 432 | 433 | public String getCondition() { 434 | return condition; 435 | } 436 | 437 | public Object getValue() { 438 | return value; 439 | } 440 | 441 | public Object getSecondValue() { 442 | return secondValue; 443 | } 444 | 445 | public boolean isNoValue() { 446 | return noValue; 447 | } 448 | 449 | public boolean isSingleValue() { 450 | return singleValue; 451 | } 452 | 453 | public boolean isBetweenValue() { 454 | return betweenValue; 455 | } 456 | 457 | public boolean isListValue() { 458 | return listValue; 459 | } 460 | 461 | public String getTypeHandler() { 462 | return typeHandler; 463 | } 464 | 465 | protected Criterion(String condition) { 466 | super(); 467 | this.condition = condition; 468 | this.typeHandler = null; 469 | this.noValue = true; 470 | } 471 | 472 | protected Criterion(String condition, Object value, String typeHandler) { 473 | super(); 474 | this.condition = condition; 475 | this.value = value; 476 | this.typeHandler = typeHandler; 477 | if (value instanceof List) { 478 | this.listValue = true; 479 | } else { 480 | this.singleValue = true; 481 | } 482 | } 483 | 484 | protected Criterion(String condition, Object value) { 485 | this(condition, value, null); 486 | } 487 | 488 | protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { 489 | super(); 490 | this.condition = condition; 491 | this.value = value; 492 | this.secondValue = secondValue; 493 | this.typeHandler = typeHandler; 494 | this.betweenValue = true; 495 | } 496 | 497 | protected Criterion(String condition, Object value, Object secondValue) { 498 | this(condition, value, secondValue, null); 499 | } 500 | } 501 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/model/UserExample.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class UserExample { 7 | protected String orderByClause; 8 | 9 | protected boolean distinct; 10 | 11 | protected List oredCriteria; 12 | 13 | public UserExample() { 14 | oredCriteria = new ArrayList(); 15 | } 16 | 17 | public void setOrderByClause(String orderByClause) { 18 | this.orderByClause = orderByClause; 19 | } 20 | 21 | public String getOrderByClause() { 22 | return orderByClause; 23 | } 24 | 25 | public void setDistinct(boolean distinct) { 26 | this.distinct = distinct; 27 | } 28 | 29 | public boolean isDistinct() { 30 | return distinct; 31 | } 32 | 33 | public List getOredCriteria() { 34 | return oredCriteria; 35 | } 36 | 37 | public void or(Criteria criteria) { 38 | oredCriteria.add(criteria); 39 | } 40 | 41 | public Criteria or() { 42 | Criteria criteria = createCriteriaInternal(); 43 | oredCriteria.add(criteria); 44 | return criteria; 45 | } 46 | 47 | public Criteria createCriteria() { 48 | Criteria criteria = createCriteriaInternal(); 49 | if (oredCriteria.size() == 0) { 50 | oredCriteria.add(criteria); 51 | } 52 | return criteria; 53 | } 54 | 55 | protected Criteria createCriteriaInternal() { 56 | Criteria criteria = new Criteria(); 57 | return criteria; 58 | } 59 | 60 | public void clear() { 61 | oredCriteria.clear(); 62 | orderByClause = null; 63 | distinct = false; 64 | } 65 | 66 | protected abstract static class GeneratedCriteria { 67 | protected List criteria; 68 | 69 | protected GeneratedCriteria() { 70 | super(); 71 | criteria = new ArrayList(); 72 | } 73 | 74 | public boolean isValid() { 75 | return criteria.size() > 0; 76 | } 77 | 78 | public List getAllCriteria() { 79 | return criteria; 80 | } 81 | 82 | public List getCriteria() { 83 | return criteria; 84 | } 85 | 86 | protected void addCriterion(String condition) { 87 | if (condition == null) { 88 | throw new RuntimeException("Value for condition cannot be null"); 89 | } 90 | criteria.add(new Criterion(condition)); 91 | } 92 | 93 | protected void addCriterion(String condition, Object value, String property) { 94 | if (value == null) { 95 | throw new RuntimeException("Value for " + property + " cannot be null"); 96 | } 97 | criteria.add(new Criterion(condition, value)); 98 | } 99 | 100 | protected void addCriterion(String condition, Object value1, Object value2, String property) { 101 | if (value1 == null || value2 == null) { 102 | throw new RuntimeException("Between values for " + property + " cannot be null"); 103 | } 104 | criteria.add(new Criterion(condition, value1, value2)); 105 | } 106 | 107 | public Criteria andUserIdIsNull() { 108 | addCriterion("user_id is null"); 109 | return (Criteria) this; 110 | } 111 | 112 | public Criteria andUserIdIsNotNull() { 113 | addCriterion("user_id is not null"); 114 | return (Criteria) this; 115 | } 116 | 117 | public Criteria andUserIdEqualTo(Integer value) { 118 | addCriterion("user_id =", value, "userId"); 119 | return (Criteria) this; 120 | } 121 | 122 | public Criteria andUserIdNotEqualTo(Integer value) { 123 | addCriterion("user_id <>", value, "userId"); 124 | return (Criteria) this; 125 | } 126 | 127 | public Criteria andUserIdGreaterThan(Integer value) { 128 | addCriterion("user_id >", value, "userId"); 129 | return (Criteria) this; 130 | } 131 | 132 | public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { 133 | addCriterion("user_id >=", value, "userId"); 134 | return (Criteria) this; 135 | } 136 | 137 | public Criteria andUserIdLessThan(Integer value) { 138 | addCriterion("user_id <", value, "userId"); 139 | return (Criteria) this; 140 | } 141 | 142 | public Criteria andUserIdLessThanOrEqualTo(Integer value) { 143 | addCriterion("user_id <=", value, "userId"); 144 | return (Criteria) this; 145 | } 146 | 147 | public Criteria andUserIdIn(List values) { 148 | addCriterion("user_id in", values, "userId"); 149 | return (Criteria) this; 150 | } 151 | 152 | public Criteria andUserIdNotIn(List values) { 153 | addCriterion("user_id not in", values, "userId"); 154 | return (Criteria) this; 155 | } 156 | 157 | public Criteria andUserIdBetween(Integer value1, Integer value2) { 158 | addCriterion("user_id between", value1, value2, "userId"); 159 | return (Criteria) this; 160 | } 161 | 162 | public Criteria andUserIdNotBetween(Integer value1, Integer value2) { 163 | addCriterion("user_id not between", value1, value2, "userId"); 164 | return (Criteria) this; 165 | } 166 | 167 | public Criteria andIsManagerIsNull() { 168 | addCriterion("is_manager is null"); 169 | return (Criteria) this; 170 | } 171 | 172 | public Criteria andIsManagerIsNotNull() { 173 | addCriterion("is_manager is not null"); 174 | return (Criteria) this; 175 | } 176 | 177 | public Criteria andIsManagerEqualTo(String value) { 178 | addCriterion("is_manager =", value, "isManager"); 179 | return (Criteria) this; 180 | } 181 | 182 | public Criteria andIsManagerNotEqualTo(String value) { 183 | addCriterion("is_manager <>", value, "isManager"); 184 | return (Criteria) this; 185 | } 186 | 187 | public Criteria andIsManagerGreaterThan(String value) { 188 | addCriterion("is_manager >", value, "isManager"); 189 | return (Criteria) this; 190 | } 191 | 192 | public Criteria andIsManagerGreaterThanOrEqualTo(String value) { 193 | addCriterion("is_manager >=", value, "isManager"); 194 | return (Criteria) this; 195 | } 196 | 197 | public Criteria andIsManagerLessThan(String value) { 198 | addCriterion("is_manager <", value, "isManager"); 199 | return (Criteria) this; 200 | } 201 | 202 | public Criteria andIsManagerLessThanOrEqualTo(String value) { 203 | addCriterion("is_manager <=", value, "isManager"); 204 | return (Criteria) this; 205 | } 206 | 207 | public Criteria andIsManagerLike(String value) { 208 | addCriterion("is_manager like", value, "isManager"); 209 | return (Criteria) this; 210 | } 211 | 212 | public Criteria andIsManagerNotLike(String value) { 213 | addCriterion("is_manager not like", value, "isManager"); 214 | return (Criteria) this; 215 | } 216 | 217 | public Criteria andIsManagerIn(List values) { 218 | addCriterion("is_manager in", values, "isManager"); 219 | return (Criteria) this; 220 | } 221 | 222 | public Criteria andIsManagerNotIn(List values) { 223 | addCriterion("is_manager not in", values, "isManager"); 224 | return (Criteria) this; 225 | } 226 | 227 | public Criteria andIsManagerBetween(String value1, String value2) { 228 | addCriterion("is_manager between", value1, value2, "isManager"); 229 | return (Criteria) this; 230 | } 231 | 232 | public Criteria andIsManagerNotBetween(String value1, String value2) { 233 | addCriterion("is_manager not between", value1, value2, "isManager"); 234 | return (Criteria) this; 235 | } 236 | 237 | public Criteria andUserNameIsNull() { 238 | addCriterion("user_name is null"); 239 | return (Criteria) this; 240 | } 241 | 242 | public Criteria andUserNameIsNotNull() { 243 | addCriterion("user_name is not null"); 244 | return (Criteria) this; 245 | } 246 | 247 | public Criteria andUserNameEqualTo(String value) { 248 | addCriterion("user_name =", value, "userName"); 249 | return (Criteria) this; 250 | } 251 | 252 | public Criteria andUserNameNotEqualTo(String value) { 253 | addCriterion("user_name <>", value, "userName"); 254 | return (Criteria) this; 255 | } 256 | 257 | public Criteria andUserNameGreaterThan(String value) { 258 | addCriterion("user_name >", value, "userName"); 259 | return (Criteria) this; 260 | } 261 | 262 | public Criteria andUserNameGreaterThanOrEqualTo(String value) { 263 | addCriterion("user_name >=", value, "userName"); 264 | return (Criteria) this; 265 | } 266 | 267 | public Criteria andUserNameLessThan(String value) { 268 | addCriterion("user_name <", value, "userName"); 269 | return (Criteria) this; 270 | } 271 | 272 | public Criteria andUserNameLessThanOrEqualTo(String value) { 273 | addCriterion("user_name <=", value, "userName"); 274 | return (Criteria) this; 275 | } 276 | 277 | public Criteria andUserNameLike(String value) { 278 | addCriterion("user_name like", value, "userName"); 279 | return (Criteria) this; 280 | } 281 | 282 | public Criteria andUserNameNotLike(String value) { 283 | addCriterion("user_name not like", value, "userName"); 284 | return (Criteria) this; 285 | } 286 | 287 | public Criteria andUserNameIn(List values) { 288 | addCriterion("user_name in", values, "userName"); 289 | return (Criteria) this; 290 | } 291 | 292 | public Criteria andUserNameNotIn(List values) { 293 | addCriterion("user_name not in", values, "userName"); 294 | return (Criteria) this; 295 | } 296 | 297 | public Criteria andUserNameBetween(String value1, String value2) { 298 | addCriterion("user_name between", value1, value2, "userName"); 299 | return (Criteria) this; 300 | } 301 | 302 | public Criteria andUserNameNotBetween(String value1, String value2) { 303 | addCriterion("user_name not between", value1, value2, "userName"); 304 | return (Criteria) this; 305 | } 306 | 307 | public Criteria andUserPasswordIsNull() { 308 | addCriterion("user_password is null"); 309 | return (Criteria) this; 310 | } 311 | 312 | public Criteria andUserPasswordIsNotNull() { 313 | addCriterion("user_password is not null"); 314 | return (Criteria) this; 315 | } 316 | 317 | public Criteria andUserPasswordEqualTo(String value) { 318 | addCriterion("user_password =", value, "userPassword"); 319 | return (Criteria) this; 320 | } 321 | 322 | public Criteria andUserPasswordNotEqualTo(String value) { 323 | addCriterion("user_password <>", value, "userPassword"); 324 | return (Criteria) this; 325 | } 326 | 327 | public Criteria andUserPasswordGreaterThan(String value) { 328 | addCriterion("user_password >", value, "userPassword"); 329 | return (Criteria) this; 330 | } 331 | 332 | public Criteria andUserPasswordGreaterThanOrEqualTo(String value) { 333 | addCriterion("user_password >=", value, "userPassword"); 334 | return (Criteria) this; 335 | } 336 | 337 | public Criteria andUserPasswordLessThan(String value) { 338 | addCriterion("user_password <", value, "userPassword"); 339 | return (Criteria) this; 340 | } 341 | 342 | public Criteria andUserPasswordLessThanOrEqualTo(String value) { 343 | addCriterion("user_password <=", value, "userPassword"); 344 | return (Criteria) this; 345 | } 346 | 347 | public Criteria andUserPasswordLike(String value) { 348 | addCriterion("user_password like", value, "userPassword"); 349 | return (Criteria) this; 350 | } 351 | 352 | public Criteria andUserPasswordNotLike(String value) { 353 | addCriterion("user_password not like", value, "userPassword"); 354 | return (Criteria) this; 355 | } 356 | 357 | public Criteria andUserPasswordIn(List values) { 358 | addCriterion("user_password in", values, "userPassword"); 359 | return (Criteria) this; 360 | } 361 | 362 | public Criteria andUserPasswordNotIn(List values) { 363 | addCriterion("user_password not in", values, "userPassword"); 364 | return (Criteria) this; 365 | } 366 | 367 | public Criteria andUserPasswordBetween(String value1, String value2) { 368 | addCriterion("user_password between", value1, value2, "userPassword"); 369 | return (Criteria) this; 370 | } 371 | 372 | public Criteria andUserPasswordNotBetween(String value1, String value2) { 373 | addCriterion("user_password not between", value1, value2, "userPassword"); 374 | return (Criteria) this; 375 | } 376 | 377 | public Criteria andIsVipIsNull() { 378 | addCriterion("is_VIP is null"); 379 | return (Criteria) this; 380 | } 381 | 382 | public Criteria andIsVipIsNotNull() { 383 | addCriterion("is_VIP is not null"); 384 | return (Criteria) this; 385 | } 386 | 387 | public Criteria andIsVipEqualTo(Short value) { 388 | addCriterion("is_VIP =", value, "isVip"); 389 | return (Criteria) this; 390 | } 391 | 392 | public Criteria andIsVipNotEqualTo(Short value) { 393 | addCriterion("is_VIP <>", value, "isVip"); 394 | return (Criteria) this; 395 | } 396 | 397 | public Criteria andIsVipGreaterThan(Short value) { 398 | addCriterion("is_VIP >", value, "isVip"); 399 | return (Criteria) this; 400 | } 401 | 402 | public Criteria andIsVipGreaterThanOrEqualTo(Short value) { 403 | addCriterion("is_VIP >=", value, "isVip"); 404 | return (Criteria) this; 405 | } 406 | 407 | public Criteria andIsVipLessThan(Short value) { 408 | addCriterion("is_VIP <", value, "isVip"); 409 | return (Criteria) this; 410 | } 411 | 412 | public Criteria andIsVipLessThanOrEqualTo(Short value) { 413 | addCriterion("is_VIP <=", value, "isVip"); 414 | return (Criteria) this; 415 | } 416 | 417 | public Criteria andIsVipIn(List values) { 418 | addCriterion("is_VIP in", values, "isVip"); 419 | return (Criteria) this; 420 | } 421 | 422 | public Criteria andIsVipNotIn(List values) { 423 | addCriterion("is_VIP not in", values, "isVip"); 424 | return (Criteria) this; 425 | } 426 | 427 | public Criteria andIsVipBetween(Short value1, Short value2) { 428 | addCriterion("is_VIP between", value1, value2, "isVip"); 429 | return (Criteria) this; 430 | } 431 | 432 | public Criteria andIsVipNotBetween(Short value1, Short value2) { 433 | addCriterion("is_VIP not between", value1, value2, "isVip"); 434 | return (Criteria) this; 435 | } 436 | } 437 | 438 | public static class Criteria extends GeneratedCriteria { 439 | 440 | protected Criteria() { 441 | super(); 442 | } 443 | } 444 | 445 | public static class Criterion { 446 | private String condition; 447 | 448 | private Object value; 449 | 450 | private Object secondValue; 451 | 452 | private boolean noValue; 453 | 454 | private boolean singleValue; 455 | 456 | private boolean betweenValue; 457 | 458 | private boolean listValue; 459 | 460 | private String typeHandler; 461 | 462 | public String getCondition() { 463 | return condition; 464 | } 465 | 466 | public Object getValue() { 467 | return value; 468 | } 469 | 470 | public Object getSecondValue() { 471 | return secondValue; 472 | } 473 | 474 | public boolean isNoValue() { 475 | return noValue; 476 | } 477 | 478 | public boolean isSingleValue() { 479 | return singleValue; 480 | } 481 | 482 | public boolean isBetweenValue() { 483 | return betweenValue; 484 | } 485 | 486 | public boolean isListValue() { 487 | return listValue; 488 | } 489 | 490 | public String getTypeHandler() { 491 | return typeHandler; 492 | } 493 | 494 | protected Criterion(String condition) { 495 | super(); 496 | this.condition = condition; 497 | this.typeHandler = null; 498 | this.noValue = true; 499 | } 500 | 501 | protected Criterion(String condition, Object value, String typeHandler) { 502 | super(); 503 | this.condition = condition; 504 | this.value = value; 505 | this.typeHandler = typeHandler; 506 | if (value instanceof List) { 507 | this.listValue = true; 508 | } else { 509 | this.singleValue = true; 510 | } 511 | } 512 | 513 | protected Criterion(String condition, Object value) { 514 | this(condition, value, null); 515 | } 516 | 517 | protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { 518 | super(); 519 | this.condition = condition; 520 | this.value = value; 521 | this.secondValue = secondValue; 522 | this.typeHandler = typeHandler; 523 | this.betweenValue = true; 524 | } 525 | 526 | protected Criterion(String condition, Object value, Object secondValue) { 527 | this(condition, value, secondValue, null); 528 | } 529 | } 530 | } -------------------------------------------------------------------------------- /src/main/java/com/ticketsystem/model/TicketExample.java: -------------------------------------------------------------------------------- 1 | package com.ticketsystem.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class TicketExample { 7 | protected String orderByClause; 8 | 9 | protected boolean distinct; 10 | 11 | protected List oredCriteria; 12 | 13 | public TicketExample() { 14 | oredCriteria = new ArrayList(); 15 | } 16 | 17 | public void setOrderByClause(String orderByClause) { 18 | this.orderByClause = orderByClause; 19 | } 20 | 21 | public String getOrderByClause() { 22 | return orderByClause; 23 | } 24 | 25 | public void setDistinct(boolean distinct) { 26 | this.distinct = distinct; 27 | } 28 | 29 | public boolean isDistinct() { 30 | return distinct; 31 | } 32 | 33 | public List getOredCriteria() { 34 | return oredCriteria; 35 | } 36 | 37 | public void or(Criteria criteria) { 38 | oredCriteria.add(criteria); 39 | } 40 | 41 | public Criteria or() { 42 | Criteria criteria = createCriteriaInternal(); 43 | oredCriteria.add(criteria); 44 | return criteria; 45 | } 46 | 47 | public Criteria createCriteria() { 48 | Criteria criteria = createCriteriaInternal(); 49 | if (oredCriteria.size() == 0) { 50 | oredCriteria.add(criteria); 51 | } 52 | return criteria; 53 | } 54 | 55 | protected Criteria createCriteriaInternal() { 56 | Criteria criteria = new Criteria(); 57 | return criteria; 58 | } 59 | 60 | public void clear() { 61 | oredCriteria.clear(); 62 | orderByClause = null; 63 | distinct = false; 64 | } 65 | 66 | protected abstract static class GeneratedCriteria { 67 | protected List criteria; 68 | 69 | protected GeneratedCriteria() { 70 | super(); 71 | criteria = new ArrayList(); 72 | } 73 | 74 | public boolean isValid() { 75 | return criteria.size() > 0; 76 | } 77 | 78 | public List getAllCriteria() { 79 | return criteria; 80 | } 81 | 82 | public List getCriteria() { 83 | return criteria; 84 | } 85 | 86 | protected void addCriterion(String condition) { 87 | if (condition == null) { 88 | throw new RuntimeException("Value for condition cannot be null"); 89 | } 90 | criteria.add(new Criterion(condition)); 91 | } 92 | 93 | protected void addCriterion(String condition, Object value, String property) { 94 | if (value == null) { 95 | throw new RuntimeException("Value for " + property + " cannot be null"); 96 | } 97 | criteria.add(new Criterion(condition, value)); 98 | } 99 | 100 | protected void addCriterion(String condition, Object value1, Object value2, String property) { 101 | if (value1 == null || value2 == null) { 102 | throw new RuntimeException("Between values for " + property + " cannot be null"); 103 | } 104 | criteria.add(new Criterion(condition, value1, value2)); 105 | } 106 | 107 | public Criteria andTicketIdIsNull() { 108 | addCriterion("ticket_id is null"); 109 | return (Criteria) this; 110 | } 111 | 112 | public Criteria andTicketIdIsNotNull() { 113 | addCriterion("ticket_id is not null"); 114 | return (Criteria) this; 115 | } 116 | 117 | public Criteria andTicketIdEqualTo(Integer value) { 118 | addCriterion("ticket_id =", value, "ticketId"); 119 | return (Criteria) this; 120 | } 121 | 122 | public Criteria andTicketIdNotEqualTo(Integer value) { 123 | addCriterion("ticket_id <>", value, "ticketId"); 124 | return (Criteria) this; 125 | } 126 | 127 | public Criteria andTicketIdGreaterThan(Integer value) { 128 | addCriterion("ticket_id >", value, "ticketId"); 129 | return (Criteria) this; 130 | } 131 | 132 | public Criteria andTicketIdGreaterThanOrEqualTo(Integer value) { 133 | addCriterion("ticket_id >=", value, "ticketId"); 134 | return (Criteria) this; 135 | } 136 | 137 | public Criteria andTicketIdLessThan(Integer value) { 138 | addCriterion("ticket_id <", value, "ticketId"); 139 | return (Criteria) this; 140 | } 141 | 142 | public Criteria andTicketIdLessThanOrEqualTo(Integer value) { 143 | addCriterion("ticket_id <=", value, "ticketId"); 144 | return (Criteria) this; 145 | } 146 | 147 | public Criteria andTicketIdIn(List values) { 148 | addCriterion("ticket_id in", values, "ticketId"); 149 | return (Criteria) this; 150 | } 151 | 152 | public Criteria andTicketIdNotIn(List values) { 153 | addCriterion("ticket_id not in", values, "ticketId"); 154 | return (Criteria) this; 155 | } 156 | 157 | public Criteria andTicketIdBetween(Integer value1, Integer value2) { 158 | addCriterion("ticket_id between", value1, value2, "ticketId"); 159 | return (Criteria) this; 160 | } 161 | 162 | public Criteria andTicketIdNotBetween(Integer value1, Integer value2) { 163 | addCriterion("ticket_id not between", value1, value2, "ticketId"); 164 | return (Criteria) this; 165 | } 166 | 167 | public Criteria andFlightIdIsNull() { 168 | addCriterion("flight_id is null"); 169 | return (Criteria) this; 170 | } 171 | 172 | public Criteria andFlightIdIsNotNull() { 173 | addCriterion("flight_id is not null"); 174 | return (Criteria) this; 175 | } 176 | 177 | public Criteria andFlightIdEqualTo(Integer value) { 178 | addCriterion("flight_id =", value, "flightId"); 179 | return (Criteria) this; 180 | } 181 | 182 | public Criteria andFlightIdNotEqualTo(Integer value) { 183 | addCriterion("flight_id <>", value, "flightId"); 184 | return (Criteria) this; 185 | } 186 | 187 | public Criteria andFlightIdGreaterThan(Integer value) { 188 | addCriterion("flight_id >", value, "flightId"); 189 | return (Criteria) this; 190 | } 191 | 192 | public Criteria andFlightIdGreaterThanOrEqualTo(Integer value) { 193 | addCriterion("flight_id >=", value, "flightId"); 194 | return (Criteria) this; 195 | } 196 | 197 | public Criteria andFlightIdLessThan(Integer value) { 198 | addCriterion("flight_id <", value, "flightId"); 199 | return (Criteria) this; 200 | } 201 | 202 | public Criteria andFlightIdLessThanOrEqualTo(Integer value) { 203 | addCriterion("flight_id <=", value, "flightId"); 204 | return (Criteria) this; 205 | } 206 | 207 | public Criteria andFlightIdIn(List values) { 208 | addCriterion("flight_id in", values, "flightId"); 209 | return (Criteria) this; 210 | } 211 | 212 | public Criteria andFlightIdNotIn(List values) { 213 | addCriterion("flight_id not in", values, "flightId"); 214 | return (Criteria) this; 215 | } 216 | 217 | public Criteria andFlightIdBetween(Integer value1, Integer value2) { 218 | addCriterion("flight_id between", value1, value2, "flightId"); 219 | return (Criteria) this; 220 | } 221 | 222 | public Criteria andFlightIdNotBetween(Integer value1, Integer value2) { 223 | addCriterion("flight_id not between", value1, value2, "flightId"); 224 | return (Criteria) this; 225 | } 226 | 227 | public Criteria andOrderFormIdIsNull() { 228 | addCriterion("order_form_id is null"); 229 | return (Criteria) this; 230 | } 231 | 232 | public Criteria andOrderFormIdIsNotNull() { 233 | addCriterion("order_form_id is not null"); 234 | return (Criteria) this; 235 | } 236 | 237 | public Criteria andOrderFormIdEqualTo(Integer value) { 238 | addCriterion("order_form_id =", value, "orderFormId"); 239 | return (Criteria) this; 240 | } 241 | 242 | public Criteria andOrderFormIdNotEqualTo(Integer value) { 243 | addCriterion("order_form_id <>", value, "orderFormId"); 244 | return (Criteria) this; 245 | } 246 | 247 | public Criteria andOrderFormIdGreaterThan(Integer value) { 248 | addCriterion("order_form_id >", value, "orderFormId"); 249 | return (Criteria) this; 250 | } 251 | 252 | public Criteria andOrderFormIdGreaterThanOrEqualTo(Integer value) { 253 | addCriterion("order_form_id >=", value, "orderFormId"); 254 | return (Criteria) this; 255 | } 256 | 257 | public Criteria andOrderFormIdLessThan(Integer value) { 258 | addCriterion("order_form_id <", value, "orderFormId"); 259 | return (Criteria) this; 260 | } 261 | 262 | public Criteria andOrderFormIdLessThanOrEqualTo(Integer value) { 263 | addCriterion("order_form_id <=", value, "orderFormId"); 264 | return (Criteria) this; 265 | } 266 | 267 | public Criteria andOrderFormIdIn(List values) { 268 | addCriterion("order_form_id in", values, "orderFormId"); 269 | return (Criteria) this; 270 | } 271 | 272 | public Criteria andOrderFormIdNotIn(List values) { 273 | addCriterion("order_form_id not in", values, "orderFormId"); 274 | return (Criteria) this; 275 | } 276 | 277 | public Criteria andOrderFormIdBetween(Integer value1, Integer value2) { 278 | addCriterion("order_form_id between", value1, value2, "orderFormId"); 279 | return (Criteria) this; 280 | } 281 | 282 | public Criteria andOrderFormIdNotBetween(Integer value1, Integer value2) { 283 | addCriterion("order_form_id not between", value1, value2, "orderFormId"); 284 | return (Criteria) this; 285 | } 286 | 287 | public Criteria andPriceIsNull() { 288 | addCriterion("price is null"); 289 | return (Criteria) this; 290 | } 291 | 292 | public Criteria andPriceIsNotNull() { 293 | addCriterion("price is not null"); 294 | return (Criteria) this; 295 | } 296 | 297 | public Criteria andPriceEqualTo(Float value) { 298 | addCriterion("price =", value, "price"); 299 | return (Criteria) this; 300 | } 301 | 302 | public Criteria andPriceNotEqualTo(Float value) { 303 | addCriterion("price <>", value, "price"); 304 | return (Criteria) this; 305 | } 306 | 307 | public Criteria andPriceGreaterThan(Float value) { 308 | addCriterion("price >", value, "price"); 309 | return (Criteria) this; 310 | } 311 | 312 | public Criteria andPriceGreaterThanOrEqualTo(Float value) { 313 | addCriterion("price >=", value, "price"); 314 | return (Criteria) this; 315 | } 316 | 317 | public Criteria andPriceLessThan(Float value) { 318 | addCriterion("price <", value, "price"); 319 | return (Criteria) this; 320 | } 321 | 322 | public Criteria andPriceLessThanOrEqualTo(Float value) { 323 | addCriterion("price <=", value, "price"); 324 | return (Criteria) this; 325 | } 326 | 327 | public Criteria andPriceIn(List values) { 328 | addCriterion("price in", values, "price"); 329 | return (Criteria) this; 330 | } 331 | 332 | public Criteria andPriceNotIn(List values) { 333 | addCriterion("price not in", values, "price"); 334 | return (Criteria) this; 335 | } 336 | 337 | public Criteria andPriceBetween(Float value1, Float value2) { 338 | addCriterion("price between", value1, value2, "price"); 339 | return (Criteria) this; 340 | } 341 | 342 | public Criteria andPriceNotBetween(Float value1, Float value2) { 343 | addCriterion("price not between", value1, value2, "price"); 344 | return (Criteria) this; 345 | } 346 | 347 | public Criteria andDiscountIsNull() { 348 | addCriterion("discount is null"); 349 | return (Criteria) this; 350 | } 351 | 352 | public Criteria andDiscountIsNotNull() { 353 | addCriterion("discount is not null"); 354 | return (Criteria) this; 355 | } 356 | 357 | public Criteria andDiscountEqualTo(Float value) { 358 | addCriterion("discount =", value, "discount"); 359 | return (Criteria) this; 360 | } 361 | 362 | public Criteria andDiscountNotEqualTo(Float value) { 363 | addCriterion("discount <>", value, "discount"); 364 | return (Criteria) this; 365 | } 366 | 367 | public Criteria andDiscountGreaterThan(Float value) { 368 | addCriterion("discount >", value, "discount"); 369 | return (Criteria) this; 370 | } 371 | 372 | public Criteria andDiscountGreaterThanOrEqualTo(Float value) { 373 | addCriterion("discount >=", value, "discount"); 374 | return (Criteria) this; 375 | } 376 | 377 | public Criteria andDiscountLessThan(Float value) { 378 | addCriterion("discount <", value, "discount"); 379 | return (Criteria) this; 380 | } 381 | 382 | public Criteria andDiscountLessThanOrEqualTo(Float value) { 383 | addCriterion("discount <=", value, "discount"); 384 | return (Criteria) this; 385 | } 386 | 387 | public Criteria andDiscountIn(List values) { 388 | addCriterion("discount in", values, "discount"); 389 | return (Criteria) this; 390 | } 391 | 392 | public Criteria andDiscountNotIn(List values) { 393 | addCriterion("discount not in", values, "discount"); 394 | return (Criteria) this; 395 | } 396 | 397 | public Criteria andDiscountBetween(Float value1, Float value2) { 398 | addCriterion("discount between", value1, value2, "discount"); 399 | return (Criteria) this; 400 | } 401 | 402 | public Criteria andDiscountNotBetween(Float value1, Float value2) { 403 | addCriterion("discount not between", value1, value2, "discount"); 404 | return (Criteria) this; 405 | } 406 | 407 | public Criteria andPassengerNameIsNull() { 408 | addCriterion("passenger_name is null"); 409 | return (Criteria) this; 410 | } 411 | 412 | public Criteria andPassengerNameIsNotNull() { 413 | addCriterion("passenger_name is not null"); 414 | return (Criteria) this; 415 | } 416 | 417 | public Criteria andPassengerNameEqualTo(String value) { 418 | addCriterion("passenger_name =", value, "passengerName"); 419 | return (Criteria) this; 420 | } 421 | 422 | public Criteria andPassengerNameNotEqualTo(String value) { 423 | addCriterion("passenger_name <>", value, "passengerName"); 424 | return (Criteria) this; 425 | } 426 | 427 | public Criteria andPassengerNameGreaterThan(String value) { 428 | addCriterion("passenger_name >", value, "passengerName"); 429 | return (Criteria) this; 430 | } 431 | 432 | public Criteria andPassengerNameGreaterThanOrEqualTo(String value) { 433 | addCriterion("passenger_name >=", value, "passengerName"); 434 | return (Criteria) this; 435 | } 436 | 437 | public Criteria andPassengerNameLessThan(String value) { 438 | addCriterion("passenger_name <", value, "passengerName"); 439 | return (Criteria) this; 440 | } 441 | 442 | public Criteria andPassengerNameLessThanOrEqualTo(String value) { 443 | addCriterion("passenger_name <=", value, "passengerName"); 444 | return (Criteria) this; 445 | } 446 | 447 | public Criteria andPassengerNameLike(String value) { 448 | addCriterion("passenger_name like", value, "passengerName"); 449 | return (Criteria) this; 450 | } 451 | 452 | public Criteria andPassengerNameNotLike(String value) { 453 | addCriterion("passenger_name not like", value, "passengerName"); 454 | return (Criteria) this; 455 | } 456 | 457 | public Criteria andPassengerNameIn(List values) { 458 | addCriterion("passenger_name in", values, "passengerName"); 459 | return (Criteria) this; 460 | } 461 | 462 | public Criteria andPassengerNameNotIn(List values) { 463 | addCriterion("passenger_name not in", values, "passengerName"); 464 | return (Criteria) this; 465 | } 466 | 467 | public Criteria andPassengerNameBetween(String value1, String value2) { 468 | addCriterion("passenger_name between", value1, value2, "passengerName"); 469 | return (Criteria) this; 470 | } 471 | 472 | public Criteria andPassengerNameNotBetween(String value1, String value2) { 473 | addCriterion("passenger_name not between", value1, value2, "passengerName"); 474 | return (Criteria) this; 475 | } 476 | } 477 | 478 | public static class Criteria extends GeneratedCriteria { 479 | 480 | protected Criteria() { 481 | super(); 482 | } 483 | } 484 | 485 | public static class Criterion { 486 | private String condition; 487 | 488 | private Object value; 489 | 490 | private Object secondValue; 491 | 492 | private boolean noValue; 493 | 494 | private boolean singleValue; 495 | 496 | private boolean betweenValue; 497 | 498 | private boolean listValue; 499 | 500 | private String typeHandler; 501 | 502 | public String getCondition() { 503 | return condition; 504 | } 505 | 506 | public Object getValue() { 507 | return value; 508 | } 509 | 510 | public Object getSecondValue() { 511 | return secondValue; 512 | } 513 | 514 | public boolean isNoValue() { 515 | return noValue; 516 | } 517 | 518 | public boolean isSingleValue() { 519 | return singleValue; 520 | } 521 | 522 | public boolean isBetweenValue() { 523 | return betweenValue; 524 | } 525 | 526 | public boolean isListValue() { 527 | return listValue; 528 | } 529 | 530 | public String getTypeHandler() { 531 | return typeHandler; 532 | } 533 | 534 | protected Criterion(String condition) { 535 | super(); 536 | this.condition = condition; 537 | this.typeHandler = null; 538 | this.noValue = true; 539 | } 540 | 541 | protected Criterion(String condition, Object value, String typeHandler) { 542 | super(); 543 | this.condition = condition; 544 | this.value = value; 545 | this.typeHandler = typeHandler; 546 | if (value instanceof List) { 547 | this.listValue = true; 548 | } else { 549 | this.singleValue = true; 550 | } 551 | } 552 | 553 | protected Criterion(String condition, Object value) { 554 | this(condition, value, null); 555 | } 556 | 557 | protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { 558 | super(); 559 | this.condition = condition; 560 | this.value = value; 561 | this.secondValue = secondValue; 562 | this.typeHandler = typeHandler; 563 | this.betweenValue = true; 564 | } 565 | 566 | protected Criterion(String condition, Object value, Object secondValue) { 567 | this(condition, value, secondValue, null); 568 | } 569 | } 570 | } --------------------------------------------------------------------------------