You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
4.5 KiB

  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.chenhai.muhu.mapper.MerchantMapInfoMapper">
  6. <resultMap type="MerchantMapInfo" id="MerchantMapInfoResult">
  7. <result property="id" column="id" />
  8. <result property="merchantName" column="merchant_name" />
  9. <result property="merchantType" column="merchant_type" />
  10. <result property="merchantSubtype" column="merchant_subtype" />
  11. <result property="region" column="region" />
  12. <result property="address" column="address" />
  13. <result property="latitude" column="latitude" />
  14. <result property="longitude" column="longitude" />
  15. </resultMap>
  16. <sql id="selectMerchantMapInfoVo">
  17. select id, merchant_name, merchant_type, merchant_subtype, region, address, latitude, longitude from merchant_map_info
  18. </sql>
  19. <select id="selectMerchantMapInfoList" parameterType="MerchantMapInfo" resultMap="MerchantMapInfoResult">
  20. <include refid="selectMerchantMapInfoVo"/>
  21. <where>
  22. <if test="merchantName != null and merchantName != ''"> and merchant_name like concat('%', #{merchantName}, '%')</if>
  23. <if test="merchantType != null and merchantType != ''"> and merchant_type = #{merchantType}</if>
  24. <if test="merchantSubtype != null and merchantSubtype != ''"> and merchant_subtype = #{merchantSubtype}</if>
  25. <if test="region != null and region != ''"> and region = #{region}</if>
  26. <if test="address != null and address != ''"> and address = #{address}</if>
  27. <if test="latitude != null "> and latitude = #{latitude}</if>
  28. <if test="longitude != null "> and longitude = #{longitude}</if>
  29. </where>
  30. </select>
  31. <select id="selectMerchantMapInfoById" parameterType="Long" resultMap="MerchantMapInfoResult">
  32. <include refid="selectMerchantMapInfoVo"/>
  33. where id = #{id}
  34. </select>
  35. <insert id="insertMerchantMapInfo" parameterType="MerchantMapInfo" useGeneratedKeys="true" keyProperty="id">
  36. insert into merchant_map_info
  37. <trim prefix="(" suffix=")" suffixOverrides=",">
  38. <if test="merchantName != null and merchantName != ''">merchant_name,</if>
  39. <if test="merchantType != null and merchantType != ''">merchant_type,</if>
  40. <if test="merchantSubtype != null">merchant_subtype,</if>
  41. <if test="region != null and region != ''">region,</if>
  42. <if test="address != null and address != ''">address,</if>
  43. <if test="latitude != null">latitude,</if>
  44. <if test="longitude != null">longitude,</if>
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="merchantName != null and merchantName != ''">#{merchantName},</if>
  48. <if test="merchantType != null and merchantType != ''">#{merchantType},</if>
  49. <if test="merchantSubtype != null">#{merchantSubtype},</if>
  50. <if test="region != null and region != ''">#{region},</if>
  51. <if test="address != null and address != ''">#{address},</if>
  52. <if test="latitude != null">#{latitude},</if>
  53. <if test="longitude != null">#{longitude},</if>
  54. </trim>
  55. </insert>
  56. <update id="updateMerchantMapInfo" parameterType="MerchantMapInfo">
  57. update merchant_map_info
  58. <trim prefix="SET" suffixOverrides=",">
  59. <if test="merchantName != null and merchantName != ''">merchant_name = #{merchantName},</if>
  60. <if test="merchantType != null and merchantType != ''">merchant_type = #{merchantType},</if>
  61. <if test="merchantSubtype != null">merchant_subtype = #{merchantSubtype},</if>
  62. <if test="region != null and region != ''">region = #{region},</if>
  63. <if test="address != null and address != ''">address = #{address},</if>
  64. <if test="latitude != null">latitude = #{latitude},</if>
  65. <if test="longitude != null">longitude = #{longitude},</if>
  66. </trim>
  67. where id = #{id}
  68. </update>
  69. <delete id="deleteMerchantMapInfoById" parameterType="Long">
  70. delete from merchant_map_info where id = #{id}
  71. </delete>
  72. <delete id="deleteMerchantMapInfoByIds" parameterType="String">
  73. delete from merchant_map_info where id in
  74. <foreach item="id" collection="array" open="(" separator="," close=")">
  75. #{id}
  76. </foreach>
  77. </delete>
  78. </mapper>