DailyRecordFoodbasilocatesDao.xml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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.DailyRecordFoodbasicinfolocatesDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfolocates" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="changeTime" property="changeTime"/>
  7. <result column="oldNumber" property="oldNumber"/>
  8. <result column="newNumber" property="newNumber"/>
  9. <result column="cId" property="cId"/>
  10. <result column="uId" property="uId"/>
  11. <result column="cTime" property="cTime"/>
  12. <result column="houseId" property="houseId"/>
  13. <result column="foodbasicinfoId" property="foodbasicinfoId"/>
  14. <result column="grain_number" property="grainNumber"/>
  15. <result column="change_record" property="changeRecord"/>
  16. <result column="number_of_losses" property="numberOfLosses"/>
  17. </resultMap>
  18. <sql id="columns">
  19. id ,
  20. changeTime ,
  21. oldNumber ,
  22. newNumber ,
  23. cId ,
  24. uId ,
  25. cTime ,
  26. houseId ,
  27. foodbasicinfoId,
  28. grain_number,
  29. change_record,
  30. number_of_losses
  31. </sql>
  32. <sql id="joinCols">
  33. </sql>
  34. <select id="get" resultMap="baseMap">
  35. SELECT
  36. <include refid="columns"/>
  37. FROM daily_record_foodbasicinfolocates a
  38. <include refid="joinCols"/>
  39. WHERE a.id = #{id}
  40. </select>
  41. <select id="findList" resultMap="baseMap">
  42. SELECT
  43. <include refid="columns"/>
  44. FROM daily_record_foodbasicinfolocates a
  45. <include refid="joinCols"/>
  46. <where>
  47. <if test="id !=null">
  48. and id = #{id}
  49. </if>
  50. <if test="changeTime !=null">
  51. and changeTime = #{changeTime}
  52. </if>
  53. <if test="oldNumber !=null">
  54. and oldNumber = #{oldNumber}
  55. </if>
  56. <if test="newNumber !=null">
  57. and newNumber = #{newNumber}
  58. </if>
  59. <if test="cId !=null">
  60. and cId = #{cId}
  61. </if>
  62. <if test="uId !=null">
  63. and uId = #{uId}
  64. </if>
  65. <if test="cTime !=null">
  66. and cTime = #{cTime}
  67. </if>
  68. <if test="houseId !=null">
  69. and houseId = #{houseId}
  70. </if>
  71. <if test="foodbasicinfoId !=null">
  72. and foodbasicinfoId = #{foodbasicinfoId}
  73. </if>
  74. <if test="grainNumber !=null">
  75. and grain_number = #{grainNumber}
  76. </if>
  77. <if test="changeRecord !=null">
  78. and change_record = #{changeRecord}
  79. </if>
  80. <if test="numberOfLosses !=null">
  81. and number_of_losses = #{numberOfLosses}
  82. </if>
  83. </where>
  84. <choose>
  85. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  86. ORDER BY ${page.orderBy}
  87. </when>
  88. <otherwise>
  89. </otherwise>
  90. </choose>
  91. </select>
  92. <select id="findAllList" resultMap="baseMap">
  93. SELECT
  94. <include refid="columns"/>
  95. FROM daily_record_foodbasicinfolocates a
  96. <include refid="joinCols"/>
  97. <where>
  98. <if test="id !=null">
  99. and id = #{id}
  100. </if>
  101. <if test="changeTime !=null">
  102. and changeTime = #{changeTime}
  103. </if>
  104. <if test="oldNumber !=null">
  105. and oldNumber = #{oldNumber}
  106. </if>
  107. <if test="newNumber !=null">
  108. and newNumber = #{newNumber}
  109. </if>
  110. <if test="cId !=null">
  111. and cId = #{cId}
  112. </if>
  113. <if test="uId !=null">
  114. and uId = #{uId}
  115. </if>
  116. <if test="cTime !=null">
  117. and cTime = #{cTime}
  118. </if>
  119. <if test="houseId !=null">
  120. and houseId = #{houseId}
  121. </if>
  122. <if test="foodbasicinfoId !=null">
  123. and foodbasicinfoId = #{foodbasicinfoId}
  124. </if>
  125. <if test="grainNumber !=null">
  126. and grain_number = #{grainNumber}
  127. </if>
  128. <if test="changeRecord !=null">
  129. and change_record = #{changeRecord}
  130. </if>
  131. <if test="numberOfLosses !=null">
  132. and number_of_losses = #{numberOfLosses}
  133. </if>
  134. </where>
  135. <choose>
  136. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  137. ORDER BY ${page.orderBy}
  138. </when>
  139. <otherwise>
  140. </otherwise>
  141. </choose>
  142. </select>
  143. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  144. parameterType="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfolocates">
  145. INSERT INTO daily_record_foodbasicinfolocates
  146. <trim prefix="(" suffix=")" suffixOverrides=",">
  147. <if test=" id != null">
  148. id,
  149. </if>
  150. <if test=" changeTime != null">
  151. changeTime,
  152. </if>
  153. <if test=" oldNumber != null">
  154. oldNumber,
  155. </if>
  156. <if test=" newNumber != null">
  157. newNumber,
  158. </if>
  159. <if test=" cId != null">
  160. cId,
  161. </if>
  162. <if test=" uId != null">
  163. uId,
  164. </if>
  165. <if test=" cTime != null">
  166. cTime,
  167. </if>
  168. <if test=" houseId != null">
  169. houseId,
  170. </if>
  171. <if test=" foodbasicinfoId != null">
  172. foodbasicinfoId,
  173. </if>
  174. <if test="grainNumber !=null">
  175. grain_number,
  176. </if>
  177. <if test="changeRecord !=null">
  178. change_record,
  179. </if>
  180. <if test="numberOfLosses !=null">
  181. number_of_losses
  182. </if>
  183. </trim>
  184. <trim prefix="values (" suffix=")" suffixOverrides=",">
  185. <if test=" id != null">
  186. #{id}, </if>
  187. <if test=" changeTime != null">
  188. #{changeTime}, </if>
  189. <if test=" oldNumber != null">
  190. #{oldNumber}, </if>
  191. <if test=" newNumber != null">
  192. #{newNumber}, </if>
  193. <if test=" cId != null">
  194. #{cId}, </if>
  195. <if test=" uId != null">
  196. #{uId}, </if>
  197. <if test=" cTime != null">
  198. #{cTime}, </if>
  199. <if test=" houseId != null">
  200. #{houseId}, </if>
  201. <if test=" foodbasicinfoId != null">
  202. #{foodbasicinfoId}, </if>
  203. <if test="grainNumber !=null">
  204. #{grainNumber},
  205. </if>
  206. <if test="changeRecord !=null">
  207. #{changeRecord},
  208. </if>
  209. <if test="numberOfLosses !=null">
  210. #{numberOfLosses}
  211. </if>
  212. </trim>
  213. </insert>
  214. <update id="update" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordFoodbasicinfolocates">
  215. UPDATE daily_record_foodbasicinfolocates <set>
  216. <if test="id != null">
  217. id= #{id} ,
  218. </if>
  219. <if test="changeTime != null">
  220. changeTime= #{changeTime} ,
  221. </if>
  222. <if test="oldNumber != null">
  223. oldNumber= #{oldNumber} ,
  224. </if>
  225. <if test="newNumber != null">
  226. newNumber= #{newNumber} ,
  227. </if>
  228. <if test="cId != null">
  229. cId= #{cId} ,
  230. </if>
  231. <if test="uId != null">
  232. uId= #{uId} ,
  233. </if>
  234. <if test="cTime != null">
  235. cTime= #{cTime} ,
  236. </if>
  237. <if test="houseId != null">
  238. houseId= #{houseId} ,
  239. </if>
  240. <if test="foodbasicinfoId != null">
  241. foodbasicinfoId= #{foodbasicinfoId},
  242. </if>
  243. <if test="grainNumber !=null">
  244. grain_number = #{grainNumber},
  245. </if>
  246. <if test="changeRecord !=null">
  247. change_record = #{changeRecord},
  248. </if>
  249. <if test="numberOfLosses !=null">
  250. number_of_losses = #{numberOfLosses}
  251. </if>
  252. </set>
  253. WHERE id = #{id}
  254. </update>
  255. <delete id="deleteById" parameterType="java.lang.Long">
  256. DELETE FROM daily_record_foodbasicinfolocates WHERE id = #{id}
  257. </delete>
  258. <delete id="deleteByIds" parameterType="java.util.List">
  259. DELETE FROM daily_record_foodbasicinfolocates WHERE id IN
  260. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  261. #{item}
  262. </foreach>
  263. </delete>
  264. <select id="findByHouseIdNoPage" resultMap="baseMap">
  265. SELECT *
  266. FROM daily_record_foodbasicinfolocates a
  267. where houseId=#{houseId}
  268. <if test="cTime != null">
  269. AND changeTime <![CDATA[ <= ]]> #{cTime}
  270. </if>
  271. </select>
  272. <delete id="deleteFoodbaseicInfolocatesByHouseId">
  273. DELETE FROM daily_record_foodbasicinfolocates
  274. WHERE houseId = #{houseId}
  275. <if test="cTime != null">
  276. AND changeTime <![CDATA[ <= ]]> #{cTime}
  277. </if>
  278. </delete>
  279. <select id="getLastlocateYearByHouseId" resultMap="baseMap">
  280. SELECT *
  281. FROM daily_record_foodbasicinfolocates a
  282. where houseId=#{houseId}
  283. ORDER by a.changeTime DESC
  284. limit 1
  285. </select>
  286. </mapper>