CheckRecordsDao.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  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.CheckRecordsDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.CheckRecords" 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="grain_id" property="grainId"/>
  13. <result column="grain_name" property="grainName"/>
  14. <result column="checker" property="checker"/>
  15. <result column="checkdate" property="checkDate"/>
  16. <result column="checkrule_id" property="checkRuleId"/>
  17. <result column="checkrule_uuid" property="checkRuleUuid"/>
  18. <result column="have_approved" property="haveApproved"/>
  19. <result column="have_problems" property="haveProblems"/>
  20. <result column="have_changed" property="haveChanged"/>
  21. <result column="approver" property="approver"/>
  22. <result column="approve_date" property="approveDate"/>
  23. </resultMap>
  24. <sql id="columns">
  25. a.id,
  26. a.uuid,
  27. a.grain_id,
  28. a.grain_name,
  29. a.checker,
  30. a.checkdate,
  31. a.checkrule_id,
  32. a.checkrule_uuid,
  33. a.have_approved,
  34. a.have_problems,
  35. a.have_changed,
  36. a.approver,
  37. a.approve_date
  38. # a.c_time,
  39. # a.c_id,
  40. # a.u_time,
  41. # a.u_id,
  42. # a.version
  43. </sql>
  44. <sql id="joinCols">
  45. </sql>
  46. <select id="get" resultMap="baseMap">
  47. SELECT
  48. <include refid="columns"/>
  49. FROM checkrecords a
  50. <include refid="joinCols"/>
  51. WHERE a.id = #{id}
  52. </select>
  53. <select id="findList" resultMap="baseMap">
  54. SELECT
  55. <include refid="columns"/>
  56. FROM checkrecords a
  57. left join sys_grain sg on sg.id = a.grain_id
  58. <include refid="joinCols"/>
  59. <where>
  60. <if test="id !=null">
  61. and a.id = #{id}
  62. </if>
  63. <if test="uuid !=null">
  64. and a.uuid = #{uuid}
  65. </if>
  66. <if test="grainId !=null">
  67. and a.grain_id = #{grainId}
  68. </if>
  69. <if test="grainName !=null">
  70. and a.grain_name = #{grainName}
  71. </if>
  72. <if test="checker !=null">
  73. and a.checker = #{checker}
  74. </if>
  75. <if test="checkDate !=null">
  76. and a.checkdate = #{checkDate}
  77. </if>
  78. <if test="checkRuleId !=null">
  79. and a.checkrule_id = #{checkRuleId}
  80. </if>
  81. <if test="haveApproved !=null">
  82. and a.have_approved = #{haveApproved}
  83. </if>
  84. <if test="haveProblems !=null">
  85. and a.have_problems = #{haveProblems}
  86. </if>
  87. <if test="haveChanged !=null">
  88. and a.have_changed = #{haveChanged}
  89. </if>
  90. <if test="approver !=null">
  91. and a.approver = #{approver}
  92. </if>
  93. <if test="approveDate !=null">
  94. and a.approve_date = #{approveDate}
  95. </if>
  96. <if test="searchStartDate !=null">
  97. and a.checkdate &gt;= #{searchStartDate}
  98. </if>
  99. <if test="searchEndDate !=null">
  100. and a.checkdate &lt;= #{searchEndDate}
  101. </if>
  102. <if test="cityId !=null">
  103. and sg.parentId = #{cityId}
  104. </if>
  105. <!--<if test="cTime !=null">-->
  106. <!--and c_time = #{cTime}-->
  107. <!--</if>-->
  108. <!--<if test="cId !=null">-->
  109. <!--and c_id = #{cId}-->
  110. <!--</if>-->
  111. <!--<if test="uTime !=null">-->
  112. <!--and u_time = #{uTime}-->
  113. <!--</if>-->
  114. <!--<if test="uId !=null">-->
  115. <!--and u_id = #{uId}-->
  116. <!--</if>-->
  117. <!--<if test="version !=null">-->
  118. <!--and version = #{version}-->
  119. <!--</if>-->
  120. </where>
  121. <choose>
  122. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  123. ORDER BY ${page.orderBy}
  124. </when>
  125. <otherwise>
  126. </otherwise>
  127. </choose>
  128. </select>
  129. <select id="findAllList" resultMap="baseMap">
  130. SELECT
  131. <include refid="columns"/>
  132. FROM checkrecords a
  133. <include refid="joinCols"/>
  134. <where>
  135. <if test="id !=null">
  136. and id = #{id}
  137. </if>
  138. <if test="grainId !=null">
  139. and grain_id = #{grainId}
  140. </if>
  141. <if test="grainName !=null">
  142. and grain_name = #{grainName}
  143. </if>
  144. <if test="checker !=null">
  145. and checker = #{checker}
  146. </if>
  147. <if test="checkDate !=null">
  148. and checkdate = #{checkDate}
  149. </if>
  150. <if test="checkRuleId !=null">
  151. and checkrule_id = #{checkRuleId}
  152. </if>
  153. <if test="checkRuleUuid !=null">
  154. and checkrule_uuid = #{checkRuleUuid}
  155. </if>
  156. <if test="haveApproved !=null">
  157. and have_approved = #{haveApproved}
  158. </if>
  159. <if test="haveProblems !=null">
  160. and have_problems = #{haveProblems}
  161. </if>
  162. <if test="haveChanged !=null">
  163. and have_changed = #{haveChanged}
  164. </if>
  165. <if test="approver !=null">
  166. and approver = #{approver}
  167. </if>
  168. <if test="approveDate !=null">
  169. and approve_date = #{approveDate}
  170. </if>
  171. <if test="cTime !=null">
  172. and c_time = #{cTime}
  173. </if>
  174. <if test="cId !=null">
  175. and c_id = #{cId}
  176. </if>
  177. <if test="uTime !=null">
  178. and u_time = #{uTime}
  179. </if>
  180. <if test="uId !=null">
  181. and u_id = #{uId}
  182. </if>
  183. <if test="version !=null">
  184. and version = #{version}
  185. </if>
  186. </where>
  187. <choose>
  188. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  189. ORDER BY ${page.orderBy}
  190. </when>
  191. <otherwise>
  192. </otherwise>
  193. </choose>
  194. </select>
  195. <select id="getByUuid" resultMap="baseMap">
  196. SELECT
  197. <include refid="columns"/>
  198. FROM checkrecords a
  199. <include refid="joinCols"/>
  200. WHERE a.uuid = #{uuid}
  201. </select>
  202. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  203. parameterType="cn.ourwill.module.house.entity.daily.CheckRecords">
  204. INSERT INTO checkrecords
  205. <trim prefix="(" suffix=")" suffixOverrides=",">
  206. <if test=" id != null">
  207. id,
  208. </if>
  209. <if test=" uuid != null">
  210. uuid,
  211. </if>
  212. <if test=" grainId != null">
  213. grain_id,
  214. </if>
  215. <if test=" grainName != null">
  216. grain_name,
  217. </if>
  218. <if test=" checker != null">
  219. checker,
  220. </if>
  221. <if test=" checkDate != null">
  222. checkdate,
  223. </if>
  224. <if test=" checkRuleId != null">
  225. checkrule_id,
  226. </if>
  227. <if test=" checkRuleUuid != null">
  228. checkrule_uuid,
  229. </if>
  230. <if test=" haveApproved != null">
  231. have_approved,
  232. </if>
  233. <if test=" haveProblems != null">
  234. have_problems,
  235. </if>
  236. <if test=" haveChanged != null">
  237. have_changed,
  238. </if>
  239. <if test=" approver != null">
  240. approver,
  241. </if>
  242. <if test=" approveDate != null">
  243. approve_date,
  244. </if>
  245. <if test=" cTime != null">
  246. c_time,
  247. </if>
  248. <if test=" cId != null">
  249. c_id,
  250. </if>
  251. <if test=" uTime != null">
  252. u_time,
  253. </if>
  254. <if test=" uId != null">
  255. u_id,
  256. </if>
  257. <if test=" version != null">
  258. version
  259. </if>
  260. </trim>
  261. <trim prefix="values (" suffix=")" suffixOverrides=",">
  262. <if test=" id != null">
  263. #{id},
  264. </if>
  265. <if test=" uuid != null">
  266. #{uuid},
  267. </if>
  268. <if test=" grainId != null">
  269. #{grainId},
  270. </if>
  271. <if test=" grainName != null">
  272. #{grainName},
  273. </if>
  274. <if test=" checker != null">
  275. #{checker},
  276. </if>
  277. <if test=" checkDate != null">
  278. #{checkDate},
  279. </if>
  280. <if test=" checkRuleId != null">
  281. #{checkRuleId},
  282. </if>
  283. <if test=" checkRuleUuid != null">
  284. #{checkRuleUuid},
  285. </if>
  286. <if test=" haveApproved != null">
  287. #{haveApproved},
  288. </if>
  289. <if test=" haveProblems != null">
  290. #{haveProblems},
  291. </if>
  292. <if test=" haveChanged != null">
  293. #{haveChanged},
  294. </if>
  295. <if test=" approver != null">
  296. #{approver},
  297. </if>
  298. <if test=" approveDate != null">
  299. #{approveDate},
  300. </if>
  301. <if test=" cTime != null">
  302. #{cTime},
  303. </if>
  304. <if test=" cId != null">
  305. #{cId},
  306. </if>
  307. <if test=" uTime != null">
  308. #{uTime},
  309. </if>
  310. <if test=" uId != null">
  311. #{uId},
  312. </if>
  313. <if test=" version != null">
  314. #{version}
  315. </if>
  316. </trim>
  317. </insert>
  318. <update id="update" parameterType="cn.ourwill.module.house.entity.daily.CheckRecords">
  319. UPDATE checkrecords
  320. <set>
  321. <if test="grainId !=null">
  322. grain_id = #{grainId},
  323. </if>
  324. <if test="grainName !=null">
  325. grain_name = #{grainName},
  326. </if>
  327. <if test="checker !=null">
  328. checker = #{checker},
  329. </if>
  330. <if test="checkDate !=null">
  331. checkdate = #{checkDate},
  332. </if>
  333. <if test="checkRuleId !=null">
  334. checkrule_id = #{checkRuleId},
  335. </if>
  336. <if test="haveApproved !=null">
  337. have_approved = #{haveApproved},,
  338. </if>
  339. <if test="haveProblems !=null">
  340. have_problems = #{haveProblems},
  341. </if>
  342. <if test="haveChanged !=null">
  343. have_changed = #{haveChanged},
  344. </if>
  345. <if test="approver !=null">
  346. approver = #{approver},
  347. </if>
  348. <if test="approveDate !=null">
  349. approve_date = #{approveDate},
  350. </if>
  351. <if test="cTime != null">
  352. c_time= #{cTime} ,
  353. </if>
  354. <if test="cId != null">
  355. c_id= #{cId} ,
  356. </if>
  357. <if test="uTime != null">
  358. u_time= #{uTime} ,
  359. </if>
  360. <if test="uId != null">
  361. u_id= #{uId} ,
  362. </if>
  363. <if test="version != null">
  364. version= #{version}
  365. </if>
  366. </set>
  367. WHERE id = #{id}
  368. </update>
  369. <update id="updateByUuid" parameterType="cn.ourwill.module.house.entity.daily.CheckRecords">
  370. UPDATE checkrecords
  371. <set>
  372. <if test="grainId !=null">
  373. grain_id = #{grainId},
  374. </if>
  375. <if test="grainName !=null">
  376. grain_name = #{grainName},
  377. </if>
  378. <if test="checker !=null">
  379. checker = #{checker},
  380. </if>
  381. <if test="checkDate !=null">
  382. checkdate = #{checkDate},
  383. </if>
  384. <if test="checkRuleId !=null">
  385. checkrule_id = #{checkRuleId},
  386. </if>
  387. <if test="haveApproved !=null">
  388. have_approved = #{haveApproved},,
  389. </if>
  390. <if test="haveProblems !=null">
  391. have_problems = #{haveProblems},
  392. </if>
  393. <if test="haveChanged !=null">
  394. have_changed = #{haveChanged},
  395. </if>
  396. <if test="approver !=null">
  397. approver = #{approver},
  398. </if>
  399. <if test="approveDate !=null">
  400. approve_date = #{approveDate},
  401. </if>
  402. <if test="cTime != null">
  403. c_time= #{cTime} ,
  404. </if>
  405. <if test="cId != null">
  406. c_id= #{cId} ,
  407. </if>
  408. <if test="uTime != null">
  409. u_time= #{uTime} ,
  410. </if>
  411. <if test="uId != null">
  412. u_id= #{uId} ,
  413. </if>
  414. <if test="version != null">
  415. version= #{version}
  416. </if>
  417. </set>
  418. WHERE uuid = #{uuid}
  419. </update>
  420. <delete id="deleteById" parameterType="java.lang.Long">
  421. DELETE FROM checkrecords
  422. WHERE id = #{id}
  423. </delete>
  424. <delete id="deleteByIds" parameterType="java.util.List">
  425. DELETE FROM checkrecords WHERE id IN
  426. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  427. #{item}
  428. </foreach>
  429. </delete>
  430. </mapper>