⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customerbiz.java

📁 crm系统 有源码 及相关文档sql2005 数据库 客户反馈模块
💻 JAVA
字号:
package org.jb.y272.team0.biz;

import java.io.Serializable;

import org.hibernate.Hibernate;
import org.jb.common.biz.BaseBiz;
import org.jb.common.util.PageResult;
import org.jb.y272.team0.entity.CstCustomer;

/**
 * 用户表 管理业务逻辑类
 * 
 * @author hailong.liu
 */
public class CustomerBiz extends BaseBiz {
	/* 复杂业务方法 */

	/* 简单业务方法 */
	/**
	 * 加载 用户表
	 */
	public CstCustomer get(Serializable id) {
		CstCustomer ret = (CstCustomer) this.getCommonDAO().get(
				CstCustomer.class, id);
		return ret;
	}

	/**
	 * 添加 用户表
	 */
	public boolean add(CstCustomer item) {
		this.getCommonDAO().add(item);
		return true;
	}

	/**
	 * 删除 用户表
	 */
	public boolean del(Serializable id) {
		CstCustomer item = this.get(id);
		item.setCustStatus("3");
		this.getCommonDAO().update(item);
		return true;
	}

	/**
	 * 修改 用户表
	 */
	public boolean update(CstCustomer item) {
		this.getCommonDAO().update(item);
		return true;
	}

	/**
	 * 查询 用户表
	 */
	public void search(CstCustomer condition, PageResult pageResult) {
		String hql = "select o from CstCustomer o where 1=1 ";
		if (null != condition) {
			if (isNotNullOrEmpty(condition.getCustName())) {
				hql += "and o.custName like '%" + condition.getCustName()
						+ "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustRegion())) {
				hql += "and o.custRegion like '%" + condition.getCustRegion()
						+ "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustManagerName())) {
				hql += "and o.custManagerName like '%"
						+ condition.getCustManagerName() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustLevelLabel())) {
				hql += "and o.custLevelLabel like '%"
						+ condition.getCustLevelLabel() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustAddr())) {
				hql += "and o.custAddr like '%" + condition.getCustAddr()
						+ "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustZip())) {
				hql += "and o.custZip like '%" + condition.getCustZip() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustTel())) {
				hql += "and o.custTel like '%" + condition.getCustTel() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustFax())) {
				hql += "and o.custFax like '%" + condition.getCustFax() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustWebsite())) {
				hql += "and o.custWebsite like '%" + condition.getCustWebsite()
						+ "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustLicenceNo())) {
				hql += "and o.custLicenceNo like '%"
						+ condition.getCustLicenceNo() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustChieftain())) {
				hql += "and o.custChieftain like '%"
						+ condition.getCustChieftain() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustBank())) {
				hql += "and o.custBank like '%" + condition.getCustBank()
						+ "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustBankAccount())) {
				hql += "and o.custBankAccount like '%"
						+ condition.getCustBankAccount() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustLocalTaxNo())) {
				hql += "and o.custLocalTaxNo like '%"
						+ condition.getCustLocalTaxNo() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustNationalTaxNo())) {
				hql += "and o.custNationalTaxNo like '%"
						+ condition.getCustNationalTaxNo() + "%' ";
			}

			if (isNotNullOrEmpty(condition.getCustStatus())) {
				hql += "and o.custStatus like '%" + condition.getCustStatus()
						+ "%' ";
			}

		}
		if (isNotNullOrEmpty(pageResult.getOrderBy())) {
			String sort = pageResult.getSort();
			hql += "order by " + pageResult.getOrderBy() + " " + sort;
			if ("asc".equals(sort)) {
				pageResult.setSort("desc");
			} else {
				pageResult.setSort("asc");
			}
		} else {
			hql += "order by o.custNo desc";
		}
		this.getCommonDAO().listByPage(hql, pageResult);
	}

	public CstCustomer getWithLinkmans(String id) {
		CstCustomer ret = this.get(id);
		Hibernate.initialize(ret.getCstLinkmans());
		return ret;
	}

	public CstCustomer getWithActivities(String id) {
		CstCustomer ret = this.get(id);
		Hibernate.initialize(ret.getCstActivities());
		return ret;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -