c844d36c80e6ce9faf89c7b95fc3f107a36f4703.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.NewsDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.News" id="newsResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="orgId" column="ORG_ID"/>
  7. <result property="adCode" column="AD_CODE"/>
  8. <result property="adName" column="AD_NAME"/>
  9. <result property="adFullName" column="AD_FULL_NAME"/>
  10. <result property="adGrad" column="AD_GRAD"/>
  11. <result property="title" column="TITLE"/>
  12. <result property="des" column="DES"/>
  13. <result property="clcUrl" column="CLC_URL"/>
  14. <result property="intm" column="INTM"/>
  15. <result property="uptm" column="UPTM"/>
  16. <result property="dataStat" column="DATA_STAT"/>
  17. </resultMap>
  18. <sql id="table_columns">
  19. ID,
  20. ORG_ID,
  21. AD_CODE,
  22. AD_NAME,
  23. AD_FULL_NAME,
  24. AD_GRAD,
  25. TITLE,
  26. DES,
  27. CLC_URL,
  28. INTM,
  29. UPTM,
  30. DATA_STAT,
  31. PERS_ID,
  32. PERS_NM,
  33. ORDR,
  34. PUB_DEP,
  35. APP
  36. </sql>
  37. <sql id="entity_properties">
  38. #{id},
  39. #{orgId},
  40. #{adCode},
  41. #{adName},
  42. #{adFullName},
  43. #{adGrad},
  44. #{title},
  45. #{des},
  46. #{clcUrl},
  47. #{intm},
  48. #{uptm},
  49. #{dataStat},
  50. #{persId},
  51. #{persNm},
  52. #{ordr},
  53. #{pubDep},
  54. #{app}
  55. </sql>
  56. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  57. <sql id="page_where">
  58. <trim prefix="where" prefixOverrides="and | or ">
  59. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  60. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  61. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  62. <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME = #{adFullName}</if>
  63. <if test="adGrad != null and adGrad != ''">and AD_GRAD = #{adGrad}</if>
  64. <if test="title != null and title != ''">and TITLE like '%${title}%'</if>
  65. <if test="des != null and des != ''">and DES = #{des}</if>
  66. <if test="clcUrl != null and clcUrl != ''">and CLC_URL = #{clcUrl}</if>
  67. <if test="intm != null">and INTM = #{intm}</if>
  68. <if test="uptm != null">and UPTM = #{uptm}</if>
  69. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  70. <if test="app != null and app != ''">and APP = #{app}</if>
  71. and DATA_STAT='0'
  72. </trim>
  73. </sql>
  74. <select id="get" resultMap="newsResultMap" parameterType="String" >
  75. select <include refid="table_columns" /> from GW_SYS_NEWS where ID = #{id}
  76. </select>
  77. <select id="getBy" resultMap="newsResultMap">
  78. select <include refid="table_columns" /> from GW_SYS_NEWS <include refid="page_where" />
  79. </select>
  80. <select id="findAll" resultMap="newsResultMap">
  81. select <include refid="table_columns" /> from GW_SYS_NEWS
  82. </select>
  83. <select id="findList" resultMap="newsResultMap">
  84. select
  85. <include refid="table_columns" />
  86. from GW_SYS_NEWS
  87. <include refid="page_where" />
  88. ORDER BY INTM DESC
  89. </select>
  90. <select id="selectCount" resultType="int" >
  91. select count(ID) from GW_SYS_NEWS <include refid="page_where" />
  92. </select>
  93. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.News">
  94. insert into GW_SYS_NEWS( <include refid="table_columns" /> )
  95. values ( <include refid="entity_properties" /> )
  96. </insert>
  97. <delete id="delete" parameterType="java.lang.String">
  98. update GW_SYS_NEWS set DATA_STAT='9' where ID = #{id}
  99. </delete>
  100. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.News">
  101. update GW_SYS_NEWS set DATA_STAT='9' <include refid="page_where" />
  102. </delete>
  103. <update id="deleteInFlag" parameterType="java.lang.String">
  104. update GW_SYS_NEWS set DATA_STAT = '9' where ID = #{id}
  105. </update>
  106. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.News">
  107. update GW_SYS_NEWS
  108. <trim prefix="set" suffixOverrides=",">
  109. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  110. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  111. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  112. <if test="ordr != null and ordr != ''">ORDR = #{ordr},</if>
  113. <if test="pubDep != null and pubDep != ''">PUB_DEP = #{pubDep},</if>
  114. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  115. <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
  116. <if test="title != null and title != ''">TITLE = #{title},</if>
  117. <if test="des != null and des != ''">DES = #{des},</if>
  118. <if test="clcUrl != null and clcUrl != ''">CLC_URL = #{clcUrl},</if>
  119. <if test="intm != null">INTM = #{intm},</if>
  120. <if test="uptm != null">UPTM = #{uptm},</if>
  121. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  122. </trim>
  123. <where>ID = #{id}</where>
  124. </update>
  125. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.News">
  126. update GW_SYS_NEWS
  127. <trim prefix="set" suffixOverrides=",">
  128. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  129. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  130. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  131. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  132. <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
  133. <if test="title != null and title != ''">TITLE = #{title},</if>
  134. <if test="des != null and des != ''">DES = #{des},</if>
  135. <if test="clcUrl != null and clcUrl != ''">CLC_URL = #{clcUrl},</if>
  136. <if test="intm != null">INTM = #{intm},</if>
  137. <if test="uptm != null">UPTM = #{uptm},</if>
  138. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  139. </trim>
  140. <include refid="page_where" />
  141. </update>
  142. <!-- 其他自定义SQL -->
  143. </mapper>