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

📄 basdictbiz.java

📁 实现用户关系管理系统
💻 JAVA
字号:
package org.jb.y2t308.team3.biz;

import java.util.ArrayList;
import java.util.List;

import org.jb.common.biz.BaseBiz;
import org.jb.common.util.PageResult;
import org.jb.y2t308.team3.entity.BasDict;
import org.jb.y2t308.team3.entity.Product;
import org.jb.y2t308.team3.entity.Storage;

public class BasDictBiz extends BaseBiz {

	// 添加数据字典条目
	public void addDict(BasDict dict) {
		this.getCommonDAO().add(dict);
	}

	// 删除数据字典条目
	public void del(long id) {
		this.getCommonDAO().del(BasDict.class, id);
	}

	// 查询数据字典条目
	public BasDict getDict(long id) {
		
		BasDict basDict=(BasDict)this.getCommonDAO().get(BasDict.class, id);
		return basDict;
	}

	// 分页显示数据字典信息
	public void getDictList(BasDict basDict, PageResult pageResult) {
		String hql = "select dict from BasDict dict where 1=1";
		/**
		 * 根据(类别、条目、值)进行模糊查询
		 */
		if (null != basDict) {
			if (isNotNullOrEmpty(basDict.getDictType())) {
				hql += "and dict.dictType like '%" + basDict.getDictType().trim()
						+ "%'";
			}
			if (isNotNullOrEmpty(basDict.getDictItem())) {
				hql += "and dict.dictItem like '%" + basDict.getDictItem().trim()
						+ "%'";
			}
			if (isNotNullOrEmpty(basDict.getDictValue())) {
				hql += "and dict.dictValue like '%" + basDict.getDictValue().trim()
						+ "%'";
			}
		}
		
		/**
		 * 排序
		 */
		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 dict.dictId,dict.dictType asc";
		}

		this.getCommonDAO().listByPage(hql, pageResult);

	}
	
	//编辑数据字典条目
	public void updateDict(BasDict dict){
		this.getCommonDAO().update(dict);
	}
	
	
	//查询库存信息 
	public void getStorageList(Storage storage, PageResult pageResult){
		String hql = "select s from Storage s where 1=1";
		/**
		 * 根据(产品名、仓库)进行模糊查询
		 */
		if (null != storage) {
			if (isNotNullOrEmpty(storage.getProduct().getProdName())) {
				hql += "and s.product.prodName like '%" + storage.getProduct().getProdName()
						+ "%'";
			}
			if (isNotNullOrEmpty(storage.getStkWarehouse())) {
				hql += "and s.stkWarehouse like '%" + storage.getStkWarehouse()
						+ "%'";
			}		
		}
		
		/**
		 * 排序
		 */
		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 s.stkId,s.product.prodId asc";
		}

		this.getCommonDAO().listByPage(hql, pageResult);
	}
}

⌨️ 快捷键说明

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