SysUserCustomerAuthorizationMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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.dgtly.system.mapper.SysUserCustomerAuthorizationMapper">
  6. <resultMap type="SysUserCustomerAuthorization" id="SysUserCustomerAuthorizationResult">
  7. <result property="customerCode" column="customer_code" />
  8. <result property="userId" column="user_id" />
  9. <result property="isConsignee" column="is_consignee" />
  10. <result property="isIndependently" column="is_independently" />
  11. <result property="isSelfDelivery" column="is_self_delivery" />
  12. <result property="createBy" column="create_by" />
  13. <result property="createTime" column="create_time" />
  14. <result property="updateBy" column="update_by" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="isDelete" column="is_delete" />
  17. </resultMap>
  18. <sql id="selectSysUserCustomerAuthorizationVo">
  19. select customer_code, user_id, is_consignee, is_independently, is_self_delivery, create_by, create_time, update_by, update_time, is_delete from sys_user_customer_authorization
  20. </sql>
  21. <select id="selectSysUserCustomerAuthorizationList" parameterType="SysUserCustomerAuthorization" resultMap="SysUserCustomerAuthorizationResult">
  22. <include refid="selectSysUserCustomerAuthorizationVo"/>
  23. <where>
  24. <if test="customerCode != null and customerCode != ''"> and customer_code = #{customerCode}</if>
  25. <if test="userId != null "> and user_id = #{userId}</if>
  26. <if test="isConsignee != null and isConsignee != ''"> and is_consignee = #{isConsignee}</if>
  27. <if test="isIndependently != null and isIndependently != ''"> and is_independently = #{isIndependently}</if>
  28. <if test="isSelfDelivery != null and isSelfDelivery != ''"> and is_self_delivery = #{isSelfDelivery}</if>
  29. <if test="isDelete != null "> and is_delete = #{isDelete}</if>
  30. </where>
  31. </select>
  32. <select id="selectSysUserCustomerAuthorizationById" parameterType="String" resultMap="SysUserCustomerAuthorizationResult">
  33. <include refid="selectSysUserCustomerAuthorizationVo"/>
  34. where customer_code = #{customerCode}
  35. </select>
  36. <insert id="insertSysUserCustomerAuthorization" parameterType="SysUserCustomerAuthorization">
  37. insert into sys_user_customer_authorization
  38. <trim prefix="(" suffix=")" suffixOverrides=",">
  39. <if test="customerCode != null and customerCode != ''">customer_code,</if>
  40. <if test="userId != null ">user_id,</if>
  41. <if test="isConsignee != null and isConsignee != ''">is_consignee,</if>
  42. <if test="isIndependently != null and isIndependently != ''">is_independently,</if>
  43. <if test="isSelfDelivery != null and isSelfDelivery != ''">is_self_delivery,</if>
  44. <if test="createBy != null and createBy != ''">create_by,</if>
  45. <if test="createTime != null ">create_time,</if>
  46. <if test="updateBy != null and updateBy != ''">update_by,</if>
  47. <if test="updateTime != null ">update_time,</if>
  48. <if test="isDelete != null ">is_delete,</if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="customerCode != null and customerCode != ''">#{customerCode},</if>
  52. <if test="userId != null ">#{userId},</if>
  53. <if test="isConsignee != null and isConsignee != ''">#{isConsignee},</if>
  54. <if test="isIndependently != null and isIndependently != ''">#{isIndependently},</if>
  55. <if test="isSelfDelivery != null and isSelfDelivery != ''">#{isSelfDelivery},</if>
  56. <if test="createBy != null and createBy != ''">#{createBy},</if>
  57. <if test="createTime != null ">#{createTime},</if>
  58. <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
  59. <if test="updateTime != null ">#{updateTime},</if>
  60. <if test="isDelete != null ">#{isDelete},</if>
  61. </trim>
  62. </insert>
  63. <update id="updateSysUserCustomerAuthorization" parameterType="SysUserCustomerAuthorization">
  64. update sys_user_customer_authorization
  65. <trim prefix="SET" suffixOverrides=",">
  66. <if test="userId != null ">user_id = #{userId},</if>
  67. <if test="isConsignee != null and isConsignee != ''">is_consignee = #{isConsignee},</if>
  68. <if test="isIndependently != null and isIndependently != ''">is_independently = #{isIndependently},</if>
  69. <if test="isSelfDelivery != null and isSelfDelivery != ''">is_self_delivery = #{isSelfDelivery},</if>
  70. <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
  71. <if test="createTime != null ">create_time = #{createTime},</if>
  72. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  73. <if test="updateTime != null ">update_time = #{updateTime},</if>
  74. <if test="isDelete != null ">is_delete = #{isDelete},</if>
  75. </trim>
  76. where customer_code = #{customerCode}
  77. </update>
  78. <delete id="deleteSysUserCustomerAuthorizationById" parameterType="String">
  79. delete from sys_user_customer_authorization where customer_code = #{customerCode}
  80. </delete>
  81. <delete id="deleteSysUserCustomerAuthorizationByIds" parameterType="String">
  82. delete from sys_user_customer_authorization where customer_code in
  83. <foreach item="customerCode" collection="array" open="(" separator="," close=")">
  84. #{customerCode}
  85. </foreach>
  86. </delete>
  87. <update id="updateAuthorizationByCustomerCodeAndUserId" parameterType="SysUserCustomerAuthorization">
  88. update sys_user_customer_authorization
  89. <trim prefix="SET" suffixOverrides=",">
  90. <if test="isConsignee != null and isConsignee != ''">is_consignee = #{isConsignee},</if>
  91. <if test="isIndependently != null and isIndependently != ''">is_independently = #{isIndependently},</if>
  92. <if test="isSelfDelivery != null and isSelfDelivery != ''">is_self_delivery = #{isSelfDelivery},</if>
  93. <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
  94. <if test="createTime != null ">create_time = #{createTime},</if>
  95. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  96. <if test="updateTime != null ">update_time = #{updateTime},</if>
  97. <if test="isDelete != null ">is_delete = #{isDelete},</if>
  98. </trim>
  99. where customer_code = #{customerCode} and user_id = #{userId}
  100. </update>
  101. <select id="selectAuthorizationByUserIdAndCustomerCode" parameterType="String" resultMap="SysUserCustomerAuthorizationResult">
  102. <include refid="selectSysUserCustomerAuthorizationVo"/>
  103. where customer_code = #{customerCode} and user_id = #{userId}
  104. </select>
  105. </mapper>