Struts2+Spring2.5+ibatis+ExtJS3.1 基于注解框架搭建(4)
1、创建实体类StafferInfoBean.xml StafferInfoBean.java
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="common">
<!-- Use type aliases to avoid typing the full classname every time. -->
<typeAlias alias="stafferInfoBean" type="com.huawei.boss.entity.StafferInfoBean"/>
<select id="getCurrFormatDate" parameterClass="java.lang.String" resultClass="java.lang.String">
<![CDATA[
select to_char(sysdate,#dateFormat#) from dual
]]>
</select>
<!-- 登录获取用户 -->
<select id="getLoginUser" parameterClass="stafferInfoBean" resultClass="stafferInfoBean">
<![CDATA[
select staffId, staffPwd from staffer where staffid = #staffId# and staffpwd = #staffPwd#
]]>
</select>
</sqlMap>
@Entity
public class StafferInfoBean implements Serializable
{
/**
* 注释内容
*/
private static final long serialVersionUID = -2749598508449992482L;
private String staffId;
private String staffPwd;
public StafferInfoBean()
{
}
public String getStaffId()
{
return staffId;
}
public void setStaffId(String staffId)
{
this.staffId = staffId;
}
public String getStaffPwd()
{
return staffPwd;
}
public void setStaffPwd(String staffPwd)
{
this.staffPwd = staffPwd;
}
}
2、创建Dao
LoginDao.java
public interface LoginDao
{
public StafferInfoBean loginDao(StafferInfoBean stafferInfoBean);
}
LoginDaoImpl.java
import javax.annotation.Resource;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Repository;
@Repository("loginDaoImpl")
public class LoginDaoImpl implements LoginDao
{
@Resource SqlMapClientTemplate sqlMapClientTemplate;
/**
* @param stafferInfoBean
* @return
*/
@Override
public StafferInfoBean loginDao(StafferInfoBean stafferInfoBean)
{
StafferInfoBean stafferInfo = null;
try
{
stafferInfo = (StafferInfoBean)sqlMapClientTemplate
&