/*kccj为订单号前缀字符串*/ private String createOrderNoByMaxOrderNo(String kccj, PurCheckStockInfoBo purCheckStockInfoBo) { //查询条件前缀 到月 SimpleDateFormat sdfSel = new SimpleDateFormat("yyyyMM"); String nowDayStr = sdfSel.format(new Date()); StringBuilder orderNoSel = new StringBuilder(); orderNoSel.append(kccj).append(nowDayStr); //实际拼写订单前缀 到日 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); String nowDayStrQz = sdf.format(new Date()); StringBuilder orderNoQz = new StringBuilder(); orderNoQz.append(kccj).append(nowDayStrQz); purCheckStockInfoBo.setDjCodeSel(orderNoSel.toString()); String maxDjCode = purCheckStockInfoBoDao.selectTodayMaxDjCode(purCheckStockInfoBo); return Utils.createDjCodeByMaxOrderNo(orderNoQz,maxDjCode); }
<select id="selectTodayMaxDjCode" parameterType="PurCheckStockInfoBo" resultType="java.lang.String"> select max(pcsi.check_code) maxCheckCode from tb_pur_check_stock_info pcsi where pcsi.check_code like '${djCodeSel}%' </select>