TacWordBaseDao.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.TacWordBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacWordBase" id="tacWordBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="type" column="TYPE"/>
  7. <result property="bizId" column="BIZ_ID"/>
  8. <result property="filePath" column="FILE_PATH"/>
  9. <result property="note" column="NOTE"/>
  10. <result property="persId" column="PERS_ID"/>
  11. <result property="bgType" column="BG_TYPE"/>
  12. <result property="intm" column="INTM"/>
  13. <result property="uptm" column="UPTM"/>
  14. <result property="dataStat" column="DATA_STAT"/>
  15. </resultMap>
  16. <sql id="table_columns">
  17. ID,
  18. TYPE,
  19. BIZ_ID,
  20. FILE_PATH,
  21. NOTE,
  22. PERS_ID,
  23. BG_TYPE,
  24. INTM,
  25. UPTM,
  26. DATA_STAT
  27. </sql>
  28. <sql id="entity_properties">
  29. #{id},
  30. #{type},
  31. #{bizId},
  32. #{filePath},
  33. #{note},
  34. #{persId},
  35. #{bgType},
  36. #{intm},
  37. #{uptm},
  38. #{dataStat}
  39. </sql>
  40. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  41. <sql id="page_where">
  42. <trim prefix="where" prefixOverrides="and | or ">
  43. <if test="type != null and type != ''">and TYPE = #{type}</if>
  44. <if test="bizId != null and bizId != ''">and BIZ_ID = #{bizId}</if>
  45. <if test="filePath != null and filePath != ''">and FILE_PATH = #{filePath}</if>
  46. <if test="note != null and note != ''">and NOTE = #{note}</if>
  47. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  48. <if test="bgType != null and bgType != ''">and BG_TYPE = #{bgType}</if>
  49. <if test="intm != null">and INTM = #{intm}</if>
  50. <if test="uptm != null">and UPTM = #{uptm}</if>
  51. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  52. </trim>
  53. </sql>
  54. <select id="get" resultMap="tacWordBaseResultMap" parameterType="String" >
  55. select <include refid="table_columns" /> from TAC_WORD_BASE where ID = #{id}
  56. </select>
  57. <select id="getBy" resultMap="tacWordBaseResultMap">
  58. select <include refid="table_columns" /> from TAC_WORD_BASE <include refid="page_where" />
  59. </select>
  60. <select id="findAll" resultMap="tacWordBaseResultMap">
  61. select <include refid="table_columns" /> from TAC_WORD_BASE
  62. </select>
  63. <select id="findList" resultMap="tacWordBaseResultMap">
  64. select <include refid="table_columns" /> from TAC_WORD_BASE <include refid="page_where" />
  65. </select>
  66. <select id="selectCount" resultType="int" >
  67. select count(ID) from TAC_WORD_BASE <include refid="page_where" />
  68. </select>
  69. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacWordBase">
  70. insert into TAC_WORD_BASE( <include refid="table_columns" /> )
  71. values ( <include refid="entity_properties" /> )
  72. </insert>
  73. <delete id="delete" parameterType="java.lang.String">
  74. delete from TAC_WORD_BASE where ID = #{id}
  75. </delete>
  76. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacWordBase">
  77. delete from TAC_WORD_BASE <include refid="page_where" />
  78. </delete>
  79. <update id="deleteInFlag" parameterType="java.lang.String">
  80. update TAC_WORD_BASE set flag_valid = 0 where ID = #{id}
  81. </update>
  82. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacWordBase">
  83. update TAC_WORD_BASE
  84. <trim prefix="set" suffixOverrides=",">
  85. <if test="type != null and type != ''">TYPE = #{type},</if>
  86. <if test="bizId != null and bizId != ''">BIZ_ID = #{bizId},</if>
  87. <if test="filePath != null and filePath != ''">FILE_PATH = #{filePath},</if>
  88. <if test="note != null and note != ''">NOTE = #{note},</if>
  89. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  90. <if test="bgType != null and bgType != ''">BG_TYPE = #{bgType},</if>
  91. <if test="intm != null">INTM = #{intm},</if>
  92. <if test="uptm != null">UPTM = #{uptm},</if>
  93. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  94. </trim>
  95. <where>ID = #{id}</where>
  96. </update>
  97. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacWordBase">
  98. update TAC_WORD_BASE
  99. <trim prefix="set" suffixOverrides=",">
  100. <if test="type != null and type != ''">TYPE = #{type},</if>
  101. <if test="bizId != null and bizId != ''">BIZ_ID = #{bizId},</if>
  102. <if test="filePath != null and filePath != ''">FILE_PATH = #{filePath},</if>
  103. <if test="note != null and note != ''">NOTE = #{note},</if>
  104. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  105. <if test="bgType != null and bgType != ''">BG_TYPE = #{bgType},</if>
  106. <if test="intm != null">INTM = #{intm},</if>
  107. <if test="uptm != null">UPTM = #{uptm},</if>
  108. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  109. </trim>
  110. <include refid="page_where" />
  111. </update>
  112. <!-- 其他自定义SQL -->
  113. <select id="getProjectNameByRgstrId" resultType="java.lang.String">
  114. select t.ojb_nm as projectName from TAC_INSP_YEAR_BATCH_OBJ t
  115. left join tac_pawp_rgstr r on t.id = r.obj_id where r.id = #{rgstrId}
  116. </select>
  117. </mapper>