EmployeeMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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="com.usoftchina.saas.document.mapper.EmployeeMapper">
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Employee">
  5. <id column="em_id" jdbcType="INTEGER" property="id" />
  6. <result column="em_code" jdbcType="VARCHAR" property="em_code" />
  7. <result column="em_name" jdbcType="VARCHAR" property="em_name" />
  8. <result column="em_password" jdbcType="VARCHAR" property="em_password" />
  9. <result column="em_class" jdbcType="VARCHAR" property="em_class" />
  10. <result column="em_mobile" jdbcType="VARCHAR" property="em_mobile" />
  11. <result column="em_email" jdbcType="VARCHAR" property="em_email" />
  12. <result column="companyId" jdbcType="INTEGER" property="companyId" />
  13. <result column="updaterId" jdbcType="INTEGER" property="updaterId" />
  14. <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
  15. <result column="em_text1" jdbcType="VARCHAR" property="em_text1" />
  16. <result column="em_text2" jdbcType="VARCHAR" property="em_text2" />
  17. <result column="em_text3" jdbcType="VARCHAR" property="em_text3" />
  18. <result column="em_text4" jdbcType="VARCHAR" property="em_text4" />
  19. <result column="em_text5" jdbcType="VARCHAR" property="em_text5" />
  20. </resultMap>
  21. <sql id="Base_Column_List">
  22. em_id, em_code, em_name, em_password, em_class, em_mobile, em_email, companyId, updaterId,
  23. updateTime, em_text1, em_text2, em_text3, em_text4, em_text5
  24. </sql>
  25. <select id="selectByPrimaryKey" parameterType="long" resultMap="BaseResultMap">
  26. select
  27. <include refid="Base_Column_List" />
  28. from employee
  29. where em_id = #{em_id,jdbcType=INTEGER}
  30. </select>
  31. <delete id="deleteByPrimaryKey" parameterType="long">
  32. delete from employee
  33. where em_id = #{em_id,jdbcType=INTEGER}
  34. </delete>
  35. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Employee">
  36. <selectKey resultType="java.lang.Long" keyProperty="id">
  37. SELECT LAST_INSERT_ID() AS ID
  38. </selectKey>
  39. insert into employee
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test="em_code != null">
  42. em_code,
  43. </if>
  44. <if test="em_name != null">
  45. em_name,
  46. </if>
  47. <if test="em_password != null">
  48. em_password,
  49. </if>
  50. <if test="em_class != null">
  51. em_class,
  52. </if>
  53. <if test="em_mobile != null">
  54. em_mobile,
  55. </if>
  56. <if test="em_email != null">
  57. em_email,
  58. </if>
  59. <if test="companyId != null">
  60. companyId,
  61. </if>
  62. <if test="updaterId != null">
  63. updaterId,
  64. </if>
  65. <if test="updateTime != null">
  66. updateTime,
  67. </if>
  68. <if test="em_text1 != null">
  69. em_text1,
  70. </if>
  71. <if test="em_text2 != null">
  72. em_text2,
  73. </if>
  74. <if test="em_text3 != null">
  75. em_text3,
  76. </if>
  77. <if test="em_text4 != null">
  78. em_text4,
  79. </if>
  80. <if test="em_text5 != null">
  81. em_text5,
  82. </if>
  83. </trim>
  84. <trim prefix="values (" suffix=")" suffixOverrides=",">
  85. <if test="em_code != null">
  86. #{em_code,jdbcType=VARCHAR},
  87. </if>
  88. <if test="em_name != null">
  89. #{em_name,jdbcType=VARCHAR},
  90. </if>
  91. <if test="em_password != null">
  92. #{em_password,jdbcType=VARCHAR},
  93. </if>
  94. <if test="em_class != null">
  95. #{em_class,jdbcType=VARCHAR},
  96. </if>
  97. <if test="em_mobile != null">
  98. #{em_mobile,jdbcType=VARCHAR},
  99. </if>
  100. <if test="em_email != null">
  101. #{em_email,jdbcType=VARCHAR},
  102. </if>
  103. <if test="companyId != null">
  104. #{companyId,jdbcType=INTEGER},
  105. </if>
  106. <if test="updaterId != null">
  107. #{updaterId,jdbcType=INTEGER},
  108. </if>
  109. <if test="updateTime != null">
  110. #{updateTime,jdbcType=TIMESTAMP},
  111. </if>
  112. <if test="em_text1 != null">
  113. #{em_text1,jdbcType=VARCHAR},
  114. </if>
  115. <if test="em_text2 != null">
  116. #{em_text2,jdbcType=VARCHAR},
  117. </if>
  118. <if test="em_text3 != null">
  119. #{em_text3,jdbcType=VARCHAR},
  120. </if>
  121. <if test="em_text4 != null">
  122. #{em_text4,jdbcType=VARCHAR},
  123. </if>
  124. <if test="em_text5 != null">
  125. #{em_text5,jdbcType=VARCHAR},
  126. </if>
  127. </trim>
  128. </insert>
  129. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Employee">
  130. update employee
  131. <set>
  132. <if test="em_code != null">
  133. em_code = #{em_code,jdbcType=VARCHAR},
  134. </if>
  135. <if test="em_name != null">
  136. em_name = #{em_name,jdbcType=VARCHAR},
  137. </if>
  138. <if test="em_password != null">
  139. em_password = #{em_password,jdbcType=VARCHAR},
  140. </if>
  141. <if test="em_class != null">
  142. em_class = #{em_class,jdbcType=VARCHAR},
  143. </if>
  144. <if test="em_mobile != null">
  145. em_mobile = #{em_mobile,jdbcType=VARCHAR},
  146. </if>
  147. <if test="em_email != null">
  148. em_email = #{em_email,jdbcType=VARCHAR},
  149. </if>
  150. <if test="companyId != null">
  151. companyId = #{companyId,jdbcType=INTEGER},
  152. </if>
  153. <if test="updaterId != null">
  154. updaterId = #{updaterId,jdbcType=INTEGER},
  155. </if>
  156. <if test="updateTime != null">
  157. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  158. </if>
  159. <if test="em_text1 != null">
  160. em_text1 = #{em_text1,jdbcType=VARCHAR},
  161. </if>
  162. <if test="em_text2 != null">
  163. em_text2 = #{em_text2,jdbcType=VARCHAR},
  164. </if>
  165. <if test="em_text3 != null">
  166. em_text3 = #{em_text3,jdbcType=VARCHAR},
  167. </if>
  168. <if test="em_text4 != null">
  169. em_text4 = #{em_text4,jdbcType=VARCHAR},
  170. </if>
  171. <if test="em_text5 != null">
  172. em_text5 = #{em_text5,jdbcType=VARCHAR},
  173. </if>
  174. </set>
  175. where em_id = #{id,jdbcType=INTEGER}
  176. </update>
  177. <!--查询所有物料信息-->
  178. <select id="selectEmployeeListByCondition" resultMap="BaseResultMap" parameterType="com.usoftchina.saas.commons.dto.DocReqDTO">
  179. SELECT * FROM Employee
  180. <where>
  181. <if test="con != null">
  182. ${con}
  183. </if>
  184. <if test="companyId != null">
  185. and companyid = #{companyId}
  186. </if>
  187. </where>
  188. ORDER BY em_ID DESC
  189. </select>
  190. <select id="validateCodeWhenInsert" resultType="int">
  191. select count(*) from Employee where em_code = #{code} and companyId =#{companyId}
  192. </select>
  193. <select id="validateCodeWhenUpdate" resultType="int" >
  194. select count(*) from Employee where em_code = #{code} and em_id != #{id} and companyId =#{companyId}
  195. </select>
  196. </mapper>