JlAdminUserMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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.ygj.yuemum.dao.admin.JlAdminUserDao" >
  4. <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.admin.JlAdminUser" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="username" property="username" jdbcType="VARCHAR" />
  7. <result column="email" property="email" jdbcType="VARCHAR" />
  8. <result column="name" property="name" jdbcType="VARCHAR" />
  9. <result column="password" property="password" jdbcType="VARCHAR" />
  10. <result column="create_time" property="create_time" jdbcType="VARCHAR" />
  11. <result column="last_login_time" property="last_login_time" jdbcType="DATE" />
  12. <result column="last_login_ip" property="last_login_ip" jdbcType="VARCHAR" />
  13. <result column="role" property="role" jdbcType="INTEGER" />
  14. <result column="status" property="status" jdbcType="INTEGER" />
  15. <result column="org" property="org" jdbcType="INTEGER" />
  16. <result column="last_login_location" property="last_login_location" jdbcType="VARCHAR" />
  17. <result column="remark" property="remark" jdbcType="VARCHAR" />
  18. <result column="phone" property="phone" jdbcType="VARCHAR" />
  19. <result column="province" property="province" jdbcType="VARCHAR" />
  20. <result column="city" property="city" jdbcType="VARCHAR" />
  21. <result column="district" property="district" jdbcType="VARCHAR" />
  22. <result column="province" property="province" jdbcType="VARCHAR" />
  23. <result column="enabled" property="enabled" jdbcType="INTEGER" />
  24. <result column="update_time" property="update_time" jdbcType="DATE" />
  25. </resultMap>
  26. <sql id="Base_Column_List" >
  27. id,username,name,email,password,create_time,last_login_time,last_login_ip,role,status,org,last_login_location,remark,phone,province,city,district,enabled,update_time
  28. </sql>
  29. <select id="checkUsername" resultType="java.lang.Integer" parameterType="java.lang.String">
  30. select
  31. count(1)
  32. from jl_admin_user
  33. where username = #{username,jdbcType=VARCHAR}
  34. </select>
  35. <select id="getConsultants" resultMap="BaseResultMap" >
  36. select
  37. *
  38. from jl_admin_user
  39. where role = 3
  40. </select>
  41. <select id="getRolePermissionCount" resultType="java.lang.Integer" parameterType="java.lang.Integer">
  42. select
  43. count(1)
  44. from jl_admin_user
  45. where role = #{roleid,jdbcType=VARCHAR}
  46. </select>
  47. <!-- 得到所有的用户信息 -->
  48. <select id="getAll" resultMap="BaseResultMap" >
  49. select
  50. <include refid="Base_Column_List" />
  51. from jl_admin_user
  52. </select>
  53. <select id="queryAdminUsers" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.admin.JlAdminUser">
  54. select
  55. id,
  56. username,
  57. name,
  58. role,
  59. status,
  60. city,
  61. IFNULL(fgetbranches_name(city),'ALL') cityname,
  62. fgetrole_name(role) rolename
  63. from jl_admin_user
  64. where username != 'admin'
  65. <if test="username != null and username !=''">
  66. and username like "%"#{username,jdbcType=VARCHAR}"%"
  67. </if>
  68. <if test="name != null and name !=''">
  69. and name like "%"#{name,jdbcType=VARCHAR}"%"
  70. </if>
  71. <if test="role != null and role !=''">
  72. and role = #{role,jdbcType=INTEGER}
  73. </if>
  74. <if test="status != null ">
  75. and status = #{status,jdbcType=INTEGER}
  76. </if>
  77. <if test="city != null and city !=''">
  78. and city = #{city,jdbcType=VARCHAR}
  79. </if>
  80. </select>
  81. <select id="logIN" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.admin.JlAdminUser">
  82. select
  83. count(1)
  84. from jl_admin_user
  85. where 1=1
  86. <if test="username != null" >
  87. and username = #{username,jdbcType=VARCHAR}
  88. </if>
  89. <if test="password != null" >
  90. and password = #{password,jdbcType=VARCHAR}
  91. </if>
  92. </select>
  93. <select id="getPassword" resultType="java.lang.String" parameterType="java.lang.String">
  94. select
  95. password
  96. from jl_admin_user
  97. where
  98. username = #{username,jdbcType=VARCHAR}
  99. </select>
  100. <select id="getStatus" resultType="java.lang.String" parameterType="java.lang.String">
  101. select
  102. status
  103. from jl_admin_user
  104. where
  105. username = #{username,jdbcType=VARCHAR}
  106. </select>
  107. <select id="getRole" resultType="java.lang.String" parameterType="java.lang.String">
  108. select
  109. role
  110. from jl_admin_user
  111. where
  112. username = #{username,jdbcType=VARCHAR}
  113. </select>
  114. <select id="getUserMkt" resultMap="BaseResultMap" parameterType="java.lang.String">
  115. select
  116. *
  117. from jl_admin_user
  118. where
  119. username = #{username,jdbcType=VARCHAR}
  120. </select>
  121. <!-- 根据id查找某个用户信息 -->
  122. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  123. select
  124. *
  125. from jl_admin_user
  126. where id = #{id,jdbcType=INTEGER}
  127. </select>
  128. <!-- 根据id删除某个用户信息 -->
  129. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  130. delete from jl_admin_user
  131. where id = #{id,jdbcType=INTEGER}
  132. </delete>
  133. <!-- 插入一条用户信息 -->
  134. <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.admin.JlAdminUser" >
  135. insert into jl_admin_user
  136. <trim prefix="(" suffix=")" suffixOverrides="," >
  137. <if test="username != null" >
  138. username,
  139. </if>
  140. <if test="email != null" >
  141. email,
  142. </if>
  143. <if test="name != null" >
  144. name,
  145. </if>
  146. <if test="password != null" >
  147. password,
  148. </if>
  149. <if test="create_time != null" >
  150. create_time,
  151. </if>
  152. <if test="last_login_time != null" >
  153. last_login_time,
  154. </if>
  155. <if test="last_login_ip != null" >
  156. last_login_ip,
  157. </if>
  158. <if test="role != null" >
  159. role,
  160. </if>
  161. <if test="status != null" >
  162. status,
  163. </if>
  164. <if test="org != null" >
  165. org,
  166. </if>
  167. <if test="last_login_location != null" >
  168. last_login_location,
  169. </if>
  170. <if test="remark != null" >
  171. remark,
  172. </if>
  173. <if test="phone != null" >
  174. phone,
  175. </if>
  176. <if test="province != null" >
  177. province,
  178. </if>
  179. <if test="city != null" >
  180. city,
  181. </if>
  182. <if test="district != null" >
  183. district,
  184. </if>
  185. <if test="enabled != null" >
  186. enabled,
  187. </if>
  188. <if test="update_time != null" >
  189. update_time
  190. </if>
  191. </trim>
  192. <trim prefix="values (" suffix=")" suffixOverrides="," >
  193. <if test="username != null" >
  194. #{username,jdbcType=VARCHAR},
  195. </if>
  196. <if test="email != null" >
  197. #{email,jdbcType=VARCHAR},
  198. </if>
  199. <if test="name != null" >
  200. #{name,jdbcType=VARCHAR},
  201. </if>
  202. <if test="password != null" >
  203. #{password,jdbcType=VARCHAR},
  204. </if>
  205. <if test="create_time != null" >
  206. #{create_time,jdbcType=VARCHAR},
  207. </if>
  208. <if test="last_login_time != null" >
  209. #{last_login_time,jdbcType=DATETIME},
  210. </if>
  211. <if test="last_login_ip != null" >
  212. #{last_login_ip,jdbcType=VARCHAR},
  213. </if>
  214. <if test="role != null" >
  215. #{role,jdbcType=INTEGER},
  216. </if>
  217. <if test="status != null" >
  218. #{status,jdbcType=INTEGER},
  219. </if>
  220. <if test="org != null" >
  221. #{org,jdbcType=INTEGER},
  222. </if>
  223. <if test="last_login_location != null" >
  224. #{last_login_location,jdbcType=VARCHAR},
  225. </if>
  226. <if test="remark != null" >
  227. #{remark,jdbcType=VARCHAR},
  228. </if>
  229. <if test="phone != null" >
  230. #{phone,jdbcType=VARCHAR},
  231. </if>
  232. <if test="province != null" >
  233. #{province,jdbcType=VARCHAR},
  234. </if>
  235. <if test="city != null" >
  236. #{city,jdbcType=VARCHAR},
  237. </if>
  238. <if test="district != null" >
  239. #{district,jdbcType=VARCHAR},
  240. </if>
  241. <if test="enabled != null" >
  242. #{enabled,jdbcType=INTEGER},
  243. </if>
  244. <if test="update_time != null" >
  245. #{update_time,jdbcType=DATE}
  246. </if>
  247. </trim>
  248. </insert>
  249. <!-- 根据id更新一条用户信息 -->
  250. <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.admin.JlAdminUser" >
  251. update jl_admin_user
  252. <set >
  253. <if test="username != null" >
  254. username = #{username,jdbcType=VARCHAR},
  255. </if>
  256. <if test="name != null" >
  257. name = #{name,jdbcType=VARCHAR},
  258. </if>
  259. <if test="email != null" >
  260. email = #{email,jdbcType=VARCHAR},
  261. </if>
  262. <if test="password != null" >
  263. password = #{password,jdbcType=VARCHAR},
  264. </if>
  265. <if test="create_time != null" >
  266. create_time = #{create_time,jdbcType=DATE},
  267. </if>
  268. <if test="last_login_time != null" >
  269. password = #{last_login_time,jdbcType=DATE},
  270. </if>
  271. <if test="last_login_ip != null" >
  272. last_login_ip = #{last_login_ip,jdbcType=VARCHAR},
  273. </if>
  274. <if test="role != null" >
  275. role = #{role,jdbcType=INTEGER},
  276. </if>
  277. <if test="status != null" >
  278. status = #{status,jdbcType=INTEGER},
  279. </if>
  280. <if test="org != null" >
  281. org = #{org,jdbcType=INTEGER},
  282. </if>
  283. <if test="last_login_location != null" >
  284. last_login_location = #{last_login_location,jdbcType=VARCHAR},
  285. </if>
  286. <if test="remark != null" >
  287. remark = #{remark,jdbcType=VARCHAR},
  288. </if>
  289. <if test="phone != null" >
  290. phone = #{phone,jdbcType=VARCHAR},
  291. </if>
  292. <if test="province != null" >
  293. province = #{province,jdbcType=VARCHAR},
  294. </if>
  295. <if test="city != null" >
  296. city = #{city,jdbcType=VARCHAR},
  297. </if>
  298. <if test="district != null" >
  299. district = #{district,jdbcType=VARCHAR},
  300. </if>
  301. <if test="enabled != null" >
  302. enabled = #{enabled,jdbcType=INTEGER},
  303. </if>
  304. <if test="update_time != null" >
  305. update_time = #{update_time,jdbcType=DATE}
  306. </if>
  307. </set>
  308. where id = #{id,jdbcType=INTEGER}
  309. </update>
  310. </mapper>