CompanyWxAccountMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.company.mapper.CompanyWxAccountMapper">
  6. <resultMap type="CompanyWxAccount" id="CompanyWxAccountResult">
  7. <result property="id" column="id" />
  8. <result property="wxNickName" column="wx_nick_name" />
  9. <result property="wxNo" column="wx_no" />
  10. <result property="companyUserId" column="company_user_id" />
  11. <result property="createTime" column="create_time" />
  12. <result property="createUser" column="create_user" />
  13. <result property="phone" column="phone" />
  14. </resultMap>
  15. <sql id="selectCompanyWxAccountVo">
  16. select * from company_wx_account
  17. </sql>
  18. <select id="selectCompanyWxAccountList" parameterType="CompanyWxAccount" resultMap="CompanyWxAccountResult">
  19. select a.*,u.nick_name as companyUserName from company_wx_account a
  20. left join company_user u on a.company_user_id = u.user_id
  21. <where>
  22. <if test="wxNickName != null and wxNickName != ''"> and a.wx_nick_name like concat( #{wxNickName}, '%')</if>
  23. <if test="phone != null and phone != ''"> and a.phone like concat( #{phone}, '%')</if>
  24. <if test="wxNo != null and wxNo != ''"> and a.wx_no = #{wxNo}</if>
  25. <if test="companyUserId != null "> and a.company_user_id = #{companyUserId}</if>
  26. <if test="createUser != null "> and a.create_user = #{createUser}</if>
  27. </where>
  28. </select>
  29. <select id="selectCompanyWxAccountListCompany" parameterType="CompanyWxAccount" resultMap="CompanyWxAccountResult">
  30. select a.*,u.nick_name as companyUserName from company_wx_account a
  31. inner join company_user u on a.company_user_id = u.user_id
  32. inner join company_dept d on u.dept_id = d.dept_id
  33. <where>
  34. <if test="wxNickName != null and wxNickName != ''"> and a.wx_nick_name like concat( #{wxNickName}, '%')</if>
  35. <if test="phone != null and phone != ''"> and a.phone like concat( #{phone}, '%')</if>
  36. <if test="wxNo != null and wxNo != ''"> and a.wx_no = #{wxNo}</if>
  37. <if test="companyUserId != null "> and a.company_user_id = #{companyUserId}</if>
  38. <if test="createUser != null "> and a.create_user = #{createUser}</if>
  39. ${params.dataScope}
  40. </where>
  41. </select>
  42. <select id="selectCompanyWxAccountById" parameterType="Long" resultMap="CompanyWxAccountResult">
  43. <include refid="selectCompanyWxAccountVo"/>
  44. where id = #{id}
  45. </select>
  46. <insert id="insertCompanyWxAccount" parameterType="CompanyWxAccount" useGeneratedKeys="true" keyProperty="id">
  47. insert into company_wx_account
  48. <trim prefix="(" suffix=")" suffixOverrides=",">
  49. <if test="wxNickName != null">wx_nick_name,</if>
  50. <if test="phone != null">phone,</if>
  51. <if test="wxNo != null">wx_no,</if>
  52. <if test="companyUserId != null">company_user_id,</if>
  53. <if test="createTime != null">create_time,</if>
  54. <if test="createUser != null">create_user,</if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test="wxNickName != null">#{wxNickName},</if>
  58. <if test="phone != null">#{phone},</if>
  59. <if test="wxNo != null">#{wxNo},</if>
  60. <if test="companyUserId != null">#{companyUserId},</if>
  61. <if test="createTime != null">#{createTime},</if>
  62. <if test="createUser != null">#{createUser},</if>
  63. </trim>
  64. </insert>
  65. <update id="updateCompanyWxAccount" parameterType="CompanyWxAccount">
  66. update company_wx_account
  67. <trim prefix="SET" suffixOverrides=",">
  68. <if test="wxNickName != null">wx_nick_name = #{wxNickName},</if>
  69. <if test="wxNo != null">wx_no = #{wxNo},</if>
  70. <if test="phone != null">phone = #{phone},</if>
  71. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  72. <if test="createTime != null">create_time = #{createTime},</if>
  73. <if test="createUser != null">create_user = #{createUser},</if>
  74. </trim>
  75. where id = #{id}
  76. </update>
  77. <delete id="deleteCompanyWxAccountById" parameterType="Long">
  78. delete from company_wx_account where id = #{id}
  79. </delete>
  80. <delete id="deleteCompanyWxAccountByIds" parameterType="String">
  81. delete from company_wx_account where id in
  82. <foreach item="id" collection="array" open="(" separator="," close=")">
  83. #{id}
  84. </foreach>
  85. </delete>
  86. <select id="companyListAll" resultType="com.fs.company.domain.CompanyUser">
  87. select * from company_user where del_flag = 0 and status = 0
  88. </select>
  89. <select id="companyListAllCompany" resultType="com.fs.company.domain.CompanyUser">
  90. select u.* from company_user u
  91. inner join company_dept d on u.dept_id = d.dept_id
  92. where u.del_flag = 0 and u.status = 0
  93. ${params.dataScope}
  94. </select>
  95. <select id="selectByCompanyUserAndWxNo" resultType="com.fs.company.domain.CompanyWxAccount">
  96. select * from company_wx_account where company_user_id = #{userId} and wx_no = #{wxNo}
  97. </select>
  98. </mapper>