|
@@ -398,6 +398,40 @@ public class BookingCommentImplDao implements BookingCommentDao {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ public BookingComment queryById(String id) {
|
|
|
|
|
+ String sql = selectSql + " and a.id = :id";
|
|
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
|
|
+ sps.addValue("id",id);
|
|
|
|
|
+ List<BookingComment> list = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ list = namedParameterJdbcTemplate.query(sql, sps,
|
|
|
|
|
+ new BeanPropertyRowMapper<>(BookingComment.class));
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (list != null && list.size() > 0) return list.get(0);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int update(BookingComment bookingComment) {
|
|
|
|
|
+ StringBuffer stringBuffer = new StringBuffer(" update `booking_comment` set ");
|
|
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
|
|
+ // 将要修改的数据填充到查询语句中
|
|
|
|
|
+ appendValue(bookingComment,stringBuffer,sps);
|
|
|
|
|
+ stringBuffer.append(" where id=:id ");
|
|
|
|
|
+ sps.addValue("id", bookingComment.getId());
|
|
|
|
|
+ int num = 0;
|
|
|
|
|
+ try{
|
|
|
|
|
+ num = namedParameterJdbcTemplate.update(stringBuffer.toString(), sps);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch(Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ return num;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
public List<BookingComment> queryPage(String sqlx, int page, int rows) {
|
|
public List<BookingComment> queryPage(String sqlx, int page, int rows) {
|
|
|
SqlUtil.filterKeyword(sqlx);
|
|
SqlUtil.filterKeyword(sqlx);
|
|
|
int start = (page - 1) * rows;// 每页的起始下标
|
|
int start = (page - 1) * rows;// 每页的起始下标
|
|
@@ -624,7 +658,78 @@ public class BookingCommentImplDao implements BookingCommentDao {
|
|
|
if (list != null && list.size() > 0) return list.get(0);
|
|
if (list != null && list.size() > 0) return list.get(0);
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ public void appendValue(BookingComment bookingComment, StringBuffer stringBuffer, MapSqlParameterSource sps){
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getCommentId())){
|
|
|
|
|
+ stringBuffer.append(" comment_id=:comment_id ,");
|
|
|
|
|
+ sps.addValue("comment_id",bookingComment.getCommentId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getCommentParentId())){
|
|
|
|
|
+ stringBuffer.append(" comment_parent_id=:comment_parent_id ,");
|
|
|
|
|
+ sps.addValue("comment_parent_id",bookingComment.getCommentParentId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getCommentName())){
|
|
|
|
|
+ stringBuffer.append(" comment_name=:comment_name ,");
|
|
|
|
|
+ sps.addValue("comment_name",bookingComment.getCommentName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getHotelId())){
|
|
|
|
|
+ stringBuffer.append(" hotel_id=:hotel_id ,");
|
|
|
|
|
+ sps.addValue("hotel_id",bookingComment.getHotelId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getBookingId())){
|
|
|
|
|
+ stringBuffer.append(" booking_id=:booking_id ,");
|
|
|
|
|
+ sps.addValue("booking_id",bookingComment.getBookingId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getHouseId())){
|
|
|
|
|
+ stringBuffer.append(" house_id=:house_id ,");
|
|
|
|
|
+ sps.addValue("house_id",bookingComment.getHouseId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getContent())){
|
|
|
|
|
+ stringBuffer.append(" content=:content ,");
|
|
|
|
|
+ sps.addValue("content",bookingComment.getContent());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getCommentStatus())){
|
|
|
|
|
+ stringBuffer.append(" comment_status=:comment_status ,");
|
|
|
|
|
+ sps.addValue("comment_status",bookingComment.getCommentStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(String.valueOf(bookingComment.getScore()))){
|
|
|
|
|
+ stringBuffer.append(" score=:score ,");
|
|
|
|
|
+ sps.addValue("score",bookingComment.getScore());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(String.valueOf(bookingComment.getScoreWs()))){
|
|
|
|
|
+ stringBuffer.append(" score_ws=:score_ws ,");
|
|
|
|
|
+ sps.addValue("score_ws",bookingComment.getScoreWs());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(String.valueOf(bookingComment.getScoreFw()))){
|
|
|
|
|
+ stringBuffer.append(" score_fw=:score_fw ,");
|
|
|
|
|
+ sps.addValue("score_fw",bookingComment.getScoreFw());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(String.valueOf(bookingComment.getScoreSs()))){
|
|
|
|
|
+ stringBuffer.append(" score_ss=:score_ss ,");
|
|
|
|
|
+ sps.addValue("score_ss",bookingComment.getScoreSs());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(String.valueOf(bookingComment.getScoreWz()))){
|
|
|
|
|
+ stringBuffer.append(" score_wz=:score_wz ,");
|
|
|
|
|
+ sps.addValue("score_wz",bookingComment.getScoreWz());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(String.valueOf(bookingComment.getCreateId()))){
|
|
|
|
|
+ stringBuffer.append(" create_id=:create_id ,");
|
|
|
|
|
+ sps.addValue("create_id",bookingComment.getCreateId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getCreateUsername())){
|
|
|
|
|
+ stringBuffer.append(" create_username=:create_username ,");
|
|
|
|
|
+ sps.addValue("create_username",bookingComment.getCreateUsername());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getCreateDate())){
|
|
|
|
|
+ stringBuffer.append(" create_date=:create_date ,");
|
|
|
|
|
+ sps.addValue("create_date",bookingComment.getCreateDate());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Func.checkNull(bookingComment.getStatus())){
|
|
|
|
|
+ stringBuffer.append(" status=:status ,");
|
|
|
|
|
+ sps.addValue("status",bookingComment.getStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ stringBuffer.append(" modify_date=:modify_date ");
|
|
|
|
|
+ sps.addValue("modify_date", UUIDUtil.getNewDate());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+}
|
|
|
|
|
+
|