BisInspOrgDao.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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.BisInspOrgDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspOrg" id="bisInspOrgResultMap">
  5. <result property="norgId" column="NORG_ID"/>
  6. <result property="norgPid" column="NORG_PID"/>
  7. <result property="orgId" column="ORG_ID"/>
  8. <result property="orgPid" column="ORG_PID"/>
  9. <result property="orgNm" column="ORG_NM"/>
  10. <result property="rlcode" column="RLCODE"/>
  11. <result property="orgType" column="ORG_TYPE"/>
  12. <result property="adCode" column="AD_CODE"/>
  13. </resultMap>
  14. <sql id="table_columns">
  15. NORG_ID
  16. ,
  17. NORG_PID,
  18. ORG_ID,
  19. ORG_PID,
  20. ORG_NM,
  21. RLCODE,
  22. ORG_TYPE,
  23. AD_CODE
  24. </sql>
  25. <sql id="entity_properties">
  26. #{norgId}
  27. ,
  28. #{norgPid},
  29. #{orgId},
  30. #{orgPid},
  31. #{orgNm},
  32. #{rlcode},
  33. #{orgType},
  34. #{adCode}
  35. </sql>
  36. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  37. <sql id="page_where">
  38. <trim prefix="where" prefixOverrides="and | or ">
  39. <if test="norgPid != null and norgPid != ''">and NORG_PID = #{norgPid}</if>
  40. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  41. <if test="orgPid != null and orgPid != ''">and ORG_PID = #{orgPid}</if>
  42. <if test="orgNm != null and orgNm != ''">and ORG_NM = #{orgNm}</if>
  43. <if test="rlcode != null and rlcode != ''">and RLCODE = #{rlcode}</if>
  44. <if test="orgType != null and orgType != ''">and ORG_TYPE = #{orgType}</if>
  45. </trim>
  46. </sql>
  47. <select id="get" resultMap="bisInspOrgResultMap" parameterType="String">
  48. select
  49. <include refid="table_columns"/>
  50. from bis_insp_org where ORG_ID = #{orgId}
  51. </select>
  52. <select id="getBy" resultMap="bisInspOrgResultMap">
  53. select
  54. <include refid="table_columns"/>
  55. from bis_insp_org
  56. <include refid="page_where"/>
  57. </select>
  58. <select id="findAll" resultMap="bisInspOrgResultMap">
  59. select
  60. <include refid="table_columns"/>
  61. from bis_insp_org
  62. </select>
  63. <select id="findPersOrgList" resultMap="bisInspOrgResultMap">
  64. SELECT O.ORG_ID,O.ORG_PID,O.ORG_NM,O.AD_CODE,O.RLCODE
  65. FROM BIS_INSP_ORG O,BIS_INSP_PERS_ORG G
  66. WHERE O.ORG_ID=G.ORG_ID
  67. <if test="persId != null and persId != ''">and g.PERS_ID = #{persId}</if>
  68. ORDER BY O.RLCODE
  69. </select>
  70. <select id="findList" resultMap="bisInspOrgResultMap">
  71. select
  72. <include refid="table_columns"/>
  73. from bis_insp_org
  74. <include refid="page_where"/>
  75. </select>
  76. <select id="selectCount" resultType="int">
  77. select count(ORG_ID) from bis_insp_org
  78. <include refid="page_where"/>
  79. </select>
  80. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspOrg">
  81. insert into bis_insp_org(
  82. <include refid="table_columns"/>
  83. )
  84. values (
  85. <include refid="entity_properties"/>
  86. )
  87. </insert>
  88. <delete id="delete" parameterType="java.lang.String">
  89. delete
  90. from bis_insp_org
  91. where ORG_ID = #{orgId}
  92. </delete>
  93. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspOrg">
  94. delete from bis_insp_org
  95. <include refid="page_where"/>
  96. </delete>
  97. <update id="deleteInFlag" parameterType="java.lang.String">
  98. update bis_insp_org
  99. set flag_valid = 0
  100. where ORG_ID = #{orgId}
  101. </update>
  102. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspOrg">
  103. update bis_insp_org
  104. <trim prefix="set" suffixOverrides=",">
  105. <if test="norgPid != null and norgPid != ''">NORG_PID = #{norgPid},</if>
  106. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  107. <if test="orgPid != null and orgPid != ''">ORG_PID = #{orgPid},</if>
  108. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  109. <if test="rlcode != null and rlcode != ''">RLCODE = #{rlcode},</if>
  110. <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
  111. </trim>
  112. <where>ORG_ID = #{orgId}</where>
  113. </update>
  114. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspOrg">
  115. update bis_insp_org
  116. <trim prefix="set" suffixOverrides=",">
  117. <if test="norgPid != null and norgPid != ''">NORG_PID = #{norgPid},</if>
  118. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  119. <if test="orgPid != null and orgPid != ''">ORG_PID = #{orgPid},</if>
  120. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  121. <if test="rlcode != null and rlcode != ''">RLCODE = #{rlcode},</if>
  122. <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
  123. </trim>
  124. <include refid="page_where"/>
  125. </update>
  126. <!-- 其他自定义SQL -->
  127. <!--根据年份和批次获取要下发的省级信息-->
  128. <select id="getOrgByTac" resultType="cn.com.goldenwater.dcproj.model.BisInspOrg">
  129. SELECT *
  130. FROM BIS_INSP_ORG
  131. WHERE ORG_ID IN (select '034' || substr(AD_CODE, 1, #{adLength})
  132. from TAC_INSP_YEAR_BATCH_OBJ A
  133. JOIN TAC_PAWP_RGSTR B ON A.ID = B.OBJ_ID
  134. WHERE B.STATE = #{state}
  135. and a.year = #{year}
  136. and A.BATCH = #{batch})
  137. </select>
  138. </mapper>