/** * 新增/修改婚嫁建议 * * @param wedisleMarrySuggest * @throws Exception */ public static void saveOrUpdateWedisleExistMarry(WedisleMarrySuggest wedisleMarrySuggest) throws Exception { if (isWedisleExistMarrySuggest(wedisleMarrySuggest.getYear(), wedisleMarrySuggest.getMonth())) { updateWedisleExistMarry(wedisleMarrySuggest); } else { saveWedisleExistMarry(wedisleMarrySuggest); } }
/** * 修改婚嫁建议 * * @param wedisleMarrySuggest * @throws Exception */ private static void updateWedisleExistMarry(WedisleMarrySuggest wedisleMarrySuggest) throws Exception { String sql = "update wedisle_marry_suggest set legal_from='" + wedisleMarrySuggest.getLegalFrom() + "',legal_end='" + wedisleMarrySuggest.getLegalEnd() + "',late_from='" + wedisleMarrySuggest.getLateFrom() + "',late_end='" + wedisleMarrySuggest.getLateEnd() + "' WHERE year=" + wedisleMarrySuggest.getYear() + " AND month=" + wedisleMarrySuggest.getMonth(); DB.executeUpdate(sql); }
/** * 新增婚嫁建议 * * @param wedisleMarrySuggest * @throws Exception */ private static void saveWedisleExistMarry(WedisleMarrySuggest wedisleMarrySuggest) throws Exception { String sql = "insert into wedisle_marry_suggest" + "(year,month,legal_from,legal_end,late_from,late_end)" + "values" + "(" + wedisleMarrySuggest.getYear() + "," + wedisleMarrySuggest.getMonth() + ",'" + wedisleMarrySuggest.getLegalFrom() + "','" + wedisleMarrySuggest.getLegalEnd() + "','" + wedisleMarrySuggest.getLateFrom() + "','" + wedisleMarrySuggest.getLateEnd() + "')"; DB.executeUpdate(sql); }