CompanyWxUserMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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.fs.wxUser.mapper.CompanyWxUserMapper">
  6. <resultMap type="CompanyWxUser" id="CompanyWxUserResult">
  7. <result property="userId" column="user_id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="companyUserId" column="company_user_id" />
  10. <result property="nickName" column="nick_name" />
  11. <result property="weixinId" column="weixin_id" />
  12. <result property="status" column="status" />
  13. <result property="remark" column="remark" />
  14. <result property="createTime" column="create_time" />
  15. <result property="avatar" column="avatar" />
  16. <result property="groupId" column="group_id" />
  17. <result property="fsUserId" column="fs_user_id" />
  18. </resultMap>
  19. <sql id="selectCompanyWxUserVo">
  20. select user_id, company_id, company_user_id, nick_name, weixin_id, status, remark, create_time, avatar,group_id,fs_user_id from company_wx_user
  21. </sql>
  22. <select id="selectCompanyWxUserList" parameterType="CompanyWxUser" resultMap="CompanyWxUserResult">
  23. <include refid="selectCompanyWxUserVo"/>
  24. <where>
  25. <if test="companyId != null "> and company_id = #{companyId}</if>
  26. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  27. <if test="nickName != null and nickName != ''"> and nick_name like concat( #{nickName}, '%')</if>
  28. <if test="weixinId != null and weixinId != ''"> and weixin_id = #{weixinId}</if>
  29. <if test="status != null "> and status = #{status}</if>
  30. <if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
  31. <if test="groupId != null and groupId != ''"> and group_id = #{groupId}</if>
  32. <if test="fsUserId != null and fsUserId != ''"> and fs_user_id = #{fsUserId}</if>
  33. <if test="accountId != null"> and account_id = #{accountId}</if>
  34. </where>
  35. </select>
  36. <select id="selectCompanyWxUserByUserId" parameterType="Long" resultMap="CompanyWxUserResult">
  37. <include refid="selectCompanyWxUserVo"/>
  38. where user_id = #{userId}
  39. </select>
  40. <select id="listCompanyIds" resultType="com.fs.wxUser.domain.CompanyWxUser">
  41. select a.*,b.company_user_id from
  42. company_wx_user a
  43. inner join company_wx_account b on a.account_id = b.id
  44. where b.company_user_id in <foreach collection="ids" open="(" separator="," close=")" item="item">#{item}</foreach>
  45. </select>
  46. <insert id="insertCompanyWxUser" parameterType="CompanyWxUser" useGeneratedKeys="true" keyProperty="userId">
  47. insert into company_wx_user
  48. <trim prefix="(" suffix=")" suffixOverrides=",">
  49. <if test="companyId != null">company_id,</if>
  50. <if test="companyUserId != null">company_user_id,</if>
  51. <if test="nickName != null">nick_name,</if>
  52. <if test="weixinId != null">weixin_id,</if>
  53. <if test="status != null">status,</if>
  54. <if test="remark != null">remark,</if>
  55. <if test="createTime != null">create_time,</if>
  56. <if test="avatar != null">avatar,</if>
  57. <if test="groupId != null">group_id,</if>
  58. <if test="fsUserId != null">fs_user_id,</if>
  59. <if test="accountId != null">account_id,</if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="companyId != null">#{companyId},</if>
  63. <if test="companyUserId != null">#{companyUserId},</if>
  64. <if test="nickName != null">#{nickName},</if>
  65. <if test="weixinId != null">#{weixinId},</if>
  66. <if test="status != null">#{status},</if>
  67. <if test="remark != null">#{remark},</if>
  68. <if test="createTime != null">#{createTime},</if>
  69. <if test="avatar != null">#{avatar},</if>
  70. <if test="groupId != null">#{groupId},</if>
  71. <if test="fsUserId != null">#{fsUserId},</if>
  72. <if test="accountId != null">#{accountId},</if>
  73. </trim>
  74. </insert>
  75. <update id="updateCompanyWxUser" parameterType="CompanyWxUser">
  76. update company_wx_user
  77. <trim prefix="SET" suffixOverrides=",">
  78. <if test="companyId != null">company_id = #{companyId},</if>
  79. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  80. <if test="nickName != null">nick_name = #{nickName},</if>
  81. <if test="weixinId != null">weixin_id = #{weixinId},</if>
  82. <if test="status != null">status = #{status},</if>
  83. <if test="remark != null">remark = #{remark},</if>
  84. <if test="createTime != null">create_time = #{createTime},</if>
  85. <if test="avatar != null">avatar = #{avatar},</if>
  86. <if test="groupId != null">group_id = #{groupId},</if>
  87. <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
  88. <if test="accountId != null">account_id = #{accountId},</if>
  89. </trim>
  90. where user_id = #{userId}
  91. </update>
  92. <delete id="deleteCompanyWxUserByUserId" parameterType="Long">
  93. delete from company_wx_user where user_id = #{userId}
  94. </delete>
  95. <delete id="deleteCompanyWxUserByUserIds" parameterType="String">
  96. delete from company_wx_user where user_id in
  97. <foreach item="userId" collection="array" open="(" separator="," close=")">
  98. #{userId}
  99. </foreach>
  100. </delete>
  101. </mapper>