src/com/jssf/tesco/dao/impl/ItemDaoImpl.java

(完整代码) 2KB

package com.jssf.tesco.dao.impl;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.jssf.tesco.base.dao.impl.BaseDaoImpl;
import com.jssf.tesco.dao.ItemDao;
import com.jssf.tesco.model.Item;
import com.jssf.tesco.utils.Pager;
@Repository
@SuppressWarnings("unchecked")
public class ItemDaoImpl extends BaseDaoImpl<Item>  implements ItemDao {
/*	private int id;
	private int itemType;//商品类型 1电子 2 女装 3 男装 4 皮包
	private int category;//商品类别      0是一般商品。 1.推荐商品 2.特价商品.3.打折商品4.二手货
	private String name;//名称
	private double price;//价格
	private String remark;//描述
	private String url;//图片路径
	private int isDelete;//是否删除
	private int status;//如果是二手货。那么就看这个属性是否审批通过  1是 2 
*/	@Override
	public Pager<Item> findPagerByItemType(Item item) {
		if(item.getItemType() !=0){
	    	   String hql = "from Item where itemType = :itemType and isDelete=2 order by id desc";
	    	   Map<String,Object> alias = new HashMap<String,Object>();
	   		   alias.put("itemType", item.getItemType() );
	   		  return findByAlias(hql, alias);
	       }else{
	    	   String hql = "from Item where 1=1 and isDelete=2 order by id desc";
				return findByAlias(hql, null);
	       }
	}

	@Override
	public Pager<Item> findPagerByCategory(Item item) {
		if(item.getCategory() !=0){
	    	   String hql = "from Item where category = :category and isDelete=2 order by id desc";
	    	   Map<String,Object> alias = new HashMap<String,Object>();
	   		   alias.put("category", item.getCategory() );
	   		  return findByAlias(hql, alias);
	       }else{
	    	   String hql = "from Item where 1=1 and isDelete=2 order by id desc";
				return findByAlias(hql, null);
	       }
	}

	@Override
	public Pager<Item> findPagerByCategory1(Item item) {
		if(item.getCategory() !=0){
	    	   String hql = "from Item where category = :category and isDelete=2  and status=1 order by id desc";
	    	   Map<String,Object> alias = new HashMap<String,Object>();
	   		   alias.put("category", item.getCategory() );
	   		  return findByAlias(hql, alias);
	       }else{
	    	   String hql = "from Item where 1=1 and isDelete=2 and status=1 order by id desc";
				return findByAlias(hql, null);
	       }
	}
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。