BisInspPlanDtlAddvcdDao.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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.BisInspPlanDtlAddvcdDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPlanDtlAddvcd" id="bisInspPlanDtlAddvcdResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="planDtlId" column="PLAN_DTL_ID"/>
  7. <result property="adCode" column="AD_CODE"/>
  8. <result property="adName" column="AD_NAME"/>
  9. <result property="adGrad" column="AD_GRAD"/>
  10. <result property="persId" column="PERS_ID"/>
  11. <result property="intm" column="INTM"/>
  12. <result property="uptm" column="UPTM"/>
  13. <result property="dataStat" column="DATA_STAT"/>
  14. </resultMap>
  15. <sql id="table_columns">
  16. ID,
  17. PLAN_DTL_ID,
  18. AD_CODE,
  19. AD_NAME,
  20. AD_GRAD,
  21. PERS_ID,
  22. INTM,
  23. UPTM,
  24. DATA_STAT
  25. </sql>
  26. <sql id="entity_properties">
  27. #{id},
  28. #{planDtlId},
  29. #{adCode},
  30. #{adName},
  31. #{adGrad},
  32. #{persId},
  33. #{intm},
  34. #{uptm},
  35. #{dataStat}
  36. </sql>
  37. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  38. <sql id="page_where">
  39. <trim prefix="where" prefixOverrides="and | or ">
  40. <if test="planDtlId != null and planDtlId != ''">and PLAN_DTL_ID = #{planDtlId}</if>
  41. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  42. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  43. <if test="adGrad != null and adGrad != ''">and AD_GRAD = #{adGrad}</if>
  44. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  45. <if test="intm != null">and INTM = #{intm}</if>
  46. <if test="uptm != null">and UPTM = #{uptm}</if>
  47. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  48. and DATA_STAT='0'
  49. </trim>
  50. </sql>
  51. <select id="get" resultMap="bisInspPlanDtlAddvcdResultMap" parameterType="String" >
  52. select <include refid="table_columns" /> from BIS_INSP_PLAN_DTL_ADDVCD where ID = #{id}
  53. </select>
  54. <select id="getBy" resultMap="bisInspPlanDtlAddvcdResultMap">
  55. select <include refid="table_columns" /> from BIS_INSP_PLAN_DTL_ADDVCD <include refid="page_where" />
  56. </select>
  57. <select id="findAll" resultMap="bisInspPlanDtlAddvcdResultMap">
  58. select <include refid="table_columns" /> from BIS_INSP_PLAN_DTL_ADDVCD
  59. </select>
  60. <select id="findList" resultMap="bisInspPlanDtlAddvcdResultMap">
  61. select <include refid="table_columns" /> from BIS_INSP_PLAN_DTL_ADDVCD <include refid="page_where" />
  62. </select>
  63. <select id="selectCount" resultType="int" >
  64. select count(ID) from BIS_INSP_PLAN_DTL_ADDVCD <include refid="page_where" />
  65. </select>
  66. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtlAddvcd">
  67. insert into BIS_INSP_PLAN_DTL_ADDVCD( <include refid="table_columns" /> )
  68. values ( <include refid="entity_properties" /> )
  69. </insert>
  70. <delete id="delete" parameterType="java.lang.String">
  71. update BIS_INSP_PLAN_DTL_ADDVCD set DATA_STAT='9' where ID = #{id}
  72. </delete>
  73. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtlAddvcd">
  74. update BIS_INSP_PLAN_DTL_ADDVCD set DATA_STAT='9' <include refid="page_where" />
  75. </delete>
  76. <update id="deleteInFlag" parameterType="java.lang.String">
  77. update BIS_INSP_PLAN_DTL_ADDVCD set DATA_STAT = '9' where ID = #{id}
  78. </update>
  79. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtlAddvcd">
  80. update BIS_INSP_PLAN_DTL_ADDVCD
  81. <trim prefix="set" suffixOverrides=",">
  82. <if test="planDtlId != null and planDtlId != ''">PLAN_DTL_ID = #{planDtlId},</if>
  83. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  84. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  85. <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
  86. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  87. <if test="intm != null">INTM = #{intm},</if>
  88. <if test="uptm != null">UPTM = #{uptm},</if>
  89. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  90. </trim>
  91. <where>ID = #{id}</where>
  92. </update>
  93. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtlAddvcd">
  94. update BIS_INSP_PLAN_DTL_ADDVCD
  95. <trim prefix="set" suffixOverrides=",">
  96. <if test="planDtlId != null and planDtlId != ''">PLAN_DTL_ID = #{planDtlId},</if>
  97. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  98. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  99. <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
  100. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  101. <if test="intm != null">INTM = #{intm},</if>
  102. <if test="uptm != null">UPTM = #{uptm},</if>
  103. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  104. </trim>
  105. <include refid="page_where" />
  106. </update>
  107. <!-- 其他自定义SQL -->
  108. <insert id="batchInsert" parameterType="java.util.ArrayList">
  109. insert into BIS_INSP_PLAN_DTL_ADDVCD(
  110. <include refid="table_columns"/>
  111. )
  112. <foreach item="item" index="index" collection="list" open="values " separator="," >
  113. (#{item.id},
  114. #{item.planDtlId},
  115. #{item.adCode},
  116. #{item.adName},
  117. #{item.adGrad},
  118. #{item.persId},
  119. #{item.intm},
  120. #{item.uptm},
  121. #{item.dataStat} )
  122. </foreach>
  123. </insert>
  124. <select id="getByAdCodeAndTm" resultType="java.util.Map">
  125. select BIPDA.AD_CODE as AD_CODE, cast(count(BIPDA.ID) as CHAR ) as COUNT
  126. from BIS_INSP_PLAN_DTL_ADDVCD BIPDA
  127. left join BIS_INSP_PLAN_DTL BIPD ON BIPD.ID = BIPDA.PLAN_DTL_ID
  128. where not (BIPD.ST_TM &gt; #{enTm} or BIPD.EN_TM &lt; #{stTm}) and BIPDA.AD_CODE in (${adCodes}) and BIPD.DATA_STAT='0' and BIPDA.DATA_STAT='0'
  129. group by BIPDA.AD_CODE
  130. having count(BIPDA.id) &gt;= 1
  131. </select>
  132. <select id="getByAdCodeAndTmList" resultType="cn.com.goldenwater.dcproj.dto.BisInspPlanDtlDto">
  133. select distinct BIPD.ID,
  134. BIPD.NM,
  135. BIPD.PLAN_ID,
  136. BIPD.ST_TM,
  137. BIPD.EN_TM,
  138. BIPD.CHK_PRJ_SIZE,
  139. BIPD.CHK_TYPE,
  140. BIPD.ONLINE_CHK,
  141. BIPD.NOTE,
  142. BIPD.PERS_ID,
  143. BIPD.INTM,
  144. BIPD.UPTM,
  145. BIPD.DATA_STAT,
  146. BIPD.CHK_CONTENT,
  147. BIPD.CHK_IMPL_DEPT
  148. from BIS_INSP_PLAN_DTL BIPD
  149. left join BIS_INSP_PLAN_DTL_ADDVCD BIPDA ON BIPD.ID = BIPDA.PLAN_DTL_ID
  150. where not (BIPD.ST_TM &gt; #{enTm} or BIPD.EN_TM &lt; #{stTm}) and BIPDA.AD_CODE in (${adCodes}) and BIPD.DATA_STAT='0' and BIPDA.DATA_STAT='0'
  151. </select>
  152. </mapper>