UserinfoMapper.xml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.mapper.UserinfoMapper">
  5. <sql id="Where_Clause">
  6. <where>
  7. <if test="id!=null and id!=0">and id= #{id}</if>
  8. <if test="name!=null and name!=''">and name=#{name}</if>
  9. <if test="upwd!=null and upwd!=''">and upwd=#{upwd}</if>
  10. <if test="tel!=null and tel!=''">and tel=#{tel}</if>
  11. </where>
  12. </sql>
  13. <select id="query" parameterType="java.util.Map"
  14. resultType="Userinfo">
  15. select * from userinfo
  16. <include refid="Where_Clause" />
  17. <if test="page">limit #{offset} ,#{pageSize}</if>
  18. </select>
  19. <select id="getCount" parameterType="java.util.Map"
  20. resultType="Int">
  21. select count(0) from userinfo
  22. <include refid="Where_Clause" />
  23. </select>
  24. <select id="queryUserinfoById" parameterType="int"
  25. resultType="Userinfo">
  26. select * from userinfo where id=${value}
  27. </select>
  28. <insert id="insertUserinfo" useGeneratedKeys="true" keyProperty="id"
  29. parameterType="Userinfo">
  30. insert into userinfo (name,tel,upwd,utype) values
  31. (#{name},#{tel},#{upwd},#{utype});
  32. </insert>
  33. <update id="updateUserinfo" parameterType="Userinfo">
  34. update userinfo set
  35. name=#{name},tel=#{tel},upwd=#{upwd},utype=#{utype} where
  36. id=#{id}
  37. </update>
  38. <delete id="deleteUserinfo" parameterType="int">
  39. delete from userinfo where id=${value}
  40. </delete>
  41. </mapper>