CheckInMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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="com.idea.saleManage.mapper.CheckInMapper">
  4. <resultMap id="BaseResultMap" type="com.idea.saleManage.model.CheckIn">
  5. <id column="id" jdbcType="VARCHAR" property="id"/>
  6. <result column="contract_manage_id" jdbcType="VARCHAR" property="contractManageId"/>
  7. <result column="status" jdbcType="VARCHAR" property="status"/>
  8. <result column="in_date" jdbcType="TIMESTAMP" property="inDate"/>
  9. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  10. <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime"/>
  11. <result column="operater_id" jdbcType="VARCHAR" property="operaterId"/>
  12. </resultMap>
  13. <sql id="Example_Where_Clause">
  14. <where>
  15. <foreach collection="oredCriteria" item="criteria" separator="or">
  16. <if test="criteria.valid">
  17. <trim prefix="(" prefixOverrides="and" suffix=")">
  18. <foreach collection="criteria.criteria" item="criterion">
  19. <choose>
  20. <when test="criterion.noValue">
  21. and ${criterion.condition}
  22. </when>
  23. <when test="criterion.singleValue">
  24. and ${criterion.condition} #{criterion.value}
  25. </when>
  26. <when test="criterion.betweenValue">
  27. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  28. </when>
  29. <when test="criterion.listValue">
  30. and ${criterion.condition}
  31. <foreach close=")" collection="criterion.value" item="listItem" open="("
  32. separator=",">
  33. #{listItem}
  34. </foreach>
  35. </when>
  36. </choose>
  37. </foreach>
  38. </trim>
  39. </if>
  40. </foreach>
  41. </where>
  42. </sql>
  43. <sql id="Update_By_Example_Where_Clause">
  44. <where>
  45. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  46. <if test="criteria.valid">
  47. <trim prefix="(" prefixOverrides="and" suffix=")">
  48. <foreach collection="criteria.criteria" item="criterion">
  49. <choose>
  50. <when test="criterion.noValue">
  51. and ${criterion.condition}
  52. </when>
  53. <when test="criterion.singleValue">
  54. and ${criterion.condition} #{criterion.value}
  55. </when>
  56. <when test="criterion.betweenValue">
  57. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  58. </when>
  59. <when test="criterion.listValue">
  60. and ${criterion.condition}
  61. <foreach close=")" collection="criterion.value" item="listItem" open="("
  62. separator=",">
  63. #{listItem}
  64. </foreach>
  65. </when>
  66. </choose>
  67. </foreach>
  68. </trim>
  69. </if>
  70. </foreach>
  71. </where>
  72. </sql>
  73. <sql id="Base_Column_List">
  74. id
  75. , contract_manage_id, status, in_date, remark, operate_time, operater_id
  76. </sql>
  77. <select id="selectByExample" parameterType="com.idea.saleManage.model.CheckInExample" resultMap="BaseResultMap">
  78. select
  79. <if test="distinct">
  80. distinct
  81. </if>
  82. <include refid="Base_Column_List"/>
  83. from check_in
  84. <if test="_parameter != null">
  85. <include refid="Example_Where_Clause"/>
  86. </if>
  87. <if test="orderByClause != null">
  88. order by ${orderByClause}
  89. </if>
  90. </select>
  91. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  92. select
  93. <include refid="Base_Column_List"/>
  94. from check_in
  95. where id = #{id,jdbcType=VARCHAR}
  96. </select>
  97. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  98. delete
  99. from check_in
  100. where id = #{id,jdbcType=VARCHAR}
  101. </delete>
  102. <delete id="deleteByExample" parameterType="com.idea.saleManage.model.CheckInExample">
  103. delete from check_in
  104. <if test="_parameter != null">
  105. <include refid="Example_Where_Clause"/>
  106. </if>
  107. </delete>
  108. <insert id="insert" parameterType="com.idea.saleManage.model.CheckIn">
  109. insert into check_in (id, contract_manage_id, status,
  110. in_date, remark, operate_time,
  111. operater_id)
  112. values (#{id,jdbcType=VARCHAR}, #{contractManageId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
  113. #{inDate,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{operateTime,jdbcType=TIMESTAMP},
  114. #{operaterId,jdbcType=VARCHAR})
  115. </insert>
  116. <insert id="insertSelective" parameterType="com.idea.saleManage.model.CheckIn">
  117. insert into check_in
  118. <trim prefix="(" suffix=")" suffixOverrides=",">
  119. <if test="id != null">
  120. id,
  121. </if>
  122. <if test="contractManageId != null">
  123. contract_manage_id,
  124. </if>
  125. <if test="status != null">
  126. status,
  127. </if>
  128. <if test="inDate != null">
  129. in_date,
  130. </if>
  131. <if test="remark != null">
  132. remark,
  133. </if>
  134. <if test="operateTime != null">
  135. operate_time,
  136. </if>
  137. <if test="operaterId != null">
  138. operater_id,
  139. </if>
  140. </trim>
  141. <trim prefix="values (" suffix=")" suffixOverrides=",">
  142. <if test="id != null">
  143. #{id,jdbcType=VARCHAR},
  144. </if>
  145. <if test="contractManageId != null">
  146. #{contractManageId,jdbcType=VARCHAR},
  147. </if>
  148. <if test="status != null">
  149. #{status,jdbcType=VARCHAR},
  150. </if>
  151. <if test="inDate != null">
  152. #{inDate,jdbcType=TIMESTAMP},
  153. </if>
  154. <if test="remark != null">
  155. #{remark,jdbcType=VARCHAR},
  156. </if>
  157. <if test="operateTime != null">
  158. #{operateTime,jdbcType=TIMESTAMP},
  159. </if>
  160. <if test="operaterId != null">
  161. #{operaterId,jdbcType=VARCHAR},
  162. </if>
  163. </trim>
  164. </insert>
  165. <select id="countByExample" parameterType="com.idea.saleManage.model.CheckInExample" resultType="java.lang.Long">
  166. select count(*) from check_in
  167. <if test="_parameter != null">
  168. <include refid="Example_Where_Clause"/>
  169. </if>
  170. </select>
  171. <update id="updateByExampleSelective" parameterType="map">
  172. update check_in
  173. <set>
  174. <if test="record.id != null">
  175. id = #{record.id,jdbcType=VARCHAR},
  176. </if>
  177. <if test="record.contractManageId != null">
  178. contract_manage_id = #{record.contractManageId,jdbcType=VARCHAR},
  179. </if>
  180. <if test="record.status != null">
  181. status = #{record.status,jdbcType=VARCHAR},
  182. </if>
  183. <if test="record.inDate != null">
  184. in_date = #{record.inDate,jdbcType=TIMESTAMP},
  185. </if>
  186. <if test="record.remark != null">
  187. remark = #{record.remark,jdbcType=VARCHAR},
  188. </if>
  189. <if test="record.operateTime != null">
  190. operate_time = #{record.operateTime,jdbcType=TIMESTAMP},
  191. </if>
  192. <if test="record.operaterId != null">
  193. operater_id = #{record.operaterId,jdbcType=VARCHAR},
  194. </if>
  195. </set>
  196. <if test="_parameter != null">
  197. <include refid="Update_By_Example_Where_Clause"/>
  198. </if>
  199. </update>
  200. <update id="updateByExample" parameterType="map">
  201. update check_in
  202. set id = #{record.id,jdbcType=VARCHAR},
  203. contract_manage_id = #{record.contractManageId,jdbcType=VARCHAR},
  204. status = #{record.status,jdbcType=VARCHAR},
  205. in_date = #{record.inDate,jdbcType=TIMESTAMP},
  206. remark = #{record.remark,jdbcType=VARCHAR},
  207. operate_time = #{record.operateTime,jdbcType=TIMESTAMP},
  208. operater_id = #{record.operaterId,jdbcType=VARCHAR}
  209. <if test="_parameter != null">
  210. <include refid="Update_By_Example_Where_Clause"/>
  211. </if>
  212. </update>
  213. <update id="updateByPrimaryKeySelective" parameterType="com.idea.saleManage.model.CheckIn">
  214. update check_in
  215. <set>
  216. <if test="contractManageId != null">
  217. contract_manage_id = #{contractManageId,jdbcType=VARCHAR},
  218. </if>
  219. <if test="status != null">
  220. status = #{status,jdbcType=VARCHAR},
  221. </if>
  222. <if test="inDate != null">
  223. in_date = #{inDate,jdbcType=TIMESTAMP},
  224. </if>
  225. <if test="remark != null">
  226. remark = #{remark,jdbcType=VARCHAR},
  227. </if>
  228. <if test="operateTime != null">
  229. operate_time = #{operateTime,jdbcType=TIMESTAMP},
  230. </if>
  231. <if test="operaterId != null">
  232. operater_id = #{operaterId,jdbcType=VARCHAR},
  233. </if>
  234. </set>
  235. where id = #{id,jdbcType=VARCHAR}
  236. </update>
  237. <update id="updateByPrimaryKey" parameterType="com.idea.saleManage.model.CheckIn">
  238. update check_in
  239. set contract_manage_id = #{contractManageId,jdbcType=VARCHAR},
  240. status = #{status,jdbcType=VARCHAR},
  241. in_date = #{inDate,jdbcType=TIMESTAMP},
  242. remark = #{remark,jdbcType=VARCHAR},
  243. operate_time = #{operateTime,jdbcType=TIMESTAMP},
  244. operater_id = #{operaterId,jdbcType=VARCHAR}
  245. where id = #{id,jdbcType=VARCHAR}
  246. </update>
  247. <!-- ================新增============================ -->
  248. <select id="findList" parameterType="com.idea.saleManage.model.CheckInMore"
  249. resultType="com.idea.saleManage.model.CheckInMore">
  250. SELECT
  251. contract_manage.id as contract_manage_id2,
  252. contract_manage.customer_management_id,
  253. contract_manage.buyer_Name,
  254. contract_manage.contract_Number,
  255. contract_manage.house_Name,
  256. frame_user.username as operater,
  257. check_in.*
  258. FROM
  259. contract_manage
  260. LEFT JOIN check_in ON check_in.contract_manage_id = contract_manage.id
  261. left join frame_user on frame_user.id=check_in.operater_id
  262. left join park_room on park_room.id = contract_manage.house_id
  263. WHERE
  264. fund_collection_status =2 and contract_manage.contract_status != 3
  265. <if test="record.buyerName != null and record.buyerName != ''">
  266. and contract_manage.buyer_Name like concat('%',#{record.buyerName},'%')
  267. </if>
  268. <if test="record.houseName != null and record.houseName != ''">
  269. and contract_manage.house_Name like concat('%',#{record.houseName},'%')
  270. </if>
  271. <if test="record.status != null and record.status != ''">
  272. <if test="record.status = '0'">
  273. and check_in.status is null
  274. </if>
  275. <if test="record.status = '1'">
  276. and check_in.status = '1'
  277. </if>
  278. <if test="record.status = '2'">
  279. and check_in.status = '2'
  280. </if>
  281. </if>
  282. <if test="record.buyerIdentityCard != null and record.buyerIdentityCard != ''">
  283. and customer_management_id in (select customer_management_id from buyer where identity_card like concat('%',#{record.buyerIdentityCard},'%'))
  284. </if>
  285. <if test="record.batchNumber != null and record.batchNumber != ''">
  286. and customer_management_id in (select id from customer_management where batch_number like concat('%',#{record.batchNumber},'%'))
  287. </if>
  288. order by park_room.group_name , park_room.disc_name , park_room.build_name , park_room.room_no + 0
  289. </select>
  290. </mapper>