DeviceCheckMonthNewDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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.new_dao.DeviceCheckMonthNewDao" >
  4. <resultMap id="baseMap" type="cn.ourwill.module.house.entity.new_entity.DeviceCheckMonthNew" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="grain_id" property="grainId" jdbcType="INTEGER" />
  7. <result column="check_date" property="checkDate" jdbcType="VARCHAR" />
  8. <result column="join_user" property="joinUser" jdbcType="VARCHAR" />
  9. <result column="check_item" property="checkItem" jdbcType="VARCHAR" />
  10. <result column="conclusion" property="conclusion" jdbcType="VARCHAR" />
  11. <result column="charge_user" property="chargeUser" jdbcType="VARCHAR" />
  12. <result column="charge_sign" property="chargeSign" jdbcType="VARCHAR" />
  13. <result column="sign_date" property="signDate" jdbcType="VARCHAR" />
  14. <result column="charge_state" property="chargeState" jdbcType="VARCHAR" />
  15. <result column="state" property="state" jdbcType="VARCHAR" />
  16. <result column="charge_idea" property="chargeIdea" jdbcType="VARCHAR" />
  17. <result column="uuid" property="uuid" jdbcType="VARCHAR" />
  18. <result column="c_id" property="cId" jdbcType="INTEGER" />
  19. <result column="c_time" property="cTime" jdbcType="TIMESTAMP" />
  20. <result column="u_id" property="uId" jdbcType="INTEGER" />
  21. <result column="u_time" property="uTime" jdbcType="TIMESTAMP" />
  22. </resultMap>
  23. <sql id="columns">
  24. a.id, a.grain_id, a.check_date, a.join_user, a.check_item, a.conclusion, a.charge_user, a.charge_sign,
  25. a.sign_date, a.charge_state, a.state, a.charge_idea, a.c_id, a.c_time, a.u_id, a.u_time
  26. </sql>
  27. <sql id = "columsOfFindd">
  28. sg.name AS grainName,
  29. /*ddm.device_name,
  30. ddm.device_model,
  31. ddm.device_manager ,
  32. ddm.collator,*/
  33. </sql>
  34. <sql id = "columsOfFi">
  35. dd.device_no,
  36. dd.asset_number,
  37. dd.place_of_origin,
  38. dd.device_unit,
  39. dd.price,
  40. dd.voucher_type,
  41. dd.voucher_number,
  42. dd.bookkeeper,
  43. dd.handler,
  44. </sql>
  45. <sql id="joinCols">
  46. </sql>
  47. <select id="get" resultMap="baseMap">
  48. SELECT
  49. <include refid="columsOfFindd"/>
  50. <include refid="columns"/>
  51. FROM device_check_month_new a
  52. LEFT JOIN sys_grain sg ON sg.id = a.grain_id
  53. <include refid="joinCols"/>
  54. WHERE a.id = #{id}
  55. </select>
  56. <insert id="insertss" parameterType="cn.ourwill.module.house.entity.new_entity.DeviceCheckMonthNew" >
  57. insert into device_check_month_new (id, grain_id, check_date,
  58. join_user, check_item, conclusion,
  59. charge_user, charge_sign, sign_date,
  60. charge_state, state, charge_idea,
  61. c_id, c_time, u_id,
  62. u_time)
  63. values (#{id,jdbcType=INTEGER}, #{grainId,jdbcType=INTEGER}, #{checkDate,jdbcType=VARCHAR},
  64. #{joinUser,jdbcType=VARCHAR}, #{checkItem,jdbcType=VARCHAR}, #{conclusion,jdbcType=VARCHAR},
  65. #{chargeUser,jdbcType=VARCHAR}, #{chargeSign,jdbcType=VARCHAR}, #{signDate,jdbcType=VARCHAR},
  66. #{chargeState,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, #{chargeIdea,jdbcType=VARCHAR},
  67. #{cId,jdbcType=INTEGER}, #{cTime,jdbcType=TIMESTAMP}, #{uId,jdbcType=INTEGER},
  68. #{uTime,jdbcType=TIMESTAMP})
  69. </insert>
  70. <select id="findList" resultMap="baseMap">
  71. SELECT
  72. <include refid="columsOfFindd"/>
  73. <include refid="columns"/>
  74. FROM device_check_month_new a
  75. LEFT JOIN sys_grain sg ON sg.id = a.grain_id
  76. <include refid="joinCols"/>
  77. <where>
  78. <if test="id !=null">
  79. id = #{id}
  80. </if>
  81. <if test="grainId !=null">
  82. and a.grain_id = #{grainId}
  83. </if>
  84. <if test="grainName !=null">
  85. and sg.name = #{grainName}
  86. </if>
  87. <if test="checkDate !=null">
  88. and a.check_date = #{checkDate}
  89. </if>
  90. <if test="joinUser !=null">
  91. and a.join_user = #{joinUser}
  92. </if>
  93. <if test="checkItem !=null">
  94. and a.check_item = #{checkItem}
  95. </if>
  96. <if test="conclusion !=null">
  97. and a.conclusion = #{conclusion}
  98. </if>
  99. <if test="chargeUser !=null">
  100. and a.charge_user = #{chargeUser}
  101. </if>
  102. <if test="chargeSign !=null">
  103. and a.charge_sign = #{chargeSign}
  104. </if>
  105. <if test="signDate !=null">
  106. and a.sign_date = #{signDate}
  107. </if>
  108. <if test="chargeState !=null">
  109. and a.charge_state = #{chargeState}
  110. </if>
  111. <if test="state !=null">
  112. and a.state = #{state}
  113. </if>
  114. <if test="chargeIdea !=null">
  115. and a.charge_idea = #{chargeIdea}
  116. </if>
  117. <if test="uuid !=null">
  118. and a.uuid = #{uuid}
  119. </if>
  120. <if test="cId !=null">
  121. and a.c_id = #{cId}
  122. </if>
  123. <if test="cTime !=null">
  124. and a.c_time = #{cTime}
  125. </if>
  126. <if test="uId !=null">
  127. and a.u_id = #{uId}
  128. </if>
  129. <if test="uTime !=null">
  130. and a.u_time = #{uTime}
  131. </if>
  132. </where>
  133. <choose>
  134. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  135. ORDER BY ${page.orderBy}
  136. </when>
  137. <otherwise>
  138. </otherwise>
  139. </choose>
  140. </select>
  141. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  142. parameterType="cn.ourwill.module.house.entity.new_entity.DeviceMachineUseNew">
  143. INSERT INTO device_check_month_new
  144. <trim prefix="(" suffix=")" suffixOverrides=",">
  145. <if test=" id != null">
  146. id,
  147. </if>
  148. <if test="grainId !=null">
  149. grain_id ,
  150. </if>
  151. <if test="checkDate !=null">
  152. check_date,
  153. </if>
  154. <if test="joinUser !=null">
  155. join_user ,
  156. </if>
  157. <if test="checkItem !=null">
  158. check_item ,
  159. </if>
  160. <if test="conclusion !=null">
  161. conclusion ,
  162. </if>
  163. <if test="chargeUser !=null">
  164. charge_user ,
  165. </if>
  166. <if test="chargeSign !=null">
  167. charge_sign ,
  168. </if>
  169. <if test="signDate !=null">
  170. sign_date ,
  171. </if>
  172. <if test="chargeState !=null">
  173. charge_state ,
  174. </if>
  175. <if test="state !=null">
  176. state,
  177. </if>
  178. <if test="chargeIdea !=null">
  179. charge_idea ,
  180. </if>
  181. <if test="uuid !=null">
  182. uuid ,
  183. </if>
  184. <if test="cId !=null">
  185. c_id ,
  186. </if>
  187. <if test="cTime !=null">
  188. c_time ,
  189. </if>
  190. <if test="uId !=null">
  191. u_id ,
  192. </if>
  193. <if test="uTime !=null">
  194. u_time
  195. </if>
  196. </trim>
  197. <trim prefix="values (" suffix=")" suffixOverrides=",">
  198. <if test=" id != null">
  199. #{id}, </if>
  200. <if test="grainId !=null">
  201. #{grainId},
  202. </if>
  203. <if test="checkDate !=null">
  204. #{checkDate},
  205. </if>
  206. <if test="joinUser !=null">
  207. #{joinUser},
  208. </if>
  209. <if test="checkItem !=null">
  210. #{checkItem},
  211. </if>
  212. <if test="conclusion !=null">
  213. #{conclusion},
  214. </if>
  215. <if test="chargeUser !=null">
  216. #{chargeUser},
  217. </if>
  218. <if test="chargeSign !=null">
  219. #{chargeSign},
  220. </if>
  221. <if test="signDate !=null">
  222. #{signDate},
  223. </if>
  224. <if test="chargeState !=null">
  225. #{chargeState},
  226. </if>
  227. <if test="state !=null">
  228. #{state},
  229. </if>
  230. <if test="chargeIdea !=null">
  231. #{chargeIdea},
  232. </if>
  233. <if test="uuid !=null">
  234. #{uuid},
  235. </if>
  236. <if test="cId !=null">
  237. #{cId},
  238. </if>
  239. <if test="cTime !=null">
  240. #{cTime},
  241. </if>
  242. <if test="uId !=null">
  243. #{uId},
  244. </if>
  245. <if test="uTime !=null">
  246. #{uTime}
  247. </if>
  248. </trim>
  249. </insert>
  250. <update id="update" parameterType="cn.ourwill.module.house.entity.new_entity.DeviceMachineUseNew">
  251. UPDATE device_check_month_new <set>
  252. <if test="id != null">
  253. id= #{id} ,
  254. </if>
  255. <if test="grainId !=null">
  256. grain_id = #{grainId},
  257. </if>
  258. <if test="checkDate !=null">
  259. check_date = #{checkDate},
  260. </if>
  261. <if test="joinUser !=null">
  262. join_user = #{joinUser},
  263. </if>
  264. <if test="checkItem !=null">
  265. check_item = #{checkItem},
  266. </if>
  267. <if test="conclusion !=null">
  268. conclusion = #{conclusion},
  269. </if>
  270. <if test="chargeUser !=null">
  271. charge_user = #{chargeUser},
  272. </if>
  273. <if test="chargeSign !=null">
  274. charge_sign = #{chargeSign},
  275. </if>
  276. <if test="signDate !=null">
  277. sign_date = #{signDate},
  278. </if>
  279. <if test="chargeState !=null">
  280. charge_state = #{chargeState},
  281. </if>
  282. <if test="state !=null">
  283. state = #{state},
  284. </if>
  285. <if test="chargeIdea !=null">
  286. charge_idea = #{chargeIdea},
  287. </if>
  288. <if test="uuid !=null">
  289. uuid = #{uuid},
  290. </if>
  291. <if test="cId !=null">
  292. c_id = #{cId},
  293. </if>
  294. <if test="cTime !=null">
  295. c_time = #{cTime},
  296. </if>
  297. <if test="uId !=null">
  298. u_id = #{uId},
  299. </if>
  300. <if test="uTime !=null">
  301. u_time = #{uTime}
  302. </if>
  303. </set>
  304. WHERE id = #{id}
  305. </update>
  306. <delete id="deleteById" parameterType="java.lang.Long">
  307. DELETE FROM device_check_month_new WHERE id = #{id}
  308. </delete>
  309. <delete id="deleteByIds" parameterType="java.util.List">
  310. DELETE FROM device_check_month_new WHERE id IN
  311. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  312. #{item}
  313. </foreach>
  314. </delete>
  315. <sql id="Example_Where_Clause" >
  316. <where >
  317. <foreach collection="oredCriteria" item="criteria" separator="or" >
  318. <if test="criteria.valid" >
  319. <trim prefix="(" suffix=")" prefixOverrides="and" >
  320. <foreach collection="criteria.criteria" item="criterion" >
  321. <choose >
  322. <when test="criterion.noValue" >
  323. and ${criterion.condition}
  324. </when>
  325. <when test="criterion.singleValue" >
  326. and ${criterion.condition} #{criterion.value}
  327. </when>
  328. <when test="criterion.betweenValue" >
  329. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  330. </when>
  331. <when test="criterion.listValue" >
  332. and ${criterion.condition}
  333. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  334. #{listItem}
  335. </foreach>
  336. </when>
  337. </choose>
  338. </foreach>
  339. </trim>
  340. </if>
  341. </foreach>
  342. </where>
  343. </sql>
  344. <sql id="Update_By_Example_Where_Clause" >
  345. <where >
  346. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  347. <if test="criteria.valid" >
  348. <trim prefix="(" suffix=")" prefixOverrides="and" >
  349. <foreach collection="criteria.criteria" item="criterion" >
  350. <choose >
  351. <when test="criterion.noValue" >
  352. and ${criterion.condition}
  353. </when>
  354. <when test="criterion.singleValue" >
  355. and ${criterion.condition} #{criterion.value}
  356. </when>
  357. <when test="criterion.betweenValue" >
  358. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  359. </when>
  360. <when test="criterion.listValue" >
  361. and ${criterion.condition}
  362. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  363. #{listItem}
  364. </foreach>
  365. </when>
  366. </choose>
  367. </foreach>
  368. </trim>
  369. </if>
  370. </foreach>
  371. </where>
  372. </sql>
  373. <sql id="Base_Column_List" >
  374. id, grain_id, check_date, join_user, check_item, conclusion, charge_user, charge_sign,
  375. sign_date, charge_state, state, charge_idea, c_id, c_time, u_id, u_time
  376. </sql>
  377. </mapper>