SysUserMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  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.ssm.mapper.system.SysUserMapper" >
  4. <resultMap id="BaseResultMap" type="com.ssm.model.system.SysUser" >
  5. <id column="UserID" property="userid" jdbcType="INTEGER" />
  6. <result column="UserName" property="username" jdbcType="VARCHAR" />
  7. <result column="UserNameEN" property="usernameen" jdbcType="VARCHAR" />
  8. <result column="EmployeeNo" property="employeeno" jdbcType="VARCHAR" />
  9. <result column="Gender" property="gender" jdbcType="VARCHAR" />
  10. <result column="Password" property="password" jdbcType="VARCHAR" />
  11. <!-- <result column="DepID" property="depid" jdbcType="INTEGER" /> -->
  12. <!-- <result column="PositionID" property="positionid" jdbcType="INTEGER" /> -->
  13. <result column="PhoneNumber" property="phonenumber" jdbcType="VARCHAR" />
  14. <result column="MobileNumber" property="mobilenumber" jdbcType="VARCHAR" />
  15. <result column="EmailAddress" property="emailaddress" jdbcType="VARCHAR" />
  16. <result column="Area" property="area" jdbcType="VARCHAR" />
  17. <result column="LineManagerID" property="linemanagerid" jdbcType="VARCHAR" />
  18. <result column="Entrydate" property="entrydate" jdbcType="TIMESTAMP" />
  19. <result column="BirthDay" property="birthday" jdbcType="TIMESTAMP" />
  20. <result column="HeadImageUrl" property="headimageurl" jdbcType="VARCHAR" />
  21. <result column="OwnedCompany" property="ownedcompany" jdbcType="VARCHAR" />
  22. <result column="WorkLocation" property="worklocation" jdbcType="VARCHAR" />
  23. <result column="Address" property="address" jdbcType="VARCHAR" />
  24. <result column="LastLoginDate" property="lastlogindate" jdbcType="TIMESTAMP" />
  25. <result column="LastLoginIP" property="lastloginip" jdbcType="VARCHAR" />
  26. <result column="LoginCounts" property="logincounts" jdbcType="INTEGER" />
  27. <result column="IsEnabled" property="isenabled" jdbcType="BIT" />
  28. <result column="IsDeleted" property="isdeleted" jdbcType="BIT" />
  29. <result column="CreatedUserID" property="createduserid" jdbcType="INTEGER" />
  30. <result column="CreatedDatetime" property="createddatetime" jdbcType="TIMESTAMP" />
  31. <result column="LastUpdateUserID" property="lastupdateuserid" jdbcType="INTEGER" />
  32. <result column="LastUpdateDatetime" property="lastupdatedatetime" jdbcType="TIMESTAMP" />
  33. <!-- 会存在N+1问题 , 影响系统效率 -->
  34. <!-- <association column="PositionID" javaType="com.ssm.model.system.SysPosition" property="sysPosition" select="getPosition" /> -->
  35. <!-- <association column="DepID" property="sysDepartment" select="getDepartment" /> -->
  36. <association javaType="com.ssm.model.system.SysPosition"
  37. property="sysPosition" resultMap="com.ssm.mapper.system.SysPositionMapper.BaseResultMap" />
  38. <association javaType="com.ssm.model.system.SysDepartment"
  39. property="sysDepartment" resultMap="com.ssm.mapper.system.SysDepartmentMapper.BaseResultMap" />
  40. <collection property="roleList" ofType="com.ssm.model.system.SysRole">
  41. <id property="roleId" column="roleid" />
  42. <result property="roleName" column="rolename" />
  43. </collection>
  44. </resultMap>
  45. <sql id="Example_Where_Clause" >
  46. <where >
  47. <foreach collection="oredCriteria" item="criteria" separator="or" >
  48. <if test="criteria.valid" >
  49. <trim prefix="(" suffix=")" prefixOverrides="and" >
  50. <foreach collection="criteria.criteria" item="criterion" >
  51. <choose >
  52. <when test="criterion.noValue" >
  53. and ${criterion.condition}
  54. </when>
  55. <when test="criterion.singleValue" >
  56. and ${criterion.condition} #{criterion.value}
  57. </when>
  58. <when test="criterion.betweenValue" >
  59. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  60. </when>
  61. <when test="criterion.listValue" >
  62. and ${criterion.condition}
  63. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  64. #{listItem}
  65. </foreach>
  66. </when>
  67. </choose>
  68. </foreach>
  69. </trim>
  70. </if>
  71. </foreach>
  72. </where>
  73. </sql>
  74. <sql id="Update_By_Example_Where_Clause" >
  75. <where >
  76. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  77. <if test="criteria.valid" >
  78. <trim prefix="(" suffix=")" prefixOverrides="and" >
  79. <foreach collection="criteria.criteria" item="criterion" >
  80. <choose >
  81. <when test="criterion.noValue" >
  82. and ${criterion.condition}
  83. </when>
  84. <when test="criterion.singleValue" >
  85. and ${criterion.condition} #{criterion.value}
  86. </when>
  87. <when test="criterion.betweenValue" >
  88. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  89. </when>
  90. <when test="criterion.listValue" >
  91. and ${criterion.condition}
  92. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  93. #{listItem}
  94. </foreach>
  95. </when>
  96. </choose>
  97. </foreach>
  98. </trim>
  99. </if>
  100. </foreach>
  101. </where>
  102. </sql>
  103. <select id="getPosition" parameterType="int" resultType="com.ssm.model.system.SysPosition">
  104. SELECT * FROM SysPosition WHERE PositionID=#{id}
  105. </select>
  106. <select id="getDepartment" parameterType="int" resultType="com.ssm.model.system.SysDepartment">
  107. SELECT * FROM SysDepartment WHERE DepID=#{id}
  108. </select>
  109. <select id="selectPerssion" resultType="int">
  110. SELECT count(*) from SysRoleMenu s ,SysUserRole sr , SysMenu sm
  111. WHERE s.RoleID = sr.RoleID AND sr.UserID=#{userid}
  112. AND s.MenuID = sm.MenuID AND sm.IsDelete = 0 AND sm.IsEnable = 0
  113. AND sm.MenuUrl= #{menuUrl}
  114. </select>
  115. <sql id="Base_Column_List" >
  116. UserID, UserName, UserNameEN, EmployeeNo, Gender, Password, DepID, PositionID, PhoneNumber,
  117. MobileNumber, EmailAddress, Area, LineManagerID, Entrydate, BirthDay, HeadImageUrl,
  118. OwnedCompany, WorkLocation, Address, LastLoginDate, LastLoginIP, LoginCounts, IsEnabled,
  119. IsDeleted, CreatedUserID, CreatedDatetime, LastUpdateUserID, LastUpdateDatetime
  120. </sql>
  121. <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.ssm.model.system.SysUserExample" >
  122. select
  123. <if test="distinct" >
  124. distinct
  125. </if>
  126. <include refid="Base_Column_List" />
  127. from SysUser
  128. <if test="_parameter != null" >
  129. <include refid="Example_Where_Clause" />
  130. </if>
  131. <if test="orderByClause != null" >
  132. order by ${orderByClause}
  133. </if>
  134. </select>
  135. <select id="selectByCondition" resultMap="BaseResultMap" parameterType="java.lang.String" >
  136. select su.userid, su.username, su.positionid, su.employeeno,
  137. su.mobilenumber, su.emailaddress,
  138. sp.positionname,su.isEnabled , sd.DepName
  139. from SysUser su
  140. LEFT JOIN SysPosition sp ON su.PositionID = sp.PositionID
  141. LEFT JOIN SysDepartment sd ON su.DepID = sd.DepID
  142. where su.isDeleted = 0
  143. <if test="username != null ">
  144. and su.username like CONCAT('%',#{username},'%')
  145. </if>
  146. <if test="employeeno != null ">
  147. and su.employeeno like CONCAT('%',#{employeeno},'%')
  148. </if>
  149. order by su.userid desc
  150. </select>
  151. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  152. select
  153. <include refid="Base_Column_List" />
  154. from SysUser
  155. where UserID = #{userid,jdbcType=INTEGER}
  156. </select>
  157. <select id="findByEmployeeno" resultMap="BaseResultMap" parameterType="java.lang.String">
  158. select
  159. <include refid="Base_Column_List" />
  160. from SysUser
  161. where EmployeeNo = #{employeeno}
  162. </select>
  163. <select id="findByEmployeenoAndPasswod" resultMap="BaseResultMap" parameterType="java.lang.String">
  164. select
  165. <include refid="Base_Column_List" />
  166. from SysUser
  167. where EmployeeNo = #{employeeno} and Password = #{password}
  168. </select>
  169. <update id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  170. update SysUser set IsDeleted = 1
  171. where UserID = #{userid,jdbcType=INTEGER}
  172. </update>
  173. <delete id="deleteByExample" parameterType="com.ssm.model.system.SysUserExample" >
  174. delete from SysUser
  175. <if test="_parameter != null" >
  176. <include refid="Example_Where_Clause" />
  177. </if>
  178. </delete>
  179. <delete id="deleteUserRole" parameterType="java.lang.Integer">
  180. delete from SysUserRole
  181. where UserID = #{userid,jdbcType=INTEGER}
  182. </delete>
  183. <insert id="insert" parameterType="com.ssm.model.system.SysUser" >
  184. insert into SysUser (UserID, UserName, UserNameEN,
  185. EmployeeNo, Gender, Password,
  186. DepID, PositionID, PhoneNumber,
  187. MobileNumber, EmailAddress, Area,
  188. LineManagerID, Entrydate, BirthDay,
  189. HeadImageUrl, OwnedCompany, WorkLocation,
  190. Address, LastLoginDate, LastLoginIP,
  191. LoginCounts, IsEnabled, IsDeleted,
  192. CreatedUserID, CreatedDatetime, LastUpdateUserID,
  193. LastUpdateDatetime)
  194. values (#{userid,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{usernameen,jdbcType=VARCHAR},
  195. #{employeeno,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
  196. #{sysDepartment.depid,jdbcType=INTEGER}, #{sysPosition.positionid,jdbcType=INTEGER}, #{phonenumber,jdbcType=VARCHAR},
  197. #{mobilenumber,jdbcType=VARCHAR}, #{emailaddress,jdbcType=VARCHAR}, #{area,jdbcType=VARCHAR},
  198. #{linemanagerid,jdbcType=VARCHAR}, #{entrydate,jdbcType=TIMESTAMP}, #{birthday,jdbcType=TIMESTAMP},
  199. #{headimageurl,jdbcType=VARCHAR}, #{ownedcompany,jdbcType=VARCHAR}, #{worklocation,jdbcType=VARCHAR},
  200. #{address,jdbcType=VARCHAR}, #{lastlogindate,jdbcType=TIMESTAMP}, #{lastloginip,jdbcType=VARCHAR},
  201. #{logincounts,jdbcType=INTEGER}, #{isenabled,jdbcType=BIT}, #{isdeleted,jdbcType=BIT},
  202. #{createduserid,jdbcType=INTEGER}, #{createddatetime,jdbcType=TIMESTAMP}, #{lastupdateuserid,jdbcType=INTEGER},
  203. #{lastupdatedatetime,jdbcType=TIMESTAMP})
  204. </insert>
  205. <insert id="insertSelective" parameterType="com.ssm.model.system.SysUser" >
  206. <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="userid">
  207. SELECT LAST_INSERT_ID()
  208. </selectKey>
  209. insert into SysUser
  210. <trim prefix="(" suffix=")" suffixOverrides="," >
  211. <if test="userid != null" >
  212. UserID,
  213. </if>
  214. <if test="username != null" >
  215. UserName,
  216. </if>
  217. <if test="usernameen != null" >
  218. UserNameEN,
  219. </if>
  220. <if test="employeeno != null" >
  221. EmployeeNo,
  222. </if>
  223. <if test="gender != null" >
  224. Gender,
  225. </if>
  226. <if test="password != null" >
  227. Password,
  228. </if>
  229. <if test="sysDepartment != null and sysDepartment.depid != null" >
  230. DepID,
  231. </if>
  232. <if test="sysPosition != null and sysPosition.positionid != null" >
  233. PositionID,
  234. </if>
  235. <if test="phonenumber != null" >
  236. PhoneNumber,
  237. </if>
  238. <if test="mobilenumber != null" >
  239. MobileNumber,
  240. </if>
  241. <if test="emailaddress != null" >
  242. EmailAddress,
  243. </if>
  244. <if test="area != null" >
  245. Area,
  246. </if>
  247. <if test="linemanagerid != null" >
  248. LineManagerID,
  249. </if>
  250. <if test="entrydate != null" >
  251. Entrydate,
  252. </if>
  253. <if test="birthday != null" >
  254. BirthDay,
  255. </if>
  256. <if test="headimageurl != null" >
  257. HeadImageUrl,
  258. </if>
  259. <if test="ownedcompany != null" >
  260. OwnedCompany,
  261. </if>
  262. <if test="worklocation != null" >
  263. WorkLocation,
  264. </if>
  265. <if test="address != null" >
  266. Address,
  267. </if>
  268. <if test="lastlogindate != null" >
  269. LastLoginDate,
  270. </if>
  271. <if test="lastloginip != null" >
  272. LastLoginIP,
  273. </if>
  274. <if test="logincounts != null" >
  275. LoginCounts,
  276. </if>
  277. <if test="isenabled != null" >
  278. IsEnabled,
  279. </if>
  280. <if test="isdeleted != null" >
  281. IsDeleted,
  282. </if>
  283. <if test="createduserid != null" >
  284. CreatedUserID,
  285. </if>
  286. <if test="createddatetime != null" >
  287. CreatedDatetime,
  288. </if>
  289. <if test="lastupdateuserid != null" >
  290. LastUpdateUserID,
  291. </if>
  292. <if test="lastupdatedatetime != null" >
  293. LastUpdateDatetime,
  294. </if>
  295. </trim>
  296. <trim prefix="values (" suffix=")" suffixOverrides="," >
  297. <if test="userid != null" >
  298. #{userid,jdbcType=INTEGER},
  299. </if>
  300. <if test="username != null" >
  301. #{username,jdbcType=VARCHAR},
  302. </if>
  303. <if test="usernameen != null" >
  304. #{usernameen,jdbcType=VARCHAR},
  305. </if>
  306. <if test="employeeno != null" >
  307. #{employeeno,jdbcType=VARCHAR},
  308. </if>
  309. <if test="gender != null" >
  310. #{gender,jdbcType=VARCHAR},
  311. </if>
  312. <if test="password != null" >
  313. #{password,jdbcType=VARCHAR},
  314. </if>
  315. <if test="sysDepartment != null and sysDepartment.depid != null" >
  316. #{sysDepartment.depid,jdbcType=INTEGER},
  317. </if>
  318. <if test="sysPosition != null and sysPosition.positionid != null" >
  319. #{sysPosition.positionid,jdbcType=INTEGER},
  320. </if>
  321. <if test="phonenumber != null" >
  322. #{phonenumber,jdbcType=VARCHAR},
  323. </if>
  324. <if test="mobilenumber != null" >
  325. #{mobilenumber,jdbcType=VARCHAR},
  326. </if>
  327. <if test="emailaddress != null" >
  328. #{emailaddress,jdbcType=VARCHAR},
  329. </if>
  330. <if test="area != null" >
  331. #{area,jdbcType=VARCHAR},
  332. </if>
  333. <if test="linemanagerid != null" >
  334. #{linemanagerid,jdbcType=VARCHAR},
  335. </if>
  336. <if test="entrydate != null" >
  337. #{entrydate,jdbcType=TIMESTAMP},
  338. </if>
  339. <if test="birthday != null" >
  340. #{birthday,jdbcType=TIMESTAMP},
  341. </if>
  342. <if test="headimageurl != null" >
  343. #{headimageurl,jdbcType=VARCHAR},
  344. </if>
  345. <if test="ownedcompany != null" >
  346. #{ownedcompany,jdbcType=VARCHAR},
  347. </if>
  348. <if test="worklocation != null" >
  349. #{worklocation,jdbcType=VARCHAR},
  350. </if>
  351. <if test="address != null" >
  352. #{address,jdbcType=VARCHAR},
  353. </if>
  354. <if test="lastlogindate != null" >
  355. #{lastlogindate,jdbcType=TIMESTAMP},
  356. </if>
  357. <if test="lastloginip != null" >
  358. #{lastloginip,jdbcType=VARCHAR},
  359. </if>
  360. <if test="logincounts != null" >
  361. #{logincounts,jdbcType=INTEGER},
  362. </if>
  363. <if test="isenabled != null" >
  364. #{isenabled,jdbcType=BIT},
  365. </if>
  366. <if test="isdeleted != null" >
  367. #{isdeleted,jdbcType=BIT},
  368. </if>
  369. <if test="createduserid != null" >
  370. #{createduserid,jdbcType=INTEGER},
  371. </if>
  372. <if test="createddatetime != null" >
  373. #{createddatetime,jdbcType=TIMESTAMP},
  374. </if>
  375. <if test="lastupdateuserid != null" >
  376. #{lastupdateuserid,jdbcType=INTEGER},
  377. </if>
  378. <if test="lastupdatedatetime != null" >
  379. #{lastupdatedatetime,jdbcType=TIMESTAMP},
  380. </if>
  381. </trim>
  382. </insert>
  383. <insert id="insertUserRole" parameterType="java.lang.Integer">
  384. insert into SysUserRole(UserID, RoleID)
  385. values(#{userid,jdbcType=INTEGER}, #{roleid, jdbcType=INTEGER})
  386. </insert>
  387. <select id="countByExample" parameterType="com.ssm.model.system.SysUserExample" resultType="java.lang.Integer" >
  388. select count(*) from SysUser
  389. <if test="_parameter != null" >
  390. <include refid="Example_Where_Clause" />
  391. </if>
  392. </select>
  393. <update id="updateByExampleSelective" parameterType="map" >
  394. update SysUser
  395. <set >
  396. <if test="record.userid != null" >
  397. UserID = #{record.userid,jdbcType=INTEGER},
  398. </if>
  399. <if test="record.username != null" >
  400. UserName = #{record.username,jdbcType=VARCHAR},
  401. </if>
  402. <if test="record.usernameen != null" >
  403. UserNameEN = #{record.usernameen,jdbcType=VARCHAR},
  404. </if>
  405. <if test="record.employeeno != null" >
  406. EmployeeNo = #{record.employeeno,jdbcType=VARCHAR},
  407. </if>
  408. <if test="record.gender != null" >
  409. Gender = #{record.gender,jdbcType=VARCHAR},
  410. </if>
  411. <if test="record.password != null" >
  412. Password = #{record.password,jdbcType=VARCHAR},
  413. </if>
  414. <if test="record.depid != null" >
  415. DepID = #{record.depid,jdbcType=INTEGER},
  416. </if>
  417. <if test="record.positionid != null" >
  418. PositionID = #{record.positionid,jdbcType=INTEGER},
  419. </if>
  420. <if test="record.phonenumber != null" >
  421. PhoneNumber = #{record.phonenumber,jdbcType=VARCHAR},
  422. </if>
  423. <if test="record.mobilenumber != null" >
  424. MobileNumber = #{record.mobilenumber,jdbcType=VARCHAR},
  425. </if>
  426. <if test="record.emailaddress != null" >
  427. EmailAddress = #{record.emailaddress,jdbcType=VARCHAR},
  428. </if>
  429. <if test="record.area != null" >
  430. Area = #{record.area,jdbcType=VARCHAR},
  431. </if>
  432. <if test="record.linemanagerid != null" >
  433. LineManagerID = #{record.linemanagerid,jdbcType=VARCHAR},
  434. </if>
  435. <if test="record.entrydate != null" >
  436. Entrydate = #{record.entrydate,jdbcType=TIMESTAMP},
  437. </if>
  438. <if test="record.birthday != null" >
  439. BirthDay = #{record.birthday,jdbcType=TIMESTAMP},
  440. </if>
  441. <if test="record.headimageurl != null" >
  442. HeadImageUrl = #{record.headimageurl,jdbcType=VARCHAR},
  443. </if>
  444. <if test="record.ownedcompany != null" >
  445. OwnedCompany = #{record.ownedcompany,jdbcType=VARCHAR},
  446. </if>
  447. <if test="record.worklocation != null" >
  448. WorkLocation = #{record.worklocation,jdbcType=VARCHAR},
  449. </if>
  450. <if test="record.address != null" >
  451. Address = #{record.address,jdbcType=VARCHAR},
  452. </if>
  453. <if test="record.lastlogindate != null" >
  454. LastLoginDate = #{record.lastlogindate,jdbcType=TIMESTAMP},
  455. </if>
  456. <if test="record.lastloginip != null" >
  457. LastLoginIP = #{record.lastloginip,jdbcType=VARCHAR},
  458. </if>
  459. <if test="record.logincounts != null" >
  460. LoginCounts = #{record.logincounts,jdbcType=INTEGER},
  461. </if>
  462. <if test="record.isenabled != null" >
  463. IsEnabled = #{record.isenabled,jdbcType=BIT},
  464. </if>
  465. <if test="record.isdeleted != null" >
  466. IsDeleted = #{record.isdeleted,jdbcType=BIT},
  467. </if>
  468. <if test="record.createduserid != null" >
  469. CreatedUserID = #{record.createduserid,jdbcType=INTEGER},
  470. </if>
  471. <if test="record.createddatetime != null" >
  472. CreatedDatetime = #{record.createddatetime,jdbcType=TIMESTAMP},
  473. </if>
  474. <if test="record.lastupdateuserid != null" >
  475. LastUpdateUserID = #{record.lastupdateuserid,jdbcType=INTEGER},
  476. </if>
  477. <if test="record.lastupdatedatetime != null" >
  478. LastUpdateDatetime = #{record.lastupdatedatetime,jdbcType=TIMESTAMP},
  479. </if>
  480. </set>
  481. <if test="_parameter != null" >
  482. <include refid="Update_By_Example_Where_Clause" />
  483. </if>
  484. </update>
  485. <update id="updateByExample" parameterType="map" >
  486. update SysUser
  487. set UserID = #{record.userid,jdbcType=INTEGER},
  488. UserName = #{record.username,jdbcType=VARCHAR},
  489. UserNameEN = #{record.usernameen,jdbcType=VARCHAR},
  490. EmployeeNo = #{record.employeeno,jdbcType=VARCHAR},
  491. Gender = #{record.gender,jdbcType=VARCHAR},
  492. Password = #{record.password,jdbcType=VARCHAR},
  493. DepID = #{record.depid,jdbcType=INTEGER},
  494. PositionID = #{record.positionid,jdbcType=INTEGER},
  495. PhoneNumber = #{record.phonenumber,jdbcType=VARCHAR},
  496. MobileNumber = #{record.mobilenumber,jdbcType=VARCHAR},
  497. EmailAddress = #{record.emailaddress,jdbcType=VARCHAR},
  498. Area = #{record.area,jdbcType=VARCHAR},
  499. LineManagerID = #{record.linemanagerid,jdbcType=VARCHAR},
  500. Entrydate = #{record.entrydate,jdbcType=TIMESTAMP},
  501. BirthDay = #{record.birthday,jdbcType=TIMESTAMP},
  502. HeadImageUrl = #{record.headimageurl,jdbcType=VARCHAR},
  503. OwnedCompany = #{record.ownedcompany,jdbcType=VARCHAR},
  504. WorkLocation = #{record.worklocation,jdbcType=VARCHAR},
  505. Address = #{record.address,jdbcType=VARCHAR},
  506. LastLoginDate = #{record.lastlogindate,jdbcType=TIMESTAMP},
  507. LastLoginIP = #{record.lastloginip,jdbcType=VARCHAR},
  508. LoginCounts = #{record.logincounts,jdbcType=INTEGER},
  509. IsEnabled = #{record.isenabled,jdbcType=BIT},
  510. IsDeleted = #{record.isdeleted,jdbcType=BIT},
  511. CreatedUserID = #{record.createduserid,jdbcType=INTEGER},
  512. CreatedDatetime = #{record.createddatetime,jdbcType=TIMESTAMP},
  513. LastUpdateUserID = #{record.lastupdateuserid,jdbcType=INTEGER},
  514. LastUpdateDatetime = #{record.lastupdatedatetime,jdbcType=TIMESTAMP}
  515. <if test="_parameter != null" >
  516. <include refid="Update_By_Example_Where_Clause" />
  517. </if>
  518. </update>
  519. <update id="updateByPrimaryKeySelective" parameterType="com.ssm.model.system.SysUser" >
  520. update SysUser
  521. <set >
  522. <if test="username != null" >
  523. UserName = #{username,jdbcType=VARCHAR},
  524. </if>
  525. <if test="usernameen != null" >
  526. UserNameEN = #{usernameen,jdbcType=VARCHAR},
  527. </if>
  528. <if test="employeeno != null" >
  529. EmployeeNo = #{employeeno,jdbcType=VARCHAR},
  530. </if>
  531. <if test="gender != null" >
  532. Gender = #{gender,jdbcType=VARCHAR},
  533. </if>
  534. <if test="password != null" >
  535. Password = #{password,jdbcType=VARCHAR},
  536. </if>
  537. <if test="sysDepartment != null and sysDepartment.depid != null" >
  538. DepID = #{sysDepartment.depid,jdbcType=INTEGER},
  539. </if>
  540. <if test="sysPosition!=null and sysPosition.positionid != null" >
  541. PositionID = #{sysPosition.positionid,jdbcType=INTEGER},
  542. </if>
  543. <if test="phonenumber != null" >
  544. PhoneNumber = #{phonenumber,jdbcType=VARCHAR},
  545. </if>
  546. <if test="mobilenumber != null" >
  547. MobileNumber = #{mobilenumber,jdbcType=VARCHAR},
  548. </if>
  549. <if test="emailaddress != null" >
  550. EmailAddress = #{emailaddress,jdbcType=VARCHAR},
  551. </if>
  552. <if test="area != null" >
  553. Area = #{area,jdbcType=VARCHAR},
  554. </if>
  555. <if test="linemanagerid != null" >
  556. LineManagerID = #{linemanagerid,jdbcType=VARCHAR},
  557. </if>
  558. <if test="entrydate != null" >
  559. Entrydate = #{entrydate,jdbcType=TIMESTAMP},
  560. </if>
  561. <if test="birthday != null" >
  562. BirthDay = #{birthday,jdbcType=TIMESTAMP},
  563. </if>
  564. <if test="headimageurl != null" >
  565. HeadImageUrl = #{headimageurl,jdbcType=VARCHAR},
  566. </if>
  567. <if test="ownedcompany != null" >
  568. OwnedCompany = #{ownedcompany,jdbcType=VARCHAR},
  569. </if>
  570. <if test="worklocation != null" >
  571. WorkLocation = #{worklocation,jdbcType=VARCHAR},
  572. </if>
  573. <if test="address != null" >
  574. Address = #{address,jdbcType=VARCHAR},
  575. </if>
  576. <if test="lastlogindate != null" >
  577. LastLoginDate = #{lastlogindate,jdbcType=TIMESTAMP},
  578. </if>
  579. <if test="lastloginip != null" >
  580. LastLoginIP = #{lastloginip,jdbcType=VARCHAR},
  581. </if>
  582. <if test="logincounts != null" >
  583. LoginCounts = #{logincounts,jdbcType=INTEGER},
  584. </if>
  585. <if test="isenabled != null" >
  586. IsEnabled = #{isenabled,jdbcType=BIT},
  587. </if>
  588. <if test="isdeleted != null" >
  589. IsDeleted = #{isdeleted,jdbcType=BIT},
  590. </if>
  591. <if test="createduserid != null" >
  592. CreatedUserID = #{createduserid,jdbcType=INTEGER},
  593. </if>
  594. <if test="createddatetime != null" >
  595. CreatedDatetime = #{createddatetime,jdbcType=TIMESTAMP},
  596. </if>
  597. <if test="lastupdateuserid != null" >
  598. LastUpdateUserID = #{lastupdateuserid,jdbcType=INTEGER},
  599. </if>
  600. <if test="lastupdatedatetime != null" >
  601. LastUpdateDatetime = #{lastupdatedatetime,jdbcType=TIMESTAMP},
  602. </if>
  603. </set>
  604. where UserID = #{userid,jdbcType=INTEGER}
  605. </update>
  606. <update id="updateByPrimaryKey" parameterType="com.ssm.model.system.SysUser" >
  607. update SysUser
  608. set UserName = #{username,jdbcType=VARCHAR},
  609. UserNameEN = #{usernameen,jdbcType=VARCHAR},
  610. EmployeeNo = #{employeeno,jdbcType=VARCHAR},
  611. Gender = #{gender,jdbcType=VARCHAR},
  612. Password = #{password,jdbcType=VARCHAR},
  613. DepID = #{sysDepartment.depid,jdbcType=INTEGER},
  614. PositionID = #{sysPosition.positionid,jdbcType=INTEGER},
  615. PhoneNumber = #{phonenumber,jdbcType=VARCHAR},
  616. MobileNumber = #{mobilenumber,jdbcType=VARCHAR},
  617. EmailAddress = #{emailaddress,jdbcType=VARCHAR},
  618. Area = #{area,jdbcType=VARCHAR},
  619. LineManagerID = #{linemanagerid,jdbcType=VARCHAR},
  620. Entrydate = #{entrydate,jdbcType=TIMESTAMP},
  621. BirthDay = #{birthday,jdbcType=TIMESTAMP},
  622. HeadImageUrl = #{headimageurl,jdbcType=VARCHAR},
  623. OwnedCompany = #{ownedcompany,jdbcType=VARCHAR},
  624. WorkLocation = #{worklocation,jdbcType=VARCHAR},
  625. Address = #{address,jdbcType=VARCHAR},
  626. LastLoginDate = #{lastlogindate,jdbcType=TIMESTAMP},
  627. LastLoginIP = #{lastloginip,jdbcType=VARCHAR},
  628. LoginCounts = #{logincounts,jdbcType=INTEGER},
  629. IsEnabled = #{isenabled,jdbcType=BIT},
  630. IsDeleted = #{isdeleted,jdbcType=BIT},
  631. CreatedUserID = #{createduserid,jdbcType=INTEGER},
  632. CreatedDatetime = #{createddatetime,jdbcType=TIMESTAMP},
  633. LastUpdateUserID = #{lastupdateuserid,jdbcType=INTEGER},
  634. LastUpdateDatetime = #{lastupdatedatetime,jdbcType=TIMESTAMP}
  635. where UserID = #{userid,jdbcType=INTEGER}
  636. </update>
  637. <select id="selectAllUser" resultMap="BaseResultMap">
  638. SELECT * from SysUser s where s.IsDeleted = 0 AND s.IsEnabled = 0
  639. </select>
  640. <select id="selectUserRoleByUserIdAndRoldId" resultType="java.lang.Integer">
  641. select COUNT(ssr.ID) from sysuserrole ssr where UserID=#{userid,jdbcType=INTEGER} and RoleID=#{roldid,jdbcType=INTEGER}
  642. </select>
  643. </mapper>