d44ef7c19db1e16786edb07c07cbb02e0263ede9.svn-base 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.RelOrgInspTypeDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.RelOrgInspType" id="relOrgInspTypeResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="orgId" column="ORG_ID"/>
  7. <result property="inspType" column="INSP_TYPE"/>
  8. <result property="inspName" column="INSP_NAME"/>
  9. <result property="intm" column="INTM"/>
  10. <result property="uptm" column="UPTM"/>
  11. </resultMap>
  12. <sql id="table_columns">
  13. ID,
  14. ORG_ID,
  15. INSP_TYPE,
  16. INSP_NAME,
  17. INTM,
  18. UPTM
  19. </sql>
  20. <sql id="entity_properties">
  21. #{id},
  22. #{orgId},
  23. #{inspType},
  24. #{inspName},
  25. #{intm},
  26. #{uptm}
  27. </sql>
  28. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  29. <sql id="page_where">
  30. <trim prefix="where" prefixOverrides="and | or ">
  31. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  32. <if test="inspType != null and inspType != ''">and INSP_TYPE = #{inspType}</if>
  33. <if test="inspName != null and inspName != ''">and INSP_NAME = #{inspName}</if>
  34. <if test="intm != null">and INTM = #{intm}</if>
  35. <if test="uptm != null">and UPTM = #{uptm}</if>
  36. </trim>
  37. </sql>
  38. <select id="get" resultMap="relOrgInspTypeResultMap" parameterType="String">
  39. select
  40. <include refid="table_columns"/>
  41. from REL_ORG_INSP_TYPE where ID = #{id}
  42. </select>
  43. <select id="getBy" resultMap="relOrgInspTypeResultMap">
  44. select
  45. <include refid="table_columns"/>
  46. from REL_ORG_INSP_TYPE
  47. <include refid="page_where"/>
  48. </select>
  49. <select id="findAll" resultMap="relOrgInspTypeResultMap">
  50. select
  51. <include refid="table_columns"/>
  52. from REL_ORG_INSP_TYPE
  53. </select>
  54. <select id="findList" resultMap="relOrgInspTypeResultMap">
  55. select
  56. <include refid="table_columns"/>
  57. from REL_ORG_INSP_TYPE
  58. <include refid="page_where"/>
  59. order by to_number(insp_type)
  60. </select>
  61. <select id="selectCount" resultType="int">
  62. select nvl(count(ID),0) from REL_ORG_INSP_TYPE
  63. <include refid="page_where"/>
  64. </select>
  65. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.RelOrgInspType">
  66. insert into REL_ORG_INSP_TYPE(
  67. <include refid="table_columns"/>
  68. )
  69. values (
  70. <include refid="entity_properties"/>
  71. )
  72. </insert>
  73. <delete id="delete" parameterType="java.lang.String">
  74. delete from REL_ORG_INSP_TYPE where ID = #{id}
  75. </delete>
  76. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.RelOrgInspType">
  77. delete from REL_ORG_INSP_TYPE
  78. <include refid="page_where"/>
  79. </delete>
  80. <update id="deleteInFlag" parameterType="java.lang.String">
  81. delete from REL_ORG_INSP_TYPE where ID = #{id}
  82. </update>
  83. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.RelOrgInspType">
  84. update REL_ORG_INSP_TYPE
  85. <trim prefix="set" suffixOverrides=",">
  86. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  87. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  88. <if test="inspName != null and inspName != ''">INSP_NAME = #{inspName},</if>
  89. <if test="intm != null">INTM = #{intm},</if>
  90. <if test="uptm != null">UPTM = #{uptm},</if>
  91. </trim>
  92. <where>ID = #{id}</where>
  93. </update>
  94. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.RelOrgInspType">
  95. update REL_ORG_INSP_TYPE
  96. <trim prefix="set" suffixOverrides=",">
  97. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  98. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  99. <if test="inspName != null and inspName != ''">INSP_NAME = #{inspName},</if>
  100. <if test="intm != null">INTM = #{intm},</if>
  101. <if test="uptm != null">UPTM = #{uptm},</if>
  102. </trim>
  103. <include refid="page_where"/>
  104. </update>
  105. <!-- 其他自定义SQL -->
  106. <select id="findListByUser" resultMap="relOrgInspTypeResultMap">
  107. select * from REL_ORG_INSP_TYPE where org_id =#{orgId} and insp_type in (select substr(id,0,3)
  108. from bis_insp_all_rlation where length(id)=6 and persid=#{persId} and org_id=#{orgId})
  109. order by to_number(insp_type)
  110. </select>
  111. <select id="listOfRgster" resultType="java.lang.String">
  112. SELECT A.RGSTR_TABLE_NAME
  113. FROM REL_ORG_INSP_TYPE R JOIN ATT_INSP_TYPE A ON A.CODE = R.INSP_TYPE
  114. WHERE R.ORG_ID = #{orgId}
  115. AND A.RGSTR_TABLE_NAME IS NOT NULL
  116. </select>
  117. <!-- 其他自定义SQL -->
  118. <select id="getInspTypeAll" resultType="cn.com.goldenwater.dcproj.model.RelOrgInspType">
  119. select NAME inspName,PTYPE inspType FROM ATT_INSP_TYPE
  120. </select>
  121. </mapper>