BisInspOrgDao.xml 5.4 KB

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