Search in sources :

Example 1 with SysButton

use of com.github.qinyou.system.model.SysButton in project my_curd by qinyou.

the class SysMenuController method updateButtonAction.

// 编辑按钮 action
public void updateButtonAction() {
    SysButton sysButton = getBean(SysButton.class, "");
    sysButton.setUpdater(WebUtils.getSessionUsername(this)).setUpdateTime(new Date());
    SysButton oldSysButton = SysButton.dao.findUniqueByProperty("buttonCode", sysButton.getButtonCode());
    if (oldSysButton != null && !sysButton.getId().equals(oldSysButton.getId())) {
        renderFail(ADD_FAIL + " 编码已经存在");
        return;
    }
    if (sysButton.update()) {
        renderSuccess(UPDATE_SUCCESS);
    } else {
        renderFail(UPDATE_FAIL);
    }
}
Also used : SysButton(com.github.qinyou.system.model.SysButton)

Example 2 with SysButton

use of com.github.qinyou.system.model.SysButton in project my_curd by qinyou.

the class SysMenuController method newButtonModel.

// 新增、编辑按钮弹窗
public void newButtonModel() {
    String id = get("id");
    String sysMenuId;
    if (StringUtils.notEmpty(id)) {
        SysButton sysButton = SysButton.dao.findById(id);
        setAttr("sysButton", sysButton);
        sysMenuId = sysButton.getSysMenuId();
    } else {
        sysMenuId = get("menuId");
    }
    setAttr("sysMenuId", sysMenuId);
    render("system/sysButton_form.ftl");
}
Also used : SysButton(com.github.qinyou.system.model.SysButton)

Example 3 with SysButton

use of com.github.qinyou.system.model.SysButton in project my_curd by qinyou.

the class SysMenuController method addButtonAction.

// 新增按钮 action
@Before(Tx.class)
public void addButtonAction() {
    SysButton sysButton = getBean(SysButton.class, "").setId(IdUtils.id()).setCreater(WebUtils.getSessionUsername(this)).setCreateTime(new Date());
    if (SysButton.dao.findUniqueByProperty("buttonCode", sysButton.getButtonCode()) != null) {
        renderFail(ADD_FAIL + " 编码已经存在");
        return;
    }
    SysMenu sysMenu = SysMenu.dao.findById(sysButton.getSysMenuId());
    if (sysMenu == null) {
        renderFail(ADD_FAIL);
        return;
    }
    sysButton.save();
    renderSuccess(ADD_SUCCESS);
}
Also used : SysMenu(com.github.qinyou.system.model.SysMenu) SysButton(com.github.qinyou.system.model.SysButton) Before(com.jfinal.aop.Before)

Aggregations

SysButton (com.github.qinyou.system.model.SysButton)3 SysMenu (com.github.qinyou.system.model.SysMenu)1 Before (com.jfinal.aop.Before)1