SysDeptMapper.xml 15 KB

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