CheckRulesDao.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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.ourwill.module.house.dao.daily.CheckRulesDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.CheckRules" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="uuid" property="uuid"/>
  7. <result column="c_id" property="cId"/>
  8. <result column="c_time" property="cTime"/>
  9. <result column="u_id" property="uId"/>
  10. <result column="u_time" property="uTime"/>
  11. <result column="version" property="version"/>
  12. <result column="checkrule_name" property="checkRuleName"/>
  13. <result column="checkrule_author" property="checkRuleAuthor"/>
  14. <result column="checkrule_date" property="checkRuleDate"/>
  15. <result column="checkrule_grain_id" property="checkRuleGrainId"/>
  16. <result column="checkrule_grain_name" property="checkRuleGrainName"/>
  17. <result column="checkrule_post_code" property="checkRulePostCode"/>
  18. <result column="checkrule_post_name" property="checkRulePostName"/>
  19. <result column="checkrule_startdate" property="checkRuleStartDate"/>
  20. <result column="checkrule_enddate" property="checkRuleEndDate"/>
  21. <result column="checkrule_used" property="checkRuleUsed"/>
  22. <result column="checkrule_domain" property="checkRuleDomain"/>
  23. <result column="checkrule_unit" property="checkRuleUnit"/>
  24. <result column="checkrule_number" property="checkRuleNumber"/>
  25. </resultMap>
  26. <sql id="columns">
  27. id,
  28. checkrule_name,
  29. checkrule_author,
  30. checkrule_date,
  31. checkrule_grain_id,
  32. checkrule_grain_name,
  33. checkrule_post_code,
  34. checkrule_post_name,
  35. checkrule_startdate,
  36. checkrule_enddate,
  37. checkrule_used,
  38. checkrule_domain,
  39. checkrule_unit,
  40. checkrule_number,
  41. uuid,
  42. c_time,
  43. c_id,
  44. u_time,
  45. u_id,
  46. version
  47. </sql>
  48. <sql id="joinCols">
  49. </sql>
  50. <select id="get" resultMap="baseMap">
  51. SELECT
  52. <include refid="columns"/>
  53. FROM checkrules a
  54. <include refid="joinCols"/>
  55. WHERE a.id = #{id}
  56. </select>
  57. <select id="getByUuid" resultMap="baseMap">
  58. SELECT
  59. <include refid="columns"/>
  60. FROM checkrules a
  61. <include refid="joinCols"/>
  62. WHERE a.uuid = #{uuid}
  63. </select>
  64. <select id="findList" resultMap="baseMap">
  65. SELECT
  66. <include refid="columns"/>
  67. FROM checkrules a
  68. <include refid="joinCols"/>
  69. <where>
  70. <if test="id !=null">
  71. and id = #{id}
  72. </if>
  73. <if test="checkRuleName !=null">
  74. and checkrule_name = #{checkRuleName}
  75. </if>
  76. <if test="checkRuleAuthor !=null">
  77. and checkrule_author = #{checkRuleAuthor}
  78. </if>
  79. <if test="checkRuleDate !=null">
  80. and checkrule_date = #{checkRuleDate}
  81. </if>
  82. <if test="checkRuleGrainId !=null">
  83. and checkrule_grain_id = #{checkRuleGrainId}
  84. </if>
  85. <if test="checkRuleGrainName !=null">
  86. and checkrule_grain_name = #{checkRuleGrainName}
  87. </if>
  88. <if test="checkRulePostCode !=null">
  89. and checkrule_post_code = #{checkRulePostCode}
  90. </if>
  91. <if test="checkRulePostName !=null">
  92. and checkrule_post_name = #{checkRulePostName}
  93. </if>
  94. <if test="checkRuleStartDate !=null">
  95. and checkrule_startdate = #{checkRuleStartDate}
  96. </if>
  97. <if test="checkRuleEndDate !=null">
  98. and checkrule_enddate = #{checkRuleEndDate}
  99. </if>
  100. <if test="checkRuleUsed !=null">
  101. and checkrule_used = #{checkRuleUsed}
  102. </if>
  103. <if test="checkRuleDomain !=null">
  104. and checkrule_domain = #{checkRuleDomain}
  105. </if>
  106. <if test="checkRuleUnit !=null">
  107. and checkrule_unit = #{checkRuleUnit}
  108. </if>
  109. <if test="checkRuleNumber !=null">
  110. and checkrule_number = #{checkRuleNumber}
  111. </if>
  112. <if test="cTime !=null">
  113. and c_time = #{cTime}
  114. </if>
  115. <if test="cId !=null">
  116. and c_id = #{cId}
  117. </if>
  118. <if test="uTime !=null">
  119. and u_time = #{uTime}
  120. </if>
  121. <if test="uId !=null">
  122. and u_id = #{uId}
  123. </if>
  124. <if test="version !=null">
  125. and version = #{version}
  126. </if>
  127. </where>
  128. <choose>
  129. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  130. ORDER BY ${page.orderBy}
  131. </when>
  132. <otherwise>
  133. </otherwise>
  134. </choose>
  135. </select>
  136. <select id="findBkList" resultMap="baseMap">
  137. SELECT
  138. <include refid="columns"/>
  139. FROM checkrules a
  140. <include refid="joinCols"/>
  141. <where>
  142. <if test="id !=null">
  143. and id = #{id}
  144. </if>
  145. <if test="checkRuleName !=null">
  146. and checkrule_name = #{checkRuleName}
  147. </if>
  148. <if test="checkRuleAuthor !=null">
  149. and checkrule_author = #{checkRuleAuthor}
  150. </if>
  151. <if test="checkRuleDate !=null">
  152. and checkrule_date = #{checkRuleDate}
  153. </if>
  154. <if test="checkRuleGrainId !=null">
  155. and checkrule_grain_id in (SELECT id FROM sys_grain a WHERE parentId = #{checkRuleGrainId} OR parentId IN (SELECT id FROM sys_grain WHERE parentId = #{checkRuleGrainId} AND NAME LIKE '%库外储粮%'))
  156. </if>
  157. <if test="checkRuleGrainName !=null">
  158. and checkrule_grain_name = #{checkRuleGrainName}
  159. </if>
  160. <if test="checkRulePostCode !=null">
  161. and checkrule_post_code = #{checkRulePostCode}
  162. </if>
  163. <if test="checkRulePostName !=null">
  164. and checkrule_post_name = #{checkRulePostName}
  165. </if>
  166. <if test="checkRuleStartDate !=null">
  167. and checkrule_startdate = #{checkRuleStartDate}
  168. </if>
  169. <if test="checkRuleEndDate !=null">
  170. and checkrule_enddate = #{checkRuleEndDate}
  171. </if>
  172. <if test="checkRuleUsed !=null">
  173. and checkrule_used = #{checkRuleUsed}
  174. </if>
  175. <if test="checkRuleDomain !=null">
  176. and checkrule_domain = #{checkRuleDomain}
  177. </if>
  178. <if test="checkRuleUnit !=null">
  179. and checkrule_unit = #{checkRuleUnit}
  180. </if>
  181. <if test="checkRuleNumber !=null">
  182. and checkrule_number = #{checkRuleNumber}
  183. </if>
  184. <if test="cTime !=null">
  185. and c_time = #{cTime}
  186. </if>
  187. <if test="cId !=null">
  188. and c_id = #{cId}
  189. </if>
  190. <if test="uTime !=null">
  191. and u_time = #{uTime}
  192. </if>
  193. <if test="uId !=null">
  194. and u_id = #{uId}
  195. </if>
  196. <if test="version !=null">
  197. and version = #{version}
  198. </if>
  199. </where>
  200. <choose>
  201. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  202. ORDER BY ${page.orderBy}
  203. </when>
  204. <otherwise>
  205. </otherwise>
  206. </choose>
  207. </select>
  208. <select id="getTreeList" resultMap="baseMap">
  209. SELECT
  210. <include refid="columns"/>
  211. FROM checkrules a
  212. <include refid="joinCols"/>
  213. <where>
  214. <if test="id !=null">
  215. and id = #{id}
  216. </if>
  217. <if test="checkRuleName !=null">
  218. and checkrule_name = #{checkRuleName}
  219. </if>
  220. <if test="checkRuleAuthor !=null">
  221. and checkrule_author = #{checkRuleAuthor}
  222. </if>
  223. <if test="checkRuleDate !=null">
  224. and checkrule_date = #{checkRuleDate}
  225. </if>
  226. <if test="checkRuleGrainId !=null">
  227. and checkrule_grain_id = #{checkRuleGrainId}
  228. </if>
  229. <if test="checkRuleGrainName !=null">
  230. and checkrule_grain_name = #{checkRuleGrainName}
  231. </if>
  232. <if test="checkRulePostCode !=null">
  233. and checkrule_post_code = #{checkRulePostCode}
  234. </if>
  235. <if test="checkRulePostName !=null">
  236. and checkrule_post_name = #{checkRulePostName}
  237. </if>
  238. <if test="checkRuleStartDate !=null">
  239. and checkrule_startdate = #{checkRuleStartDate}
  240. </if>
  241. <if test="checkRuleEndDate !=null">
  242. and checkrule_enddate = #{checkRuleEndDate}
  243. </if>
  244. <if test="checkRuleUsed !=null">
  245. and checkrule_used = #{checkRuleUsed}
  246. </if>
  247. <if test="checkRuleDomain !=null">
  248. and checkrule_domain = #{checkRuleDomain}
  249. </if>
  250. <if test="checkRuleUnit !=null">
  251. and checkrule_unit = #{checkRuleUnit}
  252. </if>
  253. <if test="checkRuleNumber !=null">
  254. and checkrule_number = #{checkRuleNumber}
  255. </if>
  256. <if test="cTime !=null">
  257. and c_time = #{cTime}
  258. </if>
  259. <if test="cId !=null">
  260. and c_id = #{cId}
  261. </if>
  262. <if test="uTime !=null">
  263. and u_time = #{uTime}
  264. </if>
  265. <if test="uId !=null">
  266. and u_id = #{uId}
  267. </if>
  268. <if test="version !=null">
  269. and version = #{version}
  270. </if>
  271. </where>
  272. </select>
  273. <select id="getBkTreeList" resultMap="baseMap">
  274. SELECT
  275. <include refid="columns"/>
  276. FROM checkrules a
  277. <include refid="joinCols"/>
  278. <where>
  279. <if test="id !=null">
  280. and id = #{id}
  281. </if>
  282. <if test="checkRuleName !=null">
  283. and checkrule_name = #{checkRuleName}
  284. </if>
  285. <if test="checkRuleAuthor !=null">
  286. and checkrule_author = #{checkRuleAuthor}
  287. </if>
  288. <if test="checkRuleDate !=null">
  289. and checkrule_date = #{checkRuleDate}
  290. </if>
  291. <if test="checkRuleGrainId !=null">
  292. and checkrule_grain_id in (SELECT id FROM sys_grain a WHERE parentId = #{checkRuleGrainId} OR parentId IN (SELECT id FROM sys_grain WHERE parentId = #{checkRuleGrainId} AND NAME LIKE '%库外储粮%'))
  293. </if>
  294. <if test="checkRuleGrainName !=null">
  295. and checkrule_grain_name = #{checkRuleGrainName}
  296. </if>
  297. <if test="checkRulePostCode !=null">
  298. and checkrule_post_code = #{checkRulePostCode}
  299. </if>
  300. <if test="checkRulePostName !=null">
  301. and checkrule_post_name = #{checkRulePostName}
  302. </if>
  303. <if test="checkRuleStartDate !=null">
  304. and checkrule_startdate = #{checkRuleStartDate}
  305. </if>
  306. <if test="checkRuleEndDate !=null">
  307. and checkrule_enddate = #{checkRuleEndDate}
  308. </if>
  309. <if test="checkRuleUsed !=null">
  310. and checkrule_used = #{checkRuleUsed}
  311. </if>
  312. <if test="checkRuleDomain !=null">
  313. and checkrule_domain = #{checkRuleDomain}
  314. </if>
  315. <if test="checkRuleUnit !=null">
  316. and checkrule_unit = #{checkRuleUnit}
  317. </if>
  318. <if test="checkRuleNumber !=null">
  319. and checkrule_number = #{checkRuleNumber}
  320. </if>
  321. <if test="cTime !=null">
  322. and c_time = #{cTime}
  323. </if>
  324. <if test="cId !=null">
  325. and c_id = #{cId}
  326. </if>
  327. <if test="uTime !=null">
  328. and u_time = #{uTime}
  329. </if>
  330. <if test="uId !=null">
  331. and u_id = #{uId}
  332. </if>
  333. <if test="version !=null">
  334. and version = #{version}
  335. </if>
  336. </where>
  337. </select>
  338. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  339. parameterType="cn.ourwill.module.house.entity.daily.CheckDomain">
  340. INSERT INTO checkrules
  341. <trim prefix="(" suffix=")" suffixOverrides=",">
  342. <if test=" id != null">
  343. id,
  344. </if>
  345. <if test=" uuid != null">
  346. uuid,
  347. </if>
  348. <if test=" checkRuleName != null">
  349. checkrule_name,
  350. </if>
  351. <if test=" checkRuleAuthor != null">
  352. checkrule_author,
  353. </if>
  354. <if test=" checkRuleDate != null">
  355. checkrule_date,
  356. </if>
  357. <if test=" checkRuleGrainId != null">
  358. checkrule_grain_id,
  359. </if>
  360. <if test=" checkRuleGrainName != null">
  361. checkrule_grain_name,
  362. </if>
  363. <if test=" checkRulePostCode != null">
  364. checkrule_post_code,
  365. </if>
  366. <if test=" checkRulePostName != null">
  367. checkrule_post_name,
  368. </if>
  369. <if test=" checkRuleStartDate != null">
  370. checkrule_startdate,
  371. </if>
  372. <if test=" checkRuleEndDate != null">
  373. checkrule_enddate,
  374. </if>
  375. <if test=" checkRuleUsed != null">
  376. checkrule_used,
  377. </if>
  378. <if test=" checkRuleDomain != null">
  379. checkrule_domain,
  380. </if>
  381. <if test=" checkRuleUnit != null">
  382. checkrule_unit,
  383. </if>
  384. <if test=" checkRuleNumber != null">
  385. checkrule_number,
  386. </if>
  387. <if test=" cTime != null">
  388. c_time,
  389. </if>
  390. <if test=" cId != null">
  391. c_id,
  392. </if>
  393. <if test=" uTime != null">
  394. u_time,
  395. </if>
  396. <if test=" uId != null">
  397. u_id,
  398. </if>
  399. <if test=" version != null">
  400. version
  401. </if>
  402. </trim>
  403. <trim prefix="values (" suffix=")" suffixOverrides=",">
  404. <if test=" id != null">
  405. #{id},
  406. </if>
  407. <if test=" uuid != null">
  408. #{uuid},
  409. </if>
  410. <if test=" checkRuleName != null">
  411. #{checkRuleName},
  412. </if>
  413. <if test=" checkRuleAuthor != null">
  414. #{checkRuleAuthor},
  415. </if>
  416. <if test=" checkRuleDate != null">
  417. #{checkRuleDate},
  418. </if>
  419. <if test=" checkRuleGrainId != null">
  420. #{checkRuleGrainId},
  421. </if>
  422. <if test=" checkRuleGrainName != null">
  423. #{checkRuleGrainName},
  424. </if>
  425. <if test=" checkRulePostCode != null">
  426. #{checkRulePostCode},
  427. </if>
  428. <if test=" checkRulePostName != null">
  429. #{checkRulePostName},
  430. </if>
  431. <if test=" checkRuleStartDate != null">
  432. #{checkRuleStartDate},
  433. </if>
  434. <if test=" checkRuleEndDate != null">
  435. #{checkRuleEndDate},
  436. </if>
  437. <if test=" checkRuleUsed != null">
  438. #{checkRuleUsed},
  439. </if>
  440. <if test=" checkRuleDomain != null">
  441. #{checkRuleDomain},
  442. </if>
  443. <if test=" checkRuleUnit != null">
  444. #{checkRuleUnit},
  445. </if>
  446. <if test=" checkRuleNumber != null">
  447. #{checkRuleNumber},
  448. </if>
  449. <if test=" cTime != null">
  450. #{cTime},
  451. </if>
  452. <if test=" cId != null">
  453. #{cId},
  454. </if>
  455. <if test=" uTime != null">
  456. #{uTime},
  457. </if>
  458. <if test=" uId != null">
  459. #{uId},
  460. </if>
  461. <if test=" version != null">
  462. #{version}
  463. </if>
  464. </trim>
  465. </insert>
  466. <update id="update" parameterType="cn.ourwill.module.house.entity.daily.CheckDomain">
  467. UPDATE checkrules
  468. <set>
  469. <if test=" checkRuleName != null">
  470. checkrule_name = #{checkRuleName},
  471. </if>
  472. <if test=" checkRuleAuthor != null">
  473. checkrule_author = #{checkRuleAuthor},
  474. </if>
  475. <if test=" checkRuleDate != null">
  476. checkrule_date = #{checkRuleDate},
  477. </if>
  478. <if test=" checkRuleGrainId != null">
  479. checkrule_grain_id = #{checkRuleGrainId},
  480. </if>
  481. <if test=" checkRuleGrainName != null">
  482. checkrule_grain_name = #{checkRuleGrainName},
  483. </if>
  484. <if test=" checkRulePostCode != null">
  485. checkrule_post_code = #{checkRulePostCode},
  486. </if>
  487. <if test=" checkRulePostName != null">
  488. checkrule_post_name = #{checkRulePostName},
  489. </if>
  490. <if test=" checkRuleStartDate != null">
  491. checkrule_startdate = #{checkRuleStartDate},
  492. </if>
  493. <if test=" checkRuleEndDate != null">
  494. checkrule_enddate = #{checkRuleEndDate},
  495. </if>
  496. <if test=" checkRuleUsed != null">
  497. checkrule_used = #{checkRuleUsed},
  498. </if>
  499. <if test=" checkRuleDomain != null">
  500. checkrule_domain = #{checkRuleDomain},
  501. </if>
  502. <if test=" checkRuleUnit != null">
  503. checkrule_unit = #{checkRuleUnit},
  504. </if>
  505. <if test=" checkRuleNumber != null">
  506. checkrule_number = #{checkRuleNumber},
  507. </if>
  508. <if test="cTime != null">
  509. c_time= #{cTime} ,
  510. </if>
  511. <if test="cId != null">
  512. c_id= #{cId} ,
  513. </if>
  514. <if test="uTime != null">
  515. u_time= #{uTime} ,
  516. </if>
  517. <if test="uId != null">
  518. u_id= #{uId} ,
  519. </if>
  520. <if test="version != null">
  521. version= #{version}
  522. </if>
  523. </set>
  524. WHERE id = #{id}
  525. </update>
  526. <delete id="deleteById" parameterType="java.lang.Long">
  527. DELETE FROM checkrules
  528. WHERE id = #{id}
  529. </delete>
  530. <delete id="deleteByIds" parameterType="java.util.List">
  531. DELETE FROM checkrules WHERE id IN
  532. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  533. #{item}
  534. </foreach>
  535. </delete>
  536. </mapper>