spring 基础框架建设

SysOrgMapper.xml 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. <mapper namespace="dao.SysOrgMapper" >
  4. <resultMap id="BaseResultMap" type="model.SysOrg" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="org_code" property="orgCode" jdbcType="VARCHAR" />
  7. <result column="org_name" property="orgName" jdbcType="VARCHAR" />
  8. <result column="description" property="description" jdbcType="VARCHAR" />
  9. <result column="parent_id" property="parentId" jdbcType="INTEGER" />
  10. <result column="create_user" property="createUser" jdbcType="VARCHAR" />
  11. <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  12. <result column="update_user" property="updateUser" jdbcType="VARCHAR" />
  13. <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
  14. </resultMap>
  15. <sql id="Base_Column_List" >
  16. id, org_code, org_name, description, parent_id, create_user, create_date, update_user,
  17. update_date
  18. </sql>
  19. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  20. select
  21. <include refid="Base_Column_List" />
  22. from sys_org
  23. where id = #{id,jdbcType=INTEGER}
  24. </select>
  25. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  26. delete from sys_org
  27. where id = #{id,jdbcType=INTEGER}
  28. </delete>
  29. <insert id="insert" parameterType="model.SysOrg" >
  30. insert into sys_org (id, org_code, org_name,
  31. description, parent_id, create_user,
  32. create_date, update_user, update_date
  33. )
  34. values (#{id,jdbcType=INTEGER}, #{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR},
  35. #{description,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR},
  36. #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP}
  37. )
  38. </insert>
  39. <insert id="insertSelective" parameterType="model.SysOrg" >
  40. insert into sys_org
  41. <trim prefix="(" suffix=")" suffixOverrides="," >
  42. <if test="id != null" >
  43. id,
  44. </if>
  45. <if test="orgCode != null" >
  46. org_code,
  47. </if>
  48. <if test="orgName != null" >
  49. org_name,
  50. </if>
  51. <if test="description != null" >
  52. description,
  53. </if>
  54. <if test="parentId != null" >
  55. parent_id,
  56. </if>
  57. <if test="createUser != null" >
  58. create_user,
  59. </if>
  60. <if test="createDate != null" >
  61. create_date,
  62. </if>
  63. <if test="updateUser != null" >
  64. update_user,
  65. </if>
  66. <if test="updateDate != null" >
  67. update_date,
  68. </if>
  69. </trim>
  70. <trim prefix="values (" suffix=")" suffixOverrides="," >
  71. <if test="id != null" >
  72. #{id,jdbcType=INTEGER},
  73. </if>
  74. <if test="orgCode != null" >
  75. #{orgCode,jdbcType=VARCHAR},
  76. </if>
  77. <if test="orgName != null" >
  78. #{orgName,jdbcType=VARCHAR},
  79. </if>
  80. <if test="description != null" >
  81. #{description,jdbcType=VARCHAR},
  82. </if>
  83. <if test="parentId != null" >
  84. #{parentId,jdbcType=INTEGER},
  85. </if>
  86. <if test="createUser != null" >
  87. #{createUser,jdbcType=VARCHAR},
  88. </if>
  89. <if test="createDate != null" >
  90. #{createDate,jdbcType=TIMESTAMP},
  91. </if>
  92. <if test="updateUser != null" >
  93. #{updateUser,jdbcType=VARCHAR},
  94. </if>
  95. <if test="updateDate != null" >
  96. #{updateDate,jdbcType=TIMESTAMP},
  97. </if>
  98. </trim>
  99. </insert>
  100. <update id="updateByPrimaryKeySelective" parameterType="model.SysOrg" >
  101. update sys_org
  102. <set >
  103. <if test="orgCode != null" >
  104. org_code = #{orgCode,jdbcType=VARCHAR},
  105. </if>
  106. <if test="orgName != null" >
  107. org_name = #{orgName,jdbcType=VARCHAR},
  108. </if>
  109. <if test="description != null" >
  110. description = #{description,jdbcType=VARCHAR},
  111. </if>
  112. <if test="parentId != null" >
  113. parent_id = #{parentId,jdbcType=INTEGER},
  114. </if>
  115. <if test="createUser != null" >
  116. create_user = #{createUser,jdbcType=VARCHAR},
  117. </if>
  118. <if test="createDate != null" >
  119. create_date = #{createDate,jdbcType=TIMESTAMP},
  120. </if>
  121. <if test="updateUser != null" >
  122. update_user = #{updateUser,jdbcType=VARCHAR},
  123. </if>
  124. <if test="updateDate != null" >
  125. update_date = #{updateDate,jdbcType=TIMESTAMP},
  126. </if>
  127. </set>
  128. where id = #{id,jdbcType=INTEGER}
  129. </update>
  130. <update id="updateByPrimaryKey" parameterType="model.SysOrg" >
  131. update sys_org
  132. set org_code = #{orgCode,jdbcType=VARCHAR},
  133. org_name = #{orgName,jdbcType=VARCHAR},
  134. description = #{description,jdbcType=VARCHAR},
  135. parent_id = #{parentId,jdbcType=INTEGER},
  136. create_user = #{createUser,jdbcType=VARCHAR},
  137. create_date = #{createDate,jdbcType=TIMESTAMP},
  138. update_user = #{updateUser,jdbcType=VARCHAR},
  139. update_date = #{updateDate,jdbcType=TIMESTAMP}
  140. where id = #{id,jdbcType=INTEGER}
  141. </update>
  142. </mapper>