SchoolMapper.xml 3.1 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.web.dal.dao.SchoolDao">
  8. <resultMap type="com.ym.mec.web.dal.entity.School" id="School">
  9. <result column="id_" property="id"/>
  10. <result column="name_" property="name"/>
  11. <result column="organ_id_" property="organId"/>
  12. <result column="address_" property="address"/>
  13. <result column="contact_phone_" property="contactPhone"/>
  14. <result column="create_time_" property="createTime"/>
  15. <result column="update_time_" property="updateTime"/>
  16. <result column="del_flag_" property="delFlag"/>
  17. <result column="contact_name_" property="contactName"/>
  18. </resultMap>
  19. <!-- 根据主键查询一条记录 -->
  20. <select id="get" resultMap="School">
  21. SELECT * FROM school WHERE id_ = #{id}
  22. </select>
  23. <!-- 全查询 -->
  24. <select id="findAll" resultMap="School">
  25. SELECT * FROM school ORDER BY id_
  26. </select>
  27. <!-- 向数据库增加一条记录 -->
  28. <insert id="insert" parameterType="com.ym.mec.web.dal.entity.School" 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 school
  36. (id_,name_,organ_id_,address_,contact_phone_,create_time_,update_time_,del_flag_,contact_name_)
  37. VALUES(#{id},#{name},#{organId},#{address},#{contactPhone},#{createTime},#{updateTime},#{delFlag},#{contactName})
  38. </insert>
  39. <!-- 根据主键查询一条记录 -->
  40. <update id="update" parameterType="com.ym.mec.web.dal.entity.School">
  41. UPDATE school
  42. <set>
  43. <if test="delFlag != null">
  44. del_flag_ = #{delFlag},
  45. </if>
  46. <if test="organId != null">
  47. organ_id_ = #{organId},
  48. </if>
  49. <if test="updateTime != null">
  50. update_time_ = #{updateTime},
  51. </if>
  52. <if test="contactPhone != null">
  53. contact_phone_ = #{contactPhone},
  54. </if>
  55. <if test="address != null">
  56. address_ = #{address},
  57. </if>
  58. <if test="contactName != null">
  59. contact_name_ = #{contactName},
  60. </if>
  61. <if test="name != null">
  62. name_ = #{name},
  63. </if>
  64. </set>
  65. WHERE id_ = #{id}
  66. </update>
  67. <!-- 根据主键删除一条记录 -->
  68. <delete id="delete">
  69. DELETE FROM school WHERE id_ = #{id}
  70. </delete>
  71. <!-- 分页查询 -->
  72. <select id="queryPage" resultMap="School" parameterType="map">
  73. SELECT * FROM school ORDER BY id_
  74. <include refid="global.limit"/>
  75. </select>
  76. <!-- 查询当前表的总记录数 -->
  77. <select id="queryCount" resultType="int">
  78. SELECT COUNT(*) FROM school
  79. </select>
  80. </mapper>