ExamLocationMapper.xml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.keao.edu.user.dao.ExamLocationDao">
  8. <resultMap type="com.keao.edu.user.entity.ExamLocation" id="ExamLocation">
  9. <result column="id_" property="id" />
  10. <result column="name_" property="name" />
  11. <result column="contact_name_" property="contactName" />
  12. <result column="contact_phone_" property="contactPhone" />
  13. <result column="address_" property="address" />
  14. <result column="is_available_" property="isAvailable" />
  15. <result column="create_time_" property="createTime" />
  16. <result column="update_time_" property="updateTime" />
  17. </resultMap>
  18. <!-- 根据主键查询一条记录 -->
  19. <select id="get" resultMap="ExamLocation" >
  20. SELECT * FROM exam_location WHERE id_ = #{id}
  21. </select>
  22. <!-- 全查询 -->
  23. <select id="findAll" resultMap="ExamLocation">
  24. SELECT * FROM exam_location ORDER BY id_
  25. </select>
  26. <!-- 向数据库增加一条记录 -->
  27. <insert id="insert" parameterType="com.keao.edu.user.entity.ExamLocation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  28. INSERT INTO exam_location (id_,name_,contact_name_,contact_phone_,address_,is_available_,create_time_,update_time_)
  29. VALUES(#{id},#{name},#{contactName},#{contactPhone},#{address},#{isAvailable},NOW(),NOW())
  30. </insert>
  31. <!-- 根据主键查询一条记录 -->
  32. <update id="update" parameterType="com.keao.edu.user.entity.ExamLocation">
  33. UPDATE exam_location
  34. <set>
  35. <if test="address != null">
  36. address_ = #{address},
  37. </if>
  38. <if test="isAvailable != null">
  39. is_available_ = #{isAvailable},
  40. </if>
  41. <if test="id != null">
  42. id_ = #{id},
  43. </if>
  44. <if test="contactPhone != null">
  45. contact_phone_ = #{contactPhone},
  46. </if>
  47. <if test="contactName != null">
  48. contact_name_ = #{contactName},
  49. </if>
  50. <if test="name != null">
  51. name_ = #{name},
  52. </if>
  53. <if test="createTime != null">
  54. create_time_ = #{createTime},
  55. </if>
  56. update_time_ = NOW()
  57. </set> WHERE id_ = #{id}
  58. </update>
  59. <!-- 根据主键删除一条记录 -->
  60. <delete id="delete" >
  61. DELETE FROM exam_location WHERE id_ = #{id}
  62. </delete>
  63. <!-- 分页查询 -->
  64. <select id="queryPage" resultMap="ExamLocation" parameterType="map">
  65. SELECT * FROM exam_location ORDER BY id_ <include refid="global.limit"/>
  66. </select>
  67. <!-- 查询当前表的总记录数 -->
  68. <select id="queryCount" resultType="int">
  69. SELECT COUNT(*) FROM exam_location
  70. </select>
  71. </mapper>