Search in sources :

Example 11 with Preset

use of io.github.ihongs.action.anno.Preset in project HongsCORE by ihongs.

the class SearchAction method search.

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

Example 12 with Preset

use of io.github.ihongs.action.anno.Preset in project HongsCORE by ihongs.

the class SearchAction method acount.

@Action("acount")
@Preset(conf = "", form = "")
@Titles(conf = "", form = "")
public void acount(ActionHelper helper) throws HongsException {
    SearchEntity sr = (SearchEntity) getEntity(helper);
    StatisHelper sh = new StatisHelper(sr);
    Map rd = helper.getRequestData();
    rd = getReqMap(helper, sr, "acount", rd);
    // 检查参数
    acheck(sr, rd, 1);
    Map xd = sh.acount(rd);
    Map sd = Synt.mapOf("enfo", xd);
    sd = getRspMap(helper, sr, "acount", sd);
    helper.reply(sd);
}
Also used : Map(java.util.Map) JAction(io.github.ihongs.dh.JAction) Action(io.github.ihongs.action.anno.Action) Preset(io.github.ihongs.action.anno.Preset) Titles(io.github.ihongs.dh.search.TitlesHelper.Titles)

Example 13 with Preset

use of io.github.ihongs.action.anno.Preset in project HongsCORE by ihongs.

the class SearchAction method amount.

@Action("amount")
@Preset(conf = "", form = "")
@Titles(conf = "", form = "")
public void amount(ActionHelper helper) throws HongsException {
    SearchEntity sr = (SearchEntity) getEntity(helper);
    StatisHelper sh = new StatisHelper(sr);
    Map rd = helper.getRequestData();
    rd = getReqMap(helper, sr, "amount", rd);
    // 检查参数
    acheck(sr, rd, 2);
    Map xd = sh.amount(rd);
    Map sd = Synt.mapOf("enfo", xd);
    sd = getRspMap(helper, sr, "amount", sd);
    helper.reply(sd);
}
Also used : Map(java.util.Map) JAction(io.github.ihongs.dh.JAction) Action(io.github.ihongs.action.anno.Action) Preset(io.github.ihongs.action.anno.Preset) Titles(io.github.ihongs.dh.search.TitlesHelper.Titles)

Example 14 with Preset

use of io.github.ihongs.action.anno.Preset in project HongsCORE by ihongs.

the class DBAction method delete.

@Override
@Action("delete")
@Preset(conf = "", form = "", defs = { ":defence" })
@CommitSuccess
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(io.github.ihongs.action.anno.Action) IAction(io.github.ihongs.dh.IAction) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess) Preset(io.github.ihongs.action.anno.Preset)

Example 15 with Preset

use of io.github.ihongs.action.anno.Preset in project HongsCORE by ihongs.

the class DBAction method create.

@Override
@Action("create")
@Preset(conf = "", form = "", defs = { ":initial" })
@Verify(conf = "", form = "")
@CommitSuccess
public void create(ActionHelper helper) throws HongsException {
    Model ett = getEntity(helper);
    Map req = helper.getRequestData();
    req = getReqMap(helper, ett, "create", req);
    String nid = ett.create(req);
    String msg = getRspMsg(helper, ett, "create", 1);
    helper.reply(msg, nid);
}
Also used : Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) IAction(io.github.ihongs.dh.IAction) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess) Preset(io.github.ihongs.action.anno.Preset) Verify(io.github.ihongs.action.anno.Verify)

Aggregations

Action (io.github.ihongs.action.anno.Action)15 Preset (io.github.ihongs.action.anno.Preset)15 Map (java.util.Map)15 CommitSuccess (io.github.ihongs.action.anno.CommitSuccess)7 Verify (io.github.ihongs.action.anno.Verify)5 Select (io.github.ihongs.action.anno.Select)4 IAction (io.github.ihongs.dh.IAction)4 JAction (io.github.ihongs.dh.JAction)4 HongsException (io.github.ihongs.HongsException)3 UserAction (io.github.ihongs.serv.master.UserAction)3 HashMap (java.util.HashMap)3 Titles (io.github.ihongs.dh.search.TitlesHelper.Titles)2 FormSet (io.github.ihongs.action.FormSet)1 Table (io.github.ihongs.db.Table)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1