HotelCouponImplDao.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. package com.happy.dao.impl;
  2. import com.happy.Model.AdminManager;
  3. import com.happy.Model.HotelCoupon;
  4. import com.happy.Until.Func;
  5. import com.happy.Until.SqlUtil;
  6. import com.happy.Until.UUIDUtil;
  7. import com.happy.dao.HotelCouponDao;
  8. import com.happy.vo.*;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.jdbc.core.BeanPropertyRowMapper;
  11. import org.springframework.jdbc.core.SqlOutParameter;
  12. import org.springframework.jdbc.core.namedparam.EmptySqlParameterSource;
  13. import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
  14. import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
  15. import org.springframework.stereotype.Repository;
  16. import java.util.ArrayList;
  17. import java.util.Arrays;
  18. import java.util.List;
  19. import java.util.UUID;
  20. @Repository("HotelCouponDao")
  21. public class HotelCouponImplDao implements HotelCouponDao {
  22. @Autowired
  23. private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
  24. public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
  25. return namedParameterJdbcTemplate;
  26. }
  27. public void setNamedParameterJdbcTemplate(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
  28. this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
  29. }
  30. private String selectSql = "select " +
  31. "id,hotelIds,name,type,rebate_price,deduction_price,max_deduction,grant_number,limit_number,grant_start_date,grant_end_date," +
  32. "meet_price,effective_start_date,effective_end_date,effective_type,effective_day,effective_lose_day,create_id,create_date,modify_date,status,remainder_number,remainder_number" +
  33. " from hotel_coupon where 1=1";
  34. @Override
  35. public int insert(HotelCoupon hotelCoupon) {
  36. String sql = "INSERT INTO `hotel_coupon` (`id`, `hotelIds`, `name`, `type`, `rebate_price`, `deduction_price`, `max_deduction`, `grant_number`, `limit_number`, `grant_start_date`, `grant_end_date`, `meet_price`, `effective_start_date`, `effective_end_date`, `effective_day`,`effective_type`, `effective_lose_day`,`create_id`, `create_date`, `modify_date`, `status`, `remainder_number`, `reversed_number`) VALUES (:id,:hotelIds,:name,:type,:rebate_price,:deduction_price,:max_deduction,:grant_number,:limit_number,:grant_start_date,:grant_end_date,:meet_price,:effective_start_date,:effective_end_date,:effective_day,:effective_type,:effective_lose_day,:create_id,:create_date,:modify_date,:status,:remainder_number,:reversed_number)";
  37. MapSqlParameterSource sps = new MapSqlParameterSource();
  38. if(hotelCoupon.getId()==null || "".equals(hotelCoupon.getId())){
  39. sps.addValue("id", String.valueOf(UUID.randomUUID()));
  40. }else{
  41. sps.addValue("id", hotelCoupon.getId());
  42. }
  43. sps.addValue("hotelIds", hotelCoupon.getHotelIds());
  44. sps.addValue("name", hotelCoupon.getName());
  45. sps.addValue("type", hotelCoupon.getType());
  46. sps.addValue("rebate_price", hotelCoupon.getRebatePrice());
  47. sps.addValue("deduction_price", hotelCoupon.getDeductionPrice());
  48. sps.addValue("max_deduction", hotelCoupon.getMaxDeduction());
  49. sps.addValue("grant_number", hotelCoupon.getGrantNumber());
  50. sps.addValue("limit_number", hotelCoupon.getLimitNumber());
  51. sps.addValue("grant_start_date", hotelCoupon.getGrantStartDate());
  52. sps.addValue("grant_end_date", hotelCoupon.getGrantEndDate());
  53. sps.addValue("meet_price", hotelCoupon.getMeetPrice());
  54. sps.addValue("effective_start_date", hotelCoupon.getEffectiveStartDate());
  55. sps.addValue("effective_end_date", hotelCoupon.getEffectiveEndDate());
  56. sps.addValue("effective_day", hotelCoupon.getEffectiveDay());
  57. sps.addValue("effective_type", hotelCoupon.getEffectiveType());
  58. sps.addValue("effective_lose_day", hotelCoupon.getEffectiveLoseDay());
  59. sps.addValue("create_id", hotelCoupon.getCreateId());
  60. sps.addValue("modify_date", UUIDUtil.getNewDate());
  61. sps.addValue("create_date", UUIDUtil.getNewDate());
  62. sps.addValue("status", hotelCoupon.getStatus());
  63. sps.addValue("remainder_number", hotelCoupon.getRemainderNumber());
  64. sps.addValue("reversed_number", hotelCoupon.getReversedNumber());
  65. int num = 0;
  66. try{
  67. num = namedParameterJdbcTemplate.update(sql, sps);
  68. }
  69. catch(Exception e){
  70. e.printStackTrace();
  71. }
  72. return num;
  73. }
  74. @Override
  75. public int update(HotelCoupon hotelCoupon) {
  76. StringBuffer stringBuffer = new StringBuffer(" update `hotel_coupon` set ");
  77. MapSqlParameterSource sps = new MapSqlParameterSource();
  78. // 将要修改的数据填充到查询语句中
  79. appendValue(hotelCoupon,stringBuffer,sps);
  80. stringBuffer.append(" where id=:id ");
  81. sps.addValue("id", hotelCoupon.getId());
  82. int num = 0;
  83. try{
  84. num = namedParameterJdbcTemplate.update(stringBuffer.toString(), sps);
  85. }
  86. catch(Exception e){
  87. e.printStackTrace();
  88. }
  89. return num;
  90. }
  91. @Override
  92. public int delete(Integer id) {
  93. return 0;
  94. }
  95. @Override
  96. public HotelCoupon getById(String id) {
  97. String sql = selectSql + " AND id = :id ";
  98. MapSqlParameterSource sps = new MapSqlParameterSource();
  99. sps.addValue("id",id);
  100. List<HotelCoupon> list = null;
  101. try{
  102. list = namedParameterJdbcTemplate.query(sql, sps,
  103. new BeanPropertyRowMapper<>(HotelCoupon.class));
  104. }catch (Exception e){
  105. e.printStackTrace();
  106. }
  107. if(list != null && list.size()>0) return list.get(0);
  108. return null;
  109. }
  110. @Override
  111. public List<HotelCoupon> queryPage(String sqlx, int page, int rows) {
  112. SqlUtil.filterKeyword(sqlx);
  113. int start = (page - 1) * rows;// 每页的起始下标
  114. String sql = selectSql + sqlx + " ORDER BY create_date DESC limit :start,:rows ";
  115. MapSqlParameterSource sps = new MapSqlParameterSource();
  116. sps.addValue("start", start);
  117. sps.addValue("rows", rows);
  118. List<HotelCoupon> list = namedParameterJdbcTemplate.query(sql, sps,
  119. new BeanPropertyRowMapper<>(HotelCoupon.class));
  120. if (list != null && list.size() > 0) return list;
  121. return null;
  122. }
  123. @Override
  124. public int queryTotal(String sqlx) {
  125. SqlUtil.filterKeyword(sqlx);
  126. String sql = "SELECT count(*) FROM `hotel_coupon` where 1=1 "+sqlx;
  127. MapSqlParameterSource sps = new MapSqlParameterSource();
  128. return namedParameterJdbcTemplate.queryForInt(sql, sps);
  129. }
  130. @Override
  131. public List<HotelCoupon> queryList(String sqlx) {
  132. SqlUtil.filterKeyword(sqlx);
  133. String sql = selectSql + sqlx ;
  134. List<HotelCoupon> list = null;
  135. try{
  136. list = namedParameterJdbcTemplate.query(sql, new BeanPropertyRowMapper<>(HotelCoupon.class));
  137. }catch (Exception e){
  138. e.printStackTrace();
  139. }
  140. if(list != null && list.size()>0) return list;
  141. return null;
  142. }
  143. @Override
  144. public int updateExpire() {
  145. //查询
  146. String sql = "SELECT `id` from `hotel_coupon` WHERE 1=1 and (DATE_FORMAT(`effective_end_date`, '%Y-%m-%d') < CURDATE() AND `effective_lose_day` IS NULL and `status` = 1)" +
  147. " OR" +
  148. " (DATE_FORMAT(DATE_ADD(`effective_end_date`, INTERVAL `effective_lose_day` + `effective_day` DAY),'%Y-%m-%d') < CURDATE() and `status` = 1)";
  149. int num = 0;
  150. try{
  151. List<String> ids = namedParameterJdbcTemplate.queryForList(sql, EmptySqlParameterSource.INSTANCE, String.class);
  152. if (ids.isEmpty()) return 0;
  153. //修改
  154. StringBuffer stringBuffer = new StringBuffer(" update `hotel_coupon` set ");
  155. MapSqlParameterSource sps = new MapSqlParameterSource();
  156. stringBuffer.append(" status = 3 ");
  157. stringBuffer.append(", modify_date=:modify_date ");
  158. sps.addValue("modify_date", UUIDUtil.getNewDate());
  159. stringBuffer.append(" where id in (:id)");
  160. sps.addValue("id", ids);
  161. num = namedParameterJdbcTemplate.update(stringBuffer.toString(), sps);
  162. }catch (Exception e){
  163. e.printStackTrace();
  164. }
  165. return num;
  166. }
  167. @Override
  168. public int updateLapse(List<String> coupomIds) {
  169. StringBuffer stringBuffer = new StringBuffer(" update `hotel_coupon` set ");
  170. MapSqlParameterSource sps = new MapSqlParameterSource();
  171. // 将要修改的数据填充到查询语句中
  172. stringBuffer.append(" status = 2 ");//失效状态写死
  173. stringBuffer.append(", modify_date=:modify_date ");
  174. sps.addValue("modify_date", UUIDUtil.getNewDate());
  175. stringBuffer.append(" where id in (:id)");
  176. sps.addValue("id", coupomIds);
  177. int num = 0;
  178. try{
  179. num = namedParameterJdbcTemplate.update(stringBuffer.toString(), sps);
  180. }
  181. catch(Exception e){
  182. e.printStackTrace();
  183. }
  184. return num;
  185. }
  186. @Override
  187. public List<CouponCollectionVo> couponCollection(String dateTime, int page, int rows) {
  188. int start = (page - 1) * rows;// 每页的起始下标
  189. String sql="SELECT\n" +
  190. "\t hc.id as id,hc.hotelIds as hotelIds,\n" +
  191. "\thc.type as type,\n" +
  192. "\thc.`name` as name,\n" +
  193. "\thc.rebate_price as rebatePrice,\n" +
  194. "\thc.deduction_price as deductionPrice,\n" +
  195. "\thc.max_deduction AS maxDeduction,\n" +
  196. "\thc.meet_price as meetPrice,\n" +
  197. "\thc.effective_start_date AS effectiveStartDate,(SELECT COUNT( hcs.complaint_id ) AS totalCount FROM `hotel_coupon_status` hcs WHERE hcs.complaint_id = hc.id ) AS totalCount, hc.limit_number as limitNumber,hc.remainder_number as remainderNumber, \n" +
  198. "\thc.effective_end_date AS effectiveEndDate \n" +
  199. "FROM\n" +
  200. "\t`hotel_coupon` hc where hc.effective_start_date < :dateTime and hc.effective_end_date> :dateTime and hc.`status` = 1 ORDER BY hc.effective_start_date DESC limit :start,:rows";
  201. MapSqlParameterSource sps = new MapSqlParameterSource();
  202. sps.addValue("dateTime", dateTime);
  203. sps.addValue("start", start);
  204. sps.addValue("rows", rows);
  205. List<CouponCollectionVo> list = null;
  206. try{
  207. list = namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<>(CouponCollectionVo.class));
  208. }catch (Exception e){
  209. e.printStackTrace();
  210. }
  211. if(list != null && list.size()>0) return list;
  212. return null;
  213. }
  214. @Override
  215. public int couponCollectionTotal(String date) {
  216. String sql="SELECT\n" +
  217. "\t count(1)\n" +
  218. "FROM\n" +
  219. "\t`hotel_coupon` hc where hc.effective_start_date<:date and hc.effective_end_date>:date";
  220. MapSqlParameterSource sps = new MapSqlParameterSource();
  221. sps.addValue("date", date);
  222. return namedParameterJdbcTemplate.queryForInt(sql, sps);
  223. }
  224. @Override
  225. public DesignatedHotelVo designatedHotel(String hotelIds) {
  226. String sql="SELECT GROUP_CONCAT( h.hname ) as name FROM hotel h where FIND_IN_SET(h.id,:hotelIds)";
  227. MapSqlParameterSource sps = new MapSqlParameterSource();
  228. sps.addValue("hotelIds", hotelIds);
  229. List<DesignatedHotelVo> list = null;
  230. try{
  231. list = namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<>(DesignatedHotelVo.class));
  232. }catch (Exception e){
  233. e.printStackTrace();
  234. }
  235. if(list != null && list.size()>0) return list.get(0);
  236. return null;
  237. }
  238. @Override
  239. public QuotaVo quota(String complaintId) {
  240. String sql="SELECT\n" +
  241. "\tCOUNT( hcs.complaint_id ) AS totalCount,\n" +
  242. "\t( SELECT hc.limit_number FROM hotel_coupon hc WHERE hc.id = :complaintId and hc.`status`=1 ) AS limitNumber, \n" +
  243. "\t( SELECT hc.remainder_number FROM hotel_coupon hc WHERE hc.id = :complaintId and hc.`status`=1 ) AS remainderNumber \n" +
  244. "FROM\n" +
  245. "\t`hotel_coupon_status` hcs \n" +
  246. "WHERE\n" +
  247. "\thcs.complaint_id = :complaintId ";
  248. MapSqlParameterSource sps = new MapSqlParameterSource();
  249. sps.addValue("complaintId", complaintId);
  250. List<QuotaVo> list = null;
  251. try{
  252. list = namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<>(QuotaVo.class));
  253. }catch (Exception e){
  254. e.printStackTrace();
  255. }
  256. if(list != null && list.size()>0) return list.get(0);
  257. return null;
  258. }
  259. @Override
  260. public int updateRemainderNumber(String complaintId,String modifyDate) {
  261. String sql="UPDATE `hotel_coupon` SET remainder_number=remainder_number-1 ,modify_date=:modifyDate WHERE id=:complaintId ";
  262. MapSqlParameterSource sps = new MapSqlParameterSource();
  263. sps.addValue("modifyDate", modifyDate);
  264. sps.addValue("complaintId", complaintId);
  265. int num = 0;
  266. try{
  267. num = namedParameterJdbcTemplate.update(sql, sps);
  268. }
  269. catch(Exception e){
  270. e.printStackTrace();
  271. }
  272. return num;
  273. }
  274. @Override
  275. public List<CardCouponPageVo> cardCouponPage(String types, String userId, int page, int rows) {
  276. int start = (page - 1) * rows;// 每页的起始下标
  277. String sql="SELECT\n" +
  278. "\thc.id as id,\n" +
  279. "\thc.hotelIds as hotelIds,\n" +
  280. "\thc.`name` as name,\n" +
  281. "\thc.type as type,\n" +
  282. "\thc.rebate_price as rebatePrice,\n" +
  283. "\thc.deduction_price as deductionPrice,\n" +
  284. "\thc.max_deduction as maxDeduction,\n" +
  285. "\thc.meet_price as meetPrice,\n" +
  286. "\thc.effective_end_date as effectiveEndDate ,\n" +
  287. "\tcount(hcs.complaint_id) AS count\n" +
  288. "FROM\n" +
  289. "\thotel_coupon_status hcs\n" +
  290. "\tLEFT JOIN hotel_coupon hc ON hc.id = hcs.complaint_id where FIND_IN_SET(hc.type,:status) and hcs.user_id=:userId and hcs.status=1 \n" +
  291. "\tGROUP BY hcs.complaint_id ORDER BY hc.effective_start_date DESC limit :start,:rows";
  292. MapSqlParameterSource sps = new MapSqlParameterSource();
  293. sps.addValue("status", types);
  294. sps.addValue("userId", userId);
  295. sps.addValue("start", start);
  296. sps.addValue("rows", rows);
  297. List<CardCouponPageVo> list = null;
  298. try{
  299. list = namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<>(CardCouponPageVo.class));
  300. }catch (Exception e){
  301. e.printStackTrace();
  302. }
  303. if(list != null && list.size()>0) return list;
  304. return null;
  305. }
  306. @Override
  307. public int cardCouponPageTotal(String types, String userId) {
  308. String sql="SELECT COUNT(1) FROM (SELECT\n" +
  309. "\thc.id as id,\n" +
  310. "\thc.hotelIds as hotelIds,\n" +
  311. "\thc.`name` as name,\n" +
  312. "\thc.type as type,\n" +
  313. "\thc.rebate_price as rebatePrice,\n" +
  314. "\thc.deduction_price as deductionPrice,\n" +
  315. "\thc.max_deduction as maxDeduction,\n" +
  316. "\thc.meet_price as meetPrice,\n" +
  317. "\thc.effective_end_date as effectiveEndDate ,\n" +
  318. "\tcount(hcs.complaint_id) AS count\n" +
  319. "FROM\n" +
  320. "\thotel_coupon_status hcs\n" +
  321. "\tLEFT JOIN hotel_coupon hc ON hc.id = hcs.complaint_id where FIND_IN_SET(hc.type,:status) and hcs.user_id=:userId and hcs.status=1 \n" +
  322. "\tGROUP BY hcs.complaint_id ORDER BY hc.effective_start_date DESC ) hcs2";
  323. MapSqlParameterSource sps = new MapSqlParameterSource();
  324. sps.addValue("status", types);
  325. sps.addValue("userId", userId);
  326. return namedParameterJdbcTemplate.queryForInt(sql, sps);
  327. }
  328. @Override
  329. public List<UsefulCouponVo> usefulCoupon(String hotelId, String userId, int page, int rows) {
  330. int start = (page - 1) * rows;// 每页的起始下标
  331. String sql="SELECT\n" +
  332. "\t hcs.id as id , hcs.complaint_id AS complaintId,\n" +
  333. "\thc.hotelIds as hotelIds,\n" +
  334. "\thc.`name` as name,\n" +
  335. "\thc.type as type,\n" +
  336. "\thc.rebate_price as rebatePrice,\n" +
  337. "\thc.deduction_price as deductionPrice,\n" +
  338. "\thc.max_deduction as maxDeduction,\n" +
  339. "\thc.meet_price as meetPrice,\n" +
  340. "\thc.effective_end_date as effectiveEndDate \n" +
  341. "FROM\n" +
  342. "\thotel_coupon_status hcs\n" +
  343. "\tLEFT JOIN hotel_coupon hc ON hc.id = hcs.complaint_id where (FIND_IN_SET(:hotelId, hc.hotelIds) or hc.hotelIds=-1 ) and hcs.user_id=:userId and hcs.status=1 \n" +
  344. "\t ORDER BY hc.effective_start_date DESC limit :start,:rows";
  345. MapSqlParameterSource sps = new MapSqlParameterSource();
  346. sps.addValue("hotelId", hotelId);
  347. sps.addValue("userId", userId);
  348. sps.addValue("start", start);
  349. sps.addValue("rows", rows);
  350. List<UsefulCouponVo> list = null;
  351. try{
  352. list = namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<>(UsefulCouponVo.class));
  353. }catch (Exception e){
  354. e.printStackTrace();
  355. }
  356. if(list != null && list.size()>0) return list;
  357. return null;
  358. }
  359. @Override
  360. public int usefulCouponTotal(String hotelId, String userId) {
  361. String sql="SELECT\n" +
  362. "\tCOUNT( 1 ) \n" +
  363. "FROM\n" +
  364. "\thotel_coupon_status hcs\n" +
  365. "\tLEFT JOIN hotel_coupon hc ON hc.id = hcs.complaint_id \n" +
  366. "WHERE\n" +
  367. "\t(FIND_IN_SET(:hotelId, hc.hotelIds) or hc.hotelIds=-1 ) \n" +
  368. "\tAND hcs.user_id = :userId \n" +
  369. "\tAND hcs.`status` = 1";
  370. MapSqlParameterSource sps = new MapSqlParameterSource();
  371. sps.addValue("hotelId", hotelId);
  372. sps.addValue("userId", userId);
  373. return namedParameterJdbcTemplate.queryForInt(sql, sps);
  374. }
  375. private void appendValue(HotelCoupon hotelCoupon, StringBuffer stringBuffer, MapSqlParameterSource sps){
  376. if (!Func.checkNull(String.valueOf(hotelCoupon.getHotelIds()))){
  377. stringBuffer.append(" hotelIds=:hotelIds ,");
  378. sps.addValue("hotelIds", hotelCoupon.getHotelIds());
  379. }
  380. if (!Func.checkNull(String.valueOf(hotelCoupon.getName()))){
  381. stringBuffer.append(" name=:name ,");
  382. sps.addValue("name", hotelCoupon.getName());
  383. }
  384. if (!Func.checkNull(String.valueOf(hotelCoupon.getType()))){
  385. stringBuffer.append(" type=:type ,");
  386. sps.addValue("type", hotelCoupon.getType());
  387. }
  388. if (!Func.checkNull(String.valueOf(hotelCoupon.getRebatePrice()))){
  389. stringBuffer.append(" rebate_price=:rebate_price ,");
  390. sps.addValue("rebate_price", hotelCoupon.getRebatePrice());
  391. }
  392. if (!Func.checkNull(String.valueOf(hotelCoupon.getDeductionPrice()))){
  393. stringBuffer.append(" deduction_price=:deduction_price ,");
  394. sps.addValue("deduction_price", hotelCoupon.getDeductionPrice());
  395. }
  396. if (!Func.checkNull(String.valueOf(hotelCoupon.getMaxDeduction()))){
  397. stringBuffer.append(" max_deduction=:max_deduction ,");
  398. sps.addValue("max_deduction", hotelCoupon.getMaxDeduction());
  399. }
  400. if (!Func.checkNull(String.valueOf(hotelCoupon.getGrantNumber()))){
  401. stringBuffer.append(" grant_number=:grant_number ,");
  402. sps.addValue("grant_number", hotelCoupon.getGrantNumber());
  403. }
  404. if (!Func.checkNull(String.valueOf(hotelCoupon.getLimitNumber()))){
  405. stringBuffer.append(" limit_number=:limit_number ,");
  406. sps.addValue("limit_number", hotelCoupon.getLimitNumber());
  407. }
  408. if (!Func.checkNull(String.valueOf(hotelCoupon.getGrantStartDate()))){
  409. stringBuffer.append(" grant_start_date=:grant_start_date ,");
  410. sps.addValue("grant_start_date", hotelCoupon.getGrantStartDate());
  411. }
  412. if (!Func.checkNull(String.valueOf(hotelCoupon.getGrantEndDate()))){
  413. stringBuffer.append(" grant_end_date=:grant_end_date ,");
  414. sps.addValue("grant_end_date", hotelCoupon.getGrantEndDate());
  415. }
  416. if (!Func.checkNull(String.valueOf(hotelCoupon.getMeetPrice()))){
  417. stringBuffer.append(" meet_price=:meet_price ,");
  418. sps.addValue("meet_price", hotelCoupon.getMeetPrice());
  419. }
  420. if (!Func.checkNull(String.valueOf(hotelCoupon.getEffectiveStartDate()))){
  421. stringBuffer.append(" effective_start_date=:effective_start_date ,");
  422. sps.addValue("effective_start_date", hotelCoupon.getEffectiveStartDate());
  423. }
  424. if (!Func.checkNull(String.valueOf(hotelCoupon.getEffectiveEndDate()))){
  425. stringBuffer.append(" effective_end_date=:effective_end_date ,");
  426. sps.addValue("effective_end_date", hotelCoupon.getEffectiveEndDate());
  427. }
  428. if (!Func.checkNull(String.valueOf(hotelCoupon.getEffectiveDay()))){
  429. stringBuffer.append(" effective_day=:effective_day ,");
  430. sps.addValue("effective_day", hotelCoupon.getEffectiveDay());
  431. }
  432. if (!Func.checkNull(String.valueOf(hotelCoupon.getEffectiveLoseDay()))){
  433. stringBuffer.append(" effective_lose_day=:effective_lose_day ,");
  434. sps.addValue("effective_lose_day", hotelCoupon.getEffectiveLoseDay());
  435. }
  436. if (!Func.checkNull(String.valueOf(hotelCoupon.getStatus()))){
  437. stringBuffer.append(" status=:status ,");
  438. sps.addValue("status", hotelCoupon.getStatus());
  439. }
  440. stringBuffer.append(" modify_date=:modify_date ");
  441. sps.addValue("modify_date", UUIDUtil.getNewDate());
  442. }
  443. }