notestypeservice.java
来自「java带进度条上传尽量不要让站长把时间都花费在为您修正说明上」· Java 代码 · 共 82 行
JAVA
82 行
package com.jmwl.biz;
import java.util.ArrayList;
import java.util.List;
import javax.mail.internet.NewsAddress;
import com.jmwl.common.BlogException;
import com.jmwl.dao.NoteTypeDAO;
import com.jmwl.vo.NoteTypeVO;
public class NotesTypeService extends BasicService {
public void addNoteType(String noteTypename,int userid) throws BlogException
{
NoteTypeDAO notetypedao = new NoteTypeDAO();
this.getConn();
notetypedao.setConn(conn);
try {
boolean b = notetypedao.findNoteTypeIsExist(noteTypename, userid);
if(b)
{
throw new BlogException("对不起,新闻类型名字已经存在,请选择其他名字");
}else{
notetypedao.addNoteType(noteTypename, userid);
}
} finally {
this.closeConn();
}
}
public List<NoteTypeVO> getAllNoteTypeVO(int userid) throws BlogException{
NoteTypeDAO notetypedao = new NoteTypeDAO();
this.getConn();
notetypedao.setConn(conn);
try {
return notetypedao.findAllNoteType(userid);
} finally {
this.closeConn();
}
}
public void updateNoteType(int notetypeid,String noteTypename) throws BlogException{
NoteTypeDAO notetypedao = new NoteTypeDAO();
this.getConn();
notetypedao.setConn(conn);
try {
notetypedao.updateNoteType(notetypeid, noteTypename);
} finally{
this.closeConn();
}
}
public void delNoteType(int notetypeid) throws BlogException {
NoteTypeDAO notetypedao = new NoteTypeDAO();
this.getConn();
notetypedao.setConn(conn);
try {
boolean b = notetypedao.findNoteByNoteType(notetypeid);
if(b)
throw new BlogException("对不起,该日志类型中还有日志存在,请先删除日志");
else
notetypedao.delNoteType(notetypeid);
} finally {
this.closeConn();
}
}
public NoteTypeVO findNotetypeByid(int id) throws BlogException{
NoteTypeDAO notetypedao = new NoteTypeDAO();
this.getConn();
notetypedao.setConn(conn);
try {
return notetypedao.findNotetypeByid(id);
} finally {
this.closeConn();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?