CustomerInfoMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.shkpr.service.customgateway.core.mapper.primary.CustomerInfoMapper">
  4. <insert id="upsert">
  5. <trim prefix="insert into customer_info (" suffix=")" suffixOverrides=",">
  6. code,
  7. <if test="name != null and name != ''">name,</if>
  8. <if test="address != null and address != ''">address,</if>
  9. <if test="caliber != null">caliber,</if>
  10. <if test="natureName != null and natureName != ''">nature_name,</if>
  11. <if test="pressName != null and pressName != ''">press_name,</if>
  12. <if test="usedTypeName != null and usedTypeName != ''">used_type_name,</if>
  13. <if test="stampInfo != null and stampInfo != ''">stamp_info,</if>
  14. <if test="meterType != null">meter_type,</if>
  15. created_at,
  16. updated_at,
  17. <if test="mobile != null and mobile != ''">mobile,</if>
  18. <if test="statusCode != null">status_code,</if>
  19. <if test="statusName != null and statusName != ''">status_name,</if>
  20. <if test="readCycleName != null and readCycleName != ''">read_cycle_name,</if>
  21. <if test="readerName != null and readerName != ''">reader_name,</if>
  22. <if test="readBookName != null and readBookName != ''">readbook_name,</if>
  23. <if test="readCycle != null">read_cycle,</if>
  24. <if test="readBookType != null">readbook_type,</if>
  25. <if test="gis != null and gis != ''">gis,</if>
  26. <if test="geomGis != null">geom_gis,</if>
  27. <if test="publicServType != null">public_serv_type,</if>
  28. <if test="billingType != null">billing_type,</if>
  29. <if test="meteringType != null">metering_type,</if>
  30. </trim>
  31. <trim prefix="values (" suffix=")" suffixOverrides=",">
  32. #{code,jdbcType=VARCHAR},
  33. <if test="name != null and name != ''">#{name,jdbcType=VARCHAR},</if>
  34. <if test="address != null and address != ''">#{address,jdbcType=VARCHAR},</if>
  35. <if test="caliber != null">#{caliber,jdbcType=SMALLINT},</if>
  36. <if test="natureName != null and natureName != ''">#{natureName,jdbcType=VARCHAR},</if>
  37. <if test="pressName != null and pressName != ''">#{pressName,jdbcType=VARCHAR},</if>
  38. <if test="usedTypeName != null and usedTypeName != ''">#{usedTypeName,jdbcType=VARCHAR},</if>
  39. <if test="stampInfo != null and stampInfo != ''">#{stampInfo,jdbcType=VARCHAR},</if>
  40. <if test="meterType != null">#{meterType,jdbcType=SMALLINT},</if>
  41. <if test="createdAt != null">#{createdAt,jdbcType=TIMESTAMP},</if>
  42. timezone('utc', localtimestamp(0) at time zone current_setting('timezone')),
  43. timezone('utc', localtimestamp(0) at time zone current_setting('timezone')),
  44. <if test="mobile != null and mobile != ''">#{mobile,jdbcType=VARCHAR},</if>
  45. <if test="statusCode != null">#{statusCode,jdbcType=SMALLINT},</if>
  46. <if test="statusName != null and statusName != ''">#{statusName,jdbcType=VARCHAR},</if>
  47. <if test="readCycleName != null and readCycleName != ''">#{readCycleName,jdbcType=VARCHAR},</if>
  48. <if test="readerName != null and readerName != ''">#{readerName,jdbcType=VARCHAR},</if>
  49. <if test="readBookName != null and readBookName != ''">#{readBookName,jdbcType=VARCHAR},</if>
  50. <if test="readCycle != null">#{readCycle,jdbcType=SMALLINT},</if>
  51. <if test="readBookType != null">#{readBookType,jdbcType=SMALLINT},</if>
  52. <if test="gis != null and gis != ''">#{gis,jdbcType=VARCHAR},</if>
  53. <if test="geomGis != null">#{geomGis,jdbcType=OTHER},</if>
  54. <if test="publicServType != null">#{publicServType,jdbcType=SMALLINT},</if>
  55. <if test="billingType != null">#{billingType,jdbcType=SMALLINT},</if>
  56. <if test="meteringType != null">#{meteringType,jdbcType=SMALLINT},</if>
  57. </trim>
  58. on conflict (code) do update set
  59. <trim suffixOverrides=",">
  60. <if test="name != null and name != ''">name = excluded.name,</if>
  61. <if test="address != null and address != ''">address = excluded.address,</if>
  62. <if test="caliber != null">caliber = excluded.caliber,</if>
  63. <if test="natureName != null and natureName != ''">nature_name = excluded.nature_name,</if>
  64. <if test="pressName != null and pressName != ''">press_name = excluded.press_name,</if>
  65. <if test="usedTypeName != null and usedTypeName != ''">used_type_name = excluded.used_type_name,</if>
  66. <if test="stampInfo != null and stampInfo != ''">stamp_info = excluded.stamp_info,</if>
  67. <if test="meterType != null">meter_type = excluded.meter_type,</if>
  68. updated_at = excluded.updated_at,
  69. <if test="mobile != null and mobile != ''">mobile = excluded.mobile,</if>
  70. <if test="statusCode != null">status_code = excluded.status_code,</if>
  71. <if test="statusName != null and statusName != ''">status_name = excluded.status_name,</if>
  72. <if test="readCycleName != null and readCycleName != ''">read_cycle_name = excluded.read_cycle_name,</if>
  73. <if test="readerName != null and readerName != ''">reader_name = excluded.reader_name,</if>
  74. <if test="readBookName != null and readBookName != ''">readbook_name = excluded.readbook_name,</if>
  75. <if test="readCycle != null">read_cycle = excluded.read_cycle,</if>
  76. <if test="readBookType != null">readbook_type = excluded.readbook_type,</if>
  77. <if test="gis != null and gis != ''">gis = excluded.gis,</if>
  78. <if test="geomGis != null">geom_gis = excluded.geom_gis,</if>
  79. <if test="publicServType != null">public_serv_type = excluded.public_serv_type,</if>
  80. <if test="billingType != null">billing_type = excluded.billing_type,</if>
  81. <if test="meteringType != null">metering_type = excluded.metering_type,</if>
  82. </trim>
  83. </insert>
  84. </mapper>