DailyRecordFoodbasicinfoDao.xml 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  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.DailyRecordFoodbasicinfoDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfo" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="uuid" property="uuid"/>
  7. <result column="record_unite" property="recordUnite"/>
  8. <result column="keep_unite" property="keepUnite"/>
  9. <result column="location_num" property="locationNum"/>
  10. <result column="quality" property="quality"/>
  11. <result column="type" property="type"/>
  12. <result column="htype" property="htype"/>
  13. <result column="number" property="number"/>
  14. <result column="stand_number" property="standNumber"/>
  15. <result column="input_year" property="inputYear"/>
  16. <result column="grow_year" property="growYear"/>
  17. <result column="keep_method" property="keepMethod"/>
  18. <result column="level" property="level"/>
  19. <result column="weight" property="weight"/>
  20. <result column="impurity" property="impurity"/>
  21. <result column="water" property="water"/>
  22. <result column="unsound" property="unsound"/>
  23. <result column="recorder" property="recorder"/>
  24. <result column="house_type" property="houseType"/>
  25. <result column="design_house_capacity" property="designHouseCapacity"/>
  26. <result column="valid_house_capacity" property="validHouseCapacity"/>
  27. <result column="price" property="price"/>
  28. <result column="place_of_origin" property="placeOfOrigin"/>
  29. <result column="storage_location" property="storageLocation"/>
  30. <result column="disperse_capacity" property="disperseCapacity"/>
  31. <result column="length" property="length"/>
  32. <result column="width" property="width"/>
  33. <result column="height" property="height"/>
  34. <result column="pack_num" property="packNum"/>
  35. <result column="pack_average_weight" property="packAverageWeight"/>
  36. <result column="filling_time" property="fillingTime"/>
  37. <result column="c_id" property="cId"/>
  38. <result column="c_time" property="cTime"/>
  39. <result column="u_id" property="uId"/>
  40. <result column="u_time" property="uTime"/>
  41. <result column="version" property="version"/>
  42. <result column="house_id" property="houseId"/>
  43. <result column="plan_num" property="planNum"/>
  44. <result column="responsible_user" property="responsibleUser"/>
  45. <result column="superior_user" property="superiorUser"/>
  46. <result column="line_height" property="lineHeight"/>
  47. <result column="status" property="status"/>
  48. <result column="diameter" property="diameter"/>
  49. <result column="kcvolume" property="kcvolume"/>
  50. <result column="management" property="management"/>
  51. </resultMap>
  52. <sql id="columns">
  53. a.id ,
  54. a.uuid ,
  55. a.record_unite ,
  56. a.keep_unite ,
  57. a.location_num ,
  58. a.quality ,
  59. a.`type` ,
  60. a.htype ,
  61. a.`number` ,
  62. a.stand_number ,
  63. a.input_year ,
  64. a.grow_year ,
  65. a.keep_method ,
  66. a.`level` ,
  67. a.weight ,
  68. a.impurity ,
  69. a.water ,
  70. a.unsound ,
  71. a.recorder ,
  72. a.house_type ,
  73. a.design_house_capacity ,
  74. a.valid_house_capacity ,
  75. a.price ,
  76. a.place_of_origin ,
  77. a.storage_location ,
  78. a.disperse_capacity ,
  79. a.`length` ,
  80. a.width ,
  81. a.height ,
  82. a.pack_num ,
  83. a.pack_average_weight ,
  84. a.filling_time ,
  85. a.c_id ,
  86. a.c_time ,
  87. a.u_id ,
  88. a.u_time ,
  89. a.version ,
  90. a.house_id ,
  91. a.line_height,
  92. a.status,
  93. a.diameter,
  94. a.kcvolume,
  95. a.management
  96. </sql>
  97. <sql id="joinCols">
  98. </sql>
  99. <select id="get" resultMap="baseMap">
  100. SELECT
  101. <include refid="columns"/>
  102. FROM daily_record_foodbasicinfo a
  103. <include refid="joinCols"/>
  104. WHERE a.id = #{id}
  105. </select>
  106. <select id="findList" resultMap="baseMap">
  107. SELECT
  108. <include refid="columns"/>
  109. FROM daily_record_foodbasicinfo a
  110. <if test="cityId !=null">
  111. left join house_info hou on hou.id = a.house_id
  112. left join sys_grain sg on sg.id = hou.grain_id
  113. </if>
  114. <include refid="joinCols"/>
  115. <where>
  116. <if test="cityId !=null">
  117. and sg.parentId = #{cityId}
  118. </if>
  119. <if test="id !=null">
  120. and id = #{id}
  121. </if>
  122. <if test="uuid !=null">
  123. and uuid = #{uuid}
  124. </if>
  125. <if test="recordUnite !=null">
  126. and record_unite = #{recordUnite}
  127. </if>
  128. <if test="keepUnite !=null">
  129. and keep_unite = #{keepUnite}
  130. </if>
  131. <if test="locationNum !=null">
  132. and location_num = #{locationNum}
  133. </if>
  134. <if test="quality !=null">
  135. and quality = #{quality}
  136. </if>
  137. <if test="type !=null">
  138. and `type` = #{type}
  139. </if>
  140. <if test="htype !=null">
  141. and htype = #{htype}
  142. </if>
  143. <if test="number !=null">
  144. and `number` = #{number}
  145. </if>
  146. <if test="standNumber !=null">
  147. and stand_number = #{standNumber}
  148. </if>
  149. <if test="inputYear !=null">
  150. and input_year = #{inputYear}
  151. </if>
  152. <if test="growYear !=null">
  153. and grow_year = #{growYear}
  154. </if>
  155. <if test="keepMethod !=null">
  156. and keep_method = #{keepMethod}
  157. </if>
  158. <if test="level !=null">
  159. and `level` = #{level}
  160. </if>
  161. <if test="weight !=null">
  162. and weight = #{weight}
  163. </if>
  164. <if test="impurity !=null">
  165. and impurity = #{impurity}
  166. </if>
  167. <if test="water !=null">
  168. and water = #{water}
  169. </if>
  170. <if test="unsound !=null">
  171. and unsound = #{unsound}
  172. </if>
  173. <if test="recorder !=null">
  174. and recorder = #{recorder}
  175. </if>
  176. <if test="houseType !=null">
  177. and house_type = #{houseType}
  178. </if>
  179. <if test="designHouseCapacity !=null">
  180. and design_house_capacity = #{designHouseCapacity}
  181. </if>
  182. <if test="validHouseCapacity !=null">
  183. and valid_house_capacity = #{validHouseCapacity}
  184. </if>
  185. <if test="price !=null">
  186. and price = #{price}
  187. </if>
  188. <if test="placeOfOrigin !=null">
  189. and place_of_origin = #{placeOfOrigin}
  190. </if>
  191. <if test="storageLocation !=null">
  192. and storage_location = #{storageLocation}
  193. </if>
  194. <if test="disperseCapacity !=null">
  195. and disperse_capacity = #{disperseCapacity}
  196. </if>
  197. <if test="length !=null">
  198. and `length` = #{length}
  199. </if>
  200. <if test="width !=null">
  201. and width = #{width}
  202. </if>
  203. <if test="height !=null">
  204. and height = #{height}
  205. </if>
  206. <if test="packNum !=null">
  207. and pack_num = #{packNum}
  208. </if>
  209. <if test="packAverageWeight !=null">
  210. and pack_average_weight = #{packAverageWeight}
  211. </if>
  212. <if test="fillingTime !=null">
  213. and filling_time = #{fillingTime}
  214. </if>
  215. <if test="cId !=null">
  216. and c_id = #{cId}
  217. </if>
  218. <if test="cTime !=null">
  219. and c_time = #{cTime}
  220. </if>
  221. <if test="uId !=null">
  222. and u_id = #{uId}
  223. </if>
  224. <if test="uTime !=null">
  225. and u_time = #{uTime}
  226. </if>
  227. <if test="version !=null">
  228. and version = #{version}
  229. </if>
  230. <if test="houseId !=null">
  231. and house_id = #{houseId}
  232. </if>
  233. <if test="lineHeight !=null">
  234. and line_height = #{lineHeight}
  235. </if>
  236. <if test="status !=null">
  237. and status = #{status}
  238. </if>
  239. <if test="diameter !=null">
  240. and diameter = #{diameter}
  241. </if>
  242. <if test="kcvolume !=null">
  243. and kcvolume = #{kcvolume}
  244. </if>
  245. <if test="management !=null">
  246. and management = #{management}
  247. </if>
  248. </where>
  249. <choose>
  250. <when test="page !=null and page.count != null and page.orderBy != null and page.orderBy != ''">
  251. ORDER BY ${page.orderBy}
  252. </when>
  253. <otherwise>
  254. </otherwise>
  255. </choose>
  256. </select>
  257. <select id="findAllList" resultMap="baseMap">
  258. SELECT
  259. <include refid="columns"/>
  260. FROM daily_record_foodbasicinfo a
  261. <include refid="joinCols"/>
  262. <where>
  263. <if test="id !=null">
  264. and id = #{id}
  265. </if>
  266. <if test="uuid !=null">
  267. and uuid = #{uuid}
  268. </if>
  269. <if test="recordUnite !=null">
  270. and record_unite = #{recordUnite}
  271. </if>
  272. <if test="keepUnite !=null">
  273. and keep_unite = #{keepUnite}
  274. </if>
  275. <if test="locationNum !=null">
  276. and location_num = #{locationNum}
  277. </if>
  278. <if test="quality !=null">
  279. and quality = #{quality}
  280. </if>
  281. <if test="type !=null">
  282. and `type` = #{type}
  283. </if>
  284. <if test="htype !=null">
  285. and htype = #{htype}
  286. </if>
  287. <if test="number !=null">
  288. and `number` = #{number}
  289. </if>
  290. <if test="standNumber !=null">
  291. and stand_number = #{standNumber}
  292. </if>
  293. <if test="inputYear !=null">
  294. and input_year = #{inputYear}
  295. </if>
  296. <if test="growYear !=null">
  297. and grow_year = #{growYear}
  298. </if>
  299. <if test="keepMethod !=null">
  300. and keep_method = #{keepMethod}
  301. </if>
  302. <if test="level !=null">
  303. and `level` = #{level}
  304. </if>
  305. <if test="weight !=null">
  306. and weight = #{weight}
  307. </if>
  308. <if test="impurity !=null">
  309. and impurity = #{impurity}
  310. </if>
  311. <if test="water !=null">
  312. and water = #{water}
  313. </if>
  314. <if test="unsound !=null">
  315. and unsound = #{unsound}
  316. </if>
  317. <if test="recorder !=null">
  318. and recorder = #{recorder}
  319. </if>
  320. <if test="houseType !=null">
  321. and house_type = #{houseType}
  322. </if>
  323. <if test="designHouseCapacity !=null">
  324. and design_house_capacity = #{designHouseCapacity}
  325. </if>
  326. <if test="validHouseCapacity !=null">
  327. and valid_house_capacity = #{validHouseCapacity}
  328. </if>
  329. <if test="price !=null">
  330. and price = #{price}
  331. </if>
  332. <if test="placeOfOrigin !=null">
  333. and place_of_origin = #{placeOfOrigin}
  334. </if>
  335. <if test="storageLocation !=null">
  336. and storage_location = #{storageLocation}
  337. </if>
  338. <if test="disperseCapacity !=null">
  339. and disperse_capacity = #{disperseCapacity}
  340. </if>
  341. <if test="length !=null">
  342. and `length` = #{length}
  343. </if>
  344. <if test="width !=null">
  345. and width = #{width}
  346. </if>
  347. <if test="height !=null">
  348. and height = #{height}
  349. </if>
  350. <if test="packNum !=null">
  351. and pack_num = #{packNum}
  352. </if>
  353. <if test="packAverageWeight !=null">
  354. and pack_average_weight = #{packAverageWeight}
  355. </if>
  356. <if test="fillingTime !=null">
  357. and filling_time = #{fillingTime}
  358. </if>
  359. <if test="cId !=null">
  360. and c_id = #{cId}
  361. </if>
  362. <if test="cTime !=null">
  363. and c_time = #{cTime}
  364. </if>
  365. <if test="uId !=null">
  366. and u_id = #{uId}
  367. </if>
  368. <if test="uTime !=null">
  369. and u_time = #{uTime}
  370. </if>
  371. <if test="version !=null">
  372. and version = #{version}
  373. </if>
  374. <if test="houseId !=null">
  375. and house_id = #{houseId}
  376. </if>
  377. <if test="lineHeight !=null">
  378. and line_height = #{lineHeight}
  379. </if>
  380. <if test="status !=null">
  381. and status = #{status}
  382. </if>
  383. <if test="diameter !=null">
  384. and diameter = #{diameter}
  385. </if>
  386. <if test="kcvolume !=null">
  387. and kcvolume = #{kcvolume}
  388. </if>
  389. <if test="management !=null">
  390. and management = #{management}
  391. </if>
  392. </where>
  393. <choose>
  394. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  395. ORDER BY ${page.orderBy}
  396. </when>
  397. <otherwise>
  398. </otherwise>
  399. </choose>
  400. </select>
  401. <resultMap id="StatisticUsed" type="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfo" extends="baseMap">
  402. <result column="houseName" property="houseName"/>
  403. <result column="grainName" property="grainName"/>
  404. <result column="store_num" property="storeNum"/>
  405. <result column="plan_num" property="planNum"/>
  406. <result column="responsible_user" property="responsibleUser"/>
  407. <result column="superior_user" property="superiorUser"/>
  408. <result column="grainType" property="grainType"/>
  409. <result column="sumDesignHouseCapacity" property="sumDesignHouseCapacity"/>
  410. <result column="sumNumber" property="sumNumber"/>
  411. </resultMap>
  412. <select id="findByHouseId" resultMap="StatisticUsed">
  413. select
  414. drf.house_id ,
  415. gra.name as grainName,
  416. hou.house_name as houseName,
  417. drf.Design_house_capacity as sumDesignHouseCapacity,
  418. drf.valid_house_capacity as sumValidHouseCapacity,
  419. drf.house_type ,
  420. drf.type ,
  421. drf.quality ,
  422. drf.level ,
  423. dri.store_num ,
  424. drf.place_of_origin ,
  425. dri.plan_num ,
  426. drf.grow_year,
  427. hk.name as responsible_user,
  428. drt.superior_user
  429. from daily_record_foodbasicinfo drf
  430. left join house_info hou on drf.house_id = hou.id
  431. left join house_keeper_house hkh on drf.house_id = hkh.houseId
  432. left join house_keeper hk on hkh.keeperId = hk.id
  433. left join sys_grain gra on hou.grain_id = gra.id
  434. left join daily_record_inoutput dri on drf.house_id = dri.house_id and (dri.id = (SELECT id from daily_record_inoutput where house_id = dri.house_id order by record_date desc,id desc limit 1))
  435. left join daily_record_transfer drt on drf.house_id = drt.house_id and (drt.id = (select id from daily_record_transfer where house_id = drt.house_id order by trans_time desc,id desc limit 1))
  436. <where>
  437. and drf.htype = '0'
  438. <if test="grainId!=null and grainId!=''">
  439. and gra.id = #{grainId}
  440. </if>
  441. <if test="cityId!=null and cityId!=''">
  442. and gra.parentId = #{cityId}
  443. </if>
  444. <if test="houseId!=null and houseId!=''">
  445. and drf.house_id = #{houseId}
  446. </if>
  447. </where>
  448. order by gra.id,CONCAT(GetNum(hou.house_name),hou.house_name)+0,drf.valid_house_capacity
  449. </select>
  450. <select id="getSumByGrainType" resultMap="StatisticUsed">
  451. select sg.type as grainType,
  452. sum(convert(drf.design_house_capacity, decimal(14,4))) as sumDesignHouseCapacity,
  453. sum(convert(dri.store_num, decimal(14,4)))/1000 as sumNumber
  454. from daily_record_foodbasicinfo drf
  455. left join daily_record_inoutput dri on drf.house_id = dri.house_id
  456. and dri.id = (select id from daily_record_inoutput where house_id = dri.house_id order by record_date desc,id desc limit 1)
  457. left join house_info hou on drf.house_id = hou.id
  458. left join sys_grain sg on sg.id = hou.grain_id
  459. left join sys_dic_data sdd on sdd.id = sg.type
  460. <where>
  461. and drf.htype = '0'
  462. <if test="quailty!=null and quailty!=''">
  463. and drf.quality = #{quailty}
  464. </if>
  465. </where>
  466. group by sg.type
  467. order by sg.type
  468. </select>
  469. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  470. parameterType="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfo">
  471. INSERT INTO daily_record_foodbasicinfo
  472. <trim prefix="(" suffix=")" suffixOverrides=",">
  473. <if test=" id != null">
  474. id,
  475. </if>
  476. <if test=" uuid != null">
  477. uuid,
  478. </if>
  479. <if test=" recordUnite != null">
  480. record_unite,
  481. </if>
  482. <if test=" keepUnite != null">
  483. keep_unite,
  484. </if>
  485. <if test=" locationNum != null">
  486. location_num,
  487. </if>
  488. <if test=" quality != null">
  489. quality,
  490. </if>
  491. <if test=" type != null">
  492. type,
  493. </if>
  494. <if test=" htype != null">
  495. htype,
  496. </if>
  497. <if test=" number != null">
  498. number,
  499. </if>
  500. <if test=" standNumber != null">
  501. stand_number,
  502. </if>
  503. <if test=" inputYear != null">
  504. input_year,
  505. </if>
  506. <if test=" growYear != null">
  507. grow_year,
  508. </if>
  509. <if test=" keepMethod != null">
  510. keep_method,
  511. </if>
  512. <if test=" level != null">
  513. level,
  514. </if>
  515. <if test=" weight != null">
  516. weight,
  517. </if>
  518. <if test=" impurity != null">
  519. impurity,
  520. </if>
  521. <if test=" water != null">
  522. water,
  523. </if>
  524. <if test=" unsound != null">
  525. unsound,
  526. </if>
  527. <if test=" recorder != null">
  528. recorder,
  529. </if>
  530. <if test=" houseType != null">
  531. house_type,
  532. </if>
  533. <if test=" designHouseCapacity != null">
  534. design_house_capacity,
  535. </if>
  536. <if test=" validHouseCapacity != null">
  537. valid_house_capacity,
  538. </if>
  539. <if test=" price != null">
  540. price,
  541. </if>
  542. <if test=" placeOfOrigin != null">
  543. place_of_origin,
  544. </if>
  545. <if test=" storageLocation != null">
  546. storage_location,
  547. </if>
  548. <if test=" disperseCapacity != null">
  549. disperse_capacity,
  550. </if>
  551. <if test=" length != null">
  552. length,
  553. </if>
  554. <if test=" width != null">
  555. width,
  556. </if>
  557. <if test=" height != null">
  558. height,
  559. </if>
  560. <if test=" packNum != null">
  561. pack_num,
  562. </if>
  563. <if test=" packAverageWeight != null">
  564. pack_average_weight,
  565. </if>
  566. <if test=" fillingTime != null">
  567. filling_time,
  568. </if>
  569. <if test=" cId != null">
  570. c_id,
  571. </if>
  572. <if test=" cTime != null">
  573. c_time,
  574. </if>
  575. <if test=" uId != null">
  576. u_id,
  577. </if>
  578. <if test=" uTime != null">
  579. u_time,
  580. </if>
  581. <if test=" version != null">
  582. version,
  583. </if>
  584. <if test=" houseId != null">
  585. house_id,
  586. </if>
  587. <if test="lineHeight !=null">
  588. line_height,
  589. </if>
  590. <if test="status !=null">
  591. status,
  592. </if>
  593. <if test="diameter !=null">
  594. diameter,
  595. </if>
  596. <if test="kcvolume !=null">
  597. kcvolume,
  598. </if>
  599. <if test="management !=null">
  600. management
  601. </if>
  602. </trim>
  603. <trim prefix="values (" suffix=")" suffixOverrides=",">
  604. <if test=" id != null">
  605. #{id}, </if>
  606. <if test=" uuid != null">
  607. #{uuid}, </if>
  608. <if test=" recordUnite != null">
  609. #{recordUnite}, </if>
  610. <if test=" keepUnite != null">
  611. #{keepUnite}, </if>
  612. <if test=" locationNum != null">
  613. #{locationNum}, </if>
  614. <if test=" quality != null">
  615. #{quality}, </if>
  616. <if test=" type != null">
  617. #{type}, </if>
  618. <if test=" htype != null">
  619. #{htype}, </if>
  620. <if test=" number != null">
  621. #{number}, </if>
  622. <if test=" standNumber != null">
  623. #{standNumber}, </if>
  624. <if test=" inputYear != null">
  625. #{inputYear}, </if>
  626. <if test=" growYear != null">
  627. #{growYear}, </if>
  628. <if test=" keepMethod != null">
  629. #{keepMethod}, </if>
  630. <if test=" level != null">
  631. #{level}, </if>
  632. <if test=" weight != null">
  633. #{weight}, </if>
  634. <if test=" impurity != null">
  635. #{impurity}, </if>
  636. <if test=" water != null">
  637. #{water}, </if>
  638. <if test=" unsound != null">
  639. #{unsound}, </if>
  640. <if test=" recorder != null">
  641. #{recorder}, </if>
  642. <if test=" houseType != null">
  643. #{houseType}, </if>
  644. <if test=" designHouseCapacity != null">
  645. #{designHouseCapacity}, </if>
  646. <if test=" validHouseCapacity != null">
  647. #{validHouseCapacity}, </if>
  648. <if test=" price != null">
  649. #{price}, </if>
  650. <if test=" placeOfOrigin != null">
  651. #{placeOfOrigin}, </if>
  652. <if test=" storageLocation != null">
  653. #{storageLocation}, </if>
  654. <if test=" disperseCapacity != null">
  655. #{disperseCapacity}, </if>
  656. <if test=" length != null">
  657. #{length}, </if>
  658. <if test=" width != null">
  659. #{width}, </if>
  660. <if test=" height != null">
  661. #{height}, </if>
  662. <if test=" packNum != null">
  663. #{packNum}, </if>
  664. <if test=" packAverageWeight != null">
  665. #{packAverageWeight}, </if>
  666. <if test=" fillingTime != null">
  667. #{fillingTime}, </if>
  668. <if test=" cId != null">
  669. #{cId}, </if>
  670. <if test=" cTime != null">
  671. #{cTime}, </if>
  672. <if test=" uId != null">
  673. #{uId}, </if>
  674. <if test=" uTime != null">
  675. #{uTime}, </if>
  676. <if test=" version != null">
  677. #{version}, </if>
  678. <if test=" houseId != null">
  679. #{houseId}, </if>
  680. <if test="lineHeight !=null">
  681. #{lineHeight} , </if>
  682. <if test="status !=null">
  683. #{status} , </if>
  684. <if test="diameter !=null">
  685. #{diameter},
  686. </if>
  687. <if test="kcvolume !=null">
  688. #{kcvolume},
  689. </if>
  690. <if test="management !=null">
  691. #{management}
  692. </if>
  693. </trim>
  694. </insert>
  695. <update id="update" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfo">
  696. UPDATE daily_record_foodbasicinfo <set>
  697. <if test="id != null">
  698. id= #{id} ,
  699. </if>
  700. <if test="uuid != null">
  701. uuid= #{uuid} ,
  702. </if>
  703. <if test="recordUnite != null">
  704. record_unite= #{recordUnite} ,
  705. </if>
  706. <if test="keepUnite != null">
  707. keep_unite= #{keepUnite} ,
  708. </if>
  709. <if test="locationNum != null">
  710. location_num= #{locationNum} ,
  711. </if>
  712. <if test="quality != null">
  713. quality= #{quality} ,
  714. </if>
  715. <if test="type != null">
  716. `type`= #{type} ,
  717. </if>
  718. <if test="htype != null">
  719. htype= #{htype} ,
  720. </if>
  721. <if test="number != null">
  722. `number`= #{number} ,
  723. </if>
  724. <if test="standNumber != null">
  725. stand_number= #{standNumber} ,
  726. </if>
  727. <if test="inputYear != null">
  728. input_year= #{inputYear} ,
  729. </if>
  730. <if test="growYear != null">
  731. grow_year= #{growYear} ,
  732. </if>
  733. <if test="keepMethod != null">
  734. keep_method= #{keepMethod} ,
  735. </if>
  736. <if test="level != null">
  737. `level`= #{level} ,
  738. </if>
  739. <if test="weight != null">
  740. weight= #{weight} ,
  741. </if>
  742. <if test="impurity != null">
  743. impurity= #{impurity} ,
  744. </if>
  745. <if test="water != null">
  746. water= #{water} ,
  747. </if>
  748. <if test="unsound != null">
  749. unsound= #{unsound} ,
  750. </if>
  751. <if test="recorder != null">
  752. recorder= #{recorder} ,
  753. </if>
  754. <if test="houseType != null">
  755. house_type= #{houseType} ,
  756. </if>
  757. <if test="designHouseCapacity != null">
  758. design_house_capacity= #{designHouseCapacity} ,
  759. </if>
  760. <if test="validHouseCapacity != null">
  761. valid_house_capacity= #{validHouseCapacity} ,
  762. </if>
  763. <if test="price != null">
  764. price= #{price} ,
  765. </if>
  766. <if test="placeOfOrigin != null">
  767. place_of_origin= #{placeOfOrigin} ,
  768. </if>
  769. <if test="storageLocation != null">
  770. storage_location= #{storageLocation} ,
  771. </if>
  772. <if test="disperseCapacity != null">
  773. disperse_capacity= #{disperseCapacity} ,
  774. </if>
  775. <if test="length != null">
  776. `length`= #{length} ,
  777. </if>
  778. <if test="width != null">
  779. width= #{width} ,
  780. </if>
  781. <if test="height != null">
  782. height= #{height} ,
  783. </if>
  784. <if test="packNum != null">
  785. pack_num= #{packNum} ,
  786. </if>
  787. <if test="packAverageWeight != null">
  788. pack_average_weight= #{packAverageWeight} ,
  789. </if>
  790. <if test="fillingTime != null">
  791. filling_time= #{fillingTime} ,
  792. </if>
  793. <if test="cId != null">
  794. c_id= #{cId} ,
  795. </if>
  796. <if test="cTime != null">
  797. c_time= #{cTime} ,
  798. </if>
  799. <if test="uId != null">
  800. u_id= #{uId} ,
  801. </if>
  802. <if test="uTime != null">
  803. u_time= #{uTime} ,
  804. </if>
  805. <if test="version != null">
  806. version= #{version} ,
  807. </if>
  808. <if test="houseId != null">
  809. house_id= #{houseId} ,
  810. </if>
  811. <if test="lineHeight !=null">
  812. line_height = #{lineHeight},
  813. </if>
  814. <if test="status !=null">
  815. status = #{status},
  816. </if>
  817. <if test="diameter !=null">
  818. diameter = #{diameter},
  819. </if>
  820. <if test="kcvolume !=null">
  821. kcvolume = #{kcvolume},
  822. </if>
  823. <if test="management !=null">
  824. management = #{management}
  825. </if>
  826. </set>
  827. <where>
  828. <if test="id != null ">
  829. id = #{id}
  830. </if>
  831. <if test="houseId != null ">
  832. and house_id = #{houseId}
  833. </if>
  834. </where>
  835. </update>
  836. <update id="updateStatusByHouseId" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfo">
  837. UPDATE daily_record_foodbasicinfo <set>
  838. <if test="id != null">
  839. id= #{id} ,
  840. </if>
  841. <if test="uuid != null">
  842. uuid= #{uuid} ,
  843. </if>
  844. <if test="recordUnite != null">
  845. record_unite= #{recordUnite} ,
  846. </if>
  847. <if test="keepUnite != null">
  848. keep_unite= #{keepUnite} ,
  849. </if>
  850. <if test="locationNum != null">
  851. location_num= #{locationNum} ,
  852. </if>
  853. <if test="quality != null">
  854. quality= #{quality} ,
  855. </if>
  856. <if test="type != null">
  857. `type`= #{type} ,
  858. </if>
  859. <if test="htype != null">
  860. htype= #{htype} ,
  861. </if>
  862. <if test="number != null">
  863. `number`= #{number} ,
  864. </if>
  865. <if test="standNumber != null">
  866. stand_number= #{standNumber} ,
  867. </if>
  868. <if test="inputYear != null">
  869. input_year= #{inputYear} ,
  870. </if>
  871. <if test="outputYear != null">
  872. output_year= #{outputYear} ,
  873. </if>
  874. <if test="growYear != null">
  875. grow_year= #{growYear} ,
  876. </if>
  877. <if test="keepMethod != null">
  878. keep_method= #{keepMethod} ,
  879. </if>
  880. <if test="level != null">
  881. `level`= #{level} ,
  882. </if>
  883. <if test="weight != null">
  884. weight= #{weight} ,
  885. </if>
  886. <if test="impurity != null">
  887. impurity= #{impurity} ,
  888. </if>
  889. <if test="water != null">
  890. water= #{water} ,
  891. </if>
  892. <if test="unsound != null">
  893. unsound= #{unsound} ,
  894. </if>
  895. <if test="recorder != null">
  896. recorder= #{recorder} ,
  897. </if>
  898. <if test="houseType != null">
  899. house_type= #{houseType} ,
  900. </if>
  901. <if test="designHouseCapacity != null">
  902. design_house_capacity= #{designHouseCapacity} ,
  903. </if>
  904. <if test="validHouseCapacity != null">
  905. valid_house_capacity= #{validHouseCapacity} ,
  906. </if>
  907. <if test="price != null">
  908. price= #{price} ,
  909. </if>
  910. <if test="placeOfOrigin != null">
  911. place_of_origin= #{placeOfOrigin} ,
  912. </if>
  913. <if test="storageLocation != null">
  914. storage_location= #{storageLocation} ,
  915. </if>
  916. <if test="disperseCapacity != null">
  917. disperse_capacity= #{disperseCapacity} ,
  918. </if>
  919. <if test="length != null">
  920. `length`= #{length} ,
  921. </if>
  922. <if test="width != null">
  923. width= #{width} ,
  924. </if>
  925. <if test="height != null">
  926. height= #{height} ,
  927. </if>
  928. <if test="packNum != null">
  929. pack_num= #{packNum} ,
  930. </if>
  931. <if test="packAverageWeight != null">
  932. pack_average_weight= #{packAverageWeight} ,
  933. </if>
  934. <if test="fillingTime != null">
  935. filling_time= #{fillingTime} ,
  936. </if>
  937. <if test="cId != null">
  938. c_id= #{cId} ,
  939. </if>
  940. <if test="cTime != null">
  941. c_time= #{cTime} ,
  942. </if>
  943. <if test="uId != null">
  944. u_id= #{uId} ,
  945. </if>
  946. <if test="uTime != null">
  947. u_time= #{uTime} ,
  948. </if>
  949. <if test="version != null">
  950. version= #{version} ,
  951. </if>
  952. <if test="houseId != null">
  953. house_id= #{houseId} ,
  954. </if>
  955. <if test="lineHeight !=null">
  956. line_height = #{lineHeight},
  957. </if>
  958. <if test="status !=null">
  959. status = #{status},
  960. </if>
  961. <if test="diameter !=null">
  962. diameter = #{diameter},
  963. </if>
  964. <if test="kcvolume !=null">
  965. kcvolume = #{kcvolume},
  966. </if>
  967. <if test="management !=null">
  968. management = #{management}
  969. </if>
  970. </set>
  971. <where>
  972. <if test="id != null ">
  973. id = #{id}
  974. </if>
  975. <if test="houseId != null ">
  976. and house_id = #{houseId}
  977. </if>
  978. </where>
  979. </update>
  980. <update id="updateList" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfo">
  981. UPDATE daily_record_foodbasicinfo set htype=0
  982. where
  983. id =#{id}
  984. </update>
  985. <delete id="deleteById" parameterType="java.lang.Long">
  986. DELETE FROM daily_record_foodbasicinfo WHERE id = #{id}
  987. </delete>
  988. <delete id="deleteByIds" parameterType="java.util.List">
  989. DELETE FROM daily_record_foodbasicinfo WHERE id IN
  990. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  991. #{item}
  992. </foreach>
  993. </delete>
  994. <select id="getLastId" resultType="java.lang.Integer">
  995. SELECT
  996. IFNULL(MAX(id),0)AS id
  997. FROM daily_record_foodbasicinfo a
  998. where
  999. house_id=#{houseId} order by id desc limit 1
  1000. </select>
  1001. <select id="getDailyRecodrFoodBasicInfo" resultType="int">
  1002. SELECT
  1003. id
  1004. FROM
  1005. daily_record_foodbasicinfo
  1006. WHERE
  1007. house_id = #{houseId}
  1008. ORDER BY
  1009. DATE_FORMAT(input_year, '%Y-%m-%d') DESC,
  1010. id DESC
  1011. LIMIT 1
  1012. </select>
  1013. <select id="findByHouseIdNoPage" resultMap="baseMap">
  1014. SELECT *
  1015. FROM daily_record_foodbasicinfo a
  1016. where house_id=#{houseId}
  1017. </select>
  1018. <select id="findByHouseIdAndCtimes" resultMap="baseMap">
  1019. SELECT *
  1020. FROM daily_record_foodbasicinfo a
  1021. where house_id=#{houseId}
  1022. order BY c_time DESC
  1023. limit 1
  1024. </select>
  1025. <select id="getByHouseId" resultMap="baseMap">
  1026. SELECT *
  1027. FROM daily_record_foodbasicinfo a
  1028. where house_id=#{houseId}
  1029. order BY c_time DESC
  1030. limit 1
  1031. </select>
  1032. <select id="getByUuid" resultMap="baseMap">
  1033. SELECT *
  1034. FROM daily_record_foodbasicinfo a
  1035. where uuid=#{uuid}
  1036. order BY c_time DESC
  1037. limit 1
  1038. </select>
  1039. <select id="findByHouseIdAndCtime" resultMap="baseMap">
  1040. SELECT *
  1041. FROM daily_record_foodbasicinfo a
  1042. where house_id=#{houseId}
  1043. <if test="cTime != null">
  1044. AND input_year <![CDATA[ <= ]]> #{cTime}
  1045. </if>
  1046. order BY c_time DESC
  1047. limit 1
  1048. </select>
  1049. <delete id="deleteFoodbaseicInfoByHouseId">
  1050. DELETE FROM daily_record_foodbasicinfo
  1051. WHERE house_id = #{houseId}
  1052. <if test="cTime != null">
  1053. AND input_year <![CDATA[ <= ]]> #{cTime}
  1054. </if>
  1055. </delete>
  1056. </mapper>