WorkOrder.xml 8.8 KB

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