hibernate 分组 以及构造函数

paramMap.put("submitDateYear", paramMap.get("submitDateYear") + "%");
		StringBuffer hql = new StringBuffer();
		hql.append(" select new TempDeptRectPatrol" +
				"(" +
				"	t.submitDate," +
				"	sum(t.findProblem1)," +
				"	sum(t.rectProblem1)," +
				"	sum(t.findProblem2)," +
				"	sum(t.rectProblem2)," +
				"	sum(t.findProblem3)," +
				"	sum(t.rectProblem3)," +
				"	sum(t.findProblem4)," +
				"	sum(t.rectProblem4)," +
				"	sum(t.findProblem5)," +
				"	sum(t.rectProblem5)," +
				"	sum(t.findProblem6)," +
				"	sum(t.rectProblem6)," +
				"	sum(t.findProblem7)," +
				"	sum(t.rectProblem7)," +
				"	sum(t.findProblem8)," +
				"	sum(t.rectProblem8)," +
				"	sum(t.findProblem9)," +
				"	sum(t.rectProblem9)," +
				"	sum(t.findProblem10)," +
				"	sum(t.rectProblem10)" +
				")");
		hql.append(" from TempDeptRectPatrol t");
		hql.append(" where 1 = 1 ");
		hql.append(" and t.submitDate like :submitDateYear");
hql.append(" group by submitDate");

 

关键在于,要在实体 TempDeptRectPatrol 写一个构造函数 如下:

public TempDeptRectPatrol(String _submitDate,Long _findProblem1,Long _rectProblem1,Long _findProblem2,Long _rectProblem2,Long _findProblem3,Long _rectProblem3
			,Long _findProblem4,Long _rectProblem4,Long _findProblem5,Long _rectProblem5,Long _findProblem6,Long _rectProblem6,Long _findProblem7,Long _rectProblem7
			,Long _findProblem8,Long _rectProblem8,Long _findProblem9,Long _rectProblem9,Long _findProblem10,Long _rectProblem10){
		this.submitDate = _submitDate;
		this.findProblem1 = _findProblem1;
		this.rectProblem1 = _rectProblem1;
		this.findProblem2 = _findProblem2;
		this.rectProblem2 = _rectProblem2;
		this.findProblem3 = _findProblem3;
		this.rectProblem3 = _rectProblem3;
		this.findProblem4 = _findProblem4;
		this.rectProblem4 = _rectProblem4;
		this.findProblem5 = _findProblem5;
		this.rectProblem5 = _rectProblem5;
		this.findProblem6 = _findProblem6;
		this.rectProblem6 = _rectProblem6;
		this.findProblem7 = _findProblem7;
		this.rectProblem7 = _rectProblem7;
		this.findProblem8 = _findProblem8;
		this.rectProblem8 = _rectProblem8;
		this.findProblem9 = _findProblem9;
		this.rectProblem9 = _rectProblem9;
		this.findProblem10 = _findProblem10;
		this.rectProblem10 = _rectProblem10;
	}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值