📄 attachmentmanager.java
字号:
package com.example.gw.attachment;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.util.List;
public class AttachmentManager implements IAttachmentManager{
private IAttachmentDao attachmentDao;
public void setAttachmentDao(IAttachmentDao attachmentDao){
this.attachmentDao = attachmentDao;
}
public IAttachmentDao getAttachmentDao(){
return attachmentDao;
}
public void saveAttachment(Attachment attachment){
attachmentDao.saveOrUpdate(attachment);
}
public Attachment getAttachment(String fileId){
return (Attachment)attachmentDao.findById(Attachment.class,new Integer(fileId));
}
public void deleteAttachmentById(String fileId){
attachmentDao.delete(getAttachment(fileId));
}
public void deleteAttachment(Attachment attachment){
attachmentDao.delete(attachment);
}
public List getAttachmentsBySendDocId(String sendDocId){
String where = " from Attachment where itemId="+sendDocId;
return attachmentDao.find(where);
}
public static void main(String args[]){
ApplicationContext app = new ClassPathXmlApplicationContext("/applicationContext.xml");
IAttachmentManager attachmentManager = (IAttachmentManager)app.getBean("attachmentManager");
Attachment attachment = new Attachment();
attachmentManager.saveAttachment(attachment);
}
public List getAttachmentList(String sendDocId,String status){
String where = " from Attachment where itemId="+sendDocId+" and status='"+status+"'";
return attachmentDao.find(where);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -