|
|
@@ -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;
|
|
|
+ }
|
|
|
}
|