BdglEmployeeMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.supervision.grassrootsregistration.mapper.BdglEmployeeMapper">
  6. <resultMap type="BdglEmployee" id="BdglEmployeeResult">
  7. <result property="pin" column="pin" />
  8. <result property="name" column="name" />
  9. <result property="deptnumber" column="deptnumber" />
  10. <result property="deptname" column="deptname" />
  11. <result property="position" column="position" />
  12. <result property="gender" column="gender" />
  13. <result property="telephone" column="telephone" />
  14. <result property="email" column="email" />
  15. <result property="card" column="card" />
  16. <result property="mobile" column="mobile" />
  17. <result property="status" column="status" />
  18. </resultMap>
  19. <sql id="selectBdglEmployeeVo">
  20. select pin, name, deptnumber, deptname, position, gender, telephone, email, card, mobile, status from bdgl_employee
  21. </sql>
  22. <select id="selectBdglEmployeeList" parameterType="BdglEmployee" resultMap="BdglEmployeeResult">
  23. <include refid="selectBdglEmployeeVo"/>
  24. <where>
  25. <if test="pin != null "> and pin = #{pin}</if>
  26. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  27. <if test="deptnumber != null "> and deptnumber = #{deptnumber}</if>
  28. <if test="deptname != null and deptname != ''"> and deptname like concat('%', #{deptname}, '%')</if>
  29. <if test="position != null and position != ''"> and position = #{position}</if>
  30. <if test="gender != null and gender != ''"> and gender = #{gender}</if>
  31. <if test="telephone != null and telephone != ''"> and telephone = #{telephone}</if>
  32. <if test="email != null and email != ''"> and email = #{email}</if>
  33. <if test="card != null and card != ''"> and card = #{card}</if>
  34. <if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
  35. <if test="status != null "> and status = #{status}</if>
  36. </where>
  37. </select>
  38. <select id="selectBdglEmployeeByPin" parameterType="Long" resultMap="BdglEmployeeResult">
  39. <include refid="selectBdglEmployeeVo"/>
  40. where pin = #{pin}
  41. </select>
  42. <insert id="insertBdglEmployee" parameterType="BdglEmployee">
  43. insert into bdgl_employee
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="pin != null">pin,</if>
  46. <if test="name != null">name,</if>
  47. <if test="deptnumber != null">deptnumber,</if>
  48. <if test="deptname != null">deptname,</if>
  49. <if test="position != null">position,</if>
  50. <if test="gender != null">gender,</if>
  51. <if test="telephone != null">telephone,</if>
  52. <if test="email != null">email,</if>
  53. <if test="card != null">card,</if>
  54. <if test="mobile != null">mobile,</if>
  55. <if test="status != null">status,</if>
  56. </trim>
  57. <trim prefix="values (" suffix=")" suffixOverrides=",">
  58. <if test="pin != null">#{pin},</if>
  59. <if test="name != null">#{name},</if>
  60. <if test="deptnumber != null">#{deptnumber},</if>
  61. <if test="deptname != null">#{deptname},</if>
  62. <if test="position != null">#{position},</if>
  63. <if test="gender != null">#{gender},</if>
  64. <if test="telephone != null">#{telephone},</if>
  65. <if test="email != null">#{email},</if>
  66. <if test="card != null">#{card},</if>
  67. <if test="mobile != null">#{mobile},</if>
  68. <if test="status != null">#{status},</if>
  69. </trim>
  70. </insert>
  71. <update id="updateBdglEmployee" parameterType="BdglEmployee">
  72. update bdgl_employee
  73. <trim prefix="SET" suffixOverrides=",">
  74. <if test="name != null">name = #{name},</if>
  75. <if test="deptnumber != null">deptnumber = #{deptnumber},</if>
  76. <if test="deptname != null">deptname = #{deptname},</if>
  77. <if test="position != null">position = #{position},</if>
  78. <if test="gender != null">gender = #{gender},</if>
  79. <if test="telephone != null">telephone = #{telephone},</if>
  80. <if test="email != null">email = #{email},</if>
  81. <if test="card != null">card = #{card},</if>
  82. <if test="mobile != null">mobile = #{mobile},</if>
  83. <if test="status != null">status = #{status},</if>
  84. </trim>
  85. where pin = #{pin}
  86. </update>
  87. <delete id="deleteBdglEmployeeByPin" parameterType="Long">
  88. delete from bdgl_employee where pin = #{pin}
  89. </delete>
  90. <delete id="deleteBdglEmployeeByPins" parameterType="String">
  91. delete from bdgl_employee where pin in
  92. <foreach item="pin" collection="array" open="(" separator="," close=")">
  93. #{pin}
  94. </foreach>
  95. </delete>
  96. </mapper>