ChkSafeSelsProjDao.xml 6.4 KB

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