TeacherSchoolMapper.xml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.ym.mec.biz.dal.dao.TeacherSchoolDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.TeacherSchool" id="TeacherSchool">
  9. <result column="id_" property="id"/>
  10. <result column="user_id_" property="userId"/>
  11. <result column="province_" property="province"/>
  12. <result column="city_" property="city"/>
  13. <result column="district_" property="district"/>
  14. <result column="address_" property="address"/>
  15. <result column="longitude_latitude_" property="longitudeLatitude"/>
  16. <result column="create_time_" property="createTime"/>
  17. <result column="update_time_" property="updateTime"/>
  18. </resultMap>
  19. <!-- 根据主键查询一条记录 -->
  20. <select id="get" resultMap="TeacherSchool">
  21. SELECT * FROM teacher_school WHERE id_ = #{id}
  22. </select>
  23. <!-- 全查询 -->
  24. <select id="findAll" resultMap="TeacherSchool">
  25. SELECT * FROM teacher_school ORDER BY id_
  26. </select>
  27. <!-- 向数据库增加一条记录 -->
  28. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.TeacherSchool" useGeneratedKeys="true" keyColumn="id"
  29. keyProperty="id">
  30. <!--
  31. <selectKey resultClass="int" keyProperty="id" >
  32. SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
  33. </selectKey>
  34. -->
  35. INSERT INTO teacher_school
  36. (id_,user_id_,province_,city_,district_,address_,longitude_latitude_,create_time_,update_time_)
  37. VALUES(#{id},#{userId},#{province},#{city},#{district},#{address},#{longitudeLatitude},now(),now())
  38. </insert>
  39. <!-- 根据主键查询一条记录 -->
  40. <update id="update" parameterType="com.ym.mec.biz.dal.entity.TeacherSchool">
  41. UPDATE teacher_school
  42. <set>
  43. <if test="city != null">
  44. city_ = #{city},
  45. </if>
  46. <if test="address != null">
  47. address_ = #{address},
  48. </if>
  49. <if test="userId != null">
  50. user_id_ = #{userId},
  51. </if>
  52. <if test="updateTime != null">
  53. update_time_ = #{updateTime},
  54. </if>
  55. <if test="longitudeLatitude != null">
  56. longitude_latitude_ = #{longitudeLatitude},
  57. </if>
  58. <if test="district != null">
  59. district_ = #{district},
  60. </if>
  61. <if test="province != null">
  62. province_ = #{province},
  63. </if>
  64. </set>
  65. WHERE id_ = #{id}
  66. </update>
  67. <!-- 根据主键删除一条记录 -->
  68. <delete id="delete">
  69. DELETE FROM teacher_school WHERE id_ = #{id}
  70. </delete>
  71. <!-- 分页查询 -->
  72. <select id="queryPage" resultMap="TeacherSchool" parameterType="map">
  73. SELECT * FROM teacher_school ORDER BY id_
  74. <include refid="global.limit"/>
  75. </select>
  76. <!-- 查询当前表的总记录数 -->
  77. <select id="queryCount" resultType="int">
  78. SELECT COUNT(*) FROM teacher_school
  79. </select>
  80. </mapper>