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后直接调用

  • 相关阅读:
    字串变换
    重建道路
    poj3278 Catch That Cow
    机器人搬重物
    [HNOI2004]打鼹鼠
    曼哈顿距离
    邮票面值设计
    poj1101 The Game
    解决了一个堆破坏问题
    模型资源从无到有一条龙式体验
  • 原文地址:https://www.cnblogs.com/pujiajia/p/3287255.html
Copyright © 2011-2022 走看看