SysDeptMapper.xml 15 KB

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