Examples of BizResult


Examples of org.yfsoft.comm.util.BizResult

   * @param e
   * @param table
   * @return
   */
  public BizResult insert(Map<String,String> e,String table){
    BizResult rst = new BizResult().setCode("-1");
    String sql = "desc "+table;
    String f,t,a;
    List<Map<String,Object>> list = this.mapper.list(sql);
    sql = "insert into {0}({1}) values({2})";
    StringBuffer cols = new StringBuffer();
    StringBuffer vals = new StringBuffer();
    for(Map<String,Object> o : list){
      a = o.get("Extra").toString();//自增字段,过滤
      if("auto_increment".equals(a))  continue;
      f = o.get("Field").toString();//字段名称
      if(!e.containsKey(f)) continue;//未设置字段
      cols.append(f).append(",");
      t = o.get("Type").toString();//字段类型
      if(t.indexOf("int")<0){
        //字段未非整形
        vals.append("'").append(e.get(f)).append("'").append(",");
      }else{
        vals.append(e.get(f)).append(",");
      }
    }
    cols = cols.deleteCharAt(cols.length()-1);
    vals = vals.deleteCharAt(vals.length()-1);
    sql = StringUtil.formatSql(sql,table, cols.toString(),vals.toString());
//    System.out.println(sql);
    int rows = this.mapper.execute(sql);
    if(rows==1){
      rst.setCode("0");
    }
    return rst;
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

 
  public BizResult list(Map<String,String> input){
    String m_id = input.get("m_id");
    Map<String,Object> m = this.dao.query("sys_model",null,"m_id = "+m_id).getData();
    this.setReqAttr("model", m);
    BizResult rst = this.dao.injoin(new String[]{"sys_model_control mc","sys_control c"},
        new String[]{"mc.*","c.*"},
        "mc.mc_control_id = c.c_id",
        "mc.mc_model_id = "+m_id,
        null,100,0);
    List<Map<String,Object>> controls = rst.getData();
    if(controls.size()<1){
      this.setReqAttr("msg", "未设置栏位信息");
      rst.setType(String.valueOf(ResultType.REDIRECT));
      rst.setPage("tpl/list.jsp");
      return rst;
    }
    this.setReqAttr("controls", controls);
    List<Map<String,Object>> entrys = this.dao.list((m).get("m_view").toString(),null,null,null,100,0).getData();
    for(Map<String,Object> c : controls){
      Object ds_id = c.get("mc_ds");
      if(null == ds_id) continue;
      if("0".equals(ds_id)) continue;
      for(int i = 0 ;i < entrys.size();i++){
        Map<String,Object> e = entrys.get(i);
        try {
          e.put(c.get("mc_attr_name").toString(),this.dao.getDataValue(Integer.parseInt(ds_id.toString()), e.get(c.get("mc_attr_name"))));
          entrys.set(i, e);
        catch (Throwable e1) {
        }
      }
    }
    this.setReqAttr("es", entrys);
    rst.setType(String.valueOf(ResultType.REDIRECT));
    rst.setPage("tpl/list.jsp");
    return rst;
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

      this.setReqAttr("p", "edit");
      this.setReqAttr("pri", pri);
      this.setReqAttr("key", e_id);
      this.setReqAttr("v",v);
    }
    BizResult rst = new BizResult();
    rst.setType(String.valueOf(ResultType.REDIRECT));
    rst.setPage("tpl/form.jsp");
    return rst;
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

    if(keys.length>1){
      where = pri+" in " + Arrays.toString(keys).replace("[", "(").replace("]", ")");
    }else{
      where = pri+"="+key;
    }
    BizResult rst = this.dao.delete(input.get("v"),where);
    if("0".equals(rst.getCode())){
      this.setReqAttr("msg", "OK");
    }else{
      this.setReqAttr("msg", rst.getMsg());
    }
    return list(input);
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

    Map<String,String> tmp = getControls(m_id);
    String e_id = input.get("key");
    String pri = tmp.get("pri");
    String v = tmp.get("v");
    this.setReqAttr("e", this.dao.query(v,null,pri+"="+e_id).getData());
    BizResult rst = new BizResult();
    rst.setType(String.valueOf(ResultType.REDIRECT));
    rst.setPage("tpl/detail.jsp");
    return rst;
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

 
  public BizResult edit(Map<String,String> input){
    String key = input.get("key");
    String pri = input.get("pri");
    String v = input.get("v");
    BizResult rst = this.dao.update(input, pri+"="+key, v);
    if("0".equals(rst.getCode())){
      this.setReqAttr("msg", "OK");
    }else{
      this.setReqAttr("msg", rst.getMsg());
    }
    return list(input);
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

    this.setReqAttr(GlobalKey.WF_CHECK, "c?s=tpl&o=detail&m_id="+model.get("m_id").toString()+"&key="+ref_id.toString());
    this.setReqAttr("e_id", this.dao.getLastId());
    //加载工作流模板的送审节点,跳转到前台进行流程送审
    Map<String,Object> process = this.dao.query("sys_model",new String[]{"m_id"},"m_view='wf_process'").getData();
    input.put("m_id", process.get("m_id").toString());
    BizResult rst = form(input);
    rst.setType(String.valueOf(ResultType.REDIRECT));
    rst.setPage("workflow/process.jsp");
    return rst;
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

  /**
   * 返回为单行数据
   * @return
   */
  public BizResult query(String table,String[] fields,String where){
    BizResult rst = new BizResult();
    if(StringUtil.isNullOrEmpty(table)){
      return rst.setCode("-1").setMsg("Table Is Empty!");
    }
    String sql = "select {0} from {1} where {2}";
    String cols = "*";
    if(fields!=null && fields.length>0){
      cols = StringUtil.trim(Arrays.toString(fields), 5);
    }
    if(StringUtil.isNullOrEmpty(where)){
      where = "1 = 1";
    }
    sql = StringUtil.formatSql(sql, cols,table,where);
//    System.out.println("QUERY:"+sql);
    rst.setCode("0").setData(mapper.query(sql));
    return rst;
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

    return rst;
  }
 
 
  public BizResult query(String sql){
    BizResult rst = new BizResult();
    return rst.setCode("0").setData(this.mapper.query(sql));
  }
View Full Code Here

Examples of org.yfsoft.comm.util.BizResult

  public BizResult query(String sql){
    BizResult rst = new BizResult();
    return rst.setCode("0").setData(this.mapper.query(sql));
  }
  public BizResult list(String sql){
    BizResult rst = new BizResult();
    return rst.setCode("0").setData(this.mapper.list(sql));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.