StationInfoMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.StationInfoMapper">
  6. <resultMap type="StationInfo" id="StationInfoResult">
  7. <result property="stationId" column="station_id" />
  8. <result property="stationName" column="station_name" />
  9. <result property="stationAddress" column="station_address" />
  10. <result property="oilGunNum" column="oil_gun_num" />
  11. <result property="contacts" column="contacts" />
  12. <result property="phone" column="phone" />
  13. <result property="stationGroupId" column="station_group_id" />
  14. <result property="stationGroupName" column="station_group_name" />
  15. <result property="stationPic" column="station_pic" />
  16. <result property="stationLongitude" column="station_longitude" />
  17. <result property="stationLatitude" column="station_latitude" />
  18. <result property="mno" column="mno" />
  19. </resultMap>
  20. <sql id="selectStationInfoVo">
  21. select station_id, station_name, station_address, oil_gun_num, contacts, phone, station_group_id, station_group_name, station_pic, station_longitude, station_latitude, mno from station_info
  22. </sql>
  23. <select id="selectStationInfoList" parameterType="StationInfo" resultMap="StationInfoResult">
  24. <include refid="selectStationInfoVo"/>
  25. <where>
  26. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  27. <if test="stationAddress != null and stationAddress != ''"> and station_address = #{stationAddress}</if>
  28. <if test="oilGunNum != null "> and oil_gun_num = #{oilGunNum}</if>
  29. <if test="contacts != null and contacts != ''"> and contacts = #{contacts}</if>
  30. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  31. <if test="stationGroupId != null "> and station_group_id = #{stationGroupId}</if>
  32. <if test="stationGroupName != null and stationGroupName != ''"> and station_group_name like concat('%', #{stationGroupName}, '%')</if>
  33. <if test="stationPic != null and stationPic != ''"> and station_pic = #{stationPic}</if>
  34. <if test="stationLongitude != null and stationLongitude != ''"> and station_longitude = #{stationLongitude}</if>
  35. <if test="stationLatitude != null and stationLatitude != ''"> and station_latitude = #{stationLatitude}</if>
  36. <if test="mno != null "> and mno = #{mno}</if>
  37. </where>
  38. order by station_id desc
  39. </select>
  40. <select id="selectStationInfoById" parameterType="Long" resultMap="StationInfoResult">
  41. <include refid="selectStationInfoVo"/>
  42. where station_id = #{stationId}
  43. </select>
  44. <insert id="insertStationInfo" parameterType="StationInfo">
  45. insert into station_info
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="stationId != null">station_id,</if>
  48. <if test="stationName != null">station_name,</if>
  49. <if test="stationAddress != null">station_address,</if>
  50. <if test="oilGunNum != null">oil_gun_num,</if>
  51. <if test="contacts != null">contacts,</if>
  52. <if test="phone != null">phone,</if>
  53. <if test="stationGroupId != null">station_group_id,</if>
  54. <if test="stationGroupName != null">station_group_name,</if>
  55. <if test="stationPic != null">station_pic,</if>
  56. <if test="stationLongitude != null">station_longitude,</if>
  57. <if test="stationLatitude != null">station_latitude,</if>
  58. <if test="mno != null">mno,</if>
  59. </trim>
  60. <trim prefix="values (" suffix=")" suffixOverrides=",">
  61. <if test="stationId != null">#{stationId},</if>
  62. <if test="stationName != null">#{stationName},</if>
  63. <if test="stationAddress != null">#{stationAddress},</if>
  64. <if test="oilGunNum != null">#{oilGunNum},</if>
  65. <if test="contacts != null">#{contacts},</if>
  66. <if test="phone != null">#{phone},</if>
  67. <if test="stationGroupId != null">#{stationGroupId},</if>
  68. <if test="stationGroupName != null">#{stationGroupName},</if>
  69. <if test="stationPic != null">#{stationPic},</if>
  70. <if test="stationLongitude != null">#{stationLongitude},</if>
  71. <if test="stationLatitude != null">#{stationLatitude},</if>
  72. <if test="mno != null">#{mno},</if>
  73. </trim>
  74. </insert>
  75. <update id="updateStationInfo" parameterType="StationInfo">
  76. update station_info
  77. <trim prefix="SET" suffixOverrides=",">
  78. <if test="stationName != null">station_name = #{stationName},</if>
  79. <if test="stationAddress != null">station_address = #{stationAddress},</if>
  80. <if test="oilGunNum != null">oil_gun_num = #{oilGunNum},</if>
  81. <if test="contacts != null">contacts = #{contacts},</if>
  82. <if test="phone != null">phone = #{phone},</if>
  83. <if test="stationGroupId != null">station_group_id = #{stationGroupId},</if>
  84. <if test="stationGroupName != null">station_group_name = #{stationGroupName},</if>
  85. <if test="stationPic != null">station_pic = #{stationPic},</if>
  86. <if test="stationLongitude != null">station_longitude = #{stationLongitude},</if>
  87. <if test="stationLatitude != null">station_latitude = #{stationLatitude},</if>
  88. <if test="mno != null">mno = #{mno},</if>
  89. </trim>
  90. where station_id = #{stationId}
  91. </update>
  92. <delete id="deleteStationInfoById" parameterType="Long">
  93. delete from station_info where station_id = #{stationId}
  94. </delete>
  95. <delete id="deleteStationInfoByIds" parameterType="String">
  96. delete from station_info where station_id in
  97. <foreach item="stationId" collection="array" open="(" separator="," close=")">
  98. #{stationId}
  99. </foreach>
  100. </delete>
  101. </mapper>