StationPersonnelMapper.xml 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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.yijia.station.mapper.StationPersonnelMapper">
  6. <resultMap type="StationPersonnel" id="StationPersonnelResult">
  7. <result property="personnelId" column="personnel_id" />
  8. <result property="personnelName" column="personnel_name" />
  9. <result property="gunNo" column="gun_no" />
  10. <result property="stationId" column="station_id" />
  11. <result property="stationName" column="station_name" />
  12. <result property="qrCode" column="qr_code" />
  13. <result property="personnelPhone" column="personnel_phone" />
  14. </resultMap>
  15. <sql id="selectStationPersonnelVo">
  16. select personnel_id, personnel_name, gun_no, station_id, station_name, qr_code, personnel_phone from station_personnel
  17. </sql>
  18. <select id="selectStationPersonnelList" parameterType="StationPersonnel" resultMap="StationPersonnelResult">
  19. <include refid="selectStationPersonnelVo"/>
  20. <where>
  21. <if test="personnelName != null and personnelName != ''"> and personnel_name like concat('%', #{personnelName}, '%')</if>
  22. <if test="gunNo != null and gunNo != ''"> and gun_no = #{gunNo}</if>
  23. <if test="stationId != null "> and station_id = #{stationId}</if>
  24. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  25. <if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
  26. <if test="personnelPhone != null and personnelPhone != ''"> and personnel_phone = #{personnelPhone}</if>
  27. </where>
  28. order by personnel_id desc
  29. </select>
  30. <select id="selectStationPersonnelById" parameterType="Long" resultMap="StationPersonnelResult">
  31. <include refid="selectStationPersonnelVo"/>
  32. where personnel_id = #{personnelId}
  33. </select>
  34. <insert id="insertStationPersonnel" parameterType="StationPersonnel">
  35. insert into station_personnel
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="personnelId != null">personnel_id,</if>
  38. <if test="personnelName != null">personnel_name,</if>
  39. <if test="gunNo != null">gun_no,</if>
  40. <if test="stationId != null">station_id,</if>
  41. <if test="stationName != null">station_name,</if>
  42. <if test="qrCode != null">qr_code,</if>
  43. <if test="personnelPhone != null">personnel_phone,</if>
  44. </trim>
  45. <trim prefix="values (" suffix=")" suffixOverrides=",">
  46. <if test="personnelId != null">#{personnelId},</if>
  47. <if test="personnelName != null">#{personnelName},</if>
  48. <if test="gunNo != null">#{gunNo},</if>
  49. <if test="stationId != null">#{stationId},</if>
  50. <if test="stationName != null">#{stationName},</if>
  51. <if test="qrCode != null">#{qrCode},</if>
  52. <if test="personnelPhone != null">#{personnelPhone},</if>
  53. </trim>
  54. </insert>
  55. <update id="updateStationPersonnel" parameterType="StationPersonnel">
  56. update station_personnel
  57. <trim prefix="SET" suffixOverrides=",">
  58. <if test="personnelName != null">personnel_name = #{personnelName},</if>
  59. <if test="gunNo != null">gun_no = #{gunNo},</if>
  60. <if test="stationId != null">station_id = #{stationId},</if>
  61. <if test="stationName != null">station_name = #{stationName},</if>
  62. <if test="qrCode != null">qr_code = #{qrCode},</if>
  63. <if test="personnelPhone != null">personnel_phone = #{personnelPhone},</if>
  64. </trim>
  65. where personnel_id = #{personnelId}
  66. </update>
  67. <delete id="deleteStationPersonnelById" parameterType="Long">
  68. delete from station_personnel where personnel_id = #{personnelId}
  69. </delete>
  70. <delete id="deleteStationPersonnelByIds" parameterType="String">
  71. delete from station_personnel where personnel_id in
  72. <foreach item="personnelId" collection="array" open="(" separator="," close=")">
  73. #{personnelId}
  74. </foreach>
  75. </delete>
  76. </mapper>