TacSlbLawIndexDao.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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.TacSlbLawIndexDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacSlbLawIndex" id="tacSlbLawIndexResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="lawTitle" column="LAW_TITLE"/>
  7. <result property="lawKeyword" column="LAW_KEYWORD"/>
  8. <result property="lawModify" column="LAW_MODIFY"/>
  9. <result property="lawPage" column="LAW_PAGE"/>
  10. <result property="briefContent" column="BRIEF_CONTENT"/>
  11. <result property="bookId" column="BOOK_ID"/>
  12. <result property="docId" column="DOC_ID"/>
  13. <result property="bookContent" column="BOOK_CONTENT"/>
  14. <result property="fileId" column="FILE_ID"/>
  15. <result property="flagValid" column="FLAG_VALID"/>
  16. </resultMap>
  17. <sql id="table_columns">
  18. ID,
  19. LAW_TITLE,
  20. LAW_KEYWORD,
  21. LAW_MODIFY,
  22. LAW_PAGE,
  23. BRIEF_CONTENT,
  24. BOOK_ID,DOC_ID,BOOK_CONTENT,FILE_ID,FLAG_VALID
  25. </sql>
  26. <sql id="entity_properties">
  27. #{id},
  28. #{lawTitle},
  29. #{lawKeyword},
  30. #{lawModify},
  31. #{lawPage},
  32. #{briefContent},
  33. #{bookId},#{docId},#{bookContent},#{fileId},#{flagValid}
  34. </sql>
  35. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  36. <sql id="page_where">
  37. <trim prefix="where" prefixOverrides="and | or ">
  38. <if test="lawTitle != null and lawTitle != ''">and LAW_TITLE = #{lawTitle}</if>
  39. <if test="lawKeyword != null and lawKeyword != ''">and LAW_KEYWORD like '%${lawKeyword}%'</if>
  40. <if test="lawModify != null and lawModify != ''">and LAW_MODIFY like '%{lawModify}%'</if>
  41. <if test="lawPage != null and lawPage != ''">and LAW_PAGE = #{lawPage}</if>
  42. <if test="briefContent != null and briefContent != ''">and BRIEF_CONTENT = #{briefContent}</if>
  43. <if test="bookId != null and bookId !=''">and BOOK_ID = #{bookId}</if>
  44. <if test="docId != null and docId !=''">and DOC_ID = #{docId}</if>
  45. <if test="bookContent != null and bookContent != ''">and BOOK_CONTENT = #{bookContent}</if>
  46. and FLAG_VALID = '1'
  47. </trim>
  48. </sql>
  49. <select id="get" resultMap="tacSlbLawIndexResultMap" parameterType="String" >
  50. select <include refid="table_columns" /> from TAC_SLB_LAW_index where ID = #{id}
  51. </select>
  52. <select id="getBy" resultMap="tacSlbLawIndexResultMap">
  53. select <include refid="table_columns" /> from TAC_SLB_LAW_index <include refid="page_where" />
  54. </select>
  55. <select id="findAll" resultMap="tacSlbLawIndexResultMap">
  56. select <include refid="table_columns" /> from TAC_SLB_LAW_index where flag_Valid ='1'
  57. </select>
  58. <select id="findList" resultMap="tacSlbLawIndexResultMap">
  59. select <include refid="table_columns" /> from TAC_SLB_LAW_index <include refid="page_where" />
  60. order by LAW_PAGE asc
  61. </select>
  62. <select id="findTopList" resultMap="tacSlbLawIndexResultMap">
  63. select
  64. ID,
  65. LAW_TITLE,
  66. LAW_KEYWORD,
  67. LAW_MODIFY,
  68. LAW_PAGE,
  69. BRIEF_CONTENT,
  70. BOOK_ID,DOC_ID,FILE_ID
  71. from TAC_SLB_LAW_index <include refid="page_where" />
  72. order by LAW_PAGE asc
  73. </select>
  74. <select id="findDocs" resultMap="tacSlbLawIndexResultMap">
  75. select distinct x.law_title,x.doc_id from TAC_SLB_LAW_index x where x.law_title is not null and flag_Valid ='1'
  76. <if test="bookId != null ">and BOOK_ID = #{bookId}</if>
  77. <if test="docId != null ">and DOC_ID = #{docId}</if>
  78. order by x.doc_id asc
  79. </select>
  80. <select id="findListDocs" resultType="cn.com.goldenwater.dcproj.dto.TacSlbLawIndexDto">
  81. select distinct x.law_title,x.doc_id from TAC_SLB_LAW_index x where x.law_title is not null and flag_Valid ='1'
  82. <if test="bookId != null ">and BOOK_ID = #{bookId}</if>
  83. order by x.doc_id asc
  84. </select>
  85. <select id="selectCount" resultType="int" >
  86. select count(ID) from TAC_SLB_LAW_index <include refid="page_where" />
  87. </select>
  88. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawIndex">
  89. insert into TAC_SLB_LAW_index( <include refid="table_columns" /> )
  90. values ( <include refid="entity_properties" /> )
  91. </insert>
  92. <delete id="delete" parameterType="java.lang.String">
  93. delete from TAC_SLB_LAW_index where ID = #{id}
  94. </delete>
  95. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawIndex">
  96. delete from TAC_SLB_LAW_index <include refid="page_where" />
  97. </delete>
  98. <update id="deleteInFlag" parameterType="java.lang.String">
  99. update TAC_SLB_LAW_index set flag_valid = 0 where ID = #{id}
  100. </update>
  101. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawIndex">
  102. update TAC_SLB_LAW_index
  103. <trim prefix="set" suffixOverrides=",">
  104. <if test="lawTitle != null and lawTitle != ''">LAW_TITLE = #{lawTitle},</if>
  105. <if test="lawKeyword != null and lawKeyword != ''">LAW_KEYWORD = #{lawKeyword},</if>
  106. <if test="lawModify != null and lawModify != ''">LAW_MODIFY = #{lawModify},</if>
  107. <if test="lawPage != null and lawPage != ''">LAW_PAGE = #{lawPage},</if>
  108. <if test="docId != null ">DOC_ID = #{docId},</if>
  109. BRIEF_CONTENT = #{briefContent},
  110. <if test="bookId != null ">BOOK_ID = #{bookId},</if>
  111. <if test="bookContent != null ">BOOK_CONTENT = #{bookContent},</if>
  112. <if test="fileId != null ">FILE_ID = #{fileId},</if>
  113. </trim>
  114. <where>ID = #{id}</where>
  115. </update>
  116. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacSlbLawIndex">
  117. update TAC_SLB_LAW_index
  118. <trim prefix="set" suffixOverrides=",">
  119. <if test="lawTitle != null and lawTitle != ''">LAW_TITLE = #{lawTitle},</if>
  120. <if test="lawKeyword != null and lawKeyword != ''">LAW_KEYWORD = #{lawKeyword},</if>
  121. <if test="lawModify != null and lawModify != ''">LAW_MODIFY = #{lawModify},</if>
  122. <if test="docId != null and docId != ''">DOC_ID = #{docId},</if>
  123. <if test="lawPage != null and lawPage != ''">LAW_PAGE = #{lawPage},</if>
  124. <if test="briefContent != null and briefContent != ''">BRIEF_CONTENT = #{briefContent},</if>
  125. <if test="bookId != null and bookId != ''">BOOK_ID = #{bookId},</if>
  126. <if test="bookContent != null ">BOOK_CONTENT = #{bookContent},</if>
  127. <if test="fileId != null ">FILE_ID = #{fileId},</if>
  128. </trim>
  129. <include refid="page_where" />
  130. </update>
  131. <!-- 其他自定义SQL -->
  132. </mapper>