WorkOrder.xml 9.0 KB

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