ChkSafeSelsProjDao.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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="cn.com.goldenwater.dcproj.dao.ChkSafeSelsProjDao">
  6. <resultMap type="cn.com.goldenwater.dcproj.model.ChkSafeSelsProj" id="chkSafeSelsProjResultMap">
  7. <result property="id" column="ID" />
  8. <result property="pid" column="PID" />
  9. <result property="useScope" column="USE_SCOPE" />
  10. <result property="projType" column="PROJ_TYPE" />
  11. <result property="ordr" column="ORDR" />
  12. <result property="note" column="NOTE" />
  13. <result property="persId" column="PERS_ID" />
  14. <result property="intm" column="INTM" />
  15. <result property="uptm" column="UPTM" />
  16. <result property="dataStat" column="DATA_STAT" />
  17. </resultMap>
  18. <!-- 数据库表字段列表 table_columns -->
  19. <sql id="table_columns">
  20. ID,
  21. PID,
  22. USE_SCOPE,
  23. PROJ_TYPE,
  24. ORDR,
  25. NOTE,
  26. PERS_ID,
  27. INTM,
  28. UPTM,
  29. DATA_STAT
  30. </sql>
  31. <!-- 实体类属性 列表 entity_properties -->
  32. <sql id="entity_properties">
  33. #{id},
  34. #{pid},
  35. #{useScope},
  36. #{projType},
  37. #{ordr},
  38. #{note},
  39. #{persId},
  40. #{intm},
  41. #{uptm},
  42. #{dataStat}
  43. </sql>
  44. <!-- 查询条件 -->
  45. <sql id="page_where">
  46. <trim prefix="where" prefixOverrides="and | or ">
  47. <if test='id != null and id != ""'> and ID = #{id}</if>
  48. <if test='pid != null and pid != ""'> and PID = #{pid}</if>
  49. <if test='useScope != null and useScope != ""'> and USE_SCOPE = #{useScope}</if>
  50. <if test='projType != null and projType != ""'> and PROJ_TYPE = #{projType}</if>
  51. <if test='ordr != null '> and ORDR = #{ordr}</if>
  52. <if test='note != null and note != ""'> and NOTE = #{note}</if>
  53. <if test='persId != null and persId != ""'> and PERS_ID = #{persId}</if>
  54. <if test='intm != null '> and INTM = #{intm}</if>
  55. <if test='uptm != null '> and UPTM = #{uptm}</if>
  56. <if test='dataStat != null and dataStat != ""'> and DATA_STAT = #{dataStat}</if>
  57. </trim>
  58. </sql>
  59. <!-- 根据Id查询 -->
  60. <select id="get" resultMap="chkSafeSelsProjResultMap" parameterType="String">
  61. select
  62. <include refid="table_columns"/>
  63. from CHK_SAFE_SELS_PROJ where ID = #{id}
  64. </select>
  65. <!-- 根据条件筛选查询 -->
  66. <select id="getBy" resultMap="chkSafeSelsProjResultMap" parameterType="cn.com.goldenwater.dcproj.param.ChkSafeSelsProjParam">
  67. select
  68. <include refid="table_columns"/>
  69. from CHK_SAFE_SELS_PROJ
  70. <include refid="page_where"/>
  71. </select>
  72. <!-- 查询所有 -->
  73. <select id="findAll" resultMap="chkSafeSelsProjResultMap">
  74. select
  75. <include refid="table_columns"/>
  76. from CHK_SAFE_SELS_PROJ
  77. order by USE_SCOPE asc, ORDR asc
  78. </select>
  79. <!-- 根据条件筛选 查询所有 -->
  80. <select id="findList" resultMap="chkSafeSelsProjResultMap" parameterType="cn.com.goldenwater.dcproj.param.ChkSafeSelsProjParam">
  81. select
  82. <include refid="table_columns"/>
  83. from CHK_SAFE_SELS_PROJ
  84. <include refid="page_where"/>
  85. order by ORDR asc
  86. </select>
  87. <!-- 根据条件筛选 统计记录数 -->
  88. <select id="selectCount" resultType="int" parameterType="cn.com.goldenwater.dcproj.param.ChkSafeSelsProjParam">
  89. select count( ID ) from CHK_SAFE_SELS_PROJ
  90. <include refid="page_where"/>
  91. </select>
  92. <!-- 添加 -->
  93. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeSelsProj" >
  94. insert into CHK_SAFE_SELS_PROJ(
  95. <include refid="table_columns"/>
  96. )
  97. values (
  98. <include refid="entity_properties"/>
  99. )
  100. </insert>
  101. <!-- 主键删除 -->
  102. <delete id="delete" parameterType="java.lang.String">
  103. update CHK_SAFE_SELS_PROJ set DATA_STAT='9' where ID = #{id}
  104. </delete>
  105. <!-- 条件删除 -->
  106. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeSelsProj">
  107. update CHK_SAFE_SELS_PROJ set DATA_STAT='9'
  108. <include refid="page_where"/>
  109. </delete>
  110. <!-- 逻辑删除 -->
  111. <update id="deleteInFlag" parameterType="java.lang.String">
  112. update CHK_SAFE_SELS_PROJ set DATA_STAT = '9' where ID = #{id}
  113. </update>
  114. <!-- 主键更新 -->
  115. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeSelsProj">
  116. update CHK_SAFE_SELS_PROJ
  117. <trim prefix="SET" suffixOverrides=",">
  118. <if test='pid != null'>PID = #{pid},</if>
  119. <if test='useScope != null'>USE_SCOPE = #{useScope},</if>
  120. <if test='projType != null'>PROJ_TYPE = #{projType},</if>
  121. <if test='ordr != null'>ORDR = #{ordr},</if>
  122. <if test='note != null'>NOTE = #{note},</if>
  123. <if test='uptm != null'>UPTM = #{uptm},</if>
  124. <if test='dataStat != null'>DATA_STAT = #{dataStat},</if>
  125. </trim>
  126. where ID = #{id}
  127. </update>
  128. <!-- 条件更新 -->
  129. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeSelsProj">
  130. update CHK_SAFE_SELS_PROJ
  131. <trim prefix="SET" suffixOverrides=",">
  132. <if test='pid != null'>PID = #{pid},</if>
  133. <if test='useScope != null'>USE_SCOPE = #{useScope},</if>
  134. <if test='projType != null'>PROJ_TYPE = #{projType},</if>
  135. <if test='ordr != null'>ORDR = #{ordr},</if>
  136. <if test='note != null'>NOTE = #{note},</if>
  137. <if test='uptm != null'>UPTM = #{uptm},</if>
  138. <if test='dataStat != null'>DATA_STAT = #{dataStat},</if>
  139. </trim>
  140. <include refid="page_where"/>
  141. </update>
  142. <!-- 其他自定义SQL -->
  143. <!-- 查询所有根节点 PID 为空 -->
  144. <!-- 查询专项检查表的所有根节点 PID 为空 -->
  145. <select id="findSIRootList" resultMap="chkSafeSelsProjResultMap">
  146. select
  147. <include refid="table_columns"/>
  148. from CHK_SAFE_SELS_PROJ where USE_SCOPE='1' and PID is null and DATA_STAT = '0'
  149. order by ORDR asc
  150. </select>
  151. <!-- 查询监督检查台账表的根节点 PID 为空 -->
  152. <select id="findLedgerRootList" resultMap="chkSafeSelsProjResultMap">
  153. select
  154. <include refid="table_columns"/>
  155. from CHK_SAFE_SELS_PROJ where USE_SCOPE='2' and PID is null and DATA_STAT = '0'
  156. order by ORDR asc
  157. </select>
  158. </mapper>