/** * @Title: EmpDaoImpl.java * @Package org.dao.impl * @Description: TODO该方法的主要作用: * @author A18ccms A18ccms_gmail_com * @date 2017-6-3 下午2:42:51 * @version V1.0 */ package org.dao.impl; import java.io.Serializable; import java.util.List; import org.dao.BaseDao; import org.entity.Emp; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; /** * * 项目名称:BaseTestMain * 类名称:EmpDaoImpl * 类描述: * 创建人:Mu Xiongxiong * 创建时间:2017-6-3 下午2:42:51 * 修改人:Mu Xiongxiong * 修改时间:2017-6-3 下午2:42:51 * 修改备注: * @version * */ public class EmpDaoImpl extends BaseImpl<Emp> implements BaseDao<Emp> { @Override public void update(Emp entity ,int tag) { String sql = ""; Object objects[] = null; if(tag==1){ //添加 sql="insert into emp (empno,ename) values(?,?)"; objects = new Object[] {entity.getEmpno(),entity.getEname()}; }else if(tag==2){ //修改 sql="update emp set ename=? where empno = ?"; objects = new Object[] {entity.getEname(),entity.getEmpno()}; }else if(tag==3){ //删除 sql="delete from emp where empno = ?"; objects = new Object[] {entity.getEmpno()}; } super.update(sql, objects); } @Override public List<Emp> getLists() { String sql = "select * from emp"; return super.getAll(sql); } @Override public Emp getInfoById(Serializable id) { String sql="select * from emp where empno = ?"; return super.getById(sql, id); } /** * (非 Javadoc) * <p>Title: testProcedure</p> * <p>Description(描述):调用存储过程 </p> * @param emp * @return * @see org.dao.impl.BaseImpl#testProcedure(org.entity.Emp) */ public Integer testProcedure(Emp emp){ return super.testProcedure(emp); } }