DailyRecordFoodinfoDao.xml 30 KB

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