开发者社区 问答 正文

被这句话吓到了,怎么理解这段代码? 400 报错

被这句话吓到了,怎么理解这段代码? 400 报错 public DataPackage<Template> getUntransmitTemplates(int pageNo, int pageSize)
throws Exception {
StringBuffer hql = new StringBuffer("FROM Template t where status_Id=");
hql.append(Constant.FlowStatus.Audited.getValue());
hql.append(" and transmitState in(").append(
Constant.TransmitState.Untransmit.getValue());
hql.append(",").append(Constant.TransmitState.Fault.getValue()).append(
")");
hql.append(" and transmitFaultTime<").append(Constant.FAULT_TIME);
// 默认失败次数小于3,需要优化
hql.append(" and state=" + Constant.VALID + " order by templateId");
return queryPagination(hql.toString(), pageNo, pageSize);
}

展开
收起
爱吃鱼的程序员 2020-06-01 11:22:12 530 分享
分享
版权
举报
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    LZ淡定,菜鸟拼拼sql而已.######

    本不想回答,忍不住要回答

    字符串拼接很正常

    ######回复 @thomas2 : select * from template t where status_id = ? and transmitState in ("?,?") and transmitFaultTime < ? and state = ? order by templateId######我之前的公司不会这样拼接,字符串的,怎么还原正常的sql
    2020-06-01 11:22:14 举报
    赞同 评论

    评论

    全部评论 (0)

    登录后可评论
问答地址:
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等