DailyRecordHouseIncDecDao.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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.DailyRecordHouseIncDecDao">
  4. <resultMap id="baseMap" type="cn.ourwill.module.house.entity.daily.DailyRecordHouseIncDec">
  5. <result column="id" property="id"/>
  6. <result column="report_organ" property="reportOrgan"/>
  7. <result column="grain_id" property="grainId"/>
  8. <result column="house_no" property="houseNo"/>
  9. <result column="table_no" property="tableNo"/>
  10. <result column="in_count" property="inCount"/>
  11. <result column="in_water" property="inWater"/>
  12. <result column="in_sub" property="inSub"/>
  13. <result column="in_date" property="inDate"/>
  14. <result column="out_count" property="outCount"/>
  15. <result column="out_water" property="outWater"/>
  16. <result column="out_sub" property="outSub"/>
  17. <result column="out_date" property="outDate"/>
  18. <result column="real_consum" property="realConsum"/>
  19. <result column="nature_consum" property="natureConsum"/>
  20. <result column="sub_consum" property="subConsum"/>
  21. <result column="tran_consum" property="tranConsum"/>
  22. <result column="deal_solu" property="dealSolu"/>
  23. <result column="leader_solu" property="leaderSolu"/>
  24. <result column="above_count" property="aboveCount"/>
  25. <result column="excess_quantity" property="excessQuantity"/>
  26. <result column="uuid" property="uuid"/>
  27. <result column="c_id" property="cId"/>
  28. <result column="c_time" property="cTime"/>
  29. <result column="u_id" property="uId"/>
  30. <result column="u_time" property="uTime"/>
  31. <result column="version" property="version"/>
  32. <result column="house_name" property="houseName"/>
  33. </resultMap>
  34. <sql id="columns">
  35. a.id,
  36. a.report_organ,
  37. a.house_no,
  38. a.grain_id,
  39. a.table_no,
  40. a.in_count,
  41. a.in_water,
  42. a.in_sub,
  43. a.in_date,
  44. a.out_count,
  45. a.out_water,
  46. a.out_sub,
  47. a.out_date,
  48. a.real_consum,
  49. a.nature_consum,
  50. a.sub_consum,
  51. a.tran_consum,
  52. a.deal_solu,
  53. a.leader_solu,
  54. above_count,
  55. excess_quantity,
  56. a.uuid,
  57. a.c_id,
  58. a.c_time,
  59. a.u_id,
  60. a.u_time,
  61. a.version
  62. </sql>
  63. <select id="get" resultMap="baseMap">
  64. SELECT b.house_name,<include refid="columns"/>
  65. FROM outhouse_inc_dec a LEFT JOIN house_info b ON a.house_no=b.id
  66. WHERE a.id=#{id}
  67. </select>
  68. <select id="getByHouseNo" resultMap="baseMap">
  69. SELECT
  70. <include refid="columns"/>
  71. FROM outhouse_inc_dec a
  72. WHERE a.house_no=#{id}
  73. limit 1
  74. </select>
  75. <select id="findAllList" resultMap="baseMap">
  76. SELECT
  77. <include refid="columns"/>
  78. FROM outhouse_inc_dec a
  79. <where>
  80. <if test=" id != null">
  81. and id = #{id}
  82. </if>
  83. <if test=" reportOrgan != null">
  84. and report_organ = #{reportOrgan}
  85. </if>
  86. <if test=" houseNo != null">
  87. and house_no = #{houseNo}
  88. </if>
  89. <if test=" grainId != null">
  90. and grain_id = #{grainId}
  91. </if>
  92. <if test=" tableNo != null">
  93. and table_no like CONCAT('%',#{tableNo},'%')
  94. </if>
  95. <if test=" inCount != null">
  96. and in_count = #{inCount}
  97. </if>
  98. <if test=" inWater != null">
  99. and in_water = #{inWater}
  100. </if>
  101. <if test=" inSub != null">
  102. and in_sub = #{inSub}
  103. </if>
  104. <if test=" inDate != null">
  105. and in_date = #{inDate}
  106. </if>
  107. <if test=" outCount != null">
  108. and out_count = #{outCount}
  109. </if>
  110. <if test=" outWater != null">
  111. and out_water = #{outWater}
  112. </if>
  113. <if test=" outSub != null">
  114. and out_sub = #{outSub}
  115. </if>
  116. <if test=" outDate != null">
  117. and out_date = #{outDate}
  118. </if>
  119. <if test=" realConsum != null">
  120. and real_consum = #{realConsum}
  121. </if>
  122. <if test=" natureConsum != null">
  123. and nature_consum = #{natureConsum}
  124. </if>
  125. <if test=" subConsum != null">
  126. and sub_consum = #{subConsum}
  127. </if>
  128. <if test=" tranConsum != null">
  129. and tran_consum = #{tranConsum}
  130. </if>
  131. <if test=" dealSolu != null">
  132. and deal_solu = #{dealSolu}
  133. </if>
  134. <if test=" leaderSolu != null">
  135. and leader_solu = #{leaderSolu}
  136. </if>
  137. <if test=" aboveCount != null">
  138. and above_count = #{aboveCount}
  139. </if>
  140. <if test=" excessQuantity != null">
  141. and excess_quantity = #{excessQuantity}
  142. </if>
  143. <if test="uuid != null">
  144. and uuid = #{uuid}
  145. </if>
  146. <if test="cId != null">
  147. and c_id = #{cId}
  148. </if>
  149. <if test="cTime != null">
  150. and c_time LIKE CONCAT('%',#{cTime},'%')
  151. </if>
  152. <if test="uId != null">
  153. and u_id = #{uId}
  154. </if>
  155. <if test="uTime != null">
  156. and u_time = #{uTime}
  157. </if>
  158. <if test="version !=null">
  159. and version = #{version}
  160. </if>
  161. </where>
  162. <choose>
  163. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  164. ORDER BY ${page.orderBy}
  165. </when>
  166. <otherwise>
  167. </otherwise>
  168. </choose>
  169. </select>
  170. <insert id="insert" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordHouseIncDec">
  171. INSERT INTO outhouse_inc_dec
  172. <trim prefix="(" suffix=")" suffixOverrides=",">
  173. <if test=" id != null">
  174. id,
  175. </if>
  176. <if test=" reportOrgan != null">
  177. report_organ,
  178. </if>
  179. <if test=" houseNo != null">
  180. house_no,
  181. </if>
  182. <if test=" grainId != null">
  183. grain_id,
  184. </if>
  185. <if test=" tableNo != null">
  186. table_no,
  187. </if>
  188. <if test=" inCount != null">
  189. in_count,
  190. </if>
  191. <if test=" inWater != null">
  192. in_water,
  193. </if>
  194. <if test=" inSub != null">
  195. in_sub,
  196. </if>
  197. <if test=" inDate != null">
  198. in_date,
  199. </if>
  200. <if test=" outCount != null">
  201. out_count,
  202. </if>
  203. <if test=" outWater != null">
  204. out_water,
  205. </if>
  206. <if test=" outSub != null">
  207. out_sub,
  208. </if>
  209. <if test=" outDate != null">
  210. out_date,
  211. </if>
  212. <if test=" realConsum != null">
  213. real_consum,
  214. </if>
  215. <if test=" natureConsum != null">
  216. nature_consum,
  217. </if>
  218. <if test=" subConsum != null">
  219. sub_consum,
  220. </if>
  221. <if test=" tranConsum != null">
  222. tran_consum,
  223. </if>
  224. <if test=" dealSolu != null">
  225. deal_solu,
  226. </if>
  227. <if test=" leaderSolu != null">
  228. leader_solu,
  229. </if>
  230. <if test=" aboveCount != null">
  231. above_count,
  232. </if>
  233. <if test=" excessQuantity != null">
  234. excess_quantity,
  235. </if>
  236. <if test="uuid != null">
  237. uuid,
  238. </if>
  239. <if test="cId != null">
  240. c_id,
  241. </if>
  242. <if test="cTime != null">
  243. c_time,
  244. </if>
  245. <if test="uId != null">
  246. u_id,
  247. </if>
  248. <if test="uTime != null">
  249. u_time,
  250. </if>
  251. <if test="version !=null">
  252. version
  253. </if>
  254. </trim>
  255. <trim prefix="values (" suffix=")" suffixOverrides=",">
  256. <if test=" id != null">
  257. #{id},
  258. </if>
  259. <if test=" reportOrgan != null">
  260. #{reportOrgan},
  261. </if>
  262. <if test=" houseNo != null">
  263. #{houseNo},
  264. </if>
  265. <if test=" grainId != null">
  266. #{grainId},
  267. </if>
  268. <if test=" tableNo != null">
  269. #{tableNo},
  270. </if>
  271. <if test=" inCount != null">
  272. #{inCount},
  273. </if>
  274. <if test=" inWater != null">
  275. #{inWater},
  276. </if>
  277. <if test=" inSub != null">
  278. #{inSub},
  279. </if>
  280. <if test=" inDate != null">
  281. #{inDate},
  282. </if>
  283. <if test=" outCount != null">
  284. #{outCount},
  285. </if>
  286. <if test=" outWater != null">
  287. #{outWater},
  288. </if>
  289. <if test=" outSub != null">
  290. #{outSub},
  291. </if>
  292. <if test=" outDate != null">
  293. #{ outDate},
  294. </if>
  295. <if test=" realConsum != null">
  296. #{ realConsum},
  297. </if>
  298. <if test=" natureConsum != null">
  299. #{ natureConsum},
  300. </if>
  301. <if test=" subConsum != null">
  302. #{ subConsum},
  303. </if>
  304. <if test=" tranConsum != null">
  305. #{tranConsum},
  306. </if>
  307. <if test=" dealSolu != null">
  308. #{dealSolu},
  309. </if>
  310. <if test=" leaderSolu != null">
  311. #{leaderSolu},
  312. </if>
  313. <if test=" aboveCount != null">
  314. #{aboveCount},
  315. </if>
  316. <if test=" excessQuantity != null">
  317. #{excessQuantity},
  318. </if>
  319. <if test="uuid != null">
  320. #{uuid},
  321. </if>
  322. <if test="cId != null">
  323. #{cId},
  324. </if>
  325. <if test="cTime != null">
  326. #{cTime},
  327. </if>
  328. <if test="uId != null">
  329. #{uId},
  330. </if>
  331. <if test="uTime != null">
  332. #{uTime},
  333. </if>
  334. <if test="version !=null">
  335. #{version},
  336. </if>
  337. </trim>
  338. </insert>
  339. <select id="findByHouseIdNoPage" resultMap="baseMap">
  340. SELECT *
  341. FROM outhouse_inc_dec a
  342. where house_no=#{houseId}
  343. <if test="cTime != null">
  344. AND out_date <![CDATA[ <= ]]> #{cTime}
  345. </if>
  346. </select>
  347. <delete id="deleteIncDecByHouseId">
  348. DELETE FROM outhouse_inc_dec
  349. WHERE house_no = #{houseId}
  350. <if test="cTime != null">
  351. AND out_date <![CDATA[ <= ]]> #{cTime}
  352. </if>
  353. </delete>
  354. </mapper>