67,513
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.alphago.dao.UserDao" >
<resultMap id="BaseResultMap" type="UserInfo" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="userName" property="userName" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="userEmail" property="userEmail" jdbcType="VARCHAR" />
<result column="telephone" property="telephone" jdbcType="VARCHAR" />
<result column="isEnable" property="isEnable" jdbcType="INTEGER" />
<result column="userLevel" property="userLevel" jdbcType="INTEGER" />
</resultMap>
<sql id="sqlwhere">
<where>
1=1
<if test="id != null">
and A.id = #{id}
</if>
<if test="userName != null && userName.length() > 0">
and A.userName like CONCAT(CONCAT('%','${userName}'),'%' )
</if>
<if test="userEmail != null && userEmail.length() > 0">
and A.userEmail like CONCAT(CONCAT('%','${userEmail}'),'%' )
</if>
<if test="telephone != null && telephone.length() > 0">
and A.telephone like CONCAT(CONCAT('%','${telephone}'),'%' )
</if>
<if test="isEnable != null">
and A.isEnable = #{isEnable}
</if>
<if test="userLevel != null">
and A.userLevel = #{userLevel}
</if>
</where>
</sql>
<select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select * from sys_user A where A.id = #{id}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.test.zsj.dao.TestDao">
<select id="queryByTitleId" resultType="article" >
select * from t_article where aritcle_id=#{0}
</select>
</mapper>
自己看吧