itemservice.java
来自「信息发布 发布系统 动态的菜单 和 信息统计」· Java 代码 · 共 69 行
JAVA
69 行
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.ItemBean;
import com.xuntian.material.bean.entity.ItemEntity;
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 ItemService extends BaseService {
public List<List<String>> search(ActionForm form) throws BaseInfoException {
List<List<String>> list = null;
try {
list = new ItemEntity(null).queryAll();
} catch (ConnectPoolException cpe) {
throw new BaseInfoException(Constants.ERRMSG_SELECT, cpe);
}
return list;
}
public ItemBean fill(ActionForm form) throws BaseInfoException {
ItemBean item = (ItemBean) form;
ItemEntity itemEntity = new ItemEntity(item);
try {
itemEntity.fill();
} catch (ConnectPoolException cpe) {
throw new BaseInfoException(Constants.ERRMSG_SELECT, cpe);
} catch (SQLException sqle) {
throw new BaseInfoException(Constants.ERRMSG_SELECT, sqle);
}
return itemEntity.getItemBean();
}
public int save(ActionForm form) throws BaseInfoException {
ItemBean item = (ItemBean) form;
ItemEntity itemEntity = new ItemEntity(item);
int result = 0;
try {
result = itemEntity.save();
} catch (ConnectPoolException cpe) {
throw new BaseInfoException(Constants.ERRMSG_EDIT, cpe);
}
return result;
}
public int delete(HttpServletRequest request) throws BaseInfoException {
String[] itemIDs = request.getParameterValues("itemID");
int result = 0;
try {
result = new ItemEntity(null).delete(itemIDs);
} catch (ConnectPoolException cpe) {
throw new BaseInfoException(Constants.ERRMSG_DELETE, cpe);
}
return result;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?