WorkOrder.xml 8.3 KB

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