BisInspKeyRegisterSectionDao.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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.BisInspKeyRegisterSectionDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspKeyRegisterSection" id="bisInspKeyRegisterSectionResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="regId" column="REG_ID"/>
  7. <result property="objId" column="OBJ_ID"/>
  8. <result property="nm" column="NM"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="orgId" column="ORG_ID"/>
  11. <result property="lgtd" column="LGTD"/>
  12. <result property="lttd" column="LTTD"/>
  13. <result property="lgtdPc" column="LGTD_PC"/>
  14. <result property="lttdPc" column="LTTD_PC"/>
  15. <result property="persId" column="PERS_ID"/>
  16. <result property="intm" jdbcType="TIMESTAMP" column="INTM"/>
  17. <result property="uptm" jdbcType="TIMESTAMP" column="UPTM"/>
  18. <result property="note" column="NOTE"/>
  19. </resultMap>
  20. <sql id="table_columns">
  21. ID,
  22. REG_ID,
  23. OBJ_ID,
  24. NM,
  25. AD_CODE,
  26. ORG_ID,
  27. LGTD,
  28. LTTD,
  29. LGTD_PC,
  30. LTTD_PC,
  31. PERS_ID,
  32. INTM,
  33. UPTM,
  34. NOTE
  35. </sql>
  36. <sql id="entity_properties">
  37. #{id},
  38. #{regId},
  39. #{objId},
  40. #{nm},
  41. #{adCode},
  42. #{orgId},
  43. #{lgtd},
  44. #{lttd},
  45. #{lgtdPc},
  46. #{lttdPc},
  47. #{persId},
  48. #{intm},
  49. #{uptm},
  50. #{note}
  51. </sql>
  52. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  53. <sql id="page_where">
  54. <trim prefix="where" prefixOverrides="and | or ">
  55. <if test="regId != null and regId != ''">and REG_ID = #{regId}</if>
  56. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  57. <if test="nm != null and nm != ''">and NM = #{nm}</if>
  58. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  59. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  60. <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
  61. <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
  62. <if test="lgtdPc != null and lgtdPc != ''">and LGTD_PC = #{lgtdPc}</if>
  63. <if test="lttdPc != null and lttdPc != ''">and LTTD_PC = #{lttdPc}</if>
  64. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  65. <if test="intm != null">and INTM = #{intm}</if>
  66. <if test="uptm != null">and UPTM = #{uptm}</if>
  67. <if test="note != null and note != ''">and NOTE = #{note}</if>
  68. </trim>
  69. </sql>
  70. <select id="get" resultMap="bisInspKeyRegisterSectionResultMap" parameterType="String">
  71. select
  72. <include refid="table_columns"/>
  73. from BIS_INSP_KEY_REGISTER_SECTION where ID = #{id}
  74. </select>
  75. <select id="findSecByUnitId" resultMap="bisInspKeyRegisterSectionResultMap" parameterType="java.lang.String">
  76. select * from BIS_INSP_KEY_REGISTER_SECTION n where n.id=(
  77. select t.sec_id from bis_insp_key_reg_sec_unit t where t.id=#{unitId}
  78. )
  79. </select>
  80. <select id="getBy" resultMap="bisInspKeyRegisterSectionResultMap">
  81. select
  82. <include refid="table_columns"/>
  83. from BIS_INSP_KEY_REGISTER_SECTION
  84. <include refid="page_where"/>
  85. </select>
  86. <select id="findAll" resultMap="bisInspKeyRegisterSectionResultMap">
  87. select
  88. <include refid="table_columns"/>
  89. from BIS_INSP_KEY_REGISTER_SECTION
  90. </select>
  91. <select id="findList" resultMap="bisInspKeyRegisterSectionResultMap">
  92. select
  93. <include refid="table_columns"/>
  94. from BIS_INSP_KEY_REGISTER_SECTION
  95. <include refid="page_where"/>
  96. </select>
  97. <select id="selectCount" resultType="int">
  98. select count(ID) from BIS_INSP_KEY_REGISTER_SECTION
  99. <include refid="page_where"/>
  100. </select>
  101. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspKeyRegisterSection">
  102. insert into BIS_INSP_KEY_REGISTER_SECTION(
  103. <include refid="table_columns"/>
  104. )
  105. values (
  106. <include refid="entity_properties"/>
  107. )
  108. </insert>
  109. <delete id="delete" parameterType="java.lang.String">
  110. delete from BIS_INSP_KEY_REGISTER_SECTION where ID = #{id}
  111. </delete>
  112. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspKeyRegisterSection">
  113. delete from BIS_INSP_KEY_REGISTER_SECTION
  114. <include refid="page_where"/>
  115. </delete>
  116. <update id="deleteInFlag" parameterType="java.lang.String">
  117. update BIS_INSP_KEY_REGISTER_SECTION set flag_valid = 0 where ID = #{id}
  118. </update>
  119. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspKeyRegisterSection">
  120. update BIS_INSP_KEY_REGISTER_SECTION
  121. <trim prefix="set" suffixOverrides=",">
  122. <if test="regId != null and regId != ''">REG_ID = #{regId},</if>
  123. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  124. <if test="nm != null and nm != ''">NM = #{nm},</if>
  125. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  126. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  127. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  128. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  129. <if test="lgtdPc != null and lgtdPc != ''">LGTD_PC = #{lgtdPc},</if>
  130. <if test="lttdPc != null and lttdPc != ''">LTTD_PC = #{lttdPc},</if>
  131. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  132. <if test="intm != null">INTM = #{intm},</if>
  133. <if test="uptm != null">UPTM = #{uptm},</if>
  134. <if test="note != null and note != ''">NOTE = #{note},</if>
  135. </trim>
  136. <where>ID = #{id}</where>
  137. </update>
  138. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspKeyRegisterSection">
  139. update BIS_INSP_KEY_REGISTER_SECTION
  140. <trim prefix="set" suffixOverrides=",">
  141. <if test="regId != null and regId != ''">REG_ID = #{regId},</if>
  142. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  143. <if test="nm != null and nm != ''">NM = #{nm},</if>
  144. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  145. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  146. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  147. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  148. <if test="lgtdPc != null and lgtdPc != ''">LGTD_PC = #{lgtdPc},</if>
  149. <if test="lttdPc != null and lttdPc != ''">LTTD_PC = #{lttdPc},</if>
  150. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  151. <if test="intm != null">INTM = #{intm},</if>
  152. <if test="uptm != null">UPTM = #{uptm},</if>
  153. <if test="note != null and note != ''">NOTE = #{note},</if>
  154. </trim>
  155. <include refid="page_where"/>
  156. </update>
  157. <!-- 其他自定义SQL -->
  158. <select id="getByRegId" resultMap="bisInspKeyRegisterSectionResultMap">
  159. select A.*,b.ad_name adName,c.bas_name orgName from BIS_INSP_KEY_REGISTER_SECTION A LEFT JOIN ATT_AD_BASE B ON
  160. A.AD_CODE=B.AD_CODE LEFT JOIN ATT_BAS_BASE C ON A.ORG_ID=C.Bas_Code where reg_id=#{regId}
  161. </select>
  162. </mapper>