src/com/sys/plugin/announce/AnnounceDAOImpl.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.sys.plugin.announce;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.hibernate.SessionFactory;
import org.hibernate.Query;
import java.util.List;
import com.sys.common.BaseDAO;
import com.sys.common.util.CommonUtil;
import com.sys.web.fenye.util.DefaultQueryCondition;
import com.sys.web.fenye.util.Page;
import com.sys.web.fenye.util.QueryConditionSQL;

@Service
@Transactional
public class AnnounceDAOImpl extends BaseDAO<Announce, Integer> {
	@Resource
	private SessionFactory sessionFactory;

	protected Class<Announce> getReferenceClass() {
		return Announce.class;
	}

	protected SessionFactory getSessionFactory() {
		return this.sessionFactory;
	}

	public List search(DefaultQueryCondition condition) {
		return null;
	}

	public Page<Announce> getRecord(DefaultQueryCondition condition) {
		StringBuffer sb = new StringBuffer();
		QueryConditionSQL qcSQL = new QueryConditionSQL(sb);
		StringBuffer where = new StringBuffer();
		sb.append("select pro from Announce pro where 1=1 ");
		where.append("1=1 ");
		boolean temp = false;
		Announce pro = (Announce) condition.getCondition();
		String title = pro.getTitle();
		if (CommonUtil.isNotEmpty(title)) {
			sb.append(" and pro.title like :title ");
			qcSQL.setLikeParameter("title", title);
			where.append(" and title like '%").append(title).append("%'");
			temp = true;
		}
		String date = pro.getCreateTime();
		if (CommonUtil.isNotEmpty(date)) {
			sb.append(" and pro.createTime = :date ");
			qcSQL.setParameter("date", date);
			where.append(" and createTime='").append(date).append("'");
			temp = true;
		}
		sb.append(" order by id desc");
		Query query = this.sessionFactory.getCurrentSession().createQuery(
				qcSQL.getSQL().toString());
		query.setFirstResult(condition.getFirstResult());
		query.setMaxResults(condition.getPageSize());
		qcSQL.parameterToQuery(query);
后面还有 13 行代码,购买后查看完整代码

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

AI 解读 AI

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

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