TacAttPawpBaseChangeLogDao.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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.TacAttPawpBaseChangeLogDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacAttPawpBaseChangeLog" id="tacAttPawpBaseChangeLogResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="ojbId" column="OJB_ID"/>
  7. <result property="ojbName" column="OJB_NAME"/>
  8. <result property="year" column="YEAR"/>
  9. <result property="changeReson" column="CHANGE_RESON"/>
  10. <result property="content" column="CONTENT"/>
  11. <result property="persId" column="PERS_ID"/>
  12. <result property="persName" column="PERS_NAME"/>
  13. <result property="intm" column="INTM"/>
  14. </resultMap>
  15. <sql id="table_columns">
  16. ID,
  17. OJB_ID,
  18. OJB_NAME,
  19. YEAR,
  20. CHANGE_RESON,
  21. CONTENT,
  22. PERS_ID,
  23. PERS_NAME,
  24. INTM,
  25. PROVINCE
  26. </sql>
  27. <sql id="entity_properties">
  28. #{id},
  29. #{ojbId},
  30. #{ojbName},
  31. #{year},
  32. #{changeReson},
  33. #{content},
  34. #{persId},
  35. #{persName},
  36. #{intm},
  37. #{province}
  38. </sql>
  39. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  40. <sql id="page_where">
  41. <trim prefix="where" prefixOverrides="and | or ">
  42. <if test="ojbId != null and ojbId != ''">and OJB_ID = #{ojbId}</if>
  43. <if test="ojbName != null and ojbName != ''">and OJB_NAME = #{ojbName}</if>
  44. <if test="year != null and year != ''">and YEAR = #{year}</if>
  45. <if test="changeReson != null and changeReson != ''">and CHANGE_RESON = #{changeReson}</if>
  46. <if test="content != null and content != ''">and CONTENT = #{content}</if>
  47. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  48. <if test="persName != null and persName != ''">and PERS_NAME = #{persName}</if>
  49. <if test="intm != null">and INTM = #{intm}</if>
  50. <include refid="choseSql"/>
  51. </trim>
  52. </sql>
  53. <select id="get" resultMap="tacAttPawpBaseChangeLogResultMap" parameterType="String" >
  54. select <include refid="table_columns" /> from TAC_ATT_PAWP_BASE_CHANGE_LOG where ID = #{id}
  55. </select>
  56. <select id="getBy" resultMap="tacAttPawpBaseChangeLogResultMap">
  57. select <include refid="table_columns" /> from TAC_ATT_PAWP_BASE_CHANGE_LOG <include refid="page_where" />
  58. </select>
  59. <select id="findAll" resultMap="tacAttPawpBaseChangeLogResultMap">
  60. select <include refid="table_columns" /> from TAC_ATT_PAWP_BASE_CHANGE_LOG
  61. </select>
  62. <select id="findList" resultMap="tacAttPawpBaseChangeLogResultMap">
  63. select <include refid="table_columns" /> from TAC_ATT_PAWP_BASE_CHANGE_LOG <include refid="page_where" /> order by INTM desc
  64. </select>
  65. <select id="selectCount" resultType="int" >
  66. select count(ID) from TAC_ATT_PAWP_BASE_CHANGE_LOG <include refid="page_where" />
  67. </select>
  68. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacAttPawpBaseChangeLog">
  69. insert into TAC_ATT_PAWP_BASE_CHANGE_LOG( <include refid="table_columns" /> )
  70. values ( <include refid="entity_properties" /> )
  71. </insert>
  72. <delete id="delete" parameterType="java.lang.String">
  73. update TAC_ATT_PAWP_BASE_CHANGE_LOG set DATA_STAT='9' where ID = #{id}
  74. </delete>
  75. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacAttPawpBaseChangeLog">
  76. update TAC_ATT_PAWP_BASE_CHANGE_LOG set DATA_STAT='9' <include refid="page_where" />
  77. </delete>
  78. <update id="deleteInFlag" parameterType="java.lang.String">
  79. update TAC_ATT_PAWP_BASE_CHANGE_LOG set DATA_STAT = '9' where ID = #{id}
  80. </update>
  81. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacAttPawpBaseChangeLog">
  82. update TAC_ATT_PAWP_BASE_CHANGE_LOG
  83. <trim prefix="set" suffixOverrides=",">
  84. <if test="ojbId != null and ojbId != ''">OJB_ID = #{ojbId},</if>
  85. <if test="ojbName != null and ojbName != ''">OJB_NAME = #{ojbName},</if>
  86. <if test="year != null and year != ''">YEAR = #{year},</if>
  87. <if test="changeReson != null and changeReson != ''">CHANGE_RESON = #{changeReson},</if>
  88. <if test="content != null and content != ''">CONTENT = #{content},</if>
  89. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  90. <if test="persName != null and persName != ''">PERS_NAME = #{persName},</if>
  91. <if test="intm != null">INTM = #{intm},</if>
  92. <if test="province != null">PROVINCE = #{province},</if>
  93. </trim>
  94. <where>ID = #{id}</where>
  95. </update>
  96. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacAttPawpBaseChangeLog">
  97. update TAC_ATT_PAWP_BASE_CHANGE_LOG
  98. <trim prefix="set" suffixOverrides=",">
  99. <if test="ojbId != null and ojbId != ''">OJB_ID = #{ojbId},</if>
  100. <if test="ojbName != null and ojbName != ''">OJB_NAME = #{ojbName},</if>
  101. <if test="year != null and year != ''">YEAR = #{year},</if>
  102. <if test="changeReson != null and changeReson != ''">CHANGE_RESON = #{changeReson},</if>
  103. <if test="content != null and content != ''">CONTENT = #{content},</if>
  104. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  105. <if test="persName != null and persName != ''">PERS_NAME = #{persName},</if>
  106. <if test="intm != null">INTM = #{intm},</if>
  107. <if test="province != null">PROVINCE = #{province},</if>
  108. </trim>
  109. <include refid="page_where" />
  110. </update>
  111. <sql id="choseSql">
  112. <choose>
  113. <when test="province !=null and province !=''">
  114. AND province=#{province}
  115. </when>
  116. <otherwise>
  117. AND province is null
  118. </otherwise>
  119. </choose>
  120. </sql>
  121. <!-- 其他自定义SQL -->
  122. </mapper>