Search in sources :

Example 6 with Preset

use of app.hongs.action.anno.Preset in project HongsCORE by ihongs.

the class DBAction method update.

@Action("update")
@Preset(conf = "", form = "", deft = { ":update" })
@Verify(conf = "", form = "")
@CommitSuccess
@Override
public void update(ActionHelper helper) throws HongsException {
    Model ett = getEntity(helper);
    Map req = helper.getRequestData();
    req = getReqMap(helper, ett, "update", req);
    int num = ett.update(req);
    String msg = getRspMsg(helper, ett, "update", num);
    helper.reply(msg, num);
}
Also used : Map(java.util.Map) Action(app.hongs.action.anno.Action) IAction(app.hongs.dh.IAction) CommitSuccess(app.hongs.action.anno.CommitSuccess) Preset(app.hongs.action.anno.Preset) Verify(app.hongs.action.anno.Verify)

Example 7 with Preset

use of app.hongs.action.anno.Preset in project HongsCORE by ihongs.

the class SearchAction method search.

@Action("search")
@Preset(conf = "", form = "")
@Select(conf = "", form = "")
@Spread(conf = "", form = "")
@Override
public void search(ActionHelper helper) throws HongsException {
    /**
     * 有指定查询条件则按匹配度排序
     */
    Map rd = helper.getRequestData();
    Object wd = rd.get(Cnst.WD_KEY);
    if (null != wd && "".equals(wd)) {
        List ob = Synt.asList(rd.get(Cnst.OB_KEY));
        if (ob == null) {
            ob = new ArrayList();
            rd.put(Cnst.OB_KEY, ob);
            ob.add(0, "-");
        } else if (!ob.contains("-")) {
            ob.add(0, "-");
        }
    }
    super.search(helper);
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) Action(app.hongs.action.anno.Action) LuceneAction(app.hongs.dh.lucene.LuceneAction) Spread(app.hongs.action.anno.Spread) Preset(app.hongs.action.anno.Preset) Select(app.hongs.action.anno.Select)

Example 8 with Preset

use of app.hongs.action.anno.Preset in project HongsCORE by ihongs.

the class SignAction method userCreate.

/**
 * 注册
 * @param ah
 * @throws app.hongs.HongsException
 */
@Action("user/create")
@Preset(conf = "master", form = "mine")
@Verify(conf = "master", form = "mine")
public void userCreate(ActionHelper ah) throws HongsException {
    Map rd = ah.getRequestData();
    User uo = (User) DB.getInstance("master").getModel("user");
    Map sd = uo.create(rd);
    // 提取登录信息
    String usrid = Synt.declare(sd.get("id"), "");
    String uname = Synt.declare(sd.get("name"), "");
    String uhead = Synt.declare(sd.get("head"), "");
    long utime = Synt.declare(sd.get("mtime"), 0L) * 1000;
    String appid = Synt.declare(ah.getParameter("appid"), "_WEB_");
    // 赋予公共权限
    sd = new HashMap();
    sd.put("user_id", usrid);
    sd.put("role", "public");
    uo.db.getTable("user_role").insert(sd);
    // 加入公共部门
    sd = new HashMap();
    sd.put("user_id", usrid);
    sd.put("dept_id", "PUBLIC");
    uo.db.getTable("user_dept").insert(sd);
    ah.reply(AuthKit.userSign(ah, null, appid, usrid, uname, uhead, utime));
}
Also used : User(app.hongs.serv.master.User) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action) Preset(app.hongs.action.anno.Preset) Verify(app.hongs.action.anno.Verify)

Example 9 with Preset

use of app.hongs.action.anno.Preset in project HongsCORE by ihongs.

the class DBAction method search.

@Action("search")
@Preset(conf = "", form = "")
@Select(conf = "", form = "")
@Override
public void search(ActionHelper helper) throws HongsException {
    Model ett = getEntity(helper);
    Map req = helper.getRequestData();
    req = getReqMap(helper, ett, "search", req);
    Map rsp = ett.search(req);
    rsp = getRspMap(helper, ett, "search", rsp);
    helper.reply(rsp);
}
Also used : Map(java.util.Map) Action(app.hongs.action.anno.Action) IAction(app.hongs.dh.IAction) Preset(app.hongs.action.anno.Preset) Select(app.hongs.action.anno.Select)

Example 10 with Preset

use of app.hongs.action.anno.Preset in project HongsCORE by ihongs.

the class DBAction method delete.

@Action("delete")
@Preset(conf = "", form = "", deft = { ":delete" })
@CommitSuccess
@Override
public void delete(ActionHelper helper) throws HongsException {
    Model ett = getEntity(helper);
    Map req = helper.getRequestData();
    req = getReqMap(helper, ett, "delete", req);
    int num = ett.delete(req);
    String msg = getRspMsg(helper, ett, "delete", num);
    helper.reply(msg, num);
}
Also used : Map(java.util.Map) Action(app.hongs.action.anno.Action) IAction(app.hongs.dh.IAction) CommitSuccess(app.hongs.action.anno.CommitSuccess) Preset(app.hongs.action.anno.Preset)

Aggregations

Action (app.hongs.action.anno.Action)12 Preset (app.hongs.action.anno.Preset)12 Map (java.util.Map)12 CommitSuccess (app.hongs.action.anno.CommitSuccess)6 Select (app.hongs.action.anno.Select)5 Verify (app.hongs.action.anno.Verify)5 NaviMap (app.hongs.action.NaviMap)4 IAction (app.hongs.dh.IAction)4 HashMap (java.util.HashMap)3 Spread (app.hongs.action.anno.Spread)2 ActionRunner (app.hongs.action.ActionRunner)1 CustomReplies (app.hongs.action.anno.CustomReplies)1 LuceneAction (app.hongs.dh.lucene.LuceneAction)1 Loop (app.hongs.dh.lucene.LuceneRecord.Loop)1 SearchAction (app.hongs.dh.search.SearchAction)1 User (app.hongs.serv.master.User)1 UserAction (app.hongs.serv.master.UserAction)1 Data (app.hongs.serv.matrix.Data)1 Writer (java.io.Writer)1 SimpleDateFormat (java.text.SimpleDateFormat)1