⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msgservice.java

📁 信息发布 发布系统 动态的菜单 和 信息统计
💻 JAVA
字号:
package com.xuntian.material.model.service.baseinfo;

import java.sql.SQLException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;

import com.xuntian.material.bean.BaseBean;
import com.xuntian.material.bean.MsgBean;
import com.xuntian.material.bean.entity.MsgEntity;
import com.xuntian.material.exception.BaseInfoException;
import com.xuntian.material.exception.ConnectPoolException;
import com.xuntian.material.model.service.BaseService;
import com.xuntian.material.util.Constants;

/**
 * @author zym
 * 
 * 
 */
public  class MsgService extends BaseService {

	@Override
	public List<List<String>> search(ActionForm form) throws BaseInfoException {
		MsgEntity entity=new MsgEntity((MsgBean)form);
		try {
			return entity.queryAll(((MsgBean)form).getItemId());
		} catch (ConnectPoolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
	public List<List<String>> list(ActionForm form) throws BaseInfoException, ConnectPoolException, SQLException {
		//MsgEntity entity=new MsgEntity(null);
		return null;
	}

	@Override
	public BaseBean fill(ActionForm form) throws BaseInfoException {
		MsgBean msgbean=(MsgBean)form;
		MsgEntity entity=new MsgEntity(msgbean);
		try{
		entity.fill();
		} catch (ConnectPoolException cpe) {
            throw new BaseInfoException(Constants.ERRMSG_SELECT, cpe);
        } catch (SQLException sqle) {
            throw new BaseInfoException(Constants.ERRMSG_SELECT, sqle);
        }
		return entity.getMsgBean();
	}

	@Override
	public int save(ActionForm form) throws BaseInfoException {
		MsgBean item = (MsgBean) form;
        MsgEntity itemEntity = new MsgEntity(item);
        int result = 0;
        try {
            result = itemEntity.save();
        } catch (ConnectPoolException cpe) {
            throw new BaseInfoException(Constants.ERRMSG_EDIT, cpe);
        }
        return result;
    
	}

	@Override
	public int delete(HttpServletRequest request) throws BaseInfoException {
		MsgEntity itemEntity = new MsgEntity(null);
		String[] itemIDs=request.getParameterValues("msgId");
		int result = 0;
        try {
		result=itemEntity.delete(itemIDs);
        } catch (ConnectPoolException cpe) {
            throw new BaseInfoException(Constants.ERRMSG_DELETE, cpe);
        }
        return result;
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -