zoukankan      html  css  js  c++  java
  • 检测商品简码是否唯一,不重复

    Action:

    /*

        * 检测商品简码是否唯一,不重复

        */

       public String checkCode() throws Exception {

          try {

            HttpServletRequest request = Struts2Utils.getRequest();

            String goodscode = request.getParameter("goodscode");

            String oldGc = request.getParameter("oldGc");

            goodscode = new String(goodscode.getBytes("iso8859-1"), "UTF-8");

            oldGc = new String(oldGc.getBytes("iso8859-1"), "gb2312");

    [d1]       if (busiGoodManager.isCodeUnique(goodscode, oldGc)) {

               Struts2Utils.renderText("true");

            } else {

               Struts2Utils.renderText("false");

            }

          } catch (Exception ex) {

            logger.error(ex.getMessage());

            Struts2Utils.renderText("false");

          }

          return NONE;

       }

    Service:

    public boolean isCodeUnique(String name, String oldName) {

          return busiGoodDao.isPropertyUnique[d2] ("goodscode", name, oldName);

       }

    Dao:

    /**

     *商品的泛型DAO类.

     *

     * @author ligy

     */

    @Component

    public class BusiGoodDao extends HibernateDao<BusiGood, Long> {

     

    }


     [d1]处理中午乱码

     [d2]Springside中,继承hibernatedao后直接调用

  • 相关阅读:
    GitLab-添加SSH Key亲历教程
    java-数组Array的应用总结
    Java-方法的重载和重写
    JSON-相关的工具收藏分享
    java-无重复的排列组合小技能
    Charles安装与使用
    深拷贝浅拷贝
    文件操作
    列表生成式
    非空即真,非零即真
  • 原文地址:https://www.cnblogs.com/pujiajia/p/3287255.html
Copyright © 2011-2022 走看看