AdminDao.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.yx.face.dao.AdminDao">
  4. <select id="getAdmins" resultType="com.yx.face.model.vo.AdminVO">
  5. SELECT
  6. a.id AS adminId,
  7. a.nickname AS name,
  8. a.username AS username,
  9. a.avatar AS avatar,
  10. a.phone AS phone,
  11. a.email AS email,
  12. a.gender AS gender,
  13. a.type AS type,
  14. a.create_time AS createTime,
  15. a.province_id as provinceId,
  16. a.province_name as provinceName,
  17. a.city_id as cityId,
  18. a.city_name as cityName,
  19. a.area_id as areaId,
  20. a.area_name as areaName,
  21. a.street_id as streetId,
  22. a.street_name as streetName,
  23. a.address as address,
  24. a.police_station_code as policeStationCode,
  25. a.police_station_name as policeStationName,
  26. a.tag_id as tagId,
  27. at.name as tagName,
  28. a.is_out as isOut,
  29. a.is_hide_important as isHideImportant,
  30. a.is_control_early_warning as isControlEarlyWarning
  31. FROM admin a left join admin_tag at on at.id = a.tag_id
  32. <where>
  33. <if test="type == 1">
  34. and a.type != 1
  35. </if>
  36. <if test="type == 2">
  37. and a.province_id = #{adminVo.provinceId}
  38. and a.type in (3 ,4 ,5)
  39. </if>
  40. <if test="type == 3">
  41. and a.province_id = #{adminVo.provinceId}
  42. and a.type in (4 ,5)
  43. and a.tag_id = #{adminVo.tagId}
  44. </if>
  45. <if test="type == 4">
  46. and a.city_id = #{adminVo.cityId}
  47. and a.type = 5
  48. and a.tag_id = #{adminVo.tagId}
  49. </if>
  50. <if test="type == 5">
  51. and a.id = #{adminVo.adminId}
  52. </if>
  53. <if test="ads.username != null and ads.username !=''">
  54. and a.username = #{ads.username}
  55. </if>
  56. <if test="ads.name != null and ads.name !=''">
  57. and a.nickname LIKE CONCAT('%',#{ads.name},'%')
  58. </if>
  59. <if test="ads.phone != null and ads.phone !=''">
  60. and a.phone = #{ads.phone}
  61. </if>
  62. <if test="ads.provinceId != null">
  63. and a.province_id =#{ads.provinceId}
  64. </if>
  65. <if test="ads.cityId != null">
  66. and a.city_id =#{ads.cityId}
  67. </if>
  68. <if test="ads.areaId != null">
  69. and a.area_id =#{ads.areaId}
  70. </if>
  71. <if test="ads.type != null">
  72. and a.type =#{ads.type}
  73. </if>
  74. <if test="ads.tagId != null">
  75. and a.tag_id =#{ads.tagId}
  76. </if>
  77. </where>
  78. order by a.create_time desc
  79. </select>
  80. <select id="getAuthInfo" resultType="com.yx.face.model.vo.AdminVO">
  81. SELECT id AS adminId,
  82. nickname AS name,
  83. type AS type,
  84. password AS password
  85. FROM admin
  86. WHERE id = #{id}
  87. </select>
  88. <select id="getAdminlist" resultType="com.yx.face.model.vo.AdminVO">
  89. select
  90. a.id AS adminId,
  91. a.username AS username
  92. FROM admin a
  93. <where>
  94. <if test="type == 1">
  95. and a.type != 1
  96. </if>
  97. <if test="type == 2">
  98. and a.province_id = #{provinceId}
  99. and a.type in (3 ,4 ,5)
  100. </if>
  101. <if test="type == 3">
  102. and a.province_id = #{provinceId}
  103. and a.type in (4 ,5)
  104. and a.tag_id = #{tagId}
  105. </if>
  106. <if test="type == 4">
  107. and a.city_id = #{cityId}
  108. and a.type = 5
  109. and a.tag_id = #{tagId}
  110. </if>
  111. <if test="type == 5">
  112. and a.id = #{adminId}
  113. </if>
  114. </where>
  115. </select>
  116. <select id="getAdminLsit" resultType="com.yx.face.model.vo.AdminVO">
  117. select
  118. a.id AS adminId,
  119. a.username AS username
  120. FROM admin a
  121. where a.type = #{type}
  122. </select>
  123. </mapper>