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);
}
}
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");
}
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);
}