AttWagaBaseImpDao.xml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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.AttWagaBaseImpDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttWagaBaseImp" id="attWagaBaseImpResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="adCode1" column="AD_CODE1"/>
  7. <result property="adName1" column="AD_NAME1"/>
  8. <result property="adCode2" column="AD_CODE2"/>
  9. <result property="adName2" column="AD_NAME2"/>
  10. <result property="adCode3" column="AD_CODE3"/>
  11. <result property="adName3" column="AD_NAME3"/>
  12. <result property="objCode" column="OBJ_CODE"/>
  13. <result property="gateName" column="GATE_NAME"/>
  14. <result property="gateAdmName" column="GATE_ADM_NAME"/>
  15. <result property="engScal" column="ENG_SCAL"/>
  16. <result property="gateFlow" column="GATE_FLOW"/>
  17. <result property="ifGate" column="IF_GATE"/>
  18. <result property="ifDouDile" column="IF_DOU_DILE"/>
  19. <result property="gateAdmDep" column="GATE_ADM_DEP"/>
  20. <result property="gateType" column="GATE_TYPE"/>
  21. <result property="locationCun" column="LOCATION_CUN"/>
  22. <result property="engGrad" column="ENG_GRAD"/>
  23. </resultMap>
  24. <sql id="table_columns">
  25. ID,
  26. AD_CODE1,
  27. AD_NAME1,
  28. AD_CODE2,
  29. AD_NAME2,
  30. AD_CODE3,
  31. AD_NAME3,
  32. OBJ_CODE,
  33. GATE_NAME,
  34. GATE_ADM_NAME,
  35. ENG_SCAL,
  36. GATE_FLOW,
  37. IF_GATE,
  38. IF_DOU_DILE,
  39. GATE_ADM_DEP,
  40. GATE_TYPE,
  41. LOCATION_CUN,
  42. ENG_GRAD
  43. </sql>
  44. <sql id="entity_properties">
  45. #{id},
  46. #{adCode1},
  47. #{adName1},
  48. #{adCode2},
  49. #{adName2},
  50. #{adCode3},
  51. #{adName3},
  52. #{objCode},
  53. #{gateName},
  54. #{gateAdmName},
  55. #{engScal},
  56. #{gateFlow},
  57. #{ifGate},
  58. #{ifDouDile},
  59. #{gateAdmDep},
  60. #{gateType},
  61. #{locationCun},
  62. #{engGrad}
  63. </sql>
  64. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  65. <sql id="page_where">
  66. <trim prefix="where" prefixOverrides="and | or ">
  67. <if test="adCode1 != null and adCode1 != ''">and AD_CODE1 = #{adCode1}</if>
  68. <if test="adName1 != null and adName1 != ''">and AD_NAME1 = #{adName1}</if>
  69. <if test="adCode2 != null and adCode2 != ''">and AD_CODE2 = #{adCode2}</if>
  70. <if test="adName2 != null and adName2 != ''">and AD_NAME2 = #{adName2}</if>
  71. <if test="adCode3 != null and adCode3 != ''">and AD_CODE3 = #{adCode3}</if>
  72. <if test="adName3 != null and adName3 != ''">and AD_NAME3 = #{adName3}</if>
  73. <if test="objCode != null and objCode != ''">and OBJ_CODE = #{objCode}</if>
  74. <if test="gateName != null and gateName != ''">and GATE_NAME = #{gateName}</if>
  75. <if test="gateAdmName != null and gateAdmName != ''">and GATE_ADM_NAME = #{gateAdmName}</if>
  76. <if test="engScal != null and engScal != ''">and ENG_SCAL = #{engScal}</if>
  77. <if test="gateFlow != null and gateFlow != ''">and GATE_FLOW = #{gateFlow}</if>
  78. <if test="ifGate != null and ifGate != ''">and IF_GATE = #{ifGate}</if>
  79. <if test="ifDouDile != null and ifDouDile != ''">and IF_DOU_DILE = #{ifDouDile}</if>
  80. <if test="gateAdmDep != null and gateAdmDep != ''">and GATE_ADM_DEP = #{gateAdmDep}</if>
  81. <if test="gateType != null and gateType != ''">and GATE_TYPE = #{gateType}</if>
  82. <if test="locationCun != null and locationCun != ''">and LOCATION_CUN = #{locationCun}</if>
  83. <if test="engGrad != null and engGrad != ''">and ENG_GRAD = #{engGrad}</if>
  84. </trim>
  85. </sql>
  86. <select id="get" resultMap="attWagaBaseImpResultMap" parameterType="String" >
  87. select <include refid="table_columns" /> from ATT_WAGA_BASE_IMP1 where ID = #{id}
  88. </select>
  89. <select id="getBy" resultMap="attWagaBaseImpResultMap">
  90. select <include refid="table_columns" /> from ATT_WAGA_BASE_IMP1 <include refid="page_where" />
  91. </select>
  92. <select id="findAll" resultMap="attWagaBaseImpResultMap">
  93. select <include refid="table_columns" /> from ATT_WAGA_BASE_IMP1
  94. </select>
  95. <select id="findList" resultMap="attWagaBaseImpResultMap">
  96. select <include refid="table_columns" /> from ATT_WAGA_BASE_IMP1 <include refid="page_where" />
  97. </select>
  98. <select id="selectCount" resultType="int" >
  99. select count(ID) from ATT_WAGA_BASE_IMP1 <include refid="page_where" />
  100. </select>
  101. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttWagaBaseImp">
  102. insert into ATT_WAGA_BASE_IMP1( <include refid="table_columns" /> )
  103. values ( <include refid="entity_properties" /> )
  104. </insert>
  105. <delete id="delete" parameterType="java.lang.String">
  106. delete from ATT_WAGA_BASE_IMP1 where ID = #{id}
  107. </delete>
  108. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttWagaBaseImp">
  109. delete from ATT_WAGA_BASE_IMP1 <include refid="page_where" />
  110. </delete>
  111. <update id="deleteInFlag" parameterType="java.lang.String">
  112. update ATT_WAGA_BASE_IMP1 set flag_valid = 0 where ID = #{id}
  113. </update>
  114. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttWagaBaseImp">
  115. update ATT_WAGA_BASE_IMP1
  116. <trim prefix="set" suffixOverrides=",">
  117. <if test="adCode1 != null and adCode1 != ''">AD_CODE1 = #{adCode1},</if>
  118. <if test="adName1 != null and adName1 != ''">AD_NAME1 = #{adName1},</if>
  119. <if test="adCode2 != null and adCode2 != ''">AD_CODE2 = #{adCode2},</if>
  120. <if test="adName2 != null and adName2 != ''">AD_NAME2 = #{adName2},</if>
  121. <if test="adCode3 != null and adCode3 != ''">AD_CODE3 = #{adCode3},</if>
  122. <if test="adName3 != null and adName3 != ''">AD_NAME3 = #{adName3},</if>
  123. <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
  124. <if test="gateName != null and gateName != ''">GATE_NAME = #{gateName},</if>
  125. <if test="gateAdmName != null and gateAdmName != ''">GATE_ADM_NAME = #{gateAdmName},</if>
  126. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  127. <if test="gateFlow != null and gateFlow != ''">GATE_FLOW = #{gateFlow},</if>
  128. <if test="ifGate != null and ifGate != ''">IF_GATE = #{ifGate},</if>
  129. <if test="ifDouDile != null and ifDouDile != ''">IF_DOU_DILE = #{ifDouDile},</if>
  130. <if test="gateAdmDep != null and gateAdmDep != ''">GATE_ADM_DEP = #{gateAdmDep},</if>
  131. <if test="gateType != null and gateType != ''">GATE_TYPE = #{gateType},</if>
  132. <if test="locationCun != null and locationCun != ''">LOCATION_CUN = #{locationCun},</if>
  133. <if test="engGrad != null and engGrad != ''">ENG_GRAD = #{engGrad},</if>
  134. </trim>
  135. <where>ID = #{id}</where>
  136. </update>
  137. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttWagaBaseImp">
  138. update ATT_WAGA_BASE_IMP1
  139. <trim prefix="set" suffixOverrides=",">
  140. <if test="adCode1 != null and adCode1 != ''">AD_CODE1 = #{adCode1},</if>
  141. <if test="adName1 != null and adName1 != ''">AD_NAME1 = #{adName1},</if>
  142. <if test="adCode2 != null and adCode2 != ''">AD_CODE2 = #{adCode2},</if>
  143. <if test="adName2 != null and adName2 != ''">AD_NAME2 = #{adName2},</if>
  144. <if test="adCode3 != null and adCode3 != ''">AD_CODE3 = #{adCode3},</if>
  145. <if test="adName3 != null and adName3 != ''">AD_NAME3 = #{adName3},</if>
  146. <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
  147. <if test="gateName != null and gateName != ''">GATE_NAME = #{gateName},</if>
  148. <if test="gateAdmName != null and gateAdmName != ''">GATE_ADM_NAME = #{gateAdmName},</if>
  149. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  150. <if test="gateFlow != null and gateFlow != ''">GATE_FLOW = #{gateFlow},</if>
  151. <if test="ifGate != null and ifGate != ''">IF_GATE = #{ifGate},</if>
  152. <if test="ifDouDile != null and ifDouDile != ''">IF_DOU_DILE = #{ifDouDile},</if>
  153. <if test="gateAdmDep != null and gateAdmDep != ''">GATE_ADM_DEP = #{gateAdmDep},</if>
  154. <if test="gateType != null and gateType != ''">GATE_TYPE = #{gateType},</if>
  155. <if test="locationCun != null and locationCun != ''">LOCATION_CUN = #{locationCun},</if>
  156. <if test="engGrad != null and engGrad != ''">ENG_GRAD = #{engGrad},</if>
  157. </trim>
  158. <include refid="page_where" />
  159. </update>
  160. <!-- 其他自定义SQL -->
  161. <select id="findAllNullCode" resultMap="attWagaBaseImpResultMap">
  162. select <include refid="table_columns" /> from ATT_WAGA_BASE_IMP1 where obj_code is null
  163. </select>
  164. <select id="findAllNew" resultMap="attWagaBaseImpResultMap">
  165. select <include refid="table_columns" /> from ATT_WAGA_BASE_IMP1 a where A.OBJ_CODE IS NULL or A.OBJ_CODE NOT IN (SELECT OBJ_CODE FROM ATT_WAGA_BASE) order by AD_CODE3
  166. </select>
  167. <select id="getMaxObjCode" resultType="java.lang.String" parameterType="java.lang.String">
  168. select max(obj_code) as obj_code from ATT_WAGA_BASE a where a.obj_code like concat(#{adCode},'%')
  169. </select>
  170. </mapper>