zoukankan      html  css  js  c++  java
  • 自动生成业务编号 备份

         String sqlCode = "SELECT MAX(code) as code from gongzuo where   year(create_date) = year(NOW()) and month(create_date)=month(NOW())  ";
                    String delegateCode = jdbcTemplate.queryForObject(sqlCode, String.class);
    
                    StringB     String sqlCode = "SELECT MAX(code) as code from gongzuo where   year(create_date) = year(NOW()) and month(create_date)=month(NOW())  ";
                    String delegateCode = jdbcTemplate.queryForObject(sqlCode, String.class);
    
                    StringBuffer code = new StringBuffer("ZY");
                    code.append(DateUtils.getDataString(DateUtils.yyyyMMdd).substring(2, 6));
                    if (StringUtils.isEmpty(delegateCode)) {
                        code.append("0001");
                    } else {
                        code.append(getCode(delegateCode));
                    }
                    gongzuo.setCode(code.toString());uffer code = new StringBuffer("ZY");
                    code.append(DateUtils.getDataString(DateUtils.yyyyMMdd).substring(2, 6));
                    if (StringUtils.isEmpty(delegateCode)) {
                        code.append("0001");
                    } else {
                        code.append(getCode(delegateCode));
                    }
                    gongzuo.setCode(code.toString());
     // 后4位自定义编码 +1
        public String getCode(String code) {
            String result = "";
            code = code.substring(code.length() - 4);
            int a = Integer.parseInt(code);
            a++;
            int len = (a + "").length();
            if (len == 1) {
                result = "000" + a;
            } else if (len == 2) {
                result = "00" + a;
            } else if (len == 3) {
                result = "0" + a;
            } else {
                result = "" + a;
            }
            return result;
        }
  • 相关阅读:
    Python数据结构与算法(几种排序)
    jquery元素节点操作
    Jquery事件委托
    Jquery事件冒泡
    jquery事件
    尺寸相关、滚动事件
    jquery属性操作
    jquery选择器
    JavaScript面向对象
    jQuery powerFloat万能浮动层下拉层插件
  • 原文地址:https://www.cnblogs.com/xueblvip/p/14380593.html
Copyright © 2011-2022 走看看