UserMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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.jsh.erp.datasource.mappers.UserMapper">
  4. <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.User">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="username" jdbcType="VARCHAR" property="username" />
  7. <result column="login_name" jdbcType="VARCHAR" property="loginName" />
  8. <result column="password" jdbcType="VARCHAR" property="password" />
  9. <result column="leader_flag" jdbcType="VARCHAR" property="leaderFlag" />
  10. <result column="position" jdbcType="VARCHAR" property="position" />
  11. <result column="department" jdbcType="VARCHAR" property="department" />
  12. <result column="email" jdbcType="VARCHAR" property="email" />
  13. <result column="phonenum" jdbcType="VARCHAR" property="phonenum" />
  14. <result column="ismanager" jdbcType="TINYINT" property="ismanager" />
  15. <result column="isystem" jdbcType="TINYINT" property="isystem" />
  16. <result column="status" jdbcType="TINYINT" property="status" />
  17. <result column="description" jdbcType="VARCHAR" property="description" />
  18. <result column="remark" jdbcType="VARCHAR" property="remark" />
  19. <result column="weixin_open_id" jdbcType="VARCHAR" property="weixinOpenId" />
  20. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  21. <result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
  22. </resultMap>
  23. <sql id="Example_Where_Clause">
  24. <where>
  25. <foreach collection="oredCriteria" item="criteria" separator="or">
  26. <if test="criteria.valid">
  27. <trim prefix="(" prefixOverrides="and" suffix=")">
  28. <foreach collection="criteria.criteria" item="criterion">
  29. <choose>
  30. <when test="criterion.noValue">
  31. and ${criterion.condition}
  32. </when>
  33. <when test="criterion.singleValue">
  34. and ${criterion.condition} #{criterion.value}
  35. </when>
  36. <when test="criterion.betweenValue">
  37. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  38. </when>
  39. <when test="criterion.listValue">
  40. and ${criterion.condition}
  41. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  42. #{listItem}
  43. </foreach>
  44. </when>
  45. </choose>
  46. </foreach>
  47. </trim>
  48. </if>
  49. </foreach>
  50. </where>
  51. </sql>
  52. <sql id="Update_By_Example_Where_Clause">
  53. <where>
  54. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  55. <if test="criteria.valid">
  56. <trim prefix="(" prefixOverrides="and" suffix=")">
  57. <foreach collection="criteria.criteria" item="criterion">
  58. <choose>
  59. <when test="criterion.noValue">
  60. and ${criterion.condition}
  61. </when>
  62. <when test="criterion.singleValue">
  63. and ${criterion.condition} #{criterion.value}
  64. </when>
  65. <when test="criterion.betweenValue">
  66. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  67. </when>
  68. <when test="criterion.listValue">
  69. and ${criterion.condition}
  70. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  71. #{listItem}
  72. </foreach>
  73. </when>
  74. </choose>
  75. </foreach>
  76. </trim>
  77. </if>
  78. </foreach>
  79. </where>
  80. </sql>
  81. <sql id="Base_Column_List">
  82. id, username, login_name, password, leader_flag, position, department, email, phonenum,
  83. ismanager, isystem, status, description, remark, weixin_open_id, tenant_id, delete_flag
  84. </sql>
  85. <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.UserExample" resultMap="BaseResultMap">
  86. select
  87. <if test="distinct">
  88. distinct
  89. </if>
  90. <include refid="Base_Column_List" />
  91. from jsh_user
  92. <if test="_parameter != null">
  93. <include refid="Example_Where_Clause" />
  94. </if>
  95. <if test="orderByClause != null">
  96. order by ${orderByClause}
  97. </if>
  98. </select>
  99. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  100. select
  101. <include refid="Base_Column_List" />
  102. from jsh_user
  103. where id = #{id,jdbcType=BIGINT}
  104. </select>
  105. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  106. delete from jsh_user
  107. where id = #{id,jdbcType=BIGINT}
  108. </delete>
  109. <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.UserExample">
  110. delete from jsh_user
  111. <if test="_parameter != null">
  112. <include refid="Example_Where_Clause" />
  113. </if>
  114. </delete>
  115. <insert id="insert" parameterType="com.jsh.erp.datasource.entities.User">
  116. insert into jsh_user (id, username, login_name,
  117. password, leader_flag, position,
  118. department, email, phonenum,
  119. ismanager, isystem, status,
  120. description, remark, weixin_open_id,
  121. tenant_id, delete_flag)
  122. values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR},
  123. #{password,jdbcType=VARCHAR}, #{leaderFlag,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
  124. #{department,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{phonenum,jdbcType=VARCHAR},
  125. #{ismanager,jdbcType=TINYINT}, #{isystem,jdbcType=TINYINT}, #{status,jdbcType=TINYINT},
  126. #{description,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{weixinOpenId,jdbcType=VARCHAR},
  127. #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
  128. </insert>
  129. <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.User">
  130. insert into jsh_user
  131. <trim prefix="(" suffix=")" suffixOverrides=",">
  132. <if test="id != null">
  133. id,
  134. </if>
  135. <if test="username != null">
  136. username,
  137. </if>
  138. <if test="loginName != null">
  139. login_name,
  140. </if>
  141. <if test="password != null">
  142. password,
  143. </if>
  144. <if test="leaderFlag != null">
  145. leader_flag,
  146. </if>
  147. <if test="position != null">
  148. position,
  149. </if>
  150. <if test="department != null">
  151. department,
  152. </if>
  153. <if test="email != null">
  154. email,
  155. </if>
  156. <if test="phonenum != null">
  157. phonenum,
  158. </if>
  159. <if test="ismanager != null">
  160. ismanager,
  161. </if>
  162. <if test="isystem != null">
  163. isystem,
  164. </if>
  165. <if test="status != null">
  166. status,
  167. </if>
  168. <if test="description != null">
  169. description,
  170. </if>
  171. <if test="remark != null">
  172. remark,
  173. </if>
  174. <if test="weixinOpenId != null">
  175. weixin_open_id,
  176. </if>
  177. <if test="tenantId != null">
  178. tenant_id,
  179. </if>
  180. <if test="deleteFlag != null">
  181. delete_flag,
  182. </if>
  183. </trim>
  184. <trim prefix="values (" suffix=")" suffixOverrides=",">
  185. <if test="id != null">
  186. #{id,jdbcType=BIGINT},
  187. </if>
  188. <if test="username != null">
  189. #{username,jdbcType=VARCHAR},
  190. </if>
  191. <if test="loginName != null">
  192. #{loginName,jdbcType=VARCHAR},
  193. </if>
  194. <if test="password != null">
  195. #{password,jdbcType=VARCHAR},
  196. </if>
  197. <if test="leaderFlag != null">
  198. #{leaderFlag,jdbcType=VARCHAR},
  199. </if>
  200. <if test="position != null">
  201. #{position,jdbcType=VARCHAR},
  202. </if>
  203. <if test="department != null">
  204. #{department,jdbcType=VARCHAR},
  205. </if>
  206. <if test="email != null">
  207. #{email,jdbcType=VARCHAR},
  208. </if>
  209. <if test="phonenum != null">
  210. #{phonenum,jdbcType=VARCHAR},
  211. </if>
  212. <if test="ismanager != null">
  213. #{ismanager,jdbcType=TINYINT},
  214. </if>
  215. <if test="isystem != null">
  216. #{isystem,jdbcType=TINYINT},
  217. </if>
  218. <if test="status != null">
  219. #{status,jdbcType=TINYINT},
  220. </if>
  221. <if test="description != null">
  222. #{description,jdbcType=VARCHAR},
  223. </if>
  224. <if test="remark != null">
  225. #{remark,jdbcType=VARCHAR},
  226. </if>
  227. <if test="weixinOpenId != null">
  228. #{weixinOpenId,jdbcType=VARCHAR},
  229. </if>
  230. <if test="tenantId != null">
  231. #{tenantId,jdbcType=BIGINT},
  232. </if>
  233. <if test="deleteFlag != null">
  234. #{deleteFlag,jdbcType=VARCHAR},
  235. </if>
  236. </trim>
  237. </insert>
  238. <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.UserExample" resultType="java.lang.Long">
  239. select count(*) from jsh_user
  240. <if test="_parameter != null">
  241. <include refid="Example_Where_Clause" />
  242. </if>
  243. </select>
  244. <update id="updateByExampleSelective" parameterType="map">
  245. update jsh_user
  246. <set>
  247. <if test="record.id != null">
  248. id = #{record.id,jdbcType=BIGINT},
  249. </if>
  250. <if test="record.username != null">
  251. username = #{record.username,jdbcType=VARCHAR},
  252. </if>
  253. <if test="record.loginName != null">
  254. login_name = #{record.loginName,jdbcType=VARCHAR},
  255. </if>
  256. <if test="record.password != null">
  257. password = #{record.password,jdbcType=VARCHAR},
  258. </if>
  259. <if test="record.leaderFlag != null">
  260. leader_flag = #{record.leaderFlag,jdbcType=VARCHAR},
  261. </if>
  262. <if test="record.position != null">
  263. position = #{record.position,jdbcType=VARCHAR},
  264. </if>
  265. <if test="record.department != null">
  266. department = #{record.department,jdbcType=VARCHAR},
  267. </if>
  268. <if test="record.email != null">
  269. email = #{record.email,jdbcType=VARCHAR},
  270. </if>
  271. <if test="record.phonenum != null">
  272. phonenum = #{record.phonenum,jdbcType=VARCHAR},
  273. </if>
  274. <if test="record.ismanager != null">
  275. ismanager = #{record.ismanager,jdbcType=TINYINT},
  276. </if>
  277. <if test="record.isystem != null">
  278. isystem = #{record.isystem,jdbcType=TINYINT},
  279. </if>
  280. <if test="record.status != null">
  281. status = #{record.status,jdbcType=TINYINT},
  282. </if>
  283. <if test="record.description != null">
  284. description = #{record.description,jdbcType=VARCHAR},
  285. </if>
  286. <if test="record.remark != null">
  287. remark = #{record.remark,jdbcType=VARCHAR},
  288. </if>
  289. <if test="record.weixinOpenId != null">
  290. weixin_open_id = #{record.weixinOpenId,jdbcType=VARCHAR},
  291. </if>
  292. <if test="record.tenantId != null">
  293. tenant_id = #{record.tenantId,jdbcType=BIGINT},
  294. </if>
  295. <if test="record.deleteFlag != null">
  296. delete_flag = #{record.deleteFlag,jdbcType=VARCHAR},
  297. </if>
  298. </set>
  299. <if test="_parameter != null">
  300. <include refid="Update_By_Example_Where_Clause" />
  301. </if>
  302. </update>
  303. <update id="updateByExample" parameterType="map">
  304. update jsh_user
  305. set id = #{record.id,jdbcType=BIGINT},
  306. username = #{record.username,jdbcType=VARCHAR},
  307. login_name = #{record.loginName,jdbcType=VARCHAR},
  308. password = #{record.password,jdbcType=VARCHAR},
  309. leader_flag = #{record.leaderFlag,jdbcType=VARCHAR},
  310. position = #{record.position,jdbcType=VARCHAR},
  311. department = #{record.department,jdbcType=VARCHAR},
  312. email = #{record.email,jdbcType=VARCHAR},
  313. phonenum = #{record.phonenum,jdbcType=VARCHAR},
  314. ismanager = #{record.ismanager,jdbcType=TINYINT},
  315. isystem = #{record.isystem,jdbcType=TINYINT},
  316. status = #{record.status,jdbcType=TINYINT},
  317. description = #{record.description,jdbcType=VARCHAR},
  318. remark = #{record.remark,jdbcType=VARCHAR},
  319. weixin_open_id = #{record.weixinOpenId,jdbcType=VARCHAR},
  320. tenant_id = #{record.tenantId,jdbcType=BIGINT},
  321. delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
  322. <if test="_parameter != null">
  323. <include refid="Update_By_Example_Where_Clause" />
  324. </if>
  325. </update>
  326. <update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.User">
  327. update jsh_user
  328. <set>
  329. <if test="username != null">
  330. username = #{username,jdbcType=VARCHAR},
  331. </if>
  332. <if test="loginName != null">
  333. login_name = #{loginName,jdbcType=VARCHAR},
  334. </if>
  335. <if test="password != null">
  336. password = #{password,jdbcType=VARCHAR},
  337. </if>
  338. <if test="leaderFlag != null">
  339. leader_flag = #{leaderFlag,jdbcType=VARCHAR},
  340. </if>
  341. <if test="position != null">
  342. position = #{position,jdbcType=VARCHAR},
  343. </if>
  344. <if test="department != null">
  345. department = #{department,jdbcType=VARCHAR},
  346. </if>
  347. <if test="email != null">
  348. email = #{email,jdbcType=VARCHAR},
  349. </if>
  350. <if test="phonenum != null">
  351. phonenum = #{phonenum,jdbcType=VARCHAR},
  352. </if>
  353. <if test="ismanager != null">
  354. ismanager = #{ismanager,jdbcType=TINYINT},
  355. </if>
  356. <if test="isystem != null">
  357. isystem = #{isystem,jdbcType=TINYINT},
  358. </if>
  359. <if test="status != null">
  360. status = #{status,jdbcType=TINYINT},
  361. </if>
  362. <if test="description != null">
  363. description = #{description,jdbcType=VARCHAR},
  364. </if>
  365. <if test="remark != null">
  366. remark = #{remark,jdbcType=VARCHAR},
  367. </if>
  368. <if test="weixinOpenId != null">
  369. weixin_open_id = #{weixinOpenId,jdbcType=VARCHAR},
  370. </if>
  371. <if test="tenantId != null">
  372. tenant_id = #{tenantId,jdbcType=BIGINT},
  373. </if>
  374. <if test="deleteFlag != null">
  375. delete_flag = #{deleteFlag,jdbcType=VARCHAR},
  376. </if>
  377. </set>
  378. where id = #{id,jdbcType=BIGINT}
  379. </update>
  380. <update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.User">
  381. update jsh_user
  382. set username = #{username,jdbcType=VARCHAR},
  383. login_name = #{loginName,jdbcType=VARCHAR},
  384. password = #{password,jdbcType=VARCHAR},
  385. leader_flag = #{leaderFlag,jdbcType=VARCHAR},
  386. position = #{position,jdbcType=VARCHAR},
  387. department = #{department,jdbcType=VARCHAR},
  388. email = #{email,jdbcType=VARCHAR},
  389. phonenum = #{phonenum,jdbcType=VARCHAR},
  390. ismanager = #{ismanager,jdbcType=TINYINT},
  391. isystem = #{isystem,jdbcType=TINYINT},
  392. status = #{status,jdbcType=TINYINT},
  393. description = #{description,jdbcType=VARCHAR},
  394. remark = #{remark,jdbcType=VARCHAR},
  395. weixin_open_id = #{weixinOpenId,jdbcType=VARCHAR},
  396. tenant_id = #{tenantId,jdbcType=BIGINT},
  397. delete_flag = #{deleteFlag,jdbcType=VARCHAR}
  398. where id = #{id,jdbcType=BIGINT}
  399. </update>
  400. <select id="creatorSpinnerList" resultType="com.jsh.erp.datasource.vo.SpinnerVO">
  401. SELECT
  402. id AS label,
  403. username AS VALUE
  404. FROM
  405. jsh_user
  406. </select>
  407. </mapper>