综合办公系统
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

CmcCarApprovalMapper.xml 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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.oa.mapper.CmcCarApprovalMapper">
  6. <resultMap type="CmcCarApproval" id="CmcCarApprovalResult">
  7. <result property="carApplyId" column="car_apply_id" />
  8. <result property="applier" column="applier" />
  9. <result property="useDept" column="use_dept" />
  10. <result property="cars" column="cars" />
  11. <result property="drivers" column="drivers" />
  12. <result property="projectId" column="project_id" />
  13. <result property="undertakingDept" column="undertaking_dept" />
  14. <result property="applyReason" column="apply_reason" />
  15. <result property="passengers" column="passengers" />
  16. <result property="applyDate" column="apply_date" />
  17. <result property="beginDate" column="begin_date" />
  18. <result property="endDate" column="end_date" />
  19. <result property="days" column="days" />
  20. <result property="deptUserId" column="dept_user_id" />
  21. <result property="deptComment" column="dept_comment" />
  22. <result property="managerUserId" column="manager_user_id" />
  23. <result property="managerComment" column="manager_comment" />
  24. <result property="carUsage" column="car_usage" />
  25. <result property="unionUserId" column="union_user_id" />
  26. <result property="unionComment" column="union_comment" />
  27. <result property="gmUserId" column="gm_user_id" />
  28. <result property="gmComment" column="gm_comment" />
  29. <result property="dispatcher" column="dispatcher" />
  30. <result property="dispatchComment" column="dispatch_comment" />
  31. <result property="estimateCost" column="estimate_cost" />
  32. <result property="deptTime" column="dept_time" />
  33. <result property="managerTime" column="manager_time" />
  34. <result property="unionTime" column="union_time" />
  35. <result property="gmTime" column="gm_time" />
  36. <result property="dszTime" column="dsz_time" />
  37. <result property="dispatchTime" column="dispatch_time" />
  38. <result property="returnDate" column="return_date" />
  39. <result property="kilometers" column="kilometers" />
  40. <association property="applierUser" javaType="SysUser" resultMap="ApplierUserResult" />
  41. <association property="dept" javaType="SysDept" resultMap="SysDeptResult" />
  42. <association property="project" javaType="CmcProject" resultMap="CmcProjectResult" />
  43. <association property="deptUser" javaType="SysUser" resultMap="DeptUserResult" />
  44. <association property="managerUser" javaType="SysUser" resultMap="ManagerUserResult" />
  45. <association property="unionUser" javaType="SysUser" resultMap="UnionUserResult" />
  46. <association property="gmUser" javaType="SysUser" resultMap="GmUserResult" />
  47. <association property="dszUser" javaType="SysUser" resultMap="DszUserResult" />
  48. <association property="driverUser" javaType="SysUser" resultMap="DriverUserResult" />
  49. <association property="dispatchUser" javaType="SysUser" resultMap="DispatchUserResult" />
  50. </resultMap>
  51. <resultMap type="SysUser" id="ApplierUserResult">
  52. <result property="userId" column="user_id" />
  53. <result property="nickName" column="applier_nick_name" />
  54. </resultMap>
  55. <resultMap type="SysUser" id="DeptUserResult">
  56. <result property="userId" column="user_id" />
  57. <result property="nickName" column="dept_nick_name" />
  58. </resultMap>
  59. <resultMap type="SysUser" id="ManagerUserResult">
  60. <result property="userId" column="user_id" />
  61. <result property="nickName" column="manager_nick_name" />
  62. </resultMap>
  63. <resultMap type="SysUser" id="UnionUserResult">
  64. <result property="userId" column="user_id" />
  65. <result property="nickName" column="union_nick_name" />
  66. </resultMap>
  67. <resultMap type="SysUser" id="GmUserResult">
  68. <result property="userId" column="user_id" />
  69. <result property="nickName" column="gm_nick_name" />
  70. </resultMap>
  71. <resultMap type="SysUser" id="DszUserResult">
  72. <result property="userId" column="user_id" />
  73. <result property="nickName" column="dsz_nick_name" />
  74. </resultMap>
  75. <resultMap type="SysUser" id="DispatchUserResult">
  76. <result property="userId" column="user_id" />
  77. <result property="nickName" column="dispatch_nick_name" />
  78. </resultMap>
  79. <resultMap type="SysUser" id="DriverUserResult">
  80. <result property="userId" column="user_id" />
  81. <result property="nickName" column="driver_nick_name" />
  82. </resultMap>
  83. <resultMap type="SysDept" id="SysDeptResult">
  84. <result property="deptId" column="dept_id" />
  85. <result property="deptName" column="dept_name" />
  86. </resultMap>
  87. <resultMap type="CmcProject" id="CmcProjectResult">
  88. <result property="projectId" column="project_id" />
  89. <result property="projectNumber" column="project_number" />
  90. <result property="projectName" column="project_name" />
  91. <result property="undertakingDept" column="undertaking_dept" />
  92. </resultMap>
  93. <resultMap type="CmcCar" id="CmcCarResult">
  94. <result property="carId" column="car_id" />
  95. <result property="licensePlate" column="license_plate" />
  96. </resultMap>
  97. <sql id="selectCmcCarApprovalVo">
  98. select ca.car_apply_id, ca.applier, u.nick_name as applier_nick_name, ca.use_dept, d.dept_name, ca.cars, c.license_plate, ca.drivers, u7.nick_name as driver_nick_name, ca.project_id, p.project_number, p.project_name, p.undertaking_dept,
  99. ca.apply_reason, ca.passengers, ca.apply_date, ca.begin_date, ca.end_date, ca.days, ca.dept_user_id, u1.nick_name as dept_nick_name, ca.dept_comment, ca.manager_user_id,
  100. u2.nick_name as manager_nick_name, ca.manager_comment, ca.car_usage, ca.union_user_id, u3.nick_name as union_nick_name, ca.union_comment, ca.gm_user_id, u4.nick_name as gm_nick_name,
  101. ca.dsz_user_id, u5.nick_name as dsz_nick_name, ca.gm_comment, ca.dsz_comment, ca.dispatcher, u6.nick_name as dispatch_nick_name, ca.dispatch_comment, ca.estimate_cost, ca.dept_time,
  102. ca.manager_time, ca.union_time, ca.gm_time, ca.dsz_time, ca.dispatch_time, ca.return_date, ca.kilometers from cmc_car_approval as ca
  103. left join sys_user as u on u.user_id = ca.applier
  104. left join sys_user as u1 on u1.user_id = ca.dept_user_id
  105. left join sys_user as u2 on u2.user_id = ca.manager_user_id
  106. left join sys_user as u3 on u3.user_id = ca.union_user_id
  107. left join sys_user as u4 on u4.user_id = ca.gm_user_id
  108. left join sys_user as u5 on u5.user_id = ca.dsz_user_id
  109. left join sys_user as u6 on u6.user_id = ca.dispatcher
  110. left join sys_user as u7 on concat(u7.user_id) = ca.drivers
  111. left join sys_dept as d on d.dept_id = ca.use_dept
  112. left join cmc_project as p on ca.project_id = p.project_id
  113. left join cmc_car as c on concat(c.car_id) = ca.cars
  114. </sql>
  115. <select id="selectCmcCarApprovalList" parameterType="CmcCarApproval" resultMap="CmcCarApprovalResult">
  116. <include refid="selectCmcCarApprovalVo"/>
  117. <where>
  118. <if test="applier != null "> and ca.applier = #{applier}</if>
  119. <if test="useDept != null "> and ca.use_dept = #{useDept}</if>
  120. <if test="cars != null and cars != ''"> and find_in_set(#{cars}, ca.cars)</if>
  121. <if test="undertakingDept != null and undertakingDept != ''"> and find_in_set(#{undertakingDept}, p.undertaking_dept)</if>
  122. <if test="drivers != null and drivers != ''"> and find_in_set(#{drivers}, ca.drivers)</if>
  123. <if test="projectId != null and projectId != ''"> and ca.project_id = #{projectId}</if>
  124. <if test="applyReason != null and applyReason != ''"> and ca.apply_reason = #{applyReason}</if>
  125. <if test="passengers != null "> and ca.passengers = #{passengers}</if>
  126. <if test="applyDate != null "> and YEAR(ca.apply_date) = YEAR(#{applyDate})</if>
  127. <if test="beginDate != null "> and ca.begin_date = #{beginDate}</if>
  128. <if test="endDate != null "> and ca.end_date = #{endDate}</if>
  129. <if test="days != null "> and ca.days = #{days}</if>
  130. <if test="deptUserId != null "> and ca.dept_user_id = #{deptUserId}</if>
  131. <if test="deptComment != null and deptComment != ''"> and ca.dept_comment = #{deptComment}</if>
  132. <if test="managerUserId != null "> and ca.manager_user_id = #{managerUserId}</if>
  133. <if test="managerComment != null and managerComment != ''"> and ca.manager_comment = #{managerComment}</if>
  134. <if test="carUsage != null and carUsage != ''"> and ca.car_usage = #{carUsage}</if>
  135. <if test="unionUserId != null "> and ca.union_user_id = #{unionUserId}</if>
  136. <if test="unionComment != null and unionComment != ''"> and ca.union_comment = #{unionComment}</if>
  137. <if test="gmUserId != null "> and ca.gm_user_id = #{gmUserId}</if>
  138. <if test="gmComment != null and gmComment != ''"> and ca.gm_comment = #{gmComment}</if>
  139. <if test="dispatcher != null "> and ca.dispatcher = #{dispatcher}</if>
  140. <if test="dispatchComment != null and dispatchComment != ''"> and ca.dispatch_comment = #{dispatchComment}</if>
  141. <if test="dispatchTime != null "> and da.dispatch_time = #{dispatchTime}</if>
  142. <if test="estimateCost != null "> and ca.estimate_cost = #{estimateCost}</if>
  143. </where>
  144. order by ca.apply_date desc
  145. </select>
  146. <select id="selectCmcCarApprovalByCarApplyId" parameterType="String" resultMap="CmcCarApprovalResult">
  147. <include refid="selectCmcCarApprovalVo"/>
  148. where car_apply_id = #{carApplyId}
  149. </select>
  150. <insert id="insertCmcCarApproval" parameterType="CmcCarApproval">
  151. insert into cmc_car_approval
  152. <trim prefix="(" suffix=")" suffixOverrides=",">
  153. <if test="carApplyId != null">car_apply_id,</if>
  154. <if test="applier != null">applier,</if>
  155. <if test="useDept != null">use_dept,</if>
  156. <if test="cars != null">cars,</if>
  157. <if test="drivers != null">drivers,</if>
  158. <if test="projectId != null">project_id,</if>
  159. <if test="applyReason != null">apply_reason,</if>
  160. <if test="passengers != null">passengers,</if>
  161. <if test="applyDate != null">apply_date,</if>
  162. <if test="beginDate != null">begin_date,</if>
  163. <if test="endDate != null">end_date,</if>
  164. <if test="days != null">days,</if>
  165. <if test="deptUserId != null">dept_user_id,</if>
  166. <if test="deptComment != null">dept_comment,</if>
  167. <if test="managerUserId != null">manager_user_id,</if>
  168. <if test="managerComment != null">manager_comment,</if>
  169. <if test="carUsage != null">car_usage,</if>
  170. <if test="unionUserId != null">union_user_id,</if>
  171. <if test="unionComment != null">union_comment,</if>
  172. <if test="gmUserId != null">gm_user_id,</if>
  173. <if test="gmComment != null">gm_comment,</if>
  174. <if test="dszUserId != null">dsz_user_id,</if>
  175. <if test="dszComment != null">dsz_comment,</if>
  176. <if test="dispatcher != null">dispatcher,</if>
  177. <if test="dispatchComment != null">dispatch_comment,</if>
  178. <if test="estimateCost != null">estimate_cost,</if>
  179. </trim>
  180. <trim prefix="values (" suffix=")" suffixOverrides=",">
  181. <if test="carApplyId != null">#{carApplyId},</if>
  182. <if test="applier != null">#{applier},</if>
  183. <if test="useDept != null">#{useDept},</if>
  184. <if test="cars != null">#{cars},</if>
  185. <if test="drivers != null">#{drivers},</if>
  186. <if test="projectId != null">#{projectId},</if>
  187. <if test="applyReason != null">#{applyReason},</if>
  188. <if test="passengers != null">#{passengers},</if>
  189. <if test="applyDate != null">#{applyDate},</if>
  190. <if test="beginDate != null">#{beginDate},</if>
  191. <if test="endDate != null">#{endDate},</if>
  192. <if test="days != null">#{days},</if>
  193. <if test="deptUserId != null">#{deptUserId},</if>
  194. <if test="deptComment != null">#{deptComment},</if>
  195. <if test="managerUserId != null">#{managerUserId},</if>
  196. <if test="managerComment != null">#{managerComment},</if>
  197. <if test="carUsage != null">#{carUsage},</if>
  198. <if test="unionUserId != null">#{unionUserId},</if>
  199. <if test="unionComment != null">#{unionComment},</if>
  200. <if test="gmUserId != null">#{gmUserId},</if>
  201. <if test="gmComment != null">#{gmComment},</if>
  202. <if test="dszUserId != null">#{dszUserId},</if>
  203. <if test="dszComment != null">#{dszComment},</if>
  204. <if test="dispatcher != null">#{dispatcher},</if>
  205. <if test="dispatchComment != null">#{dispatchComment},</if>
  206. <if test="estimateCost != null">#{estimateCost},</if>
  207. </trim>
  208. </insert>
  209. <update id="updateCmcCarApproval" parameterType="CmcCarApproval">
  210. update cmc_car_approval
  211. <trim prefix="SET" suffixOverrides=",">
  212. <if test="applier != null">applier = #{applier},</if>
  213. <if test="useDept != null">use_dept = #{useDept},</if>
  214. <if test="cars != null">cars = #{cars},</if>
  215. <if test="drivers != null">drivers = #{drivers},</if>
  216. <if test="projectId != null">project_id = #{projectId},</if>
  217. <if test="applyReason != null">apply_reason = #{applyReason},</if>
  218. <if test="passengers != null">passengers = #{passengers},</if>
  219. <if test="applyDate != null">apply_date = #{applyDate},</if>
  220. <if test="beginDate != null">begin_date = #{beginDate},</if>
  221. <if test="endDate != null">end_date = #{endDate},</if>
  222. <if test="days != null">days = #{days},</if>
  223. <if test="deptUserId != null">dept_user_id = #{deptUserId},</if>
  224. <if test="deptComment != null">dept_comment = #{deptComment},</if>
  225. <if test="managerUserId != null">manager_user_id = #{managerUserId},</if>
  226. <if test="managerComment != null">manager_comment = #{managerComment},</if>
  227. <if test="carUsage != null">car_usage = #{carUsage},</if>
  228. <if test="unionUserId != null">union_user_id = #{unionUserId},</if>
  229. <if test="unionComment != null">union_comment = #{unionComment},</if>
  230. <if test="gmUserId != null">gm_user_id = #{gmUserId},</if>
  231. <if test="gmComment != null">gm_comment = #{gmComment},</if>
  232. <if test="dszUserId != null">dsz_user_id = #{dszUserId},</if>
  233. <if test="dszComment != null">dsz_comment = #{dszComment},</if>
  234. <if test="dispatcher != null">dispatcher = #{dispatcher},</if>
  235. <if test="dispatchComment != null">dispatch_comment = #{dispatchComment},</if>
  236. <if test="estimateCost != null">estimate_cost = #{estimateCost},</if>
  237. <if test="deptTime != null ">dept_time = #{deptTime},</if>
  238. <if test="managerTime != null ">manager_time = #{managerTime},</if>
  239. <if test="unionTime != null ">union_time = #{unionTime},</if>
  240. <if test="gmTime != null ">gm_time = #{gmTime},</if>
  241. <if test="dszTime != null ">dsz_time = #{dszTime},</if>
  242. <if test="dispatchTime != null ">dispatch_time = #{dispatchTime},</if>
  243. <if test="returnDate != null ">return_date = #{returnDate},</if>
  244. <if test="kilometers != null ">kilometers = #{kilometers},</if>
  245. </trim>
  246. where car_apply_id = #{carApplyId}
  247. </update>
  248. <delete id="deleteCmcCarApprovalByCarApplyId" parameterType="String">
  249. delete from cmc_car_approval where car_apply_id = #{carApplyId}
  250. </delete>
  251. <delete id="deleteCmcCarApprovalByCarApplyIds" parameterType="String">
  252. delete from cmc_car_approval where car_apply_id in
  253. <foreach item="carApplyId" collection="array" open="(" separator="," close=")">
  254. #{carApplyId}
  255. </foreach>
  256. </delete>
  257. </mapper>