MenuService.java~86~
资源名称:shihua.rar [点击查看]
上传用户:zghglow
上传日期:2022-08-09
资源大小:27227k
文件大小:3k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
JavaScript
- package com.chinacannel.xlchemical.service;
- import com.chinacannel.common.TranUtil;
- import com.chinacannel.common.CommonDAO;
- import org.apache.commons.logging.LogFactory;
- import org.apache.commons.logging.Log;
- import com.chinacannel.common.DAOException;
- import com.chinacannel.entity.Menu;
- import java.util.List;
- public class MenuService extends TranUtil {
- private CommonDAO dao = new CommonDAO();
- private static Log log = LogFactory.getLog(MenuService.class);
- public boolean AddMenu(Menu menu) {
- try {
- return dao.createObject(menu);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean UpdateMenu(Menu menu) {
- try {
- return dao.updateObject(menu);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean DeleteMenu(Menu menu) {
- try {
- return dao.removeObject(menu);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public Menu GetMenuById(Long id) {
- try {
- return (Menu) dao.loadObject(id, Menu.class);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public Menu GetMenuByKey(String key) {
- try {
- return (Menu) dao.loadOneObjectBySQL(
- "from Menu as menu where menu.men_Key='" + key + "'");
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List GetMenuBySuperior(Long id, String Language) {
- try {
- return dao.loadObjectListBySQL
- ("from Menu as menu where menu.men_Superior=" + id +
- " and menu.men_Language='" + Language +
- "' order by menu.men_Order asc");
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List GetRutMenuBySuperior(Long id, String Language) {
- try {
- return dao.loadObjectListBySQL
- ("from Menu as menu where menu.men_Superior=" + id +
- " and menu.men_Default=0 and menu.men_Language='" +
- Language + "' order by menu.men_Order asc");
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List GetDefaultMenuByMenID(Long id) {
- try {
- return dao.loadObjectListBySQL(
- "from Menu as menu where menu.men_Default=1 and menu.men_Superior=" +
- id);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public Menu GetFirstMenu(Long id) {
- try {
- return (Menu)dao.loadOneObjectBySQL(
- "from Menu as menu where menu.men_Superior=" + id +
- " order by menu.men_Order");
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- }