HashMap参数

action

定义一个 HashMap,将参数放到里面

	private void doSelect(){
		HashMap<String,Object> param = new HashMap<String,Object> ();
		//工贸
		param.put("trade", trade);
		//门店
		param.put("store", store);
		//产品代表
		param.put("productDuty", productDuty);
		//产品型号
		param.put("product", product);
		
		//开始时间
		param.put("startDate", manchineJson.getStartDate());
		//结束时间
		param.put("endDate", manchineJson.getEndDate());
		
		try{
			manchineOpenedJsonList=manchineOpenedManager.getManchineOpenedJsonList(reportPage,param);
			if (manchineOpenedJsonList!=null &&  manchineOpenedJsonList.size()>0){
				manchineJson=manchineOpenedJsonList.get(0);
			}
			
		}catch(Exception e){
			e.printStackTrace();
		}

		
	}

dao层实现

    /**
     * 获取工贸-门店-产品代表-型号
     */
	public List<ManchineOpenedJson> getManchineOpenedJsonList(Page reportPage,HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		Session session=this.getSessionFactory().openSession();
		
		
		//工贸
		String trade = (String)param.get("trade");
		//门店
		String store = (String)param.get("store");
		//产品代表
		String productDuty = (String)param.get("productDuty");
		//产品型号
		String product = (String)param.get("product");
		
		//开始时间
		String startDate = (String)param.get("startDate");
		//结束时间
		String endDate = (String)param.get("endDate");
		
		String queryHql = "";
		//查询条件
		if(trade != null && !"".equals(trade) && !"null".equals(trade)){
			queryHql += "and tradeognm='" + trade + "'";
		}
		
		if(store != null && !"".equals(store) && !"null".equals(store)){
			 
				queryHql += " and custnm='" + store + "'";
		 
		}
		if(productDuty != null && !"".equals(productDuty) && !"null".equals(productDuty)){
			 
				queryHql += " and productdutyempnm='" + productDuty + "'";
			 
		}
		if(product != null && !"".equals(product) && !"null".equals(product)){
			 
				queryHql+= " and productnm='" + product + "'";
			 
		}
		
		if(startDate != null && !"".equals(startDate) && !"null".equals(startDate)){
			queryHql += " and c.activ_time >='" + startDate + "'";
		}
		
		if(endDate != null && !"".equals(endDate) && !"null".equals(endDate)){
				queryHql += " and c.activ_time <='" + endDate + "'";
		}
		

		return list;
	}



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值