|
|
@@ -1,9 +1,6 @@
|
|
|
package com.happy.dao.impl;
|
|
|
|
|
|
-import com.happy.Model.Booking;
|
|
|
-import com.happy.Model.BookingComplaint;
|
|
|
-import com.happy.Model.HotelCoupon;
|
|
|
-import com.happy.Model.House;
|
|
|
+import com.happy.Model.*;
|
|
|
import com.happy.Until.SqlUtil;
|
|
|
import com.happy.Until.UUIDUtil;
|
|
|
import com.happy.dao.BookingComplainDao;
|
|
|
@@ -35,7 +32,7 @@ public class BookingComplainImplDao implements BookingComplainDao {
|
|
|
}
|
|
|
|
|
|
private String selectSql = "select " +
|
|
|
- "u.user_phone as complainPhone,m.corpn_phone as hotelPhone,a.id,a.booking_id,a.hotel_id,a.house_id,a.title,a.content,a.create_id,a.create_date,a.modify_date,a.status,h.h_name as house_name,h2.hname as hotel_name" +
|
|
|
+ "u.user_phone as complainPhone,m.corpn_phone as hotelPhone,a.id,a.remark,a.booking_id,a.hotel_id,a.house_id,a.title,a.content,a.create_id,a.create_date,a.modify_date,a.status,h.h_name as house_name,h2.hname as hotel_name" +
|
|
|
" from booking_complaint a " +
|
|
|
" left join house h on a.house_id = h.id " +
|
|
|
" left join hotel h2 on a.hotel_id = h2.id "+
|
|
|
@@ -44,7 +41,7 @@ public class BookingComplainImplDao implements BookingComplainDao {
|
|
|
" where a.status != 0 ";
|
|
|
|
|
|
private String selectLeftSql = "select " +
|
|
|
- " bk.order_num,u.user_phone as complainPhone,m.corpn_phone as hotelPhone,a.id,a.booking_id,a.hotel_id,a.house_id,a.title,a.content,a.create_id,a.create_date,a.modify_date,/*a.status,*/h.h_name as house_name,h2.hname as hotel_name,(SELECT bcp.progress_type FROM booking_complaint_progress bcp WHERE bcp.complaint_id = a.id ORDER BY bcp.create_date DESC LIMIT 1 ) AS status" +
|
|
|
+ " bk.order_num,u.user_phone as complainPhone,m.corpn_phone as hotelPhone,a.id,a.remark,a.booking_id,a.hotel_id,a.house_id,a.title,a.content,a.create_id,a.create_date,a.modify_date,/*a.status,*/h.h_name as house_name,h2.hname as hotel_name,(SELECT bcp.progress_type FROM booking_complaint_progress bcp WHERE bcp.complaint_id = a.id ORDER BY bcp.create_date DESC LIMIT 1 ) AS status" +
|
|
|
" from booking_complaint a " +
|
|
|
" left join house h on a.house_id = h.id " +
|
|
|
" left join hotel h2 on a.hotel_id = h2.id "+
|
|
|
@@ -55,7 +52,7 @@ public class BookingComplainImplDao implements BookingComplainDao {
|
|
|
|
|
|
|
|
|
private String selectLeftSql1 = "select * from (select " +
|
|
|
- " bk.order_num,u.user_phone as complainPhone,m.corpn_phone as hotelPhone,a.id,a.booking_id,a.hotel_id,a.house_id,a.title,a.content,a.create_id,a.create_date,a.modify_date,/*a.status,*/h.h_name as house_name,h2.hname as hotel_name,(SELECT bcp.progress_type FROM booking_complaint_progress bcp WHERE bcp.complaint_id = a.id ORDER BY bcp.create_date DESC LIMIT 1 ) AS status" +
|
|
|
+ " bk.order_num,u.user_phone as complainPhone,m.corpn_phone as hotelPhone,a.id,a.remark,a.booking_id,a.hotel_id,a.house_id,a.title,a.content,a.create_id,a.create_date,a.modify_date,/*a.status,*/h.h_name as house_name,h2.hname as hotel_name,(SELECT bcp.progress_type FROM booking_complaint_progress bcp WHERE bcp.complaint_id = a.id ORDER BY bcp.create_date DESC LIMIT 1 ) AS status" +
|
|
|
" from booking_complaint a " +
|
|
|
" left join house h on a.house_id = h.id " +
|
|
|
" left join hotel h2 on a.hotel_id = h2.id "+
|
|
|
@@ -64,6 +61,15 @@ public class BookingComplainImplDao implements BookingComplainDao {
|
|
|
" left join users u on a.create_id = u.id ) t" +
|
|
|
" where 1=1 ";
|
|
|
|
|
|
+ private String detailSql = "select " +
|
|
|
+ "u.user_phone as complainPhone,m.corpn_phone as hotelPhone,a.id,a.remark,a.booking_id,a.hotel_id,a.house_id,a.title,a.content,a.create_id,a.create_date,a.modify_date,h.h_name as house_name,h2.hname as hotel_name,(SELECT bcp.progress_type FROM booking_complaint_progress bcp WHERE bcp.complaint_id = a.id ORDER BY bcp.create_date DESC LIMIT 1 ) AS status" +
|
|
|
+ " from booking_complaint a " +
|
|
|
+ " left join house h on a.house_id = h.id " +
|
|
|
+ " left join hotel h2 on a.hotel_id = h2.id "+
|
|
|
+ " left join admin_manager m on h2.manager_id = m.id " +
|
|
|
+ " left join users u on a.create_id = u.id " +
|
|
|
+ " where a.status != 0 ";
|
|
|
+
|
|
|
@Override
|
|
|
public List<BookingComplaintVo> queryPage(String sqlx, int page, int rows) {
|
|
|
SqlUtil.filterKeyword(sqlx);
|
|
|
@@ -113,6 +119,22 @@ public class BookingComplainImplDao implements BookingComplainDao {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public BookingComplaint getDetailById(String id) {
|
|
|
+ String sql = detailSql + " and a.id = :id";
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
+ sps.addValue("id", id);
|
|
|
+ List<BookingComplaint> list = null;
|
|
|
+ try{
|
|
|
+ list = namedParameterJdbcTemplate.query(sql, sps,
|
|
|
+ new BeanPropertyRowMapper<>(BookingComplaint.class));
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if(list != null && list.size()>0) return list.get(0);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public String insert(String bookingId, String hotelId, String houseId, String title, String content, String createId, String createDate, String modifyDate) {
|
|
|
String sql = "insert into `booking_complaint` (id,booking_id,hotel_id,house_id,title,content,create_id,create_date,modify_date,status)" +
|
|
|
" values (:id,:booking_id,:hotel_id,:house_id,:title,:content,:create_id,:create_date,:modify_date,:status)";
|
|
|
@@ -259,4 +281,20 @@ public class BookingComplainImplDao implements BookingComplainDao {
|
|
|
if(list != null && list.size()>0) return list.get(0);
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateComplain(String id,String status) {
|
|
|
+
|
|
|
+ String sql= " update `booking_complaint` set "+status+" where id=:id";
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
+ sps.addValue("id", id);
|
|
|
+
|
|
|
+ int num = 0;
|
|
|
+ try {
|
|
|
+ num = namedParameterJdbcTemplate.update(sql, sps);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ }
|
|
|
}
|