RecordDeviceGetDao.xml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188
  1. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  2. <mapper namespace="cn.ourwill.module.house.dao.dm.RecordDeviceGetDao">
  3. <resultMap type="cn.ourwill.module.house.entity.dm.RecordDeviceGet" id="baseMap">
  4. <result column="id" property="id"/>
  5. <result column="uuid" property="uuid"/>
  6. <result column="grain_id" property="grainId"/>
  7. <result column="house_id" property="houseId"/>
  8. <result column="get_man" property="getMan"/>
  9. <result column="get_number" property="getNumber"/>
  10. <result column="back_number" property="backNumber"/>
  11. <result column="bookkeeper" property="bookkeeper"/>
  12. <result column="handler" property="handler"/>
  13. <result column="number" property="number"/>
  14. <result column="unit" property="unit"/>
  15. <result column="collator" property="collator"/>
  16. <result column="get_time" property="getTime"/>
  17. <result column="device_describe" property="deviceDescribe"/>
  18. <result column="remark" property="remark"/>
  19. <result column="c_id" property="cId"/>
  20. <result column="c_time" property="cTime"/>
  21. <result column="u_id" property="uId"/>
  22. <result column="u_time" property="uTime"/>
  23. <result column="model_uuid" property="modelUuid"/>
  24. <result column="other_house" property="otherHouse"/>
  25. <result column="device_id_of" property="device_id_of"/>
  26. <result column="workingStatus" property="workingStatus"/>
  27. <result column="grain_type" property="grain_type"/>
  28. <result column="pro_num" property="pro_num"/>
  29. <result column="department_head" property="departmentHead"/>
  30. <result column="leaders_in_charge" property="leadersInCharge"/>
  31. <result column="employer" property="employer"/>
  32. <result column="responsible_department_head" property="responsibleDepartmentHead"/>
  33. <result column="retrieval_department" property="retrievalDepartment"/>
  34. <result column="amount" property="amount"/>
  35. <result column="unit_price" property="unitPrice"/>
  36. <result column="application_department" property="applicationDepartment"/>
  37. <result column="applicant" property="applicant"/>
  38. <result column="application_reason" property="applicationReason"/>
  39. <result column="department_heads" property="departmentHeads"/>
  40. <result column="leadership_opinions" property="leadershipOpinions"/>
  41. <result column="normal_boot" property="normalBoot"/>
  42. <result column="normal_operation" property="normalOperation"/>
  43. <result column="clean_and_tidy" property="cleanAndTidy"/>
  44. <result column="fixed_asset_number" property="fixedAssetNumber"/>
  45. </resultMap>
  46. <resultMap type="cn.ourwill.module.house.entity.dm.RecordDeviceGet" id="mapOfFind" extends="baseMap">
  47. <result column="name" property="grainName"/>
  48. <result column="namee" property="grainName1"/>
  49. <result column="house_name" property="houseName"/>
  50. <result column="device_name" property="deviceName"/>
  51. <result column="device_model" property="deviceModel"/>
  52. <result column="device_kind" property="device_kind"/>
  53. <result column="grain_get_id" property="grainGetId"/>
  54. <result column="house_name" property="houseName"/>
  55. <result column="device_no" property="deviceNo"/>
  56. <result column="model_uuid" property="modelUuid"/>
  57. <result column="status_repair" property="statusRepair"/>
  58. <result column="return_time" property="returnTime"/>
  59. </resultMap>
  60. <sql id="columns">
  61. a.id ,
  62. a.uuid ,
  63. a.grain_id ,
  64. a.house_id ,
  65. a.get_man ,
  66. a.get_number ,
  67. a.back_number ,
  68. a.bookkeeper ,
  69. a.handler ,
  70. a.`number` ,
  71. a.unit ,
  72. a.collator ,
  73. a.get_time ,
  74. a.device_describe ,
  75. a.unit_price ,
  76. a.remark ,
  77. a.c_id ,
  78. a.c_time ,
  79. a.u_id ,
  80. a.u_time ,
  81. a.model_uuid,
  82. a.grain_get_id,
  83. a.other_house,
  84. a.device_id_of,
  85. a.workingStatus,
  86. a.grain_type,
  87. a.pro_num,
  88. a.amount,
  89. a.department_head,
  90. a.leaders_in_charge
  91. </sql>
  92. <sql id="columnnew">
  93. a.uuid,
  94. a.other_house,
  95. a.grain_id ,
  96. a.house_id ,
  97. a.get_man ,
  98. a.get_number ,
  99. a.back_number ,
  100. a.bookkeeper ,
  101. a.handler ,
  102. a.`number` ,
  103. a.collator ,
  104. a.get_time ,
  105. a.model_uuid,
  106. /*ddm.device_model,*/
  107. a.grain_get_id,
  108. a.device_id_of
  109. </sql>
  110. <sql id="cnew">
  111. /*仓储设备使用单新加字段*/
  112. a.application_department,
  113. a.applicant,
  114. a.application_reason ,
  115. a.department_heads ,
  116. a.leadership_opinions ,
  117. a.normal_boot ,
  118. a.normal_operation ,
  119. a.clean_and_tidy ,
  120. a.fixed_asset_number,
  121. </sql>
  122. <sql id="columsOfFind">
  123. sg.name ,
  124. ddm.device_name ,
  125. ddm.device_model ,
  126. ddm.device_kind,
  127. </sql>
  128. <sql id="columsOfFindds">
  129. ddm.device_name ,
  130. ddm.device_model ,
  131. ddm.device_kind,
  132. </sql>
  133. <sql id="columsOfFinds">
  134. sg.name AS grain_name1,
  135. ddm.device_name ,
  136. ddm.device_model ,
  137. ddm.device_kind,
  138. </sql>
  139. <sql id="columnssnew">
  140. c.house_name,
  141. </sql>
  142. <sql id="columnss">
  143. d.name AS namee,
  144. c.house_name,
  145. </sql>
  146. <sql id="columndd">
  147. dd.device_no,
  148. dd.asset_number,
  149. </sql>
  150. <sql id="joinCols">
  151. </sql>
  152. <select id="get" resultMap="baseMap">
  153. SELECT
  154. <include refid="columns"/>
  155. FROM record_device_get a
  156. <include refid="joinCols"/>
  157. WHERE a.id = #{id}
  158. </select>
  159. <select id="getDetailsById" resultMap="mapOfFind">
  160. SELECT
  161. house_name,
  162. a.other_house,
  163. a.employer,
  164. a.retrieval_department,
  165. a.responsible_department_head,
  166. <include refid="columsOfFind"/>
  167. <include refid="columns"/>
  168. FROM record_device_get a
  169. left join dm_device_model ddm on a.model_uuid = ddm.uuid
  170. left join sys_grain sg on sg.id = a.grain_id
  171. left join house_info hf on a.house_id=hf.id
  172. <include refid="joinCols"/>
  173. WHERE a.id = #{id}
  174. </select>
  175. <select id="getborrowList" resultMap="mapOfFind">
  176. SELECT
  177. hf.house_name,
  178. dd.device_no,
  179. a.other_house,
  180. <include refid="columsOfFind"/>
  181. <include refid="columns"/>
  182. FROM record_device_get a
  183. left join dm_device_model ddm on a.model_uuid = ddm.uuid
  184. left join sys_grain sg on sg.id = a.grain_id
  185. left join house_info hf on a.house_id=hf.id
  186. left join device_get_log dgl on dgl.get_uuid=a.uuid
  187. left JOIN dm_device dd on dd.uuid=dgl.device_uuid
  188. <include refid="joinCols"/>
  189. WHERE a.id = #{id}
  190. </select>
  191. <select id="getReturnList" resultMap="mapOfFind">
  192. SELECT
  193. hf.house_name,
  194. rdb.get_uuid,
  195. rdb.collator,
  196. rdb.bookkeeper,
  197. rdb.return_time,
  198. rdb.status_repair,
  199. rdb.device_no,
  200. a.other_house,
  201. <include refid="columsOfFind"/>
  202. <include refid="columns"/>
  203. FROM
  204. record_device_get a
  205. LEFT JOIN sys_grain sg ON sg.id = a.grain_id
  206. LEFT JOIN house_info hf ON a.house_id = hf.id
  207. LEFT JOIN dm_device_model ddm ON a.model_uuid = ddm.uuid
  208. LEFT JOIN record_device_back rdb ON rdb.get_uuid = a.uuid
  209. WHERE a.id = #{id} and a.back_number<![CDATA[ <> ]]>'0'
  210. </select>
  211. <!-- <select id="getReturnList" resultMap="mapOfFind">
  212. SELECT
  213. rdb.collator,
  214. rdb.bookkeeper,
  215. rdb.return_time
  216. FROM record_device_back rdb
  217. LEFT JOIN record_device_get a on rdb.get_uuid=a.uuid
  218. WHERE a.id = #{id}
  219. </select>
  220. <select id="getDeviceInfoList" resultMap="mapOfFind">
  221. SELECT
  222. sg.name,
  223. hf.house_name,
  224. dd.device_no,
  225. dd.status_repair,
  226. ddm.device_name,
  227. ddm.device_model
  228. FROM record_device_get a
  229. left join dm_device_model ddm on a.model_uuid = ddm.uuid
  230. left join sys_grain sg on sg.id = a.grain_id
  231. left join house_info hf on a.house_id=hf.id
  232. left join dm_device dd on dd.get_uuid=a.uuid
  233. WHERE a.id = #{id} AND dd.status_repair in (0,2)
  234. </select>-->
  235. <select id="getByUuid" resultMap="baseMap">
  236. SELECT
  237. <include refid="columns"/>
  238. FROM record_device_get a
  239. <include refid="joinCols"/>
  240. WHERE a.uuid = #{uuid}
  241. </select>
  242. <select id="getModelUuid" resultMap="baseMap">
  243. SELECT
  244. <include refid="columsOfFindds"/>
  245. <include refid="columns"/>
  246. FROM record_device_get a
  247. left join dm_device_model ddm on a.model_uuid = ddm.uuid
  248. <include refid="joinCols"/>
  249. WHERE uuid=#{modelUuid}
  250. </select>
  251. <select id="getIdName" resultType="java.lang.String" parameterType="java.lang.String">
  252. SELECT name FROM sys_grain WHERE id=#{grainGetId}
  253. </select>
  254. <select id="getDeviceGetList" resultType="java.lang.Double" parameterType="java.lang.String">
  255. SELECT
  256. SUM(a.get_number)
  257. FROM record_device_get a
  258. left join dm_device_model ddm on a.model_uuid = ddm.uuid
  259. left join sys_grain sg on sg.id = a.grain_id
  260. WHERE a.grain_id = #{grainId}
  261. AND ddm.device_name = #{deviceName}
  262. AND ddm.device_model = #{deviceModel}
  263. </select>
  264. <select id="findList" resultMap="mapOfFind">
  265. SELECT
  266. DISTINCT a.id ,
  267. <include refid="columsOfFinds"/>
  268. <include refid="columnssnew"/>
  269. <include refid="columndd"/>
  270. <include refid="columnnew"/>
  271. FROM record_device_get a
  272. /* LEFT JOIN house_info c ON c.id = a.house_id
  273. left join dm_device_model ddm on a.model_uuid = ddm.uuid
  274. left join sys_grain sg on sg.id = a.grain_id
  275. LEFT JOIN sys_grain d ON d.id = (
  276. SELECT
  277. grain_id
  278. FROM
  279. dm_device_model
  280. WHERE
  281. uuid = a.model_uuid
  282. )*/
  283. LEFT JOIN house_info c ON c.id = a.house_id
  284. LEFT JOIN (select dm.uuid,dm.device_name,
  285. dm.device_model,
  286. dm.device_kind from dm_device_model dm) ddm ON a.model_uuid = ddm.uuid
  287. LEFT JOIN (
  288. SELECT
  289. d.device_no,
  290. d.model_uuid as mouuid,
  291. d.get_uuid,
  292. d.asset_number
  293. FROM
  294. dm_device d
  295. ) dd ON ddm.uuid = dd.mouuid AND dd.get_uuid=a.uuid
  296. LEFT JOIN (select s.`name`,s.id,s.parentId from sys_grain s) sg ON sg.id = a.grain_id
  297. <include refid="joinCols"/>
  298. <where>
  299. <if test="grainId !=null">
  300. and a.grain_id = #{grainId}
  301. </if>
  302. <if test="cityId !=null">
  303. and sg.parentId = #{cityId}
  304. </if>
  305. <if test="houseId !=null">
  306. and a.house_id = #{houseId}
  307. </if>
  308. <if test="deviceName !=null and deviceName!=''">
  309. and ddm.device_name = #{deviceName}
  310. </if>
  311. <if test="deviceModel !=null and deviceModel!=''">
  312. and ddm.device_model = #{deviceModel}
  313. </if>
  314. <if test="device_kind!=null and device_kind!=''">
  315. and ddm.device_kind=#{device_kind}
  316. </if>
  317. <if test="deviceNo!=null and deviceNo!=''">
  318. and dd.device_no=#{deviceNo}
  319. </if>
  320. <if test="grainGetId!=null and grainGetId!=''">
  321. and a.grain_get_id=#{grainGetId}
  322. </if>
  323. <if test="getTime !=null">
  324. and a.get_time like CONCAT('%',#{getTime},'%')
  325. </if>
  326. </where>
  327. <choose>
  328. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  329. ORDER BY ${page.orderBy}
  330. </when>
  331. <otherwise>
  332. ORDER BY get_time desc
  333. </otherwise>
  334. </choose>
  335. </select>
  336. <select id="findDeviceList" resultMap="mapOfFind">
  337. SELECT DISTINCT
  338. a.id,
  339. sg. NAME AS grain_name1,
  340. ddm.device_name,
  341. ddm.device_model,
  342. ddm.device_kind,
  343. c.house_name,
  344. dd.device_no,
  345. dd.asset_number,
  346. a.uuid,
  347. a.other_house,
  348. a.grain_id,
  349. a.house_id,
  350. a.get_man,
  351. a.get_number,
  352. a.back_number,
  353. a.bookkeeper,
  354. a. HANDLER,
  355. a.`number`,
  356. a.collator,
  357. a.get_time,
  358. a.model_uuid,
  359. /*ddm.device_model,*/
  360. a.grain_get_id,
  361. a.device_id_of
  362. FROM
  363. record_device_get a
  364. LEFT JOIN
  365. house_info c ON c.id = a.house_id
  366. LEFT JOIN
  367. dm_device_model ddm ON a.model_uuid = ddm.uuid
  368. LEFT JOIN
  369. dm_device dd ON ddm.uuid = dd.model_uuid
  370. AND dd.get_uuid = a.uuid
  371. LEFT JOIN
  372. sys_grain sg ON sg.id = a.grain_id
  373. <include refid="joinCols"/>
  374. <where>
  375. <if test="grainId !=null">
  376. and a.grain_id = #{grainId}
  377. </if>
  378. <if test="cityId !=null">
  379. and sg.parentId = #{cityId}
  380. </if>
  381. <if test="houseId !=null">
  382. and a.house_id = #{houseId}
  383. </if>
  384. <if test="deviceName !=null and deviceName!=''">
  385. and ddm.device_name = #{deviceName}
  386. </if>
  387. <if test="deviceModel !=null and deviceModel!=''">
  388. and ddm.device_model = #{deviceModel}
  389. </if>
  390. <!--<if test="device_kind!=null and device_kind!=''">-->
  391. and ddm.device_kind=1
  392. <!-- </if>-->
  393. <if test="deviceNo!=null and deviceNo!=''">
  394. and dd.device_no=#{deviceNo}
  395. </if>
  396. <if test="grainGetId!=null and grainGetId!=''">
  397. and a.grain_get_id=#{grainGetId}
  398. </if>
  399. <if test="getTime !=null">
  400. and a.get_time like CONCAT('%',#{getTime},'%')
  401. </if>
  402. </where>
  403. <choose>
  404. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  405. ORDER BY ${page.orderBy}
  406. </when>
  407. <otherwise>
  408. ORDER BY a.get_time desc
  409. </otherwise>
  410. </choose>
  411. </select>
  412. <select id="findMaterialList" resultMap="mapOfFind">
  413. SELECT DISTINCT
  414. a.id,
  415. sg. NAME AS grain_name1,
  416. ddm.device_name,
  417. ddm.device_model,
  418. ddm.device_kind,
  419. c.house_name,
  420. dd.device_no,
  421. dd.asset_number,
  422. a.uuid,
  423. a.other_house,
  424. a.grain_id,
  425. a.house_id,
  426. a.get_man,
  427. a.get_number,
  428. a.back_number,
  429. a.bookkeeper,
  430. a. HANDLER,
  431. a.`number`,
  432. a.collator,
  433. a.get_time,
  434. a.model_uuid,
  435. /*ddm.device_model,*/
  436. a.grain_get_id,
  437. a.device_id_of
  438. FROM
  439. record_device_get a
  440. LEFT JOIN
  441. house_info c ON c.id = a.house_id
  442. LEFT JOIN
  443. dm_device_model ddm ON a.model_uuid = ddm.uuid
  444. LEFT JOIN
  445. dm_device dd ON ddm.uuid = dd.model_uuid
  446. AND dd.get_uuid = a.uuid
  447. LEFT JOIN
  448. sys_grain sg ON sg.id = a.grain_id
  449. <include refid="joinCols"/>
  450. <where>
  451. <if test="grainId !=null">
  452. and a.grain_id = #{grainId}
  453. </if>
  454. <if test="cityId !=null">
  455. and sg.parentId = #{cityId}
  456. </if>
  457. <if test="houseId !=null">
  458. and a.house_id = #{houseId}
  459. </if>
  460. <if test="deviceName !=null and deviceName!=''">
  461. and ddm.device_name = #{deviceName}
  462. </if>
  463. <if test="deviceModel !=null and deviceModel!=''">
  464. and ddm.device_model = #{deviceModel}
  465. </if>
  466. <!--<if test="device_kind!=null and device_kind!=''">-->
  467. and ddm.device_kind!=1
  468. <!-- </if>-->
  469. <if test="deviceNo!=null and deviceNo!=''">
  470. and dd.device_no=#{deviceNo}
  471. </if>
  472. <if test="grainGetId!=null and grainGetId!=''">
  473. and a.grain_get_id=#{grainGetId}
  474. </if>
  475. <if test="getTime !=null">
  476. and a.get_time like CONCAT('%',#{getTime},'%')
  477. </if>
  478. </where>
  479. GROUP BY a.id
  480. <choose>
  481. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  482. ORDER BY ${page.orderBy}
  483. </when>
  484. <otherwise>
  485. ORDER BY get_time desc
  486. </otherwise>
  487. </choose>
  488. </select>
  489. <select id="findAllList" resultMap="mapOfFind">
  490. SELECT
  491. <include refid="columsOfFind"/>
  492. <include refid="columns"/>
  493. FROM record_device_get a
  494. left join dm_device_model ddm on a.model_uuid = ddm.uuid
  495. left join sys_grain sg on sg.id = a.grain_id
  496. <include refid="joinCols"/>
  497. <where>
  498. <if test="id !=null">
  499. and a.id = #{id}
  500. </if>
  501. <if test="uuid !=null">
  502. and a.uuid = #{uuid}
  503. </if>
  504. <if test="grainId !=null">
  505. and a.grain_id = #{grainId}
  506. </if>
  507. <if test="houseId !=null">
  508. and a.house_id = #{houseId}
  509. </if>
  510. <if test="getMan !=null">
  511. and a.get_man = #{getMan}
  512. </if>
  513. <if test="deviceName !=null">
  514. and ddm.device_name = #{deviceName}
  515. </if>
  516. <if test="deviceModel !=null">
  517. and dm.device_model = #{deviceModel}
  518. </if>
  519. <if test="getNumber !=null">
  520. and a.get_number = #{getNumber}
  521. </if>
  522. <if test="backNumber !=null">
  523. and a.back_number = #{backNumber}
  524. </if>
  525. <if test="bookkeeper !=null">
  526. and a.bookkeeper = #{bookkeeper}
  527. </if>
  528. <if test="handler !=null">
  529. and a.handler = #{handler}
  530. </if>
  531. <if test="number !=null">
  532. and a.`number` = #{number}
  533. </if>
  534. <if test="unit !=null">
  535. and a.unit = #{unit}
  536. </if>
  537. <if test="collator !=null">
  538. and a.collator = #{collator}
  539. </if>
  540. <if test="getTime !=null">
  541. and a.get_time = #{getTime}
  542. </if>
  543. <if test="deviceDescribe !=null">
  544. and a.device_describe = #{deviceDescribe}
  545. </if>
  546. <if test="remark !=null">
  547. and a.remark = #{remark}
  548. </if>
  549. <if test="cId !=null">
  550. and a.c_id = #{cId}
  551. </if>
  552. <if test="cTime !=null">
  553. and a.c_time = #{cTime}
  554. </if>
  555. <if test="uId !=null">
  556. and a.u_id = #{uId}
  557. </if>
  558. <if test="uTime !=null">
  559. and a.u_time = #{uTime}
  560. </if>
  561. <if test="modelUuid !=null">
  562. and a.model_uuid = #{modelUuid}
  563. </if>
  564. <if test="departmentHead !=null">
  565. and a.department_head = #{departmentHead}
  566. </if>
  567. <if test="leadersInCharge !=null">
  568. and a.leaders_in_charge = #{leadersInCharge}
  569. </if>
  570. <if test="employer !=null">
  571. and a.employer = #{employer}
  572. </if>
  573. <if test="responsibleDepartmentHead !=null">
  574. and a.responsible_department_head = #{responsibleDepartmentHead}
  575. </if>
  576. <if test="retrievalDepartment !=null">
  577. and a.retrieval_department = #{retrievalDepartment}
  578. </if>
  579. <if test="amount !=null">
  580. and a.amount = #{amount}
  581. </if>
  582. <if test="unitPrice !=null">
  583. and a.unit_price = #{unitPrice}
  584. </if>
  585. <if test="applicationDepartment !=null">
  586. and a.application_department = #{applicationDepartment}
  587. </if>
  588. <if test="applicant !=null">
  589. and a.applicant = #{applicant}
  590. </if>
  591. <if test="applicationReason !=null">
  592. and a.application_reason = #{applicationReason}
  593. </if>
  594. <if test="departmentHeads !=null">
  595. and a.department_heads = #{departmentHeads}
  596. </if>
  597. <if test="leadershipOpinions !=null">
  598. and a.leadership_opinions = #{leadershipOpinions}
  599. </if>
  600. <if test="normalBoot !=null">
  601. and a.normal_boot = #{normalBoot}
  602. </if>
  603. <if test="normalOperation !=null">
  604. and a.normal_operation = #{normalOperation}
  605. </if>
  606. <if test="cleanAndTidy !=null">
  607. and a.clean_and_tidy = #{cleanAndTidy}
  608. </if>
  609. <if test="fixedAssetNumber !=null">
  610. and a.fixed_asset_number = #{fixedAssetNumber}
  611. </if>
  612. </where>
  613. <choose>
  614. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  615. ORDER BY ${page.orderBy}
  616. </when>
  617. <otherwise>
  618. </otherwise>
  619. </choose>
  620. </select>
  621. <select id="selectSumGetNumber" resultType="java.lang.Double">
  622. SELECT sum(get_number) FROM record_device_get WHERE model_uuid=#{modelUuid} ORDER BY c_time ASC LIMIT 1
  623. </select>
  624. <select id="selectPaymentNumber" resultType="java.lang.Double">
  625. SELECT number from daily_record_payment ORDER BY id DESC LIMIT 1
  626. </select>
  627. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  628. parameterType="cn.ourwill.module.house.entity.dm.RecordDeviceGet">
  629. INSERT INTO record_device_get
  630. <trim prefix="(" suffix=")" suffixOverrides=",">
  631. <if test=" id != null">
  632. id,
  633. </if>
  634. <if test="uuid !=null">
  635. uuid,
  636. </if>
  637. <if test=" grainId != null">
  638. grain_id,
  639. </if>
  640. <if test="houseId !=null">
  641. house_id,
  642. </if>
  643. <if test="getMan !=null">
  644. get_man,
  645. </if>
  646. <if test=" getNumber != null">
  647. get_number,
  648. </if>
  649. <if test=" backNumber != null">
  650. back_number,
  651. </if>
  652. <if test=" bookkeeper != null">
  653. bookkeeper,
  654. </if>
  655. <if test=" handler != null">
  656. handler,
  657. </if>
  658. <if test=" number != null">
  659. `number`,
  660. </if>
  661. <if test=" unit != null">
  662. unit,
  663. </if>
  664. <if test=" collator != null">
  665. collator,
  666. </if>
  667. <if test=" getTime != null">
  668. get_time,
  669. </if>
  670. <if test=" deviceDescribe != null">
  671. device_describe,
  672. </if>
  673. <if test=" remark != null">
  674. remark,
  675. </if>
  676. <if test=" cId != null">
  677. c_id,
  678. </if>
  679. <if test=" cTime != null">
  680. c_time,
  681. </if>
  682. <if test=" uId != null">
  683. u_id,
  684. </if>
  685. <if test=" uTime != null">
  686. u_time,
  687. </if>
  688. <if test="modelUuid !=null">
  689. model_uuid,
  690. </if>
  691. <if test="grainGetId!=null and grainGetId!=''">
  692. grain_get_id,
  693. </if>
  694. <if test="otherHouse !=null">
  695. other_house,
  696. </if>
  697. <if test="device_id_of !=null">
  698. device_id_of,
  699. </if>
  700. <if test="workingStatus !=null">
  701. workingStatus,
  702. </if>
  703. <if test="grain_type !=null">
  704. grain_type,
  705. </if>
  706. <if test="pro_num !=null and pro_num!=''">
  707. pro_num,
  708. </if>
  709. <if test="departmentHead !=null">
  710. department_head,
  711. </if>
  712. <if test="leadersInCharge !=null">
  713. leaders_in_charge,
  714. </if>
  715. <if test="employer !=null">
  716. employer,
  717. </if>
  718. <if test="responsibleDepartmentHead !=null">
  719. responsible_department_head,
  720. </if>
  721. <if test="retrievalDepartment !=null">
  722. retrieval_department,
  723. </if>
  724. <if test="amount !=null">
  725. amount,
  726. </if>
  727. <if test="unitPrice !=null">
  728. unit_price,
  729. </if>
  730. <if test="applicationDepartment !=null">
  731. application_department ,
  732. </if>
  733. <if test="applicant !=null">
  734. applicant,
  735. </if>
  736. <if test="applicationReason !=null">
  737. application_reason,
  738. </if>
  739. <if test="departmentHeads !=null">
  740. department_heads,
  741. </if>
  742. <if test="leadershipOpinions !=null">
  743. leadership_opinions ,
  744. </if>
  745. <if test="normalBoot !=null">
  746. normal_boot ,
  747. </if>
  748. <if test="normalOperation !=null">
  749. normal_operation ,
  750. </if>
  751. <if test="cleanAndTidy !=null">
  752. clean_and_tidy,
  753. </if>
  754. <if test="fixedAssetNumber !=null">
  755. fixed_asset_number
  756. </if>
  757. </trim>
  758. <trim prefix="values (" suffix=")" suffixOverrides=",">
  759. <if test=" id != null">
  760. #{id},
  761. </if>
  762. <if test="uuid !=null">
  763. #{uuid},
  764. </if>
  765. <if test=" grainId != null">
  766. #{grainId},
  767. </if>
  768. <if test="houseId !=null">
  769. #{houseId},
  770. </if>
  771. <if test="getMan !=null">
  772. #{getMan},
  773. </if>
  774. <if test=" getNumber != null">
  775. #{getNumber},
  776. </if>
  777. <if test=" backNumber != null">
  778. #{backNumber},
  779. </if>
  780. <if test=" bookkeeper != null">
  781. #{bookkeeper},
  782. </if>
  783. <if test=" handler != null">
  784. #{handler},
  785. </if>
  786. <if test=" number != null">
  787. #{number},
  788. </if>
  789. <if test=" unit != null">
  790. #{unit},
  791. </if>
  792. <if test=" collator != null">
  793. #{collator},
  794. </if>
  795. <if test=" getTime != null">
  796. #{getTime},
  797. </if>
  798. <if test=" deviceDescribe != null">
  799. #{deviceDescribe},
  800. </if>
  801. <if test=" remark != null">
  802. #{remark},
  803. </if>
  804. <if test=" cId != null">
  805. #{cId},
  806. </if>
  807. <if test=" cTime != null">
  808. #{cTime},
  809. </if>
  810. <if test="uId != null">
  811. #{uId} ,
  812. </if>
  813. <if test="uTime != null">
  814. #{uTime} ,
  815. </if>
  816. <if test="modelUuid !=null">
  817. #{modelUuid},
  818. </if>
  819. <if test="grainGetId!=null and grainGetId!=''">
  820. #{grainGetId},
  821. </if>
  822. <if test="otherHouse !=null">
  823. #{otherHouse},
  824. </if>
  825. <if test="device_id_of !=null">
  826. #{device_id_of},
  827. </if>
  828. <if test="workingStatus !=null">
  829. #{workingStatus},
  830. </if>
  831. <if test="grain_type !=null">
  832. #{grain_type},
  833. </if>
  834. <if test="pro_num !=null and pro_num!=''">
  835. #{pro_num},
  836. </if>
  837. <if test="departmentHead !=null">
  838. #{departmentHead},
  839. </if>
  840. <if test="leadersInCharge !=null">
  841. #{leadersInCharge},
  842. </if>
  843. <if test="employer !=null">
  844. #{employer},
  845. </if>
  846. <if test="responsibleDepartmentHead !=null">
  847. #{responsibleDepartmentHead},
  848. </if>
  849. <if test="retrievalDepartment !=null">
  850. #{retrievalDepartment},
  851. </if>
  852. <if test="amount !=null">
  853. #{amount},
  854. </if>
  855. <if test="unitPrice !=null">
  856. #{unitPrice},
  857. </if>
  858. <if test="applicationDepartment !=null">
  859. #{applicationDepartment},
  860. </if>
  861. <if test="applicant !=null">
  862. #{applicant},
  863. </if>
  864. <if test="applicationReason !=null">
  865. #{applicationReason},
  866. </if>
  867. <if test="departmentHeads !=null">
  868. #{departmentHeads},
  869. </if>
  870. <if test="leadershipOpinions !=null">
  871. #{leadershipOpinions},
  872. </if>
  873. <if test="normalBoot !=null">
  874. #{normalBoot},
  875. </if>
  876. <if test="normalOperation !=null">
  877. #{normalOperation},
  878. </if>
  879. <if test="cleanAndTidy !=null">
  880. #{cleanAndTidy},
  881. </if>
  882. <if test="fixedAssetNumber !=null">
  883. #{fixedAssetNumber}
  884. </if>
  885. </trim>
  886. </insert>
  887. <update id="update" parameterType="cn.ourwill.module.house.entity.dm.RecordDeviceGet">
  888. UPDATE record_device_get
  889. <set>
  890. <if test="id != null">
  891. id= #{id} ,
  892. </if>
  893. <if test="uuid !=null">
  894. uuid = #{uuid} ,
  895. </if>
  896. <if test="grainId != null">
  897. grain_id= #{grainId} ,
  898. </if>
  899. <if test="houseId !=null">
  900. house_id = #{houseId} ,
  901. </if>
  902. <if test="getMan !=null">
  903. get_man = #{getMan} ,
  904. </if>
  905. <if test="deviceName != null">
  906. device_name= #{deviceName} ,
  907. </if>
  908. <if test="deviceModel != null">
  909. device_model= #{deviceModel} ,
  910. </if>
  911. <if test="getNumber != null">
  912. get_number= #{getNumber} ,
  913. </if>
  914. <if test="backNumber != null">
  915. back_number= #{backNumber} ,
  916. </if>
  917. <if test="bookkeeper != null">
  918. bookkeeper= #{bookkeeper} ,
  919. </if>
  920. <if test="handler != null">
  921. handler= #{handler} ,
  922. </if>
  923. <if test="number != null">
  924. `number`= #{number} ,
  925. </if>
  926. <if test="unit != null">
  927. unit= #{unit} ,
  928. </if>
  929. <if test="collator != null">
  930. collator= #{collator} ,
  931. </if>
  932. <if test="getTime != null">
  933. get_time= #{getTime} ,
  934. </if>
  935. <if test="deviceDescribe != null">
  936. device_describe= #{deviceDescribe} ,
  937. </if>
  938. <if test="remark != null">
  939. remark= #{remark} ,
  940. </if>
  941. <if test="cId != null">
  942. c_id= #{cId} ,
  943. </if>
  944. <if test="cTime != null">
  945. c_time= #{cTime} ,
  946. </if>
  947. <if test="uId != null">
  948. u_id= #{uId} ,
  949. </if>
  950. <if test="uTime != null">
  951. u_time= #{uTime} ,
  952. </if>
  953. <if test="modelUuid !=null">
  954. model_uuid = #{modelUuid},
  955. </if>
  956. <if test="device_id_of !=null">
  957. device_id_of = #{device_id_of},
  958. </if>
  959. <if test="workingStatus !=null">
  960. workingStatus = #{workingStatus},
  961. </if>
  962. <if test="grain_type !=null">
  963. grain_type = #{grain_type},
  964. </if>
  965. <if test="pro_num !=null and pro_num!=''">
  966. pro_num = #{pro_num},
  967. </if>
  968. <if test="departmentHead !=null">
  969. department_head = #{departmentHead},
  970. </if>
  971. <if test="leadersInCharge !=null">
  972. leaders_in_charge = #{leadersInCharge},
  973. </if>
  974. <if test="employer !=null">
  975. employer = #{employer},
  976. </if>
  977. <if test="responsibleDepartmentHead !=null">
  978. responsible_department_head = #{responsibleDepartmentHead},
  979. </if>
  980. <if test="retrievalDepartment !=null">
  981. retrieval_department = #{retrievalDepartment},
  982. </if>
  983. <if test="amount !=null">
  984. amount = #{amount},
  985. </if>
  986. <if test="unitPrice !=null">
  987. unit_price = #{unitPrice},
  988. </if>
  989. <if test="applicationDepartment !=null">
  990. application_department = #{applicationDepartment},
  991. </if>
  992. <if test="applicant !=null">
  993. applicant = #{applicant},
  994. </if>
  995. <if test="applicationReason !=null">
  996. application_reason = #{applicationReason},
  997. </if>
  998. <if test="departmentHeads !=null">
  999. department_heads = #{departmentHeads},
  1000. </if>
  1001. <if test="leadershipOpinions !=null">
  1002. leadership_opinions = #{leadershipOpinions},
  1003. </if>
  1004. <if test="normalBoot !=null">
  1005. normal_boot = #{normalBoot},
  1006. </if>
  1007. <if test="normalOperation !=null">
  1008. normal_operation = #{normalOperation},
  1009. </if>
  1010. <if test="cleanAndTidy !=null">
  1011. clean_and_tidy = #{cleanAndTidy},
  1012. </if>
  1013. <if test="fixedAssetNumber !=null">
  1014. and a.fixed_asset_number = #{fixedAssetNumber}
  1015. </if>
  1016. </set>
  1017. WHERE id = #{id}
  1018. </update>
  1019. <update id="updateByUuid" parameterType="cn.ourwill.module.house.entity.dm.RecordDeviceGet">
  1020. UPDATE record_device_get
  1021. <set>
  1022. <if test="uuid !=null">
  1023. uuid = #{uuid} ,
  1024. </if>
  1025. <if test="grainId != null">
  1026. grain_id= #{grainId} ,
  1027. </if>
  1028. <if test="houseId !=null">
  1029. house_id = #{houseId} ,
  1030. </if>
  1031. <if test="getMan !=null">
  1032. get_man = #{getMan} ,
  1033. </if>
  1034. <if test="deviceName != null">
  1035. device_name= #{deviceName} ,
  1036. </if>
  1037. <if test="deviceModel != null">
  1038. device_model= #{deviceModel} ,
  1039. </if>
  1040. <if test="getNumber != null">
  1041. get_number= #{getNumber} ,
  1042. </if>
  1043. <if test="backNumber != null">
  1044. back_number= #{backNumber} ,
  1045. </if>
  1046. <if test="bookkeeper != null">
  1047. bookkeeper= #{bookkeeper} ,
  1048. </if>
  1049. <if test="handler != null">
  1050. handler= #{handler} ,
  1051. </if>
  1052. <if test="number != null">
  1053. `number`= #{number} ,
  1054. </if>
  1055. <if test="unit != null">
  1056. unit= #{unit} ,
  1057. </if>
  1058. <if test="collator != null">
  1059. collator= #{collator} ,
  1060. </if>
  1061. <if test="getTime != null">
  1062. get_time= #{getTime} ,
  1063. </if>
  1064. <if test="deviceDescribe != null">
  1065. device_describe= #{deviceDescribe} ,
  1066. </if>
  1067. <if test="remark != null">
  1068. remark= #{remark} ,
  1069. </if>
  1070. <if test="cId != null">
  1071. c_id= #{cId} ,
  1072. </if>
  1073. <if test="cTime != null">
  1074. c_time= #{cTime} ,
  1075. </if>
  1076. <if test="uId != null">
  1077. u_id= #{uId} ,
  1078. </if>
  1079. <if test="uTime != null">
  1080. u_time= #{uTime} ,
  1081. </if>
  1082. <if test="modelUuid !=null">
  1083. model_uuid = #{modelUuid},
  1084. </if>
  1085. <if test="device_id_of !=null">
  1086. device_id_of = #{device_id_of},
  1087. </if>
  1088. <if test="workingStatus !=null">
  1089. workingStatus = #{workingStatus},
  1090. </if>
  1091. <if test="grain_type !=null">
  1092. grain_type = #{grain_type},
  1093. </if>
  1094. <if test="pro_num !=null and pro_num!=''">
  1095. pro_num = #{pro_num},
  1096. </if>
  1097. <if test="departmentHead !=null">
  1098. department_head = #{departmentHead},
  1099. </if>
  1100. <if test="leadersInCharge !=null">
  1101. leaders_in_charge = #{leadersInCharge},
  1102. </if>
  1103. <if test="employer !=null">
  1104. employer = #{employer},
  1105. </if>
  1106. <if test="responsibleDepartmentHead !=null">
  1107. responsible_department_head = #{responsibleDepartmentHead},
  1108. </if>
  1109. <if test="retrievalDepartment !=null">
  1110. retrieval_department = #{retrievalDepartment},
  1111. </if>
  1112. <if test="amount !=null">
  1113. amount = #{amount},
  1114. </if>
  1115. <if test="unitPrice !=null">
  1116. unit_price = #{unitPrice},
  1117. </if>
  1118. <if test="applicationDepartment !=null">
  1119. application_department = #{applicationDepartment},
  1120. </if>
  1121. <if test="applicant !=null">
  1122. applicant = #{applicant},
  1123. </if>
  1124. <if test="applicationReason !=null">
  1125. application_reason = #{applicationReason},
  1126. </if>
  1127. <if test="departmentHeads !=null">
  1128. department_heads = #{departmentHeads},
  1129. </if>
  1130. <if test="leadershipOpinions !=null">
  1131. leadership_opinions = #{leadershipOpinions},
  1132. </if>
  1133. <if test="normalBoot !=null">
  1134. normal_boot = #{normalBoot},
  1135. </if>
  1136. <if test="normalOperation !=null">
  1137. normal_operation = #{normalOperation},
  1138. </if>
  1139. <if test="cleanAndTidy !=null">
  1140. </if>
  1141. <if test="fixedAssetNumber !=null">
  1142. and a.fixed_asset_number = #{fixedAssetNumber}
  1143. </if>
  1144. </set>
  1145. WHERE uuid = #{uuid}
  1146. </update>
  1147. <delete id="deleteById" parameterType="java.lang.Long">
  1148. DELETE FROM record_device_get WHERE id = #{id}
  1149. </delete>
  1150. <delete id="deleteByIds" parameterType="java.util.List">
  1151. DELETE FROM record_device_get WHERE id IN
  1152. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  1153. #{item}
  1154. </foreach>
  1155. </delete>
  1156. </mapper>