lijie пре 2 година
родитељ
комит
ddebac3790

+ 0 - 131
mhotel/src/com/happy/Model/BookingComment.java

@@ -75,135 +75,4 @@ public class BookingComment {
     //    下级评论回复
     private List<BookingComment> lowCommentList;
 
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getCommentId() {
-        return commentId;
-    }
-
-    public void setCommentId(String commentId) {
-        this.commentId = commentId;
-    }
-
-    public String getBookingId() {
-        return bookingId;
-    }
-
-    public void setBookingId(String bookingId) {
-        this.bookingId = bookingId;
-    }
-
-    public String getHotelId() {
-        return hotelId;
-    }
-
-    public void setHotelId(String hotelId) {
-        this.hotelId = hotelId;
-    }
-
-    public String getHouseId() {
-        return houseId;
-    }
-
-    public void setHouseId(String houseId) {
-        this.houseId = houseId;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    public String getCommentStatus() {
-        return commentStatus;
-    }
-
-    public void setCommentStatus(String commentStatus) {
-        this.commentStatus = commentStatus;
-    }
-
-    public Double getScore() {
-        return score;
-    }
-
-    public void setScore(Double score) {
-        this.score = score;
-    }
-
-    public Double getScoreWs() {
-        return scoreWs;
-    }
-
-    public void setScoreWs(Double scoreWs) {
-        this.scoreWs = scoreWs;
-    }
-
-    public Double getScoreFw() {
-        return scoreFw;
-    }
-
-    public void setScoreFw(Double scoreFw) {
-        this.scoreFw = scoreFw;
-    }
-
-    public Double getScoreSs() {
-        return scoreSs;
-    }
-
-    public void setScoreSs(Double scoreSs) {
-        this.scoreSs = scoreSs;
-    }
-
-    public Double getScoreWz() {
-        return scoreWz;
-    }
-
-    public void setScoreWz(Double scoreWz) {
-        this.scoreWz = scoreWz;
-    }
-
-    public Integer getCreateId() {
-        return createId;
-    }
-
-    public void setCreateId(Integer createId) {
-        this.createId = createId;
-    }
-
-    public String getCreateUsername() {
-        return createUsername;
-    }
-
-    public void setCreateUsername(String createUsername) {
-        this.createUsername = createUsername;
-    }
-
-    public String getCreateDate() {
-        return createDate;
-    }
-
-    public void setCreateDate(String createDate) {
-        this.createDate = createDate;
-    }
-
-    public String getModifyDate() {
-        return modifyDate;
-    }
-
-    public void setModifyDate(String modifyDate) {
-        this.modifyDate = modifyDate;
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
 }

+ 1 - 1
mhotel/src/com/happy/action/AppBookingCommentAction.java

@@ -377,7 +377,7 @@ public class AppBookingCommentAction extends ActionSupport implements ServletReq
         BookingComment bookingComment = BookingComment.builder().commentId(commentId).commentParentId(commentParentId).commentName(commentName).bookingId(bookingId)
                 .hotelId(hotelId).houseId(houseId).content(content).commentStatus(commentStatus)
                 .score(score).scoreWs(scoreWs).scoreFw(scoreFw)
-                .scoreSs(scoreSs).scoreWz(scoreWz).createId(createId)
+                .scoreSs(scoreSs).scoreWz(scoreWz).createId(String.valueOf(createId))
                 .createUsername(createUsername).createDate(createDate)
                 .modifyDate(modifyDate).build();
 

+ 68 - 0
mhotel/src/com/happy/dao/impl/BookingCommentDaoImpl.java

@@ -7,6 +7,8 @@ import com.happy.Until.Func;
 import com.happy.Until.SqlUtil;
 import com.happy.Until.UUIDUtil;
 import com.happy.dao.BookingCommentDao;
+import com.happy.vo.BookingCommentPageVo;
+import com.happy.vo.EvaluatePageVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@@ -325,4 +327,70 @@ public class BookingCommentDaoImpl implements BookingCommentDao {
         return num;
     }
 
+    @Override
+    public List<BookingComment> queryPage(String sqlx, int page, int rows) {
+        SqlUtil.filterKeyword(sqlx);
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = selectSql + sqlx + " and a.comment_id is null " + " ORDER BY create_date DESC limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<BookingComment> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(BookingComment.class));
+        if (list != null && list.size() > 0) return list;
+        return null;
+    }
+
+    @Override
+    public int queryTotal(String sqlx) {
+        SqlUtil.filterKeyword(sqlx);
+        String sql = "SELECT count(*) FROM ("+ selectSql + " and a.comment_id is null " +") a where status != 0 "+sqlx;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    @Override
+    public List<BookingComment> getByBookId(String bookId) {
+        String sql = selectSql + " and a.booking_id = :id and a.comment_id is null and status != 0";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id",bookId);
+        List<BookingComment> list = new ArrayList<>();
+        try{
+            list = namedParameterJdbcTemplate.query(sql,sps, new BeanPropertyRowMapper<>(BookingComment.class));
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        if(list != null && list.size()>0) return list;
+        return null;
+    }
+
+    @Override
+    public List<BookingComment> getByParentId(String parentId) {
+        String sql = selectSql + " and a.comment_parent_id = :id and status != 0";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id",parentId);
+        List<BookingComment> list = new ArrayList<>();
+        try{
+            list = namedParameterJdbcTemplate.query(sql,sps, new BeanPropertyRowMapper<>(BookingComment.class));
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        if(list != null && list.size()>0) return list;
+        return null;
+    }
+
+    @Override
+    public List<BookingComment> getByCommentId(String commentId) {
+        String sql = selectSql + " and a.comment_id = :id and status != 0";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id",commentId);
+        List<BookingComment> list = new ArrayList<>();
+        try{
+            list = namedParameterJdbcTemplate.query(sql,sps, new BeanPropertyRowMapper<>(BookingComment.class));
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        if(list != null && list.size()>0) return list;
+        return null;
+    }
 }

+ 13 - 2
mhotel/src/com/happy/service/impl/BookingCommentImplService.java

@@ -1,10 +1,16 @@
 package com.happy.service.impl;
 
-import com.happy.Model.BookingComment;
-import com.happy.Model.FileInfo;
+import com.happy.Model.*;
 import com.happy.dao.BookingCommentDao;
+import com.happy.dao.FileInfoDao;
+import com.happy.dto.BookCommentDto;
+import com.happy.dto.IPage;
+import com.happy.service.BookService;
 import com.happy.service.BookingCommentService;
 import com.happy.service.FileService;
+import com.happy.service.HouseService;
+import com.happy.vo.BookingCommentPageVo;
+import com.happy.vo.EvaluatePageVo;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -98,6 +104,11 @@ public class BookingCommentImplService implements BookingCommentService {
     }
 
     @Override
+    public EvaluatePageVo evaluateScore(String hotelId) {
+        return  bookingCommentDao.evaluateScore(hotelId);
+    }
+
+    @Override
     public int replyComment(BookingComment bookingComment) {
 //
         String id = bookingCommentDao.insertBookingComment(bookingComment);