UserDao.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  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="cn.com.goldenwater.dcproj.dao.UserDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.User" id="userResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="ofcId" column="OFC_ID"/>
  7. <result property="depId" column="DEP_ID"/>
  8. <result property="loginName" column="LOGIN_NAME"/>
  9. <result property="password" column="PASSWORD"/>
  10. <result property="userState" column="USER_STATE"/>
  11. <result property="userNbr" column="USER_NBR"/>
  12. <result property="userName" column="USER_NAME"/>
  13. <result property="userGender" column="USER_GENDER"/>
  14. <result property="userEmail" column="USER_EMAIL"/>
  15. <result property="userTel" column="USER_TEL"/>
  16. <result property="userMobile" column="USER_MOBILE"/>
  17. <result property="userType" column="USER_TYPE"/>
  18. <result property="userAvatarUrl" column="USER_AVATAR_URL"/>
  19. <result property="idCard" column="ID_CARD"/>
  20. <result property="idCardFrontUrl" column="ID_CARD_FRONT_URL"/>
  21. <result property="idCardBackUrl" column="ID_CARD_BACK_URL"/>
  22. <result property="loginIp" column="LOGIN_IP"/>
  23. <result property="loginTime" column="LOGIN_TIME"/>
  24. <result property="token" column="TOKEN"/>
  25. <result property="flagLogin" column="FLAG_LOGIN"/>
  26. <result property="flagValid" column="FLAG_VALID"/>
  27. </resultMap>
  28. <resultMap type="cn.com.goldenwater.dcproj.dto.UserDto" id="userDtoResultMap">
  29. <id property="id" column="ID"/>
  30. <result property="ofcId" column="OFC_ID"/>
  31. <result property="depId" column="DEP_ID"/>
  32. <result property="loginName" column="LOGIN_NAME"/>
  33. <result property="password" column="PASSWORD"/>
  34. <result property="userState" column="USER_STATE"/>
  35. <result property="userNbr" column="USER_NBR"/>
  36. <result property="userName" column="USER_NAME"/>
  37. <result property="userGender" column="USER_GENDER"/>
  38. <result property="userEmail" column="USER_EMAIL"/>
  39. <result property="userTel" column="USER_TEL"/>
  40. <result property="userMobile" column="USER_MOBILE"/>
  41. <result property="userType" column="USER_TYPE"/>
  42. <result property="userAvatarUrl" column="USER_AVATAR_URL"/>
  43. <result property="idCard" column="ID_CARD"/>
  44. <result property="idCardFrontUrl" column="ID_CARD_FRONT_URL"/>
  45. <result property="idCardBackUrl" column="ID_CARD_BACK_URL"/>
  46. <result property="loginIp" column="LOGIN_IP"/>
  47. <result property="loginTime" column="LOGIN_TIME"/>
  48. <result property="token" column="TOKEN"/>
  49. <result property="flagLogin" column="FLAG_LOGIN"/>
  50. <result property="flagValid" column="FLAG_VALID"/>
  51. <collection property="role" ofType="cn.com.goldenwater.dcproj.model.Role">
  52. <result property="id" column="ROLEID"/>
  53. <result property="ofcId" column="ROLE_OFC_ID"/>
  54. <result property="roleName" column="ROLE_NAME"/>
  55. <result property="flagValid" column="ROLE_FLAG_VALID"/>
  56. <result property="dataScope" column="DATA_SCOPE"/>
  57. <collection property="priv" ofType="cn.com.goldenwater.dcproj.model.Priv">
  58. <result property="id" column="PRIVID"/>
  59. <result property="privName" column="PRIV_NAME"/>
  60. <result property="privType" column="PRIV_TYPE"/>
  61. <result property="privUri" column="PRIV_URI"/>
  62. <result property="parentId" column="PRIV_PARENT_ID"/>
  63. <result property="flagLeaf" column="FLAG_LEAF"/>
  64. </collection>
  65. </collection>
  66. </resultMap>
  67. <sql id="table_columns">
  68. ID,
  69. OFC_ID,
  70. DEP_ID,
  71. LOGIN_NAME,
  72. PASSWORD,
  73. USER_STATE,
  74. USER_NBR,
  75. USER_NAME,
  76. USER_GENDER,
  77. USER_EMAIL,
  78. USER_TEL,
  79. USER_MOBILE,
  80. USER_TYPE,
  81. USER_AVATAR_URL,
  82. ID_CARD,
  83. ID_CARD_FRONT_URL,
  84. ID_CARD_BACK_URL,
  85. LOGIN_IP,
  86. LOGIN_TIME,
  87. TOKEN,
  88. FLAG_LOGIN,
  89. FLAG_VALID
  90. </sql>
  91. <sql id="entity_properties">
  92. #{id},
  93. #{ofcId},
  94. #{depId},
  95. #{loginName},
  96. #{password},
  97. #{userState},
  98. #{userNbr},
  99. #{userName},
  100. #{userGender},
  101. #{userEmail},
  102. #{userTel},
  103. #{userMobile},
  104. #{userType},
  105. #{userAvatarUrl},
  106. #{idCard},
  107. #{idCardFrontUrl},
  108. #{idCardBackUrl},
  109. #{loginIp},
  110. #{loginTime},
  111. #{token},
  112. #{flagLogin},
  113. #{flagValid}
  114. </sql>
  115. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  116. <sql id="page_where">
  117. <trim prefix="where" prefixOverrides="and | or ">
  118. <if test="ofcId != null and ofcId != ''">and OFC_ID = #{ofcId}</if>
  119. <if test="depId != null and depId != ''">and DEP_ID = #{depId}</if>
  120. <if test="loginName != null and loginName != ''">and LOGIN_NAME LIKE concat(concat('%',#{loginName}),'%')</if>
  121. <if test="password != null and password != ''">and PASSWORD = #{password}</if>
  122. <if test="userState != null and userState != ''">and USER_STATE = #{userState}</if>
  123. <if test="userNbr != null and userNbr != ''">and USER_NBR = #{userNbr}</if>
  124. <if test="userName != null and userName != ''">and USER_NAME = #{userName}</if>
  125. <if test="userGender != null and userGender != ''">and USER_GENDER = #{userGender}</if>
  126. <if test="userEmail != null and userEmail != ''">and USER_EMAIL = #{userEmail}</if>
  127. <if test="userTel != null and userTel != ''">and USER_TEL = #{userTel}</if>
  128. <if test="userMobile != null and userMobile != ''">and USER_MOBILE = #{userMobile}</if>
  129. <if test="userType != null and userType != ''">and USER_TYPE = #{userType}</if>
  130. <if test="userAvatarUrl != null and userAvatarUrl != ''">and USER_AVATAR_URL = #{userAvatarUrl}</if>
  131. <if test="idCard != null and idCard != ''">and ID_CARD = #{idCard}</if>
  132. <if test="idCardFrontUrl != null and idCardFrontUrl != ''">and ID_CARD_FRONT_URL = #{idCardFrontUrl}</if>
  133. <if test="idCardBackUrl != null and idCardBackUrl != ''">and ID_CARD_BACK_URL = #{idCardBackUrl}</if>
  134. <if test="loginIp != null and loginIp != ''">and LOGIN_IP = #{loginIp}</if>
  135. <if test="loginTime != null">and LOGIN_TIME = #{loginTime}</if>
  136. <if test="token != null and token != ''">and TOKEN = #{token}</if>
  137. <if test="flagLogin != null">and FLAG_LOGIN = #{flagLogin}</if>
  138. <if test="flagValid != null">and FLAG_VALID = #{flagValid}</if>
  139. </trim>
  140. </sql>
  141. <select id="get" resultMap="userResultMap" parameterType="String">
  142. select
  143. <include refid="table_columns"/>
  144. from GW_SYS_USER where ID = #{id}
  145. </select>
  146. <select id="getBy" resultMap="userResultMap">
  147. select
  148. <include refid="table_columns"/>
  149. from GW_SYS_USER
  150. <include refid="page_where"/>
  151. </select>
  152. <select id="findAll" resultMap="userResultMap">
  153. select
  154. <include refid="table_columns"/>
  155. from GW_SYS_USER
  156. </select>
  157. <select id="findList" resultMap="userResultMap">
  158. select
  159. <include refid="table_columns"/>
  160. from GW_SYS_USER
  161. <include refid="page_where"/>
  162. </select>
  163. <select id="selectCount" resultType="int">
  164. select count(ID) from GW_SYS_USER
  165. <include refid="page_where"/>
  166. </select>
  167. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.User">
  168. insert into GW_SYS_USER(
  169. <include refid="table_columns"/>
  170. )
  171. values (
  172. <include refid="entity_properties"/>
  173. )
  174. </insert>
  175. <delete id="delete" parameterType="java.lang.String">
  176. delete from GW_SYS_USER where ID = #{id}
  177. </delete>
  178. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.User">
  179. delete from GW_SYS_USER
  180. <include refid="page_where"/>
  181. </delete>
  182. <update id="deleteInFlag" parameterType="java.lang.String">
  183. update GW_SYS_USER set flag_valid = 0 where>ID = #{id}
  184. </update>
  185. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.User">
  186. update GW_SYS_USER
  187. <trim prefix="set" suffixOverrides=",">
  188. <if test="ofcId != null and ofcId != ''">OFC_ID = #{ofcId},</if>
  189. <if test="depId != null and depId != ''">DEP_ID = #{depId},</if>
  190. <if test="loginName != null and loginName != ''">LOGIN_NAME = #{loginName},</if>
  191. <if test="password != null and password != ''">PASSWORD = #{password},</if>
  192. <if test="userState != null and userState != ''">USER_STATE = #{userState},</if>
  193. <if test="userNbr != null and userNbr != ''">USER_NBR = #{userNbr},</if>
  194. <if test="userName != null and userName != ''">USER_NAME = #{userName},</if>
  195. <if test="userGender != null and userGender != ''">USER_GENDER = #{userGender},</if>
  196. <if test="userEmail != null and userEmail != ''">USER_EMAIL = #{userEmail},</if>
  197. <if test="userTel != null and userTel != ''">USER_TEL = #{userTel},</if>
  198. <if test="userMobile != null and userMobile != ''">USER_MOBILE = #{userMobile},</if>
  199. <if test="userType != null and userType != ''">USER_TYPE = #{userType},</if>
  200. <if test="userAvatarUrl != null and userAvatarUrl != ''">USER_AVATAR_URL = #{userAvatarUrl},</if>
  201. <if test="idCard != null and idCard != ''">ID_CARD = #{idCard},</if>
  202. <if test="idCardFrontUrl != null and idCardFrontUrl != ''">ID_CARD_FRONT_URL = #{idCardFrontUrl},</if>
  203. <if test="idCardBackUrl != null and idCardBackUrl != ''">ID_CARD_BACK_URL = #{idCardBackUrl},</if>
  204. <if test="loginIp != null and loginIp != ''">LOGIN_IP = #{loginIp},</if>
  205. <if test="loginTime != null">LOGIN_TIME = #{loginTime},</if>
  206. <if test="token != null and token != ''">TOKEN = #{token},</if>
  207. <if test="flagLogin != null">FLAG_LOGIN = #{flagLogin},</if>
  208. <if test="flagValid != null">FLAG_VALID = #{flagValid},</if>
  209. </trim>
  210. <where>ID = #{id}</where>
  211. </update>
  212. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.User">
  213. update GW_SYS_USER
  214. <trim prefix="set" suffixOverrides=",">
  215. <if test="ofcId != null and ofcId != ''">OFC_ID = #{ofcId},</if>
  216. <if test="depId != null and depId != ''">DEP_ID = #{depId},</if>
  217. <if test="loginName != null and loginName != ''">LOGIN_NAME = #{loginName},</if>
  218. <if test="password != null and password != ''">PASSWORD = #{password},</if>
  219. <if test="userState != null and userState != ''">USER_STATE = #{userState},</if>
  220. <if test="userNbr != null and userNbr != ''">USER_NBR = #{userNbr},</if>
  221. <if test="userName != null and userName != ''">USER_NAME = #{userName},</if>
  222. <if test="userGender != null and userGender != ''">USER_GENDER = #{userGender},</if>
  223. <if test="userEmail != null and userEmail != ''">USER_EMAIL = #{userEmail},</if>
  224. <if test="userTel != null and userTel != ''">USER_TEL = #{userTel},</if>
  225. <if test="userMobile != null and userMobile != ''">USER_MOBILE = #{userMobile},</if>
  226. <if test="userType != null and userType != ''">USER_TYPE = #{userType},</if>
  227. <if test="userAvatarUrl != null and userAvatarUrl != ''">USER_AVATAR_URL = #{userAvatarUrl},</if>
  228. <if test="idCard != null and idCard != ''">ID_CARD = #{idCard},</if>
  229. <if test="idCardFrontUrl != null and idCardFrontUrl != ''">ID_CARD_FRONT_URL = #{idCardFrontUrl},</if>
  230. <if test="idCardBackUrl != null and idCardBackUrl != ''">ID_CARD_BACK_URL = #{idCardBackUrl},</if>
  231. <if test="loginIp != null and loginIp != ''">LOGIN_IP = #{loginIp},</if>
  232. <if test="loginTime != null">LOGIN_TIME = #{loginTime},</if>
  233. <if test="token != null and token != ''">TOKEN = #{token},</if>
  234. <if test="flagLogin != null">FLAG_LOGIN = #{flagLogin},</if>
  235. <if test="flagValid != null">FLAG_VALID = #{flagValid},</if>
  236. </trim>
  237. <include refid="page_where"/>
  238. </update>
  239. <!-- 其他自定义SQL -->
  240. <!-- 根据登录名查询用户 -->
  241. <select id="getByLoginName" resultMap="userResultMap" parameterType="String">
  242. select
  243. <include refid="table_columns"/>
  244. from gw_sys_user a where a.login_name = #{loginName}
  245. </select>
  246. <!-- 根据手机查询用户 -->
  247. <select id="getByMobile" resultMap="userResultMap" parameterType="String">
  248. select
  249. <include refid="table_columns"/>
  250. from gw_sys_user a where a.user_mobile = #{userMobile}
  251. </select>
  252. <!-- 根据用户ID查询用户(级联:机构、角色、岗位) -->
  253. <select id="getCascade" resultMap="userDtoResultMap" parameterType="String">
  254. select A.ID,
  255. A.OFC_ID,
  256. DEP_ID,
  257. LOGIN_NAME,
  258. PASSWORD,
  259. USER_STATE,
  260. USER_NBR,
  261. USER_NAME,
  262. USER_GENDER,
  263. USER_EMAIL,
  264. USER_TEL,
  265. USER_MOBILE,
  266. USER_TYPE,
  267. USER_AVATAR_URL,
  268. ID_CARD,
  269. ID_CARD_FRONT_URL,
  270. ID_CARD_BACK_URL,
  271. LOGIN_IP,
  272. LOGIN_TIME,
  273. TOKEN,
  274. FLAG_LOGIN,
  275. A.FLAG_VALID,
  276. B.id officeId,
  277. B.parent_id,
  278. province_id,
  279. city_id,
  280. country_id,
  281. ofc_addr,
  282. ofc_code,
  283. ofc_name,
  284. sort_level,
  285. ofc_type,
  286. ofc_level,
  287. ofc_zip,
  288. ofc_tel,
  289. ofc_fax,
  290. ofc_email,
  291. contact_name,
  292. contact_tel,
  293. license_nbr,
  294. license_url,
  295. D.POST_NAME,
  296. D.ID POSTID,
  297. D.FLAG_VALID POST_FLAG_VALID,
  298. F.ID ROLEID,
  299. F.ROLE_NAME,
  300. H.ID PRIVID,
  301. H.PRIV_NAME,
  302. H.PRIV_TYPE,
  303. H.PRIV_URI,
  304. H.PARENT_ID PRIV_PARENT_ID,
  305. H.FLAG_LEAF,
  306. D.OFC_ID POST_OFC_ID,
  307. F.OFC_ID ROLE_OFC_ID,
  308. F.FLAG_VALID ROLE_FLAG_VALID
  309. from GW_SYS_USER A LEFT JOIN GW_SYS_OFFICE B
  310. ON A.OFC_ID = B.ID
  311. left join GW_SYS_REL_USER_POST C ON A.ID=C.USER_ID
  312. LEFT JOIN GW_SYS_POST D ON C.POST_ID=D.ID
  313. LEFT JOIN GW_SYS_REL_USER_ROLE E ON A.id=E.USER_ID
  314. LEFT JOIN GW_SYS_ROLE F ON E.ROLE_ID=F.ID
  315. LEFT JOIN GW_SYS_REL_ROLE_PRIV G ON F.ID=G.ROLE_ID
  316. LEFT JOIN GW_SYS_PRIV H ON G.PRIV_ID=H.ID
  317. where A.ID = #{id}
  318. </select>
  319. <!-- 分页查询用户(级联:机构、角色、岗位) -->
  320. <select id="findPageDto" resultMap="userDtoResultMap" parameterType="cn.com.goldenwater.dcproj.param.UserParam">
  321. select A.ID,
  322. A.OFC_ID,
  323. A.DEP_ID,
  324. A.LOGIN_NAME,
  325. A.PASSWORD,
  326. A.USER_STATE,
  327. A.USER_NBR,
  328. A.USER_NAME,
  329. A.USER_GENDER,
  330. A.USER_EMAIL,
  331. A.USER_TEL,
  332. A.USER_MOBILE,
  333. A.USER_TYPE,
  334. A.USER_AVATAR_URL,
  335. A.ID_CARD,
  336. A.ID_CARD_FRONT_URL,
  337. A.ID_CARD_BACK_URL,
  338. A.LOGIN_IP,
  339. A.LOGIN_TIME,
  340. A.TOKEN,
  341. A.FLAG_LOGIN,
  342. A.FLAG_VALID,
  343. B.id officeId,
  344. B.parent_id,
  345. B.province_id,
  346. B.city_id,
  347. B.country_id,
  348. B.ofc_addr,
  349. B.ofc_code,
  350. B.ofc_name,
  351. B.sort_level,
  352. B.ofc_type,
  353. B.ofc_level,
  354. B.ofc_zip,
  355. B.ofc_tel,
  356. B.ofc_fax,
  357. B.ofc_email,
  358. B.contact_name,
  359. B.contact_tel,
  360. B.license_nbr,
  361. B.license_url,
  362. D.POST_NAME,
  363. D.ID POSTID,
  364. D.FLAG_VALID POST_FLAG_VALID,
  365. F.ID ROLEID,
  366. F.ROLE_NAME,
  367. H.ID PRIVID,
  368. H.PRIV_NAME,
  369. H.PRIV_TYPE,
  370. H.PRIV_URI,
  371. H.PARENT_ID PRIV_PARENT_ID,
  372. H.FLAG_LEAF,
  373. D.OFC_ID POST_OFC_ID,
  374. F.OFC_ID ROLE_OFC_ID,
  375. F.FLAG_VALID ROLE_FLAG_VALID
  376. from GW_SYS_USER A LEFT JOIN GW_SYS_OFFICE B
  377. ON A.OFC_ID = B.ID
  378. left join GW_SYS_REL_USER_POST C ON A.ID=C.USER_ID
  379. LEFT JOIN GW_SYS_POST D ON C.POST_ID=D.ID
  380. LEFT JOIN GW_SYS_REL_USER_ROLE E ON A.id=E.USER_ID
  381. LEFT JOIN GW_SYS_ROLE F ON E.ROLE_ID=F.ID
  382. LEFT JOIN GW_SYS_REL_ROLE_PRIV G ON F.ID=G.ROLE_ID
  383. LEFT JOIN GW_SYS_PRIV H ON G.PRIV_ID=H.ID
  384. <trim prefix="where" prefixOverrides="and | or ">
  385. <if test="ofcId != null and ofcId != ''">and A.OFC_ID = #{ofcId}</if>
  386. <if test="depId != null and depId != ''">and A.DEP_ID = #{depId}</if>
  387. <if test="loginName != null and loginName != ''">and A.LOGIN_NAME LIKE concat('%',#{loginName},'%')</if>
  388. <if test="password != null and password != ''">and A.PASSWORD = #{password}</if>
  389. <if test="userState != null and userState != ''">and A.USER_STATE = #{userState}</if>
  390. <if test="userNbr != null and userNbr != ''">and A.USER_NBR = #{userNbr}</if>
  391. <if test="userName != null and userName != ''">and A.USER_NAME LIKE concat('%',#{userName},'%')</if>
  392. <if test="userGender != null and userGender != ''">and A.USER_GENDER = #{userGender}</if>
  393. <if test="userEmail != null and userEmail != ''">and A.USER_EMAIL = #{userEmail}</if>
  394. <if test="userTel != null and userTel != ''">and A.USER_TEL = #{userTel}</if>
  395. <if test="userMobile != null and userMobile != ''">and A.USER_MOBILE = #{userMobile}</if>
  396. <if test="userType != null and userType != ''">and A.USER_TYPE = #{userType}</if>
  397. <if test="userAvatarUrl != null and userAvatarUrl != ''">and A.USER_AVATAR_URL = #{userAvatarUrl}</if>
  398. <if test="idCard != null and idCard != ''">and A.ID_CARD = #{idCard}</if>
  399. <if test="idCardFrontUrl != null and idCardFrontUrl != ''">and A.ID_CARD_FRONT_URL = #{idCardFrontUrl}</if>
  400. <if test="idCardBackUrl != null and idCardBackUrl != ''">and A.ID_CARD_BACK_URL = #{idCardBackUrl}</if>
  401. <if test="loginIp != null and loginIp != ''">and A.LOGIN_IP = #{loginIp}</if>
  402. <if test="loginTime != null">and A.LOGIN_TIME = #{loginTime}</if>
  403. <if test="token != null and token != ''">and A.TOKEN = #{token}</if>
  404. <if test="flagLogin != null">and A.FLAG_LOGIN = #{flagLogin}</if>
  405. <if test="flagValid != null">and A.FLAG_VALID = #{flagValid}</if>
  406. </trim>
  407. </select>
  408. <!-- 分页查询用户(级联:机构、角色、岗位) -->
  409. <select id="findPageInfoListCount" resultType="Long" parameterType="cn.com.goldenwater.dcproj.param.UserParam">
  410. select count(A.ID)
  411. from GW_SYS_USER A
  412. <trim prefix="where" prefixOverrides="and | or ">
  413. <if test="ofcId != null and ofcId != ''">and A.OFC_ID = #{ofcId}</if>
  414. <if test="depId != null and depId != ''">and A.DEP_ID = #{depId}</if>
  415. <if test="loginName != null and loginName != ''">and A.LOGIN_NAME LIKE concat('%',#{loginName},'%' )</if>
  416. <if test="password != null and password != ''">and A.PASSWORD = #{password}</if>
  417. <if test="userState != null and userState != ''">and A.USER_STATE = #{userState}</if>
  418. <if test="userNbr != null and userNbr != ''">and A.USER_NBR = #{userNbr}</if>
  419. <if test="userName != null and userName != ''">and A.USER_NAME LIKE concat('%',#{userName},'%')</if>
  420. <if test="userGender != null and userGender != ''">and A.USER_GENDER = #{userGender}</if>
  421. <if test="userEmail != null and userEmail != ''">and A.USER_EMAIL = #{userEmail}</if>
  422. <if test="userTel != null and userTel != ''">and A.USER_TEL = #{userTel}</if>
  423. <if test="userMobile != null and userMobile != ''">and A.USER_MOBILE = #{userMobile}</if>
  424. <if test="userType != null and userType != ''">and A.USER_TYPE = #{userType}</if>
  425. <if test="userAvatarUrl != null and userAvatarUrl != ''">and A.USER_AVATAR_URL = #{userAvatarUrl}</if>
  426. <if test="idCard != null and idCard != ''">and A.ID_CARD = #{idCard}</if>
  427. <if test="idCardFrontUrl != null and idCardFrontUrl != ''">and A.ID_CARD_FRONT_URL = #{idCardFrontUrl}</if>
  428. <if test="idCardBackUrl != null and idCardBackUrl != ''">and A.ID_CARD_BACK_URL = #{idCardBackUrl}</if>
  429. <if test="loginIp != null and loginIp != ''">and A.LOGIN_IP = #{loginIp}</if>
  430. <if test="loginTime != null">and A.LOGIN_TIME = #{loginTime}</if>
  431. <if test="token != null and token != ''">and A.TOKEN = #{token}</if>
  432. <if test="flagLogin != null">and A.FLAG_LOGIN = #{flagLogin}</if>
  433. <if test="flagValid != null">and A.FLAG_VALID = #{flagValid}</if>
  434. </trim>
  435. </select>
  436. <!-- 分页查询用户(级联:机构、角色、岗位) -->
  437. <select id="findPageInfoList" resultMap="userDtoResultMap" parameterType="cn.com.goldenwater.dcproj.param.UserParam">
  438. select A.ID,
  439. A.OFC_ID,
  440. A.DEP_ID,
  441. A.LOGIN_NAME,
  442. A.PASSWORD,
  443. A.USER_STATE,
  444. A.USER_NBR,
  445. A.USER_NAME,
  446. A.USER_GENDER,
  447. A.USER_EMAIL,
  448. A.USER_TEL,
  449. A.USER_MOBILE,
  450. A.USER_TYPE,
  451. A.USER_AVATAR_URL,
  452. A.ID_CARD,
  453. A.ID_CARD_FRONT_URL,
  454. A.ID_CARD_BACK_URL,
  455. A.LOGIN_IP,
  456. A.LOGIN_TIME,
  457. A.TOKEN,
  458. A.FLAG_LOGIN,
  459. A.FLAG_VALID,
  460. B.id officeId,
  461. B.parent_id,
  462. B.province_id,
  463. B.city_id,
  464. B.country_id,
  465. B.ofc_addr,
  466. B.ofc_code,
  467. B.ofc_name,
  468. B.sort_level,
  469. B.ofc_type,
  470. B.ofc_level,
  471. B.ofc_zip,
  472. B.ofc_tel,
  473. B.ofc_fax,
  474. B.ofc_email,
  475. B.contact_name,
  476. B.contact_tel,
  477. B.license_nbr,
  478. B.license_url,
  479. D.POST_NAME,
  480. D.ID POSTID,
  481. D.FLAG_VALID POST_FLAG_VALID,
  482. F.ID ROLEID,
  483. F.ROLE_NAME,
  484. H.ID PRIVID,
  485. H.PRIV_NAME,
  486. H.PRIV_TYPE,
  487. H.PRIV_URI,
  488. H.PARENT_ID PRIV_PARENT_ID,
  489. H.FLAG_LEAF,
  490. D.OFC_ID POST_OFC_ID,
  491. F.OFC_ID ROLE_OFC_ID,
  492. F.FLAG_VALID ROLE_FLAG_VALID
  493. from (
  494. SELECT * from GW_SYS_USER
  495. <trim prefix="where" prefixOverrides="and | or ">
  496. <if test="ofcId != null and ofcId != ''">and A.OFC_ID = #{ofcId}</if>
  497. <if test="depId != null and depId != ''">and A.DEP_ID = #{depId}</if>
  498. <if test="loginName != null and loginName != ''">and A.LOGIN_NAME LIKE concat('%',#{loginName},'%')</if>
  499. <if test="password != null and password != ''">and A.PASSWORD = #{password}</if>
  500. <if test="userState != null and userState != ''">and A.USER_STATE = #{userState}</if>
  501. <if test="userNbr != null and userNbr != ''">and A.USER_NBR = #{userNbr}</if>
  502. <if test="userName != null and userName != ''">and A.USER_NAME LIKE concat('%',#{userName},'%')</if>
  503. <if test="userGender != null and userGender != ''">and A.USER_GENDER = #{userGender}</if>
  504. <if test="userEmail != null and userEmail != ''">and A.USER_EMAIL = #{userEmail}</if>
  505. <if test="userTel != null and userTel != ''">and A.USER_TEL = #{userTel}</if>
  506. <if test="userMobile != null and userMobile != ''">and A.USER_MOBILE = #{userMobile}</if>
  507. <if test="userType != null and userType != ''">and A.USER_TYPE = #{userType}</if>
  508. <if test="userAvatarUrl != null and userAvatarUrl != ''">and A.USER_AVATAR_URL = #{userAvatarUrl}</if>
  509. <if test="idCard != null and idCard != ''">and A.ID_CARD = #{idCard}</if>
  510. <if test="idCardFrontUrl != null and idCardFrontUrl != ''">and A.ID_CARD_FRONT_URL = #{idCardFrontUrl}</if>
  511. <if test="idCardBackUrl != null and idCardBackUrl != ''">and A.ID_CARD_BACK_URL = #{idCardBackUrl}</if>
  512. <if test="loginIp != null and loginIp != ''">and A.LOGIN_IP = #{loginIp}</if>
  513. <if test="loginTime != null">and A.LOGIN_TIME = #{loginTime}</if>
  514. <if test="token != null and token != ''">and A.TOKEN = #{token}</if>
  515. <if test="flagLogin != null">and A.FLAG_LOGIN = #{flagLogin}</if>
  516. <if test="flagValid != null">and A.FLAG_VALID = #{flagValid}</if>
  517. </trim>
  518. limit #{from}, #{to}-#{from}
  519. ) A
  520. LEFT JOIN GW_SYS_OFFICE B
  521. ON A.OFC_ID = B.ID
  522. left join GW_SYS_REL_USER_POST C ON A.ID=C.USER_ID
  523. LEFT JOIN GW_SYS_POST D ON C.POST_ID=D.ID
  524. LEFT JOIN GW_SYS_REL_USER_ROLE E ON A.id=E.USER_ID
  525. LEFT JOIN GW_SYS_ROLE F ON E.ROLE_ID=F.ID
  526. LEFT JOIN GW_SYS_REL_ROLE_PRIV G ON F.ID=G.ROLE_ID
  527. LEFT JOIN GW_SYS_PRIV H ON G.PRIV_ID=H.ID
  528. </select>
  529. </mapper>