TInvoiceBookingworkticketMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.project.invoice.mapper.TInvoiceBookingworkticketMapper">
  6. <resultMap type="TInvoiceBookingworkticket" id="TInvoiceBookingworkticketResult">
  7. <result property="id" column="id" />
  8. <result property="workUnit" column="work_unit" />
  9. <result property="workArea" column="work_area" />
  10. <result property="unitNumber" column="unit_number" />
  11. <result property="floorLocation" column="floor_location" />
  12. <result property="workStartTime" column="work_start_time" />
  13. <result property="workEndTime" column="work_end_time" />
  14. <result property="delFlag" column="del_flag" />
  15. <result property="createrCode" column="creater_code" />
  16. <result property="createdate" column="createdate" />
  17. <result property="updaterCode" column="updater_code" />
  18. <result property="updatedate" column="updatedate" />
  19. <result property="contact" column="contact" />
  20. <result property="phonenumber" column="phonenumber" />
  21. <result property="status" column="status" />
  22. <result property="deptId" column="dept_id" />
  23. <result property="userMg" column="user_mg" />
  24. <result property="deptName" column="dept_name" />
  25. <result property="reservationNumber" column="reservation_number" />
  26. <result property="filename" column="filename" />
  27. <result property="userUnit" column="user_unit" />
  28. <!--关联属性的映射关系-->
  29. <!-- column: 对应的外键。 -->
  30. <!-- <collection property="tInvoiceWorkcontentList" ofType="TInvoiceWorkcontent" column="id"
  31. select="getWorkcontentList"></collection>-->
  32. </resultMap>
  33. <resultMap type="TInvoiceBookingworkticketVo" id="TInvoiceBookingworkticketResultVo">
  34. <result property="workUnit" column="work_unit" />
  35. <result property="workArea" column="work_area" />
  36. <result property="floorLocation" column="floor_location" />
  37. <result property="workStartTime" column="work_start_time" />
  38. <result property="workEndTime" column="work_end_time" />
  39. <result property="contact" column="contact" />
  40. <result property="phonenumber" column="phonenumber" />
  41. <result property="workType" column="work_type" />
  42. <result property="riskLevel" column="risk_level" />
  43. <result property="workDescription" column="work_description" />
  44. <result property="workPeopleNumber" column="work_people_number" />
  45. <result property="estimateWorktime" column="estimate_worktime" />
  46. <result property="status" column="status" />
  47. <result property="bookingticketId" column="id" />
  48. </resultMap>
  49. <resultMap type="TInvoiceWorkcontent" id="TInvoiceWorkcontentResult">
  50. <result property="id" column="id" />
  51. <result property="delFlag" column="del_flag" />
  52. <result property="createrCode" column="creater_code" />
  53. <result property="createdate" column="createdate" />
  54. <result property="updaterCode" column="updater_code" />
  55. <result property="updatedate" column="updatedate" />
  56. <result property="workType" column="work_type" />
  57. <result property="riskLevel" column="risk_level" />
  58. <result property="workDescription" column="work_description" />
  59. <result property="workPeopleNumber" column="work_people_number" />
  60. <result property="hpjb" column="hpjb" />
  61. <result property="estimateWorktime" column="estimate_worktime" />
  62. <result property="bookingticketId" column="bookingticket_id" />
  63. <result property="deptId" column="dept_id" />
  64. <result property="deptName" column="dept_name" />
  65. <result property="reservationNumber" column="reservation_number" />
  66. <result property="whgzxkzh" column="whgzxkzh" />
  67. <result property="dhzyxkzh" column="dhzyxkzh" />
  68. <result property="xzkjxkzh" column="xzkjxkzh" />
  69. <result property="mbzyxkzh" column="mbzyxkzh" />
  70. <result property="gczyxkzh" column="gczyxkzh" />
  71. <result property="gczyjb" column="gczyjb" />
  72. </resultMap>
  73. <sql id="selectTInvoiceBookingworkticketVo">
  74. select d.id, d.work_unit, d.work_area, d.unit_number, d.floor_location, d.work_start_time, d.work_end_time, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.contact, d.phonenumber, d.status, d.dept_id, d.user_mg ,d.user_unit,s.dept_name,d.filename,d.reservation_number from t_invoice_bookingworkticket d
  75. left join sys_dept s on s.dept_id = d.dept_id
  76. </sql>
  77. <sql id="selectTInvoiceWorkcontentVo">
  78. select d.id, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.work_type, d.risk_level, d.work_description, d.work_people_number, d.hpjb, d.estimate_worktime, d.bookingticket_id, d.dept_id ,d.reservation_number,s.dept_name,
  79. d.whgzxkzh,d.dhzyxkzh,d.xzkjxkzh,d.mbzyxkzh,d.gczyxkzh,d.gczyjb,d.tag,d.yqxkzh,d.xpxp from t_invoice_workcontent d
  80. left join sys_dept s on s.dept_id = d.dept_id left join t_invoice_bookingworkticket b on d.bookingticket_id =b.id
  81. </sql>
  82. <select id="selectTInvoiceBookingworkticketList" parameterType="TInvoiceBookingworkticket" resultMap="TInvoiceBookingworkticketResult">
  83. <include refid="selectTInvoiceBookingworkticketVo"/>
  84. <where>
  85. <if test="workUnit != null and workUnit != ''"> and work_unit = #{workUnit}</if>
  86. <if test="workArea != null and workArea != ''"> and work_area = #{workArea}</if>
  87. <if test="unitNumber != null and unitNumber != ''"> and unit_number = #{unitNumber}</if>
  88. <if test="floorLocation != null and floorLocation != ''"> and floor_location = #{floorLocation}</if>
  89. <if test="workStartTime != null "> and work_start_time = #{workStartTime}</if>
  90. <if test="workEndTime != null "> and work_end_time = #{workEndTime}</if>
  91. <if test="createrCode != null and createrCode != ''"> and creater_code = #{createrCode}</if>
  92. <if test="createdate != null "> and createdate = #{createdate}</if>
  93. <if test="updaterCode != null and updaterCode != ''"> and updater_code = #{updaterCode}</if>
  94. <if test="updatedate != null "> and updatedate = #{updatedate}</if>
  95. <if test="contact != null and contact != ''"> and contact = #{contact}</if>
  96. <if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
  97. <if test="status != null "> and status = #{status}</if>
  98. <if test="deptId != null "> and dept_id = #{deptId}</if>
  99. <if test="userMg != null "> and user_mg = #{userMg}</if>
  100. <if test="userUnit != null "> and user_unit = #{userUnit}</if>
  101. <if test="reservationNumber != null "> and reservation_number = #{reservationNumber}</if>
  102. <if test="filename != null and filename != ''"> and filename like concat(concat('%', #{filename}), '%')</if>
  103. <if test="workType != null "> and b.work_type = #{workType}</if>
  104. and d.del_flag = 0
  105. </where>
  106. <!-- 数据范围过滤 -->
  107. ${params.dataScope}
  108. </select>
  109. <!-- 新的list方法 -->
  110. <select id="selectTInvoiceWorkcontentList" parameterType="TInvoiceBookingworkticket" resultMap="TInvoiceWorkcontentResult">
  111. <include refid="selectTInvoiceWorkcontentVo"/>
  112. <where>
  113. <if test="createrCode != null "> and creater_code = #{createrCode} </if>
  114. <if test="createdate != null "> and to_char(b.createdate, 'yyyy-mm-dd') = to_char(#{createdate}, 'yyyy-mm-dd')</if>
  115. <if test="updaterCode != null "> and updater_code = #{updaterCode}</if>
  116. <if test="updatedate != null "> and updatedate = #{updatedate}</if>
  117. <if test="workType != null "> and FIND_IN_SET (#{workType},d.work_type) >0</if>
  118. <!-- &lt;!&ndash; <if test="riskLevel != null "> and risk_level = #{riskLevel}</if>&ndash;&gt;
  119. <if test="workDescription != null and workDescription != ''"> and work_description = #{workDescription}</if>
  120. <if test="workPeopleNumber != null "> and work_people_number = #{workPeopleNumber}</if>
  121. <if test="guardianUnit != null and guardianUnit != ''"> and guardian_unit = #{guardianUnit}</if>
  122. <if test="estimateWorktime != null and estimateWorktime != ''"> and estimate_worktime = #{estimateWorktime}</if>
  123. <if test="bookingticketId != null "> and bookingticket_id = #{bookingticketId}</if>
  124. <if test="reservationNumber != null and reservationNumber != ''"> and reservation_number = #{reservationNumber}</if>
  125. <if test="deptId != null "> and dept_id = #{deptId}</if>-->
  126. <if test="workUnit != null and workUnit != ''"> and b.work_unit = #{workUnit}</if>
  127. <if test="workArea != null and workArea != ''"> and b.work_area = #{workArea}</if>
  128. <if test="floorLocation != null and floorLocation != ''"> and FIND_IN_SET (#{floorLocation},b.floor_location) >0</if>
  129. <if test="workStartTime != null "> and b.work_start_time = #{workStartTime}</if>
  130. <if test="workEndTime != null "> and b.work_end_time = #{workEndTime}</if>
  131. <if test="contact != null and contact != ''"> and b.contact = #{contact}</if>
  132. <if test="phonenumber != null and phonenumber != ''"> and b.phonenumber = #{phonenumber}</if>
  133. <if test="whgzxkzh != null and whgzxkzh != ''"> and whgzxkzh = #{whgzxkzh}</if>
  134. <if test="dhzyxkzh != null and dhzyxkzh != ''"> and dhzyxkzh = #{dhzyxkzh}</if>
  135. <if test="xzkjxkzh != null and xzkjxkzh != ''"> and xzkjxkzh = #{xzkjxkzh}</if>
  136. <if test="mbzyxkzh != null and mbzyxkzh != ''"> and mbzyxkzh = #{mbzyxkzh}</if>
  137. <if test="gczyxkzh != null and gczyxkzh != ''"> and gczyxkzh = #{gczyxkzh}</if>
  138. <if test="gczyjb != null and gczyjb != ''"> and gczyjb = #{gczyjb}</if>
  139. and d.del_flag = 0
  140. </where>
  141. <!-- 数据范围过滤 -->
  142. ${params.dataScope}
  143. order by b.work_start_time desc ,d.bookingticket_id desc
  144. </select>
  145. <select id="selectDetailById" parameterType="Long" resultMap="TInvoiceBookingworkticketResultVo">
  146. select a.work_unit,a.work_area,a.floor_location,a.work_start_time,a.work_end_time,a.status,b.work_type,b.risk_level,b.work_description,b.work_people_number,b.estimate_worktime,a.contact,a.phonenumber,a.id
  147. ,b.whgzxkzh,b.dhzyxkzh,b.xzkjxkzh,b.mbzyxkzh,b.gczyxkzh,b.gczyjb,b.tag,b.yqxkzh,b.xpxp
  148. from t_invoice_bookingworkticket a,t_invoice_workcontent b
  149. where a.id=b.bookingticket_id and a.id=#{id} and a.del_flag = 0 and b.del_flag = 0
  150. </select>
  151. <select id="selectTInvoiceBookingworkticketById" parameterType="Long" resultMap="TInvoiceBookingworkticketResult">
  152. <include refid="selectTInvoiceBookingworkticketVo"/>
  153. where id = #{id}
  154. and d.del_flag = 0
  155. </select>
  156. <!-- <select id="getWorkcontentList" resultType="TInvoiceWorkcontent" parameterType="int">
  157. SELECT
  158. b.id ,b.work_description, b.work_type , b.bookingticket_id
  159. FROM t_invoice_workcontent b
  160. <where>
  161. b.bookingticket_id = #{id}
  162. <if test="workType != null "> and work_type = #{workType}</if>
  163. </where>
  164. </select>-->
  165. <insert id="insertTInvoiceBookingworkticket" parameterType="TInvoiceBookingworkticket" useGeneratedKeys = "true" keyProperty = "id">
  166. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  167. SELECT t_bookingworkticket_seq.NEXTVAL as id FROM DUAL
  168. </selectKey>
  169. insert into t_invoice_bookingworkticket
  170. <trim prefix="(" suffix=")" suffixOverrides=",">
  171. <if test="id != null">id,</if>
  172. <if test="workUnit != null">work_unit,</if>
  173. <if test="workArea != null">work_area,</if>
  174. <if test="unitNumber != null">unit_number,</if>
  175. <if test="floorLocation != null">floor_location,</if>
  176. <if test="workStartTime != null">work_start_time,</if>
  177. <if test="workEndTime != null">work_end_time,</if>
  178. <if test="delFlag != null">del_flag,</if>
  179. <if test="createrCode != null">creater_code,</if>
  180. <if test="updaterCode != null">updater_code,</if>
  181. <if test="updatedate != null">updatedate,</if>
  182. <if test="contact != null">contact,</if>
  183. <if test="phonenumber != null">phonenumber,</if>
  184. <if test="status != null">status,</if>
  185. <if test="deptId != null">dept_id,</if>
  186. <if test="userMg != null">user_mg,</if>
  187. <if test="userUnit != null">user_unit,</if>
  188. <if test="reservationNumber != null">reservation_number,</if>
  189. <if test="filename != null">filename,</if>
  190. </trim>
  191. <trim prefix="values (" suffix=")" suffixOverrides=",">
  192. <if test="id != null">#{id},</if>
  193. <if test="workUnit != null">#{workUnit},</if>
  194. <if test="workArea != null">#{workArea},</if>
  195. <if test="unitNumber != null">#{unitNumber},</if>
  196. <if test="floorLocation != null">#{floorLocation},</if>
  197. <if test="workStartTime != null">#{workStartTime},</if>
  198. <if test="workEndTime != null">#{workEndTime},</if>
  199. <if test="delFlag != null">#{delFlag},</if>
  200. <if test="createrCode != null">#{createrCode},</if>
  201. <if test="updaterCode != null">#{updaterCode},</if>
  202. <if test="updatedate != null">#{updatedate},</if>
  203. <if test="contact != null">#{contact},</if>
  204. <if test="phonenumber != null">#{phonenumber},</if>
  205. <if test="status != null">#{status},</if>
  206. <if test="deptId != null">#{deptId},</if>
  207. <if test="userMg != null">#{userMg},</if>
  208. <if test="userUnit != null">#{userUnit},</if>
  209. <if test="reservationNumber != null">#{reservationNumber},</if>
  210. <if test="filename != null">#{filename},</if>
  211. </trim>
  212. </insert>
  213. <update id="updateTInvoiceBookingworkticket" parameterType="TInvoiceBookingworkticket">
  214. update t_invoice_bookingworkticket
  215. <trim prefix="SET" suffixOverrides=",">
  216. <if test="workUnit != null">work_unit = #{workUnit},</if>
  217. <if test="workArea != null">work_area = #{workArea},</if>
  218. <if test="unitNumber != null">unit_number = #{unitNumber},</if>
  219. <if test="floorLocation != null">floor_location = #{floorLocation},</if>
  220. <if test="workStartTime != null">work_start_time = #{workStartTime},</if>
  221. <if test="workEndTime != null">work_end_time = #{workEndTime},</if>
  222. <if test="delFlag != null">del_flag = #{delFlag},</if>
  223. <if test="createrCode != null">creater_code = #{createrCode},</if>
  224. <if test="createdate != null">createdate = #{createdate},</if>
  225. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  226. <if test="updatedate != null">updatedate = #{updatedate},</if>
  227. <if test="contact != null">contact = #{contact},</if>
  228. <if test="phonenumber != null">phonenumber = #{phonenumber},</if>
  229. <if test="status != null">status = #{status},</if>
  230. <if test="deptId != null">dept_id = #{deptId},</if>
  231. <if test="userMg != null">user_mg = #{userMg},</if>
  232. <if test="userUnit != null">user_unit = #{userUnit},</if>
  233. <if test="reservationNumber != null">reservation_number = #{reservationNumber},</if>
  234. <if test="filename != null">filename = #{filename},</if>
  235. </trim>
  236. where id = #{id}
  237. </update>
  238. <update id="deleteTInvoiceBookingworkticketById" parameterType="Long">
  239. update t_invoice_bookingworkticket set del_flag = 2 where id = #{id}
  240. </update>
  241. <update id="deleteTInvoiceBookingworkticketByIds" parameterType="String">
  242. update t_invoice_bookingworkticket set del_flag = 2 where id in
  243. <foreach item="id" collection="array" open="(" separator="," close=")">
  244. #{id}
  245. </foreach>
  246. </update>
  247. </mapper>