AdminMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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.gree.mall.manager.commonmapper.AdminMapper">
  4. <select id="mchList" resultType="com.gree.mall.manager.plus.entity.AdminUser">
  5. select a.* from admin_user a
  6. join admin_user_company_rela b on a.admin_user_id = b.admin_user_id
  7. join admin_company_wechat c on c.company_wechat_id = b.company_wechat_id
  8. <where>
  9. <if test="userName != null and userName !=''">
  10. a.user_name like concat('%',#{userName},'%')
  11. </if>
  12. <if test="nickName != null and nickName !=''">
  13. a.nick_name like concat('%',#{nickName},'%')
  14. </if>
  15. <if test="linkPhone != null and linkPhone !=''">
  16. a.link_phone like concat('%',#{linkPhone},'%')
  17. </if>
  18. <if test="email != null and email !=''">
  19. a.email like concat('%',#{email},'%')
  20. </if>
  21. <if test="status != null">
  22. a.status = #{status}
  23. </if>
  24. </where>
  25. order by a.create_time desc
  26. </select>
  27. <select id="queryAdminCompanyWechat" resultType="com.gree.mall.manager.plus.entity.AdminCompanyWechat">
  28. select b.* from admin_user_company_rela a join admin_company_wechat b on a.company_wechat_id = b.company_wechat_id
  29. where b.del=0
  30. <if test="adminUserId != null and adminUserId !=''">
  31. and a.admin_user_id = #{adminUserId}
  32. </if>
  33. </select>
  34. <select id="getAdminUser" resultType="com.gree.mall.manager.plus.entity.AdminUser">
  35. SELECT u.*
  36. from admin_user_company_rela aucr
  37. join admin_user u on aucr.admin_user_id=u.admin_user_id
  38. <where>
  39. <if test="roleId != null and roleId != ''">
  40. and u.role_id = #{roleId}
  41. </if>
  42. <if test="status != null and status != ''">
  43. and u.status = #{status}
  44. </if>
  45. <if test="userName != null and userName != ''">
  46. and u.user_name like concat('%',#{userName},'%')
  47. </if>
  48. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  49. and aucr.company_wechat_id in
  50. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  51. #{item}
  52. </foreach>
  53. </if>
  54. </where>
  55. </select>
  56. <sql id="adminUserAllCol">
  57. b.admin_user_id, b.nick_name,b.status,b.role_id,b.role_name,b.last_login_time,b.user_name,
  58. b.password,b.link_name,b.link_phone,b.email,b.address,b.never_exprise,b.del as del2,b.create_time as create_time2,
  59. b.type,b.company_wechat_id as company_wechat_id2,b.company_name as company_name2
  60. </sql>
  61. <select id="pageCompanyWechat" resultMap="pageCompanyWechatResultMap">
  62. select * from(
  63. SELECT DISTINCT
  64. a.*,
  65. <include refid="adminUserAllCol"/>,
  66. a.del as del1,
  67. a.company_wechat_id as company_wechat_id1,
  68. a.company_name as company_name1,
  69. a.create_time as create_time1
  70. FROM admin_user_company_rela aucr
  71. RIGHT JOIN admin_company_wechat a on a.company_wechat_id=aucr.company_wechat_id
  72. LEFT JOIN admin_user b on b.admin_user_id = aucr.admin_user_id
  73. <where>
  74. <if test="userName != null and userName !=''">b.user_name like concat('%',#{userName},'%')
  75. </if>
  76. <if test="nickName != null and nickName !=''">
  77. b.nick_name like concat('%',#{nickName},'%')
  78. </if>
  79. <if test="linkPhone != null and linkPhone !=''">
  80. b.link_phone like concat('%',#{linkPhone},'%')
  81. </if>
  82. <if test="email != null and email !=''">
  83. b.email like concat('%',#{email},'%')
  84. </if>
  85. <if test="status != null">
  86. b.status = #{status}
  87. </if>
  88. </where>
  89. ORDER BY b.create_time
  90. )a
  91. GROUP BY a.company_wechat_id
  92. </select>
  93. <select id="list" resultType="com.gree.mall.manager.bean.admin.AdminDeptWebsitVO">
  94. SELECT
  95. ${ex.selected}
  96. FROM admin_dept_websit a
  97. ${ex.query}
  98. <if test="ex.orderBy == null or ex.orderBy ==''">
  99. ORDER BY a.create_time DESC
  100. </if>
  101. ${ex.orderBy}
  102. </select>
  103. <select id="sysDictCompanyList" resultType="com.gree.mall.manager.bean.common.SysDictCompanyVO">
  104. select
  105. a.*,
  106. b.remark as 'dictTypeName'
  107. from sys_dict_company a
  108. left join sys_dict_type_company b on a.dict_type=b.dict_type
  109. ${ex.query}
  110. and a.del=0
  111. <if test="companyWechatIds != null and companyWechatIds.size > 0">
  112. AND a.company_wechat_id IN
  113. <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
  114. #{item}
  115. </foreach>
  116. </if>
  117. <if test="ex.orderBy == null or ex.orderBy ==''">
  118. order by a.sort_num,a.create_time desc
  119. </if>
  120. ${ex.orderBy}
  121. </select>
  122. <resultMap id="pageCompanyWechatResultMap" autoMapping="true" type="com.gree.mall.manager.bean.admin.respDto.AdminCompanyWechatRespPageBean">
  123. <id column="company_wechat_id1" property="companyWechatId"/>
  124. <result column="del1" property="del"/>
  125. <result column="company_name1" property="companyName"/>
  126. <result column="create_time1" property="createTime"/>
  127. <association property="adminUser" autoMapping="true" javaType="com.gree.mall.manager.plus.entity.AdminUser">
  128. <result column="del2" property="del"/>
  129. <result column="company_wechat_id2" property="companyWechatId"/>
  130. <result column="company_name2" property="companyName"/>
  131. <result column="create_time2" property="createTime"/>
  132. </association>
  133. </resultMap>
  134. </mapper>