StationInfoMapper.xml 6.4 KB

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