TAdminMapper.xml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.TAdminMapper">
  5. <select id="findTAdminList"
  6. resultType="TAdmin">
  7. select * from admin
  8. </select>
  9. <select id="query" parameterType="java.util.Map" resultType="TAdmin">
  10. select * from admin
  11. <where>
  12. <if test="userid!=null and userid!=0">
  13. and userid= #{userid}
  14. </if>
  15. <if test="username!=null and username!=''">
  16. and username= #{username}
  17. </if>
  18. <if test="userpw!=null and userpw!=''">
  19. and userpw=#{userpw}
  20. </if>
  21. </where>
  22. </select>
  23. <select id="queryTAdminById" parameterType="int" resultType="TAdmin">
  24. select * from admin where userId=${value}
  25. </select>
  26. <insert id="insertTAdmin" useGeneratedKeys="true" keyProperty="id" parameterType="TAdmin">
  27. insert into admin
  28. (userName,userPw)
  29. values
  30. (#{username},#{userpw});
  31. </insert>
  32. <update id="updateTAdmin" parameterType="TAdmin" >
  33. update admin set
  34. userName=#{username},userPw=#{userpw}
  35. where
  36. userid=#{userid}
  37. </update>
  38. <delete id="deleteTAdmin" parameterType="int">
  39. delete from admin where userid=${value}
  40. </delete>
  41. </mapper>