OlBisInspOrgDao.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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(cast(g.org_id as SIGNED) ) as org_id from bis_insp_org g order by g.org_id desc
  44. </select>
  45. <select id="get" resultMap="bisInspOrgResultMap" parameterType="java.lang.String">
  46. select
  47. <include refid="table_columns"/>
  48. from BIS_INSP_ORG where ORG_ID = #{id}
  49. </select>
  50. <select id="getBy" resultMap="bisInspOrgResultMap">
  51. select
  52. <include refid="table_columns"/>
  53. from BIS_INSP_ORG
  54. <include refid="page_where"/>
  55. </select>
  56. <select id="findAll" resultMap="bisInspOrgResultMap">
  57. select
  58. <include refid="table_columns"/>
  59. from BIS_INSP_ORG
  60. </select>
  61. <select id="findList" resultMap="bisInspOrgResultMap">
  62. select
  63. <include refid="table_columns"/>
  64. from BIS_INSP_ORG
  65. <include refid="page_where"/>
  66. </select>
  67. <select id="selectCount" resultType="int">
  68. select count(ID) from BIS_INSP_ORG
  69. <include refid="page_where"/>
  70. </select>
  71. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.OlBisInspOrg">
  72. insert into BIS_INSP_ORG(
  73. <include refid="table_columns"/>
  74. )
  75. values (
  76. <include refid="entity_properties"/>
  77. )
  78. </insert>
  79. <delete id="delete" parameterType="java.lang.String">
  80. delete from BIS_INSP_ORG where ORG_ID = #{id}
  81. </delete>
  82. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.OlBisInspOrg">
  83. delete from BIS_INSP_ORG
  84. <include refid="page_where"/>
  85. </delete>
  86. <update id="deleteInFlag" parameterType="java.lang.String">
  87. update BIS_INSP_ORG set flag_valid = 0 where ORG_ID = #{id}
  88. </update>
  89. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.OlBisInspOrg">
  90. update BIS_INSP_ORG
  91. <trim prefix="set" suffixOverrides=",">
  92. <if test="orgPid != null and orgPid != ''">ORG_PID = #{orgPid},</if>
  93. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  94. <if test="rlcode != null and rlcode != ''">RLCODE = #{rlcode},</if>
  95. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  96. <if test="pblmLogo != null and pblmLogo != ''">PBLM_LOGO = #{pblmLogo},</if>
  97. <if test="quoteOrgId != null and quoteOrgId != ''">QUOTE_ORG_ID = #{quoteOrgId},</if>
  98. <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
  99. </trim>
  100. <where>ORG_ID = #{orgId}</where>
  101. </update>
  102. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.OlBisInspOrg">
  103. update BIS_INSP_ORG
  104. <trim prefix="set" suffixOverrides=",">
  105. <if test="orgPid != null and orgPid != ''">ORG_PID = #{orgPid},</if>
  106. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  107. <if test="rlcode != null and rlcode != ''">RLCODE = #{rlcode},</if>
  108. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  109. <if test="pblmLogo != null and pblmLogo != ''">PBLM_LOGO = #{pblmLogo},</if>
  110. <if test="quoteOrgId != null and quoteOrgId != ''">QUOTE_ORG_ID = #{quoteOrgId},</if>
  111. <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
  112. </trim>
  113. <include refid="page_where"/>
  114. </update>
  115. <!-- 其他自定义SQL -->
  116. <select id="getByPid" resultMap="bisInspOrgResultMap">
  117. select
  118. <include refid="table_columns"/>
  119. from BIS_INSP_ORG WHERE ORG_PID = #{pid}
  120. <if test="province !=null and province !=''">
  121. and rlcode=#{province}
  122. </if>
  123. order by org_id
  124. </select>
  125. <select id="getById" resultMap="bisInspOrgResultMap">
  126. select
  127. <include refid="table_columns"/>
  128. from BIS_INSP_ORG WHERE ORG_ID = #{id}
  129. <if test="province !=null and province !=''">
  130. and rlcode=#{province}
  131. </if>
  132. order by org_id
  133. </select>
  134. <select id="getOrgList" resultMap="bisInspOrgResultMap">
  135. select
  136. <include refid="table_columns"/>
  137. from BIS_INSP_ORG WHERE length(org_id) = 3
  138. <if test="relCode !=null and relCode !=''">
  139. and rlcode like '${relCode}%'
  140. </if>
  141. </select>
  142. <select id="getNodeOne" resultMap="bisInspOrgResultMap">
  143. select * from BIS_INSP_ORG where 1=1
  144. <if test="currentOrgId != null and currentOrgId != ''">and org_id= #{currentOrgId}</if>
  145. <if test="currentOrgId == null or currentOrgId == ''">and org_pid= 1</if>
  146. order by org_id
  147. </select>
  148. <select id="getNodeNext" resultMap="bisInspOrgResultMap">
  149. select * from BIS_INSP_ORG where org_pid = #{pid} order by org_id
  150. </select>
  151. </mapper>