📄 filetype.java
字号:
package entity;
import java.util.ArrayList;
import java.util.List;
import service.DBManager;
import service.Util;
/**
* @author myte
*
* 实体类:文件类型
*/
public class FileType {
private Integer intTID;//类型编号
private String strTypeName="";//类型名称
public Integer getIntTID() {
return intTID;
}
public void setIntTID(Integer intTID) {
this.intTID = intTID;
}
public String getStrTypeName() {
return strTypeName;
}
public void setStrTypeName(String strTypeName) {
this.strTypeName = strTypeName;
}
private static class FileTypeDB extends DBManager {
private String tableName="FileType";
private FileTypeDB() {
}
protected String getTableName() {
return tableName;
}
protected String[] getFields() {
return new String[] { "TID","strTypeName"};
}
protected Object[] getFieldValues(Object o) {
FileType u = (FileType) o;
return new Object[] {u.getIntTID(),u.getStrTypeName()};
}
protected String getKeyFields() {
return KEY_FIELD_NAME;
}
protected Object[] getKeyValues(Object o) {
return new Object[] { ((FileType) o).getIntTID() };
}
}
private static final String KEY_FIELD_NAME = "TID";
private static FileTypeDB entityDB = new FileTypeDB();
public int insert(){
Object obj[]=new Object[1];
List list = select("insert into FileType(strTypeName) values('"+
this.getStrTypeName()+"');select @@identity;");
if(list.size()>0)
obj=(Object[])list.get(0);
return Util.obj2int(obj[0]);
}
public void update(){
try {
entityDB.update(this);
} catch (Exception e) {
e.printStackTrace();
}
}
public void delete(){
try {
entityDB.delete(this);
} catch (Exception e) {
e.printStackTrace();
}
}
public List select(String sql){
try {
return entityDB.executeSelect(sql);
} catch (Exception e) {
e.printStackTrace();
}
return new ArrayList();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -