Package com.jfinal.plugin.activerecord

Examples of com.jfinal.plugin.activerecord.Record


     * @param someBodyName 人名
     * @return 返回相应的问候语
     * @throws java.rmi.RemoteException
     */
    public String sayHelloToSomeBody(String someBodyName) throws RemoteException {
      Record r= Db.findById("manager", 1);
        return "你好," +r.getStr("username")+ someBodyName + "!";
    }
View Full Code Here


              cell.setCellValue(model.get(columns[j])+"");
            }
          }

        }else if(obj instanceof Record){
          Record record = (Record)obj;
          Map<String,Object> map = record.getColumns();
          if(columns.length==0){//未设置显示列,默认全部
            record.getColumns();
            Set<String> keys = map.keySet();
            int  columnIndex=0;
            for (String key : keys) {
              cell = row.createCell(columnIndex);
              cell.setCellValue(record.get(key)+"");
              columnIndex++;
            }
          }else{
            for (int j = 0, lenJ = columns.length; j < lenJ; j++) {
              cell = row.createCell(j);
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

    }
  }

  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 class WebadminController extends BaseController {
 
  public void index() {
    this.setAttr("StaticCfg", new StaticCfg());
//    Record m=this.getSessionAttr("manager");
    Record m=getCurrentUser();
    if(m==null){
      this.setAttr("StaticCfg", new StaticCfg());
    }else{
      List<Record> menus=fetchMenu();
      if(menus!=null&&menus.isEmpty()==false){
View Full Code Here

    this.render("loginDialog.html");
  }
  @SuppressWarnings("unchecked")
  private List<Record> fetchMenu(){
    String sid=getSession().getId();
    Record m=getCurrentUser();
    List<Record> menus=(List<Record>)MemcacheTool.mcc.get("menu"+sid);
    if(menus==null||menus.isEmpty())
      menus=Db.find(SqlManager.sql("webadmin.getpower"),m.get("id"));
    if(menus!=null&&menus.isEmpty()==false){
      //将菜单放置memcache
      MemcacheTool.mcc.set("menu"+sid,menus,new Date(new Date().getTime()+86400000));
      List<String> powersafecodelist=new ArrayList<String>();
      for(Record menu:menus){
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){
//        this.setSessionAttr("manager", m);
        String nowsid=this.getSession().getId();
        /**唯一登录,即同一用户只可在一处登录*/
        /**第一步 获取所有的session集合
         * 第二步 比较对应sessionid存储的Record记录
         * 第三步 对应的session进行超时操作,删除sessionid对应的缓存*/
        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 sid=it.next();
              Record r=(Record) MemcacheTool.mcc.get(sid);
              if(r!=null)
              if(!sid.equals(nowsid)&&r.get("userno").equals(m.get("userno"))){
                MemcacheTool.mcc.delete(sid);
                MemcacheTool.mcc.delete("menu"+sid);
                MemcacheTool.mcc.delete("btn"+sid);
              }
            }
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.