WorkOrder.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <!-- namespace必须指向DAO接口 -->
  5. <mapper namespace="com.jpsoft.employment.modules.base.dao.WorkOrderDAO">
  6. <resultMap id="WorkOrderMap" type="com.jpsoft.employment.modules.base.entity.WorkOrder">
  7. <id property="id" column="id_" />
  8. <result property="number" column="number_" />
  9. <result property="title" column="title_" />
  10. <result property="address" column="address_" />
  11. <result property="date" column="date_" />
  12. <result property="tag" column="tag_" />
  13. <result property="image" column="image_" />
  14. <result property="status" column="status_" />
  15. <result property="price" column="price_" />
  16. <result property="location" column="location_" />
  17. <result property="companyId" column="company_id" />
  18. <result property="map" column="map_" />
  19. <result property="constructionLocation" column="construction_location" />
  20. <result property="environment" column="environment" />
  21. <result property="volume" column="volume_" />
  22. <result property="technicianId" column="technician_id" />
  23. <result property="payStatus" column="pay_status" />
  24. <result property="createTime" column="create_time" />
  25. <result property="updateTime" column="update_time" />
  26. <result property="delFlag" column="del_flag" />
  27. <result property="createBy" column="create_by" />
  28. <result property="updateBy" column="update_by" />
  29. <result property="customerName" column="customer_name" />
  30. <result property="customerPhone" column="customer_phone" />
  31. <result property="viewNum" column="view_num" />
  32. <result property="certificate" column="certificate_" />
  33. <result property="cancelCauses" column="cancel_causes" />
  34. <result property="cancelReasons" column="cancel_reasons" />
  35. <result property="cancelImages" column="cancel_images" />
  36. <result property="peopleSeenNum" column="people_seen_num" />
  37. <result property="bak" column="bak_" />
  38. <result property="payCertificate" column="pay_certificate" />
  39. </resultMap>
  40. <insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.WorkOrder">
  41. <!--
  42. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  43. select sys_guid() from dual
  44. </selectKey>
  45. -->
  46. <![CDATA[
  47. insert into base_work_order
  48. (id_,number_,title_,address_,date_,tag_,image_,status_,price_,location_,company_id,map_,construction_location,environment,volume_,technician_id,pay_status,create_time,update_time,del_flag,create_by,update_by,
  49. customer_name,customer_phone,view_num,certificate_,cancel_causes,cancel_reasons,cancel_images,people_seen_num,bak_,pay_certificate)
  50. values
  51. (
  52. #{id,jdbcType=VARCHAR}
  53. ,#{number,jdbcType=VARCHAR}
  54. ,#{title,jdbcType=VARCHAR}
  55. ,#{address,jdbcType=VARCHAR}
  56. ,#{date,jdbcType= TIMESTAMP }
  57. ,#{tag,jdbcType=VARCHAR}
  58. ,#{image,jdbcType=VARCHAR}
  59. ,#{status,jdbcType=VARCHAR}
  60. ,#{price,jdbcType= NUMERIC }
  61. ,#{location,jdbcType=VARCHAR}
  62. ,#{companyId,jdbcType=VARCHAR}
  63. ,#{map,jdbcType=VARCHAR}
  64. ,#{constructionLocation,jdbcType=VARCHAR}
  65. ,#{environment,jdbcType=VARCHAR}
  66. ,#{volume,jdbcType= NUMERIC }
  67. ,#{technicianId,jdbcType=VARCHAR}
  68. ,#{payStatus,jdbcType=VARCHAR}
  69. ,#{createTime,jdbcType= TIMESTAMP }
  70. ,#{updateTime,jdbcType= TIMESTAMP }
  71. ,#{delFlag,jdbcType= NUMERIC }
  72. ,#{createBy,jdbcType=VARCHAR}
  73. ,#{updateBy,jdbcType=VARCHAR}
  74. ,#{customerName,jdbcType=VARCHAR}
  75. ,#{customerPhone,jdbcType=VARCHAR}
  76. ,#{viewNum,jdbcType= NUMERIC }
  77. ,#{certificate,jdbcType=VARCHAR}
  78. ,#{cancelCauses,jdbcType=VARCHAR}
  79. ,#{cancelReasons,jdbcType=VARCHAR}
  80. ,#{cancelImages,jdbcType=VARCHAR}
  81. ,#{peopleSeenNum,jdbcType= NUMERIC }
  82. ,#{bak,jdbcType=VARCHAR}
  83. ,#{payCertificate,jdbcType=VARCHAR}
  84. )
  85. ]]>
  86. </insert>
  87. <delete id="delete" parameterType="string">
  88. delete from base_work_order where id_=#{id,jdbcType=VARCHAR}
  89. </delete>
  90. <update id="update" parameterType="com.jpsoft.employment.modules.base.entity.WorkOrder">
  91. update base_work_order
  92. <set>
  93. <if test="number!=null">
  94. number_=#{number,jdbcType=VARCHAR},
  95. </if>
  96. <if test="title!=null">
  97. title_=#{title,jdbcType=VARCHAR},
  98. </if>
  99. <if test="address!=null">
  100. address_=#{address,jdbcType=VARCHAR},
  101. </if>
  102. <if test="date!=null">
  103. date_=#{date,jdbcType= TIMESTAMP },
  104. </if>
  105. <if test="tag!=null">
  106. tag_=#{tag,jdbcType=VARCHAR},
  107. </if>
  108. <if test="image!=null">
  109. image_=#{image,jdbcType=VARCHAR},
  110. </if>
  111. <if test="status!=null">
  112. status_=#{status,jdbcType=VARCHAR},
  113. </if>
  114. <if test="price!=null">
  115. price_=#{price,jdbcType= NUMERIC },
  116. </if>
  117. <if test="location!=null">
  118. location_=#{location,jdbcType=VARCHAR},
  119. </if>
  120. <if test="companyId!=null">
  121. company_id=#{companyId,jdbcType=VARCHAR},
  122. </if>
  123. <if test="map!=null">
  124. map_=#{map,jdbcType=VARCHAR},
  125. </if>
  126. <if test="constructionLocation!=null">
  127. construction_location=#{constructionLocation,jdbcType=VARCHAR},
  128. </if>
  129. <if test="environment!=null">
  130. environment=#{environment,jdbcType=VARCHAR},
  131. </if>
  132. <if test="volume!=null">
  133. volume_=#{volume,jdbcType= NUMERIC },
  134. </if>
  135. <if test="technicianId!=null">
  136. technician_id=#{technicianId,jdbcType=VARCHAR},
  137. </if>
  138. <if test="payStatus!=null">
  139. pay_status=#{payStatus,jdbcType=VARCHAR},
  140. </if>
  141. <if test="createTime!=null">
  142. create_time=#{createTime,jdbcType= TIMESTAMP },
  143. </if>
  144. <if test="updateTime!=null">
  145. update_time=#{updateTime,jdbcType= TIMESTAMP },
  146. </if>
  147. <if test="delFlag!=null">
  148. del_flag=#{delFlag,jdbcType= NUMERIC },
  149. </if>
  150. <if test="createBy!=null">
  151. create_by=#{createBy,jdbcType=VARCHAR},
  152. </if>
  153. <if test="updateBy!=null">
  154. update_by=#{updateBy,jdbcType=VARCHAR},
  155. </if>
  156. <if test="customerName!=null">
  157. customer_name=#{customerName,jdbcType=VARCHAR},
  158. </if>
  159. <if test="customerPhone!=null">
  160. customer_phone=#{customerPhone,jdbcType=VARCHAR},
  161. </if>
  162. <if test="viewNum!=null">
  163. view_num=#{viewNum,jdbcType=NUMERIC},
  164. </if>
  165. <if test="certificate!=null">
  166. certificate_=#{certificate,jdbcType=VARCHAR},
  167. </if>
  168. <if test="cancelCauses!=null">
  169. cancel_causes=#{cancelCauses,jdbcType=VARCHAR},
  170. </if>
  171. <if test="cancelReasons!=null">
  172. cancel_reasons=#{cancelReasons,jdbcType=VARCHAR},
  173. </if>
  174. <if test="cancelImages!=null">
  175. cancel_images=#{cancelImages,jdbcType=VARCHAR},
  176. </if>
  177. <if test="peopleSeenNum!=null">
  178. people_seen_num=#{peopleSeenNum,jdbcType= NUMERIC },
  179. </if>
  180. <if test="bak!=null">
  181. bak_=#{bak,jdbcType=VARCHAR},
  182. </if>
  183. <if test="payCertificate!=null">
  184. pay_certificate=#{payCertificate,jdbcType=VARCHAR},
  185. </if>
  186. </set>
  187. where id_=#{id}
  188. </update>
  189. <select id="get" parameterType="string" resultMap="WorkOrderMap">
  190. select * from base_work_order where id_=#{0}
  191. </select>
  192. <select id="exist" parameterType="string" resultType="int">
  193. select count(*) from base_work_order where id_=#{0}
  194. </select>
  195. <select id="list" resultMap="WorkOrderMap">
  196. select * from base_work_order
  197. </select>
  198. <select id="findLastByCompanyId" resultMap="WorkOrderMap">
  199. select * from base_work_order where del_flag=false and company_id=#{0}
  200. order by create_time desc limit 1
  201. </select>
  202. <select id="countByCustomerId" resultType="java.util.Map">
  203. select count(id_) as 'count_',sum(price_) as 'price_' from base_work_order
  204. <where>
  205. del_flag = false
  206. <if test="searchParams.companyId != null">
  207. and company_id = #{searchParams.companyId}
  208. </if>
  209. <if test="searchParams.status != null">
  210. and status_ = #{searchParams.status}
  211. </if>
  212. </where>
  213. </select>
  214. <select id="countByTechnicianId" resultType="java.lang.Integer">
  215. select count(id_) from base_work_order
  216. <where>
  217. del_flag = false
  218. <if test="searchParams.technicianId != null">
  219. and technician_id = #{searchParams.technicianId}
  220. </if>
  221. <if test="searchParams.status != null">
  222. and status_ = #{searchParams.status}
  223. </if>
  224. </where>
  225. </select>
  226. <select id="findTopByCustomerId" resultType="java.lang.String">
  227. select technician_id from base_work_order where del_flag = false and company_id = #{0}
  228. order by create_time desc limit 3
  229. </select>
  230. <select id="search" parameterType="hashmap" resultMap="WorkOrderMap">
  231. <![CDATA[
  232. select * from base_work_order
  233. ]]>
  234. <where>
  235. del_flag = false
  236. <if test="searchParams.status != null">
  237. and status_ = #{searchParams.status}
  238. </if>
  239. <if test="searchParams.key != null">
  240. and (title_ like #{searchParams.key} or address_ like #{searchParams.key})
  241. </if>
  242. <if test="searchParams.technicianId != null">
  243. and technician_id = #{searchParams.technicianId}
  244. </if>
  245. <if test="searchParams.date != null">
  246. and create_time like #{searchParams.date}
  247. </if>
  248. </where>
  249. <foreach item="sort" collection="sortList" open="order by" separator=",">
  250. ${sort.name} ${sort.order}
  251. </foreach>
  252. </select>
  253. <select id="searchMobile" parameterType="hashmap" resultMap="WorkOrderMap">
  254. <![CDATA[
  255. select * from base_work_order
  256. ]]>
  257. <where>
  258. del_flag = false
  259. <if test="searchParams.title != null">
  260. and title_ like #{searchParams.title}
  261. </if>
  262. <if test="searchParams.companyId != null">
  263. and company_id = #{searchParams.companyId}
  264. </if>
  265. <if test="searchParams.status != null">
  266. and status_ = #{searchParams.status}
  267. </if>
  268. <if test="searchParams.startDate != null">
  269. <![CDATA[
  270. and date_ >= #{searchParams.startDate}
  271. ]]>
  272. </if>
  273. <if test="searchParams.endDate != null">
  274. <![CDATA[
  275. and date_ < #{searchParams.endDate}
  276. ]]>
  277. </if>
  278. </where>
  279. <foreach item="sort" collection="sortList" open="order by" separator=",">
  280. ${sort.name} ${sort.order}
  281. </foreach>
  282. </select>
  283. </mapper>