📄 itemservice.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.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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -