BisInspTravelPlanDao.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.com.goldenwater.dcproj.dao.BisInspTravelPlanDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspTravelPlan" id="bisInspTravelPlanResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="title" column="TITLE"/>
  7. <result property="sttm" column="STTM" jdbcType="TIMESTAMP"/>
  8. <result property="entm" column="ENTM" jdbcType="TIMESTAMP"/>
  9. <result property="dayCount" column="DAY_COUNT"/>
  10. <result property="pass" column="PASS"/>
  11. <result property="persId" column="PERS_ID"/>
  12. <result property="intm" column="INTM" jdbcType="TIMESTAMP"/>
  13. <result property="uptm" column="UPTM" jdbcType="TIMESTAMP"/>
  14. <result property="dataStat" column="DATA_STAT"/>
  15. <result property="isCollect" column="IS_COLLECT"/>
  16. <result property="planNm" column="PLAN_NM"/>
  17. <result property="planId" column="PLAN_ID"/>
  18. </resultMap>
  19. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspTravelPlan" id="bisInspTravelPlanAllResultMap">
  20. <id column="AID" property="id"/>
  21. <result property="title" column="ATITLE"/>
  22. <result property="sttm" column="ASTTM" jdbcType="TIMESTAMP"/>
  23. <result property="entm" column="AENTM" jdbcType="TIMESTAMP"/>
  24. <result property="dayCount" column="ADAY_COUNT"/>
  25. <result property="pass" column="APASS"/>
  26. <result property="persId" column="PERS_ID"/>
  27. <result property="intm" column="AINTM" jdbcType="TIMESTAMP"/>
  28. <result property="uptm" column="AUPTM" jdbcType="TIMESTAMP"/>
  29. <collection property="bisInspTravelPlanDayList" ofType="cn.com.goldenwater.dcproj.model.BisInspTravelPlanDay">
  30. <id property="id" column="BID"/>
  31. <result property="title" column="BTITLE"/>
  32. <result property="minte" column="BMINTE"/>
  33. <result property="distance" column="BDISTANCE"/>
  34. <collection property="bisInspTravelPlanPoints"
  35. ofType="cn.com.goldenwater.dcproj.model.BisInspTravelPlanPoint">
  36. <id property="id" column="CID"/>
  37. <result property="distance" column="CDISTANCE"/>
  38. <result property="consuming" column="CCONSUMING"/>
  39. <result property="name" column="CNAME"/>
  40. <result property="addvcd" column="CADDVCD"/>
  41. <result property="addvnm" column="CADDVNM"/>
  42. <result property="lev" column="CLEV"/>
  43. <result property="lgtd" column="CLGTD"/>
  44. <result property="lttd" column="CLTTD"/>
  45. <result property="icons" column="CICONS"/>
  46. <result property="ordr" column="CORDR"/>
  47. <result property="intm" column="CINTM" jdbcType="TIMESTAMP"/>
  48. <result property="uptm" column="CUPTM" jdbcType="TIMESTAMP"/>
  49. <result property="ptype" column="CPTYPE"/>
  50. <result property="regid" column="CREGID"/>
  51. <result property="sttm" column="CSTTM" jdbcType="TIMESTAMP"/>
  52. <result property="entm" column="CENTM" jdbcType="TIMESTAMP"/>
  53. <result property="note" column="CNOTE"/>
  54. </collection>
  55. </collection>
  56. </resultMap>
  57. <sql id="table_columns">
  58. ID,
  59. TITLE,
  60. STTM,
  61. ENTM,
  62. DAY_COUNT,
  63. PASS,
  64. PERS_ID,
  65. INTM,
  66. UPTM,
  67. DATA_STAT,
  68. IS_COLLECT,
  69. PLAN_NM,
  70. PLAN_ID
  71. </sql>
  72. <sql id="entity_properties">
  73. #{id},
  74. #{title},
  75. #{sttm},
  76. #{entm},
  77. #{dayCount},
  78. #{pass},
  79. #{persId},
  80. #{intm},
  81. #{uptm},
  82. #{dataStat},
  83. #{isCollect},
  84. #{planNm},
  85. #{planId}
  86. </sql>
  87. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  88. <sql id="page_where">
  89. <trim prefix="where" prefixOverrides="and | or ">
  90. <if test="title != null and title != ''">and TITLE = #{title}</if>
  91. <if test="sttm != null">and STTM = #{sttm}</if>
  92. <if test="entm != null">and ENTM = #{entm}</if>
  93. <if test="dayCount != null and dayCount != ''">and DAY_COUNT = #{dayCount}</if>
  94. <if test="pass != null and pass != ''">and PASS = #{pass}</if>
  95. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  96. <if test="intm != null">and INTM = #{intm}</if>
  97. <if test="uptm != null">and UPTM = #{uptm}</if>
  98. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  99. <if test="isCollect != null and isCollect != ''">and IS_COLLECT = #{isCollect}</if>
  100. <if test="planNm != null and planNm != ''">and PLAN_NM = #{planNm}</if>
  101. <if test="planId != null and planId != ''">and PLAN_ID = #{planId}</if>
  102. and DATA_STAT='0'
  103. </trim>
  104. </sql>
  105. <select id="get" resultMap="bisInspTravelPlanResultMap" parameterType="String">
  106. select
  107. <include refid="table_columns"/>
  108. from bis_insp_travel_plan where ID = #{id}
  109. </select>
  110. <select id="getBy" resultMap="bisInspTravelPlanResultMap">
  111. select
  112. <include refid="table_columns"/>
  113. from bis_insp_travel_plan
  114. <include refid="page_where"/>
  115. </select>
  116. <select id="findAll" resultMap="bisInspTravelPlanResultMap">
  117. select
  118. <include refid="table_columns"/>
  119. from bis_insp_travel_plan
  120. </select>
  121. <select id="findList" resultMap="bisInspTravelPlanResultMap">
  122. select
  123. <include refid="table_columns"/>
  124. from bis_insp_travel_plan
  125. <include refid="page_where"/>
  126. </select>
  127. <select id="selectCount" resultType="int">
  128. select count(ID) from bis_insp_travel_plan
  129. <include refid="page_where"/>
  130. </select>
  131. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspTravelPlan">
  132. insert into bis_insp_travel_plan(
  133. <include refid="table_columns"/>
  134. )
  135. values (
  136. <include refid="entity_properties"/>
  137. )
  138. </insert>
  139. <delete id="delete" parameterType="java.lang.String">
  140. update bis_insp_travel_plan set DATA_STAT='9' where ID = #{id}
  141. </delete>
  142. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspTravelPlan">
  143. update bis_insp_travel_plan set DATA_STAT='9'
  144. <include refid="page_where"/>
  145. </delete>
  146. <update id="deleteInFlag" parameterType="java.lang.String">
  147. update bis_insp_travel_plan set DATA_STAT = '9' where ID = #{id}
  148. </update>
  149. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspTravelPlan">
  150. update bis_insp_travel_plan
  151. <trim prefix="set" suffixOverrides=",">
  152. <if test="title != null and title != ''">TITLE = #{title},</if>
  153. <if test="sttm != null">STTM = #{sttm},</if>
  154. <if test="entm != null">ENTM = #{entm},</if>
  155. <if test="dayCount != null and dayCount != ''">DAY_COUNT = #{dayCount},</if>
  156. <if test="pass != null and pass != ''">PASS = #{pass},</if>
  157. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  158. <if test="intm != null">INTM = #{intm},</if>
  159. <if test="uptm != null">UPTM = #{uptm},</if>
  160. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  161. <if test="isCollect != null and isCollect != ''">IS_COLLECT = #{isCollect},</if>
  162. <if test="planNm != null and planNm != ''">PLAN_NM = #{planNm},</if>
  163. <if test="planId != null and planId != ''">PLAN_ID = #{planId},</if>
  164. </trim>
  165. <where>ID = #{id}</where>
  166. </update>
  167. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspTravelPlan">
  168. update bis_insp_travel_plan
  169. <trim prefix="set" suffixOverrides=",">
  170. <if test="title != null and title != ''">TITLE = #{title},</if>
  171. <if test="sttm != null">STTM = #{sttm},</if>
  172. <if test="entm != null">ENTM = #{entm},</if>
  173. <if test="dayCount != null and dayCount != ''">DAY_COUNT = #{dayCount},</if>
  174. <if test="pass != null and pass != ''">PASS = #{pass},</if>
  175. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  176. <if test="intm != null">INTM = #{intm},</if>
  177. <if test="uptm != null">UPTM = #{uptm},</if>
  178. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  179. <if test="isCollect != null and isCollect != ''">IS_COLLECT = #{isCollect},</if>
  180. <if test="planNm != null and planNm != ''">PLAN_NM = #{planNm},</if>
  181. <if test="planId != null and planId != ''">PLAN_ID = #{planId},</if>
  182. </trim>
  183. <include refid="page_where"/>
  184. </update>
  185. <!-- 其他自定义SQL -->
  186. <select id="getMyTravelPlan" resultMap="bisInspTravelPlanResultMap">
  187. select A.*,B.PERS_NAME from bis_insp_travel_plan a left join bis_insp_all_rlation_pers b on a.pers_id=b.guid
  188. where A.DATA_STAT='0' AND a.pers_id = #{persId}
  189. </select>
  190. <!--根据督查组获取路书相关信息-->
  191. <select id="getTravelByPlanId" resultMap="bisInspTravelPlanResultMap">
  192. select * from bis_insp_travel_plan where DATA_STAT='0' and plan_id= #{planId}
  193. </select>
  194. <select id="getMaxOne" resultType="java.lang.Integer">
  195. select Max(ORDR) as ordr from bis_insp_travel_plan where DATA_STAT='0' AND pers_id = #{persId}
  196. </select>
  197. <!--获取路书信息-->
  198. <select id="getTravelPlanInfo" resultMap="bisInspTravelPlanAllResultMap">
  199. select A.ID AID,A.TITLE ATITLE,A.STTM ASTTM,A.ENTM AENTM,A.DAY_COUNT ADAY_COUNT,A.PASS APASS,A.INTM AINTM,A.UPTM AUPTM,A.IS_COLLECT,
  200. b.id BID,B.TITLE BTITLE,B.MINTE BMINTE,B.DISTANCE BDISTANCE,
  201. C.ID CID,C.NAME CNAME,C.ADDVCD CADDVCD,C.ADDVNM CADDVNM,C.REGID CREGID,C.STTM CSTTM,C.ENTM CENTM,C.CONSUMING CCONSUMING,C.NOTE CNOTE
  202. FROM bis_insp_travel_plan A
  203. LEFT JOIN BIS_INSP_TRAVEL_PLAN_DAY B ON A.ID=B.TRAVEL_PLAN_ID
  204. LEFT JOIN BIS_INSP_TRAVEL_PLAN_POINT C ON B.ID=C.PLAN_DAY_ID
  205. WHERE A.DATA_STAT='0' AND B.DATA_STAT='0' AND C.DATA_STAT='0'
  206. and A.ID = #{travelPlanId}
  207. order by B.ORDR,C.ORDR
  208. </select>
  209. <!--取消路书关联-->
  210. <update id="cancelTravelPlan" parameterType="java.lang.String">
  211. update bis_insp_travel_plan set PLAN_NM =null,PLAN_ID=null where ID = #{id}
  212. </update>
  213. </mapper>