📄 lcategory.java
字号:
/*
* This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/).
*/
package ch07.logic;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.*;
import javax.servlet.http.HttpSession;
import ch07.*;
import ch07.global.GlobalObjectProvider;
import ch07.object.unit.*;
import ch07.database.*;
/**
* 针对用户相关的逻辑处理类
* @author ShenYK
* @version 1.0
*/
public class LCategory
{
public Vector getAllCategory()
throws Exception
{
//得到分类信息的数据操作对象
DCategory dCategory = (DCategory)GlobalObjectProvider.getDatabaseService(CommonConst.DATABASE_KEY_CATEGORY);
//如果对应的类没有的话,报错并返回login页面
if ( dCategory == null )
{
throw new Exception("对应的数据操作类没有找到!");
}
Vector vCategorys = dCategory.getAllCategoryInfo();
return vCategorys;
}
//删除某一指定分类
public void deleteCategoryById( String sCategoryId )
throws Exception
{
//利用对应的数据操作类取得所有问题
DCategory dCategory = (DCategory)GlobalObjectProvider.getDatabaseService(CommonConst.DATABASE_KEY_CATEGORY);
//如果对应的类没有的话,报错
if ( dCategory == null )
{
throw new Exception("对应的数据操作类没有找到!");
}
dCategory.deleteCategoryById( sCategoryId );
return;
}
//根据分类ID获得对应的分类详细信息
public Category getCategoryById( String sCategory )
throws Exception
{
//利用对应的数据操作类取得所有问题
DCategory dCategory = (DCategory)GlobalObjectProvider.getDatabaseService(CommonConst.DATABASE_KEY_CATEGORY);
//如果对应的类没有的话,报错
if ( dCategory == null )
{
throw new Exception("对应的数据操作类没有找到!");
}
Category categoryObj = dCategory.getCategoryById( sCategory );
return categoryObj;
}
//修改某一指定分类
public void modifyCategory( Category categoryObj )
throws Exception
{
//利用对应的数据操作类取得所有问题
DCategory dCategory = (DCategory)GlobalObjectProvider.getDatabaseService(CommonConst.DATABASE_KEY_CATEGORY);
//如果对应的类没有的话,报错
if ( dCategory == null )
{
throw new Exception("对应的数据操作类没有找到!");
}
dCategory.modifyCategory( categoryObj );
return;
}
//添加一条新分类
public void addCategory( Category categoryObj )
throws Exception
{
//利用对应的数据操作类取得所有问题
DCategory dCategory = (DCategory)GlobalObjectProvider.getDatabaseService(CommonConst.DATABASE_KEY_CATEGORY);
//如果对应的类没有的话,报错
if ( dCategory == null )
{
throw new Exception("对应的数据操作类没有找到!");
}
dCategory.addCategory( categoryObj );
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -