📄 clientdao.java
字号:
package com.qrsx.qrsxcrm.dao;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import com.qrsx.qrsxcrm.model.Client;
import com.qrsx.qrsxcrm.model.Employee;
import com.qrsx.qrsxcrm.model.LinkMan;
public class ClientDAO extends BaseDAO {
public ClientDAO(Class<Client> client) {
super(client);
}
public void updates(Client client){
Client client1=new Client();
client1=(Client) this.findById(Client.class, client.getId());
client1.setClientName(client.getClientName());
client1.setClientCode(client.getClientCode());
client1.setTelephone(client.getTelephone());
client1.setAddress(client.getAddress());
client1.setPostCard(client.getPostCard());
client1.setFax(client.getFax());
client1.setCreateDate(client.getCreateDate());
client1.setOrigin(client.getOrigin());
client1.setEmail(client.getEmail());
client1.setClientType(client.getClientType());
client1.setEmployee(client.getEmployee());
client1.setRemark(client.getRemark());
session.update(client1);
}
/**
* 根据客户查找其所有的联系人
*/
public List findAllLinks(Client client){
Set linkMen=client.getLinkMen();
List list=new ArrayList();
Iterator it=linkMen.iterator();
while(it.hasNext()){
LinkMan links=(LinkMan) it.next();
list.add(links);
}
return list;
}
/**
* 查找客户的负责人 不一定用到
*/
public Employee findEmployee(Client client){
EmployeeDAO edao = new EmployeeDAO(Employee.class);
Employee employee= (Employee) edao.findById(Employee.class, client.getEmployeeId());
return employee;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -