clientinfoserviceimpl.java
来自「一个关于tlms的一个小程序 看看能否帮助到别人」· Java 代码 · 共 133 行
JAVA
133 行
package com.szmx.tlms.admin.service.impl;
import com.szmx.framework.base.service.impl.BaseServiceImpl;
import com.szmx.framework.base.model.Pagination;
import com.szmx.framework.util.StringUtil;
import com.szmx.tlms.admin.service.ClientInfoService;
import com.szmx.tlms.admin.dao.ClientInfoDAO;
import com.szmx.tlms.admin.dao.ClientBusinessRelationDAO;
import com.szmx.tlms.admin.model.ClientInfo;
import com.szmx.tlms.admin.model.ClientBusinessRelation;
import com.szmx.tlms.TlmsServiceException;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date: 2006-7-28
* Time: 15:53:40
* To change this template use File | Settings | File Templates.
*/
public class ClientInfoServiceImpl extends BaseServiceImpl implements ClientInfoService {
private ClientInfoDAO clientInfoDAO;
public void setClientInfoDAO(ClientInfoDAO clientInfoDAO) {
this.clientInfoDAO = clientInfoDAO;
}
//根据条件查找数据得到数据集合
public Pagination searchClientInfo(final Pagination pagination,
final ClientInfo clientInfo) throws TlmsServiceException {
Map paraMap = new HashMap();
if (! StringUtil.isNull(clientInfo.getName())) {
paraMap.put("name", "%" + clientInfo.getName().trim() + "%");
}
if (! StringUtil.isNull(clientInfo.getCode())) {
paraMap.put("code", "%" + clientInfo.getCode().trim() + "%");
}
if (clientInfo.getCorpType() != null) {
paraMap.put("corpType", clientInfo.getCorpType());
}
if (clientInfo.getClientCatalog() != null) {
paraMap.put("clientCatalog", clientInfo.getClientCatalog());
}
if (clientInfo.getCalling() != null) {
paraMap.put("calling", clientInfo.getCalling());
}
return clientInfoDAO.searchClientInfoByHql(pagination, paraMap);
}
//根据条件查找数据得到数据集合
public Pagination searchClientInfo(final Pagination paginationObj, final Map paraMap) throws TlmsServiceException {
ClientInfo searchBean = (ClientInfo) paraMap.get("searchBean");
Map pMap = new HashMap();
pMap.put("clientInfoName", searchBean.getName());
return clientInfoDAO.searchClientInfo(paginationObj, pMap);
}
//保存数据
public void saveClientInfo(ClientInfo clientInfo) {
clientInfoDAO.saveClientInfo(clientInfo);
if (! StringUtil.isNull(clientInfo.getBusinessID())) {
String business[] = clientInfo.getBusinessID().split("~");
for (int i = 0; i < business.length; i++) {
ClientBusinessRelation clientBusinessRelation = new ClientBusinessRelation();
clientBusinessRelation.setClientID(clientInfo.getId());
clientBusinessRelation.setBusinessID(Long.valueOf(business[i]));
clientInfoDAO.saveObject(clientBusinessRelation);
}
}
}
//根据id得到数据
public ClientInfo getClientInfo(Long id) {
return clientInfoDAO.getClientInfo(id);
}
//删除数据
public void removeClientInfo(String[] id) {
for (int i = 0; i < id.length; i++) {
// inactive: [can not inactive admin user]
ClientInfo clientInfo = (ClientInfo) clientInfoDAO.getObject(ClientInfo.class, new Long(id[i]));
clientInfoDAO.removeClientBusinessRelation(clientInfo.getId());
clientInfoDAO.removeClientContact(clientInfo.getId());
clientInfoDAO.removeClientInfo(clientInfo.getId());
}
}
//更新数据
public void updateClientInfo(ClientInfo clientInfo) throws TlmsServiceException {
clientInfoDAO.removeClientBusinessRelation(clientInfo.getId());
clientInfoDAO.updateClientInfo(clientInfo);
if (! StringUtil.isNull(clientInfo.getBusinessID())) {
String business[] = clientInfo.getBusinessID().split("~");
for (int i = 0; i < business.length; i++) {
ClientBusinessRelation clientBusinessRelation = new ClientBusinessRelation();
clientBusinessRelation.setClientID(clientInfo.getId());
clientBusinessRelation.setBusinessID(Long.valueOf(business[i]));
clientInfoDAO.saveObject(clientBusinessRelation);
}
}
}
//得到下拉菜单的类型
public List getClientCatalogList() {
Map paraMap = new HashMap();
paraMap.put("dataType", "ClientCatalog");
return clientInfoDAO.getRelationTypeList(paraMap);
}
public List getCorpTypeList() {
Map paraMap = new HashMap();
paraMap.put("dataType", "CorpType");
return clientInfoDAO.getRelationTypeList(paraMap);
}
public List getCallingList() {
Map paraMap = new HashMap();
paraMap.put("dataType", "Calling");
return clientInfoDAO.getRelationTypeList(paraMap);
}
public List getBusinessList() {
return clientInfoDAO.getBusinessList();
}
public List getHadCode() {
return clientInfoDAO.getHadCode();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?