Search in sources :

Example 51 with Action

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

the class UnitAction method isUnique.

@Action("unique")
public void isUnique(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    boolean un = model.unique(rd);
    helper.reply(null, un ? 1 : 0);
}
Also used : Map(java.util.Map) Action(io.github.ihongs.action.anno.Action)

Example 52 with Action

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

the class UnitAction method doSave.

@Action("save")
@Verify(conf = "matrix", form = "unit")
@CommitSuccess
public void doSave(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    String id = model.set(rd);
    CoreLocale lang = CoreLocale.getInstance().clone();
    lang.load("matrix");
    String ms = lang.translate("core.save.unit.success");
    helper.reply(ms, id);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess) Verify(io.github.ihongs.action.anno.Verify)

Example 53 with Action

use of io.github.ihongs.action.anno.Action 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 54 with Action

use of io.github.ihongs.action.anno.Action 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 55 with Action

use of io.github.ihongs.action.anno.Action 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)

Aggregations

Action (io.github.ihongs.action.anno.Action)64 Map (java.util.Map)53 HashMap (java.util.HashMap)26 CommitSuccess (io.github.ihongs.action.anno.CommitSuccess)22 Preset (io.github.ihongs.action.anno.Preset)15 HongsException (io.github.ihongs.HongsException)14 CoreLocale (io.github.ihongs.CoreLocale)12 NaviMap (io.github.ihongs.action.NaviMap)12 Verify (io.github.ihongs.action.anno.Verify)10 IAction (io.github.ihongs.dh.IAction)10 CoreConfig (io.github.ihongs.CoreConfig)9 Select (io.github.ihongs.action.anno.Select)8 Set (java.util.Set)8 List (java.util.List)7 File (java.io.File)6 HashSet (java.util.HashSet)6 FetchCase (io.github.ihongs.db.util.FetchCase)5 JAction (io.github.ihongs.dh.JAction)4 UserAction (io.github.ihongs.serv.master.UserAction)3 ArrayList (java.util.ArrayList)3