UserAttrServiceDaoImplMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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="userAttrServiceDaoImpl">
  6. <!-- 保存用户属性信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessUserAttrInfo" parameterType="Map">
  8. insert into business_user_attr(
  9. attr_id,operate,spec_cd,b_id,user_id,value
  10. ) values (
  11. #{attrId},#{operate},#{specCd},#{bId},#{userId},#{value}
  12. )
  13. </insert>
  14. <insert id="saveUserAttr" parameterType="Map">
  15. insert into u_user_attr(
  16. attr_id,spec_cd,b_id,user_id,value
  17. ) values (
  18. #{attrId},#{specCd},'-1',#{userId},#{value}
  19. )
  20. </insert>
  21. <!-- 查询用户属性信息(Business) add by wuxw 2018-07-03 -->
  22. <select id="getBusinessUserAttrInfo" parameterType="Map" resultType="Map">
  23. select t.attr_id,t.attr_id attrId,t.operate,t.spec_cd,t.spec_cd specCd,t.b_id,t.b_id bId,t.user_id,t.user_id
  24. userId,t.value
  25. from business_user_attr t
  26. where 1 =1
  27. <if test="attrId !=null and attrId != ''">
  28. and t.attr_id= #{attrId}
  29. </if>
  30. <if test="operate !=null and operate != ''">
  31. and t.operate= #{operate}
  32. </if>
  33. <if test="specCd !=null and specCd != ''">
  34. and t.spec_cd= #{specCd}
  35. </if>
  36. <if test="bId !=null and bId != ''">
  37. and t.b_id= #{bId}
  38. </if>
  39. <if test="userId !=null and userId != ''">
  40. and t.user_id= #{userId}
  41. </if>
  42. <if test="value !=null and value != ''">
  43. and t.value= #{value}
  44. </if>
  45. </select>
  46. <!-- 保存用户属性信息至 instance表中 add by wuxw 2018-07-03 -->
  47. <insert id="saveUserAttrInfoInstance" parameterType="Map">
  48. insert into u_user_attr(
  49. attr_id,spec_cd,status_cd,b_id,user_id,value
  50. ) select t.attr_id,t.spec_cd,'0',t.b_id,t.user_id,t.value from business_user_attr t where 1=1
  51. <if test="attrId !=null and attrId != ''">
  52. and t.attr_id= #{attrId}
  53. </if>
  54. and t.operate= 'ADD'
  55. <if test="specCd !=null and specCd != ''">
  56. and t.spec_cd= #{specCd}
  57. </if>
  58. <if test="bId !=null and bId != ''">
  59. and t.b_id= #{bId}
  60. </if>
  61. <if test="userId !=null and userId != ''">
  62. and t.user_id= #{userId}
  63. </if>
  64. <if test="value !=null and value != ''">
  65. and t.value= #{value}
  66. </if>
  67. </insert>
  68. <!-- 查询用户属性信息 add by wuxw 2018-07-03 -->
  69. <select id="getUserAttrInfo" parameterType="Map" resultType="Map">
  70. select t.attr_id,t.attr_id attrId,t.spec_cd,t.spec_cd specCd,t.status_cd,t.status_cd statusCd,t.b_id,t.b_id
  71. bId,t.user_id,t.user_id userId,t.value
  72. from u_user_attr t
  73. where 1 =1
  74. <if test="attrId !=null and attrId != ''">
  75. and t.attr_id= #{attrId}
  76. </if>
  77. <if test="specCd !=null and specCd != ''">
  78. and t.spec_cd= #{specCd}
  79. </if>
  80. <if test="statusCd !=null and statusCd != ''">
  81. and t.status_cd= #{statusCd}
  82. </if>
  83. <if test="bId !=null and bId != ''">
  84. and t.b_id= #{bId}
  85. </if>
  86. <if test="userId !=null and userId != ''">
  87. and t.user_id= #{userId}
  88. </if>
  89. <if test="value !=null and value != ''">
  90. and t.value= #{value}
  91. </if>
  92. order by t.create_time desc
  93. <if test="page != -1 and page != null ">
  94. limit #{page}, #{row}
  95. </if>
  96. </select>
  97. <!-- 修改用户属性信息 add by wuxw 2018-07-03 -->
  98. <update id="updateUserAttrInfoInstance" parameterType="Map">
  99. update u_user_attr t set t.status_cd = #{statusCd}
  100. <if test="newBId != null and newBId != ''">
  101. ,t.b_id = #{newBId}
  102. </if>
  103. <if test="specCd !=null and specCd != ''">
  104. , t.spec_cd= #{specCd}
  105. </if>
  106. <if test="userId !=null and userId != ''">
  107. , t.user_id= #{userId}
  108. </if>
  109. <if test="value !=null and value != ''">
  110. , t.value= #{value}
  111. </if>
  112. where 1=1
  113. <if test="attrId !=null and attrId != ''">
  114. and t.attr_id= #{attrId}
  115. </if>
  116. <if test="bId !=null and bId != ''">
  117. and t.b_id= #{bId}
  118. </if>
  119. </update>
  120. <!-- 查询用户属性数量 add by wuxw 2018-07-03 -->
  121. <select id="queryUserAttrsCount" parameterType="Map" resultType="Map">
  122. select count(1) count
  123. from u_user_attr t
  124. where 1 =1
  125. <if test="attrId !=null and attrId != ''">
  126. and t.attr_id= #{attrId}
  127. </if>
  128. <if test="specCd !=null and specCd != ''">
  129. and t.spec_cd= #{specCd}
  130. </if>
  131. <if test="statusCd !=null and statusCd != ''">
  132. and t.status_cd= #{statusCd}
  133. </if>
  134. <if test="bId !=null and bId != ''">
  135. and t.b_id= #{bId}
  136. </if>
  137. <if test="userId !=null and userId != ''">
  138. and t.user_id= #{userId}
  139. </if>
  140. <if test="value !=null and value != ''">
  141. and t.value= #{value}
  142. </if>
  143. </select>
  144. </mapper>