CheckDomainDao.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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.CheckDomainDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.CheckDomain" id="baseMap">
  5. <result column="id" property="id"/>
  6. <!--<result column="uuid" property="uuid"/>-->
  7. <result column="c_id" property="cId"/>
  8. <result column="c_time" property="cTime"/>
  9. <result column="u_id" property="uId"/>
  10. <result column="u_time" property="uTime"/>
  11. <result column="version" property="version"/>
  12. <result column="grain_id" property="grainId"/>
  13. <result column="check_domain_name" property="checkDomainName"/>
  14. <result column="check_domain_detail" property="checkDomainDetail"/>
  15. </resultMap>
  16. <sql id="columns">
  17. id,
  18. grain_id,
  19. check_domain_name,
  20. check_domain_detail,
  21. c_time,
  22. c_id,
  23. u_time,
  24. u_id,
  25. version
  26. </sql>
  27. <sql id="joinCols">
  28. </sql>
  29. <select id="get" resultMap="baseMap">
  30. SELECT
  31. <include refid="columns"/>
  32. FROM check_domain a
  33. <include refid="joinCols"/>
  34. WHERE a.id = #{id}
  35. </select>
  36. <select id="findList" resultMap="baseMap">
  37. SELECT
  38. <include refid="columns"/>
  39. FROM check_domain a
  40. <include refid="joinCols"/>
  41. <where>
  42. <if test="id !=null">
  43. and id = #{id}
  44. </if>
  45. <if test="grainId !=null">
  46. and grain_id = #{grainId}
  47. </if>
  48. <if test="checkDomainName !=null">
  49. and check_domain_name like CONCAT('%',#{checkDomainName},'%')
  50. </if>
  51. <if test="checkDomainDetail !=null">
  52. and check_domain_detail = #{checkDomainDetail}
  53. </if>
  54. <if test="cTime !=null">
  55. and c_time = #{cTime}
  56. </if>
  57. <if test="cId !=null">
  58. and c_id = #{cId}
  59. </if>
  60. <if test="uTime !=null">
  61. and u_time = #{uTime}
  62. </if>
  63. <if test="uId !=null">
  64. and u_id = #{uId}
  65. </if>
  66. <if test="version !=null">
  67. and version = #{version}
  68. </if>
  69. </where>
  70. <choose>
  71. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  72. ORDER BY ${page.orderBy}
  73. </when>
  74. <otherwise>
  75. </otherwise>
  76. </choose>
  77. </select>
  78. <select id="findBkList" resultMap="baseMap">
  79. SELECT
  80. <include refid="columns"/>
  81. FROM check_domain a
  82. <include refid="joinCols"/>
  83. <where>
  84. <if test="id !=null">
  85. and id = #{id}
  86. </if>
  87. <if test="grainId !=null">
  88. and grain_id in (SELECT id FROM sys_grain a WHERE parentId = #{grainId} OR parentId IN (SELECT id FROM sys_grain WHERE parentId = #{grainId} AND NAME LIKE '%库外储粮%'))
  89. </if>
  90. <if test="checkDomainName !=null">
  91. and check_domain_name like CONCAT('%',#{checkDomainName},'%')
  92. </if>
  93. <if test="checkDomainDetail !=null">
  94. and check_domain_detail = #{checkDomainDetail}
  95. </if>
  96. <if test="cTime !=null">
  97. and c_time = #{cTime}
  98. </if>
  99. <if test="cId !=null">
  100. and c_id = #{cId}
  101. </if>
  102. <if test="uTime !=null">
  103. and u_time = #{uTime}
  104. </if>
  105. <if test="uId !=null">
  106. and u_id = #{uId}
  107. </if>
  108. <if test="version !=null">
  109. and version = #{version}
  110. </if>
  111. </where>
  112. <choose>
  113. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  114. ORDER BY ${page.orderBy}
  115. </when>
  116. <otherwise>
  117. </otherwise>
  118. </choose>
  119. </select>
  120. <select id="getBkTreeList" resultMap="baseMap">
  121. SELECT
  122. <include refid="columns"/>
  123. FROM check_domain a
  124. <include refid="joinCols"/>
  125. <where>
  126. <if test="id !=null">
  127. and id = #{id}
  128. </if>
  129. <if test="grainId !=null">
  130. and grain_id in (SELECT id FROM sys_grain a WHERE parentId = #{grainId} OR parentId IN (SELECT id FROM sys_grain WHERE parentId = #{grainId} AND NAME LIKE '%库外储粮%'))
  131. </if>
  132. <if test="checkDomainName !=null">
  133. and check_domain_name like CONCAT('%',#{checkDomainName},'%')
  134. </if>
  135. <if test="checkDomainDetail !=null">
  136. and check_domain_detail = #{checkDomainDetail}
  137. </if>
  138. <if test="cTime !=null">
  139. and c_time = #{cTime}
  140. </if>
  141. <if test="cId !=null">
  142. and c_id = #{cId}
  143. </if>
  144. <if test="uTime !=null">
  145. and u_time = #{uTime}
  146. </if>
  147. <if test="uId !=null">
  148. and u_id = #{uId}
  149. </if>
  150. <if test="version !=null">
  151. and version = #{version}
  152. </if>
  153. </where>
  154. </select>
  155. <select id="getTreeList" resultMap="baseMap">
  156. SELECT
  157. <include refid="columns"/>
  158. FROM check_domain a
  159. <include refid="joinCols"/>
  160. <where>
  161. <if test="id !=null">
  162. and id = #{id}
  163. </if>
  164. <if test="grainId !=null">
  165. and grain_id = #{grainId}
  166. </if>
  167. <if test="checkDomainName !=null">
  168. and check_domain_name like CONCAT('%',#{checkDomainName},'%')
  169. </if>
  170. <if test="checkDomainDetail !=null">
  171. and check_domain_detail = #{checkDomainDetail}
  172. </if>
  173. <if test="cTime !=null">
  174. and c_time = #{cTime}
  175. </if>
  176. <if test="cId !=null">
  177. and c_id = #{cId}
  178. </if>
  179. <if test="uTime !=null">
  180. and u_time = #{uTime}
  181. </if>
  182. <if test="uId !=null">
  183. and u_id = #{uId}
  184. </if>
  185. <if test="version !=null">
  186. and version = #{version}
  187. </if>
  188. </where>
  189. </select>
  190. <select id="findAllList" resultMap="baseMap">
  191. SELECT
  192. <include refid="columns"/>
  193. FROM check_domain a
  194. <include refid="joinCols"/>
  195. <where>
  196. <if test="id !=null">
  197. and id = #{id}
  198. </if>
  199. <if test="grainId !=null">
  200. and grain_id in (SELECT id FROM sys_grain WHERE id = #{grainId} OR parentId = #{grainId})
  201. </if>
  202. <if test="checkDomainName !=null">
  203. and check_domain_name like CONCAT('%',#{checkDomainName},'%')
  204. </if>
  205. <if test="checkDomainDetail !=null">
  206. and check_domain_detail = #{checkDomainDetail}
  207. </if>
  208. <if test="cTime !=null">
  209. and c_time = #{cTime}
  210. </if>
  211. <if test="cId !=null">
  212. and c_id = #{cId}
  213. </if>
  214. <if test="uTime !=null">
  215. and u_time = #{uTime}
  216. </if>
  217. <if test="uId !=null">
  218. and u_id = #{uId}
  219. </if>
  220. <if test="version !=null">
  221. and version = #{version}
  222. </if>
  223. </where>
  224. <choose>
  225. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  226. ORDER BY ${page.orderBy}
  227. </when>
  228. <otherwise>
  229. </otherwise>
  230. </choose>
  231. </select>
  232. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  233. parameterType="cn.ourwill.module.house.entity.daily.CheckDomain">
  234. INSERT INTO check_domain
  235. <trim prefix="(" suffix=")" suffixOverrides=",">
  236. <if test=" id != null">
  237. id,
  238. </if>
  239. <!-- <if test=" uuid != null">
  240. uuid,
  241. </if>-->
  242. <if test=" grainId != null">
  243. grain_id,
  244. </if>
  245. <if test=" checkDomainName != null">
  246. check_domain_name,
  247. </if>
  248. <if test="checkDomainDetail !=null">
  249. check_domain_detail,
  250. </if>
  251. <if test=" cTime != null">
  252. c_time,
  253. </if>
  254. <if test=" cId != null">
  255. c_id,
  256. </if>
  257. <if test=" uTime != null">
  258. u_time,
  259. </if>
  260. <if test=" uId != null">
  261. u_id,
  262. </if>
  263. <if test=" version != null">
  264. version
  265. </if>
  266. </trim>
  267. <trim prefix="values (" suffix=")" suffixOverrides=",">
  268. <if test=" id != null">
  269. #{id},
  270. </if>
  271. <!-- <if test=" uuid != null">
  272. #{uuid},
  273. </if>-->
  274. <if test=" grainId != null">
  275. #{grainId},
  276. </if>
  277. <if test=" checkDomainName != null">
  278. #{checkDomainName},
  279. </if>
  280. <if test="checkDomainDetail !=null">
  281. #{checkDomainDetail},
  282. </if>
  283. <if test=" cTime != null">
  284. #{cTime},
  285. </if>
  286. <if test=" cId != null">
  287. #{cId},
  288. </if>
  289. <if test=" uTime != null">
  290. #{uTime},
  291. </if>
  292. <if test=" uId != null">
  293. #{uId},
  294. </if>
  295. <if test=" version != null">
  296. #{version}
  297. </if>
  298. </trim>
  299. </insert>
  300. <update id="update" parameterType="cn.ourwill.module.house.entity.daily.CheckDomain">
  301. UPDATE check_domain
  302. <set>
  303. <if test="grainId != null">
  304. grain_id= #{grainId} ,
  305. </if>
  306. <if test="checkDomainName != null">
  307. check_domain_name= #{checkDomainName} ,
  308. </if>
  309. <if test="checkDomainDetail != null">
  310. check_domain_detail= #{checkDomainDetail} ,
  311. </if>
  312. <if test="cTime != null">
  313. c_time= #{cTime} ,
  314. </if>
  315. <if test="cId != null">
  316. c_id= #{cId} ,
  317. </if>
  318. <if test="uTime != null">
  319. u_time= #{uTime} ,
  320. </if>
  321. <if test="uId != null">
  322. u_id= #{uId} ,
  323. </if>
  324. <if test="version != null">
  325. version= #{version}
  326. </if>
  327. </set>
  328. WHERE id = #{id}
  329. </update>
  330. <delete id="deleteById" parameterType="java.lang.Long">
  331. DELETE FROM check_domain
  332. WHERE id = #{id}
  333. </delete>
  334. <delete id="deleteByIds" parameterType="java.util.List">
  335. DELETE FROM check_domain WHERE id IN
  336. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  337. #{item}
  338. </foreach>
  339. </delete>
  340. </mapper>