OlBisInspOrgDao.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.OlBisInspOrgDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.OlBisInspOrg" id="bisInspOrgResultMap">
  5. <result property="orgId" column="ORG_ID"/>
  6. <result property="orgPid" column="ORG_PID"/>
  7. <result property="orgNm" column="ORG_NM"/>
  8. <result property="rlcode" column="RLCODE"/>
  9. <result property="inTm" column="IN_TM"/>
  10. <result property="upTm" column="UP_TM"/>
  11. <result property="adCode" column="AD_CODE"/>
  12. <result property="pblmLogo" column="PBLM_LOGO"/>
  13. <result property="quoteOrgId" column="QUOTE_ORG_ID"/>
  14. <result property="orgType" column="ORG_TYPE"/>
  15. </resultMap>
  16. <sql id="table_columns">
  17. ORG_ID,
  18. ORG_PID,
  19. ORG_NM,
  20. RLCODE,IN_TM,UP_TM,AD_CODE,PBLM_LOGO,QUOTE_ORG_ID,
  21. ORG_TYPE
  22. </sql>
  23. <sql id="entity_properties">
  24. #{orgId},
  25. #{orgPid},
  26. #{orgNm},
  27. #{rlcode},#{inTm},#{upTm},#{adCode},#{pblmLogo},#{quoteOrgId},
  28. #{orgType}
  29. </sql>
  30. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  31. <sql id="page_where">
  32. <trim prefix="where" prefixOverrides="and | or ">
  33. <if test="orgPid != null and orgPid != ''">and ORG_PID = #{orgPid}</if>
  34. <if test="orgNm != null and orgNm != ''">and ORG_NM = #{orgNm}</if>
  35. <if test="rlcode != null and rlcode != ''">and RLCODE = #{rlcode}</if>
  36. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  37. <if test="pblmLogo != null and pblmLogo != ''">and PBLM_LOGO = #{pblmLogo}</if>
  38. <if test="quoteOrgId != null and quoteOrgId != ''">and QUOTE_ORG_ID = #{quoteOrgId}</if>
  39. <if test="orgType != null and orgType != ''">and ORG_TYPE = #{orgType}</if>
  40. </trim>
  41. </sql>
  42. <select id="selectMax" resultType="java.lang.String" parameterType="java.lang.String">
  43. <!--select max(to_number(g.org_id)) as org_id from bis_insp_org g where g.org_pid=#{orgPid} order by g.org_id desc-->
  44. select max(to_number(g.org_id)) as org_id from bis_insp_org g order by g.org_id desc
  45. </select>
  46. <select id="get" resultMap="bisInspOrgResultMap" parameterType="java.lang.String">
  47. select
  48. <include refid="table_columns"/>
  49. from BIS_INSP_ORG where ORG_ID = #{id}
  50. </select>
  51. <select id="getBy" resultMap="bisInspOrgResultMap">
  52. select
  53. <include refid="table_columns"/>
  54. from BIS_INSP_ORG
  55. <include refid="page_where"/>
  56. </select>
  57. <select id="findAll" resultMap="bisInspOrgResultMap">
  58. select
  59. <include refid="table_columns"/>
  60. from BIS_INSP_ORG
  61. </select>
  62. <select id="findList" resultMap="bisInspOrgResultMap">
  63. select
  64. <include refid="table_columns"/>
  65. from BIS_INSP_ORG
  66. <include refid="page_where"/>
  67. </select>
  68. <select id="selectCount" resultType="int">
  69. select count(ID) from BIS_INSP_ORG
  70. <include refid="page_where"/>
  71. </select>
  72. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.OlBisInspOrg">
  73. insert into BIS_INSP_ORG(
  74. <include refid="table_columns"/>
  75. )
  76. values (
  77. <include refid="entity_properties"/>
  78. )
  79. </insert>
  80. <delete id="delete" parameterType="java.lang.String">
  81. delete from BIS_INSP_ORG where ORG_ID = #{id}
  82. </delete>
  83. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.OlBisInspOrg">
  84. delete from BIS_INSP_ORG
  85. <include refid="page_where"/>
  86. </delete>
  87. <update id="deleteInFlag" parameterType="java.lang.String">
  88. update BIS_INSP_ORG set flag_valid = 0 where ORG_ID = #{id}
  89. </update>
  90. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.OlBisInspOrg">
  91. update BIS_INSP_ORG
  92. <trim prefix="set" suffixOverrides=",">
  93. <if test="orgPid != null and orgPid != ''">ORG_PID = #{orgPid},</if>
  94. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  95. <if test="rlcode != null and rlcode != ''">RLCODE = #{rlcode},</if>
  96. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  97. <if test="pblmLogo != null and pblmLogo != ''">PBLM_LOGO = #{pblmLogo},</if>
  98. <if test="quoteOrgId != null and quoteOrgId != ''">QUOTE_ORG_ID = #{quoteOrgId},</if>
  99. <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
  100. </trim>
  101. <where>ORG_ID = #{orgId}</where>
  102. </update>
  103. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.OlBisInspOrg">
  104. update BIS_INSP_ORG
  105. <trim prefix="set" suffixOverrides=",">
  106. <if test="orgPid != null and orgPid != ''">ORG_PID = #{orgPid},</if>
  107. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  108. <if test="rlcode != null and rlcode != ''">RLCODE = #{rlcode},</if>
  109. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  110. <if test="pblmLogo != null and pblmLogo != ''">PBLM_LOGO = #{pblmLogo},</if>
  111. <if test="quoteOrgId != null and quoteOrgId != ''">QUOTE_ORG_ID = #{quoteOrgId},</if>
  112. <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
  113. </trim>
  114. <include refid="page_where"/>
  115. </update>
  116. <!-- 其他自定义SQL -->
  117. <select id="getByPid" resultMap="bisInspOrgResultMap">
  118. select
  119. <include refid="table_columns"/>
  120. from BIS_INSP_ORG WHERE ORG_PID = #{pid}
  121. <if test="province !=null and province !=''">
  122. and rlcode=#{province}
  123. </if>
  124. order by org_id
  125. </select>
  126. <select id="getById" resultMap="bisInspOrgResultMap">
  127. select
  128. <include refid="table_columns"/>
  129. from BIS_INSP_ORG WHERE ORG_ID = #{id}
  130. <if test="province !=null and province !=''">
  131. and rlcode=#{province}
  132. </if>
  133. order by org_id
  134. </select>
  135. <select id="getOrgList" resultMap="bisInspOrgResultMap">
  136. select
  137. <include refid="table_columns"/>
  138. from BIS_INSP_ORG WHERE length(org_id) = 3
  139. <if test="relCode !=null and relCode !=''">
  140. and rlcode like '${relCode}%'
  141. </if>
  142. </select>
  143. <select id="getNodeOne" resultMap="bisInspOrgResultMap">
  144. select * from BIS_INSP_ORG where 1=1
  145. <if test="currentOrgId != null and currentOrgId != ''">and org_id= #{currentOrgId}</if>
  146. <if test="currentOrgId == null or currentOrgId == ''">and org_pid= 1</if>
  147. order by org_id
  148. </select>
  149. <select id="getNodeNext" resultMap="bisInspOrgResultMap">
  150. select * from BIS_INSP_ORG where org_pid = #{pid} order by org_id
  151. </select>
  152. </mapper>