StationNoticeMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.StationNoticeMapper">
  6. <resultMap type="StationNotice" id="StationNoticeResult">
  7. <result property="noticeId" column="notice_id" />
  8. <result property="fullName" column="full_name" />
  9. <result property="phone" column="phone" />
  10. <result property="bindDate" column="bind_date" />
  11. <result property="bindStatus" column="bind_status" />
  12. <result property="wxFullName" column="wx_full_name" />
  13. <result property="stationId" column="station_id" />
  14. <result property="stationName" column="station_name" />
  15. </resultMap>
  16. <sql id="selectStationNoticeVo">
  17. select notice_id, full_name, phone, bind_date, bind_status, wx_full_name, station_id, station_name from station_notice
  18. </sql>
  19. <select id="selectStationNoticeList" parameterType="StationNotice" resultMap="StationNoticeResult">
  20. <include refid="selectStationNoticeVo"/>
  21. <where>
  22. <if test="fullName != null and fullName != ''"> and full_name like concat('%', #{fullName}, '%')</if>
  23. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  24. <if test="bindDate != null "> and bind_date = #{bindDate}</if>
  25. <if test="bindStatus != null and bindStatus != ''"> and bind_status = #{bindStatus}</if>
  26. <if test="wxFullName != null and wxFullName != ''"> and wx_full_name like concat('%', #{wxFullName}, '%')</if>
  27. <if test="stationId != null "> and station_id = #{stationId}</if>
  28. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  29. </where>
  30. </select>
  31. <select id="selectStationNoticeById" parameterType="Long" resultMap="StationNoticeResult">
  32. <include refid="selectStationNoticeVo"/>
  33. where notice_id = #{noticeId}
  34. </select>
  35. <insert id="insertStationNotice" parameterType="StationNotice" useGeneratedKeys="true" keyProperty="noticeId">
  36. insert into station_notice
  37. <trim prefix="(" suffix=")" suffixOverrides=",">
  38. <if test="fullName != null">full_name,</if>
  39. <if test="phone != null">phone,</if>
  40. <if test="bindDate != null">bind_date,</if>
  41. <if test="bindStatus != null">bind_status,</if>
  42. <if test="wxFullName != null">wx_full_name,</if>
  43. <if test="stationId != null">station_id,</if>
  44. <if test="stationName != null">station_name,</if>
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="fullName != null">#{fullName},</if>
  48. <if test="phone != null">#{phone},</if>
  49. <if test="bindDate != null">#{bindDate},</if>
  50. <if test="bindStatus != null">#{bindStatus},</if>
  51. <if test="wxFullName != null">#{wxFullName},</if>
  52. <if test="stationId != null">#{stationId},</if>
  53. <if test="stationName != null">#{stationName},</if>
  54. </trim>
  55. </insert>
  56. <update id="updateStationNotice" parameterType="StationNotice">
  57. update station_notice
  58. <trim prefix="SET" suffixOverrides=",">
  59. <if test="fullName != null">full_name = #{fullName},</if>
  60. <if test="phone != null">phone = #{phone},</if>
  61. <if test="bindDate != null">bind_date = #{bindDate},</if>
  62. <if test="bindStatus != null">bind_status = #{bindStatus},</if>
  63. <if test="wxFullName != null">wx_full_name = #{wxFullName},</if>
  64. <if test="stationId != null">station_id = #{stationId},</if>
  65. <if test="stationName != null">station_name = #{stationName},</if>
  66. </trim>
  67. where notice_id = #{noticeId}
  68. </update>
  69. <delete id="deleteStationNoticeById" parameterType="Long">
  70. delete from station_notice where notice_id = #{noticeId}
  71. </delete>
  72. <delete id="deleteStationNoticeByIds" parameterType="String">
  73. delete from station_notice where notice_id in
  74. <foreach item="noticeId" collection="array" open="(" separator="," close=")">
  75. #{noticeId}
  76. </foreach>
  77. </delete>
  78. </mapper>