Package com.jfinal.plugin.activerecord

Examples of com.jfinal.plugin.activerecord.Record


    }
  }

  public void del() {
    Long id = getParaToLong(0, 0L);
    Record po = getCurrentUser();
    if (id != po.getLong("id")) {
      Employee.dao.deleteById(id);
      toDwzJson(200, "删除成功!", navTabId);
    } else {
      toDwzJson(300, "不能删除自己的账号!");
    }
View Full Code Here


  }
  @PowerBind
  public void savepwd() {
    String oldpwd = getPara("oldpwd");
    String pwd = getPara("pwd");
    Record po = getCurrentUser();
    Employee e = Employee.dao.findById(po.get("id"));
    String pwd1 = e.getStr("pwd");
    if (MD5.getMD5ofStr(oldpwd).equals(pwd1)) {
      e.set("pwd", MD5.getMD5ofStr(pwd));
      e.update();
      toDwzJson(200, "重置密码成功!密码为<br><h3><b style='color:red;'>" + pwd
View Full Code Here

 
  public void index() {
    this.setAttr("StaticCfg", new StaticCfg());
    setAttr("root",getRequest().getContextPath());
//    Record m=this.getSessionAttr("manager");
    Record m=getCurrentUser();
    if(m==null){
      this.setAttr("StaticCfg", new StaticCfg());
    }else{
      List<Record> menus=fetchMenu(this.getCookie("user_token"),m.getLong("id"));
      if(menus!=null&&menus.isEmpty()==false){
        this.setAttr("menus",menus);
        this.setAttr("pid", menus.get(0).getLong("id"));
        this.setAttr("menuChild",menus);
        this.setAttr("user",m);
View Full Code Here

  }
  @Before({ ManagerPowerInterceptor.class})
  public void commmenu(){}
  @Before({ ManagerPowerInterceptor.class })
  public void getmenu(){
    Record m=getCurrentUser();
    this.setAttr("pid", getParaToLong(0));
    this.setAttr("menuChild", fetchMenu(this.getCookie("user_token"),m.getLong("id")));
  }
View Full Code Here

      this.toDwzJson(300, "验证码超时!");
    }else if(validCode&&(check!=null&&code!=null&&!check.equals(code.toLowerCase()))){
      this.toDwzJson(300, "验证码错误!");
    }else{
      pwd=MD5.getMD5ofStr(pwd);
      Record m=Db.findFirst(SqlManager.sql("webadmin.login"), new Object[]{username,pwd});
      if(m!=null&&m.getLong("id")!=0){
        String nowuser_token=this.getRequest().getRemoteAddr()+"_"+System.currentTimeMillis();
        this.setCookie("user_token", nowuser_token, 86400000,"/");
        /**唯一登录,即同一用户只可在一处登录*/
        /**第一步 获取所有的session集合
         * 第二步 比较对应user_token存储的Record记录
         * 第三步 对应的session进行超时操作,删除user_token对应的缓存*/
        boolean single="1".equals(StaticCfg.get("single").get("value"))?true:false;
        if(single){
          Set<String>sessionSet=(Set<String>)MemcacheTool.mcc.get("clientSet");
          if(sessionSet!=null&&sessionSet.isEmpty()==false){
            Iterator<String> it= sessionSet.iterator();
            while(it.hasNext()){
              String user_token=it.next();
              Record r=(Record) MemcacheTool.mcc.get(user_token);
              if(r!=null)
              if(!user_token.equals(nowuser_token)&&r.get("userno").equals(m.get("userno"))){
                MemcacheTool.mcc.delete(user_token);
                MemcacheTool.mcc.delete("menu"+user_token);
                MemcacheTool.mcc.delete("btn"+user_token);
              }
            }
View Full Code Here

  public void intercept(ActionInvocation ai) {
    Controller ctrl=ai.getController();
    ctrl.setAttr("root",ctrl.getRequest().getContextPath());
    ctrl.setAttr("StaticCfg", new StaticCfg());
    String user_token=ctrl.getCookie("user_token");
    Record po=(Record)MemcacheTool.mcc.get(user_token);
    if(po==null){
      /*String ckey=ai.getControllerKey();
      if(ckey.contains("webadmin")){
        ctrl.redirect(ctrl.getRequest().getContextPath()+"/webadmin");
      }else*/
 
View Full Code Here

    int columnCount = rsmd.getColumnCount();
    String[] labelNames = new String[columnCount + 1];
    int[] types = new int[columnCount + 1];
    buildLabelNamesAndTypes(rsmd, labelNames, types);
    for (int k=0; k<pageSize && rs.next(); k++) {
      Record record = new Record();
      Map<String, Object> columns = record.getColumns();
      for (int i=1; i<=columnCount; i++) {
        Object value;
        if (types[i] < Types.BLOB)
          value = rs.getObject(i);
        else if (types[i] == Types.CLOB)
View Full Code Here

    int columnCount = rsmd.getColumnCount();
    String[] labelNames = new String[columnCount + 1];
    int[] types = new int[columnCount + 1];
    buildLabelNamesAndTypes(rsmd, labelNames, types);
    for (int k=0; k<pageSize && rs.next(); k++) {
      Record record = new Record();
      Map<String, Object> columns = record.getColumns();
      for (int i=1; i<=columnCount; i++) {
        Object value;
        if (types[i] < Types.BLOB)
          value = rs.getObject(i);
        else if (types[i] == Types.CLOB)
View Full Code Here

    }

    //@Test
    public void testSave() {
        List<Record> records = new ArrayList<Record>();
        Record record = new Record();
        record.set("name", "aa");
        records.add(record);
        Record record2 = new Record();
        record2.set("name", "bb");
        record2.set("age", "1");
        records.add(record2);
        System.out.println(MongoKit.save("sns", records));
    }
View Full Code Here

    //@Test
    public void testUpdate() {
        MongoKit.removeAll("sns");
        List<Record> records = new ArrayList<Record>();
        Record record = new Record();
        record.set("name", "aa");
        records.add(record);
        Record record2 = new Record();
        record2.set("name", "bb");
        record2.set("age", "1");
        records.add(record2);
        Record record3 = new Record();
        record3.set("name", "qbb");
        record3.set("age", "1");
        records.add(record3);
        MongoKit.save("sns", records);
        Map<String, Object> src = new HashMap<String, Object>();
        src.put("age", "1");
        Map<String, Object> desc = new HashMap<String, Object>();
View Full Code Here

TOP

Related Classes of com.jfinal.plugin.activerecord.Record

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.