LiveDaoImpl.java 1.35 KB
package com.bjivt.dao.showtime.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bjivt.base.dao.impl.BaseDaoImpl;
import com.bjivt.dao.showtime.LiveDao;
import com.bjivt.entity.showtime.Live;
import com.bjivt.util.Pager;

@Component
public class LiveDaoImpl extends BaseDaoImpl<Live, Integer> implements LiveDao{
	@Autowired(required = true)  
	protected SqlSession sqlSessionTemplate;  

	@Override
	public List<Live> findStarLiveListByPage(Map<String, Object> map) {
		return this.getSqlSession().selectList(getSqlName("findStarLiveListByPage"), map);
	}

	@Override
	public int getStarLiveCountBy(Live live) {
		
		return this.getSqlSession().selectOne(getSqlName("getStarLiveCountBy"), live);
	}
	
	public String getExecuteSql(String execName, Object obj){
		BoundSql boundSql = sqlSessionTemplate.getConfiguration()
				.getMappedStatement(execName).getBoundSql(obj);
//		String[] sqls = boundSql.getSql().split(";");
		String sqls = boundSql.getSql();
		System.out.println(sqls);
		return sqls;
	}

	@Override
	public List<Live> findLiveListByPage(Map<String, Object> map) {
		
		return this.getSqlSession().selectList(getSqlName("findLiveListByPage"), map);
	}

}