BisInspUplogDao.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.BisInspUplogDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspUplog" id="bisInspUplogResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="persid" column="PERSID"/>
  7. <result property="intm" column="INTM"/>
  8. <result property="content" column="CONTENT"/>
  9. <result property="flagValid" column="FLAG_VALID"/>
  10. </resultMap>
  11. <sql id="table_columns">
  12. ID,
  13. PERSID,
  14. <if test="intm != null and intm != ''">INTM,</if>
  15. CONTENT
  16. <if test="flagValid != null and flagValid != ''">,FLAG_VALID</if>
  17. </sql>
  18. <sql id="entity_properties">
  19. #{id},
  20. #{persid},
  21. <if test="intm != null and intm != ''">#{intm},</if>
  22. #{content}
  23. <if test="flagValid != null and flagValid != ''">,#{flagValid}</if>
  24. </sql>
  25. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  26. <sql id="page_where">
  27. <trim prefix="where" prefixOverrides="and | or ">
  28. <if test="persid != null and persid != ''">and PERSID = #{persid}</if>
  29. <if test="intm != null">and INTM = #{intm}</if>
  30. <if test="content != null and content != ''">and CONTENT = #{content}</if>
  31. <if test="flagValid != null">and FLAG_VALID = #{flagValid}</if>
  32. </trim>
  33. </sql>
  34. <select id="get" resultMap="bisInspUplogResultMap" parameterType="String">
  35. select
  36. <include refid="table_columns"/>
  37. from BIS_INSP_UPLOG where ID = #{id}
  38. </select>
  39. <select id="getBy" resultMap="bisInspUplogResultMap">
  40. select
  41. <include refid="table_columns"/>
  42. from BIS_INSP_UPLOG
  43. <include refid="page_where"/>
  44. </select>
  45. <select id="findAll" resultMap="bisInspUplogResultMap">
  46. select
  47. <include refid="table_columns"/>
  48. from BIS_INSP_UPLOG
  49. </select>
  50. <select id="findList" resultMap="bisInspUplogResultMap">
  51. select
  52. <include refid="table_columns"/>
  53. from BIS_INSP_UPLOG
  54. <include refid="page_where"/>
  55. </select>
  56. <select id="selectCount" resultType="int">
  57. select count(ID) from BIS_INSP_UPLOG
  58. <include refid="page_where"/>
  59. </select>
  60. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspUplog">
  61. insert into BIS_INSP_UPLOG(
  62. <include refid="table_columns"/>
  63. )
  64. values (
  65. <include refid="entity_properties"/>
  66. )
  67. </insert>
  68. <delete id="delete" parameterType="java.lang.String">
  69. delete from BIS_INSP_UPLOG where ID = #{id}
  70. </delete>
  71. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspUplog">
  72. delete from BIS_INSP_UPLOG
  73. <include refid="page_where"/>
  74. </delete>
  75. <update id="deleteInFlag" parameterType="java.lang.String">
  76. update BIS_INSP_UPLOG set flag_valid = 0 where ID = #{id}
  77. </update>
  78. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspUplog">
  79. update BIS_INSP_UPLOG
  80. <trim prefix="set" suffixOverrides=",">
  81. <if test="persid != null and persid != ''">PERSID = #{persid},</if>
  82. <if test="intm != null">INTM = #{intm},</if>
  83. <if test="content != null and content != ''">CONTENT = #{content},</if>
  84. <if test="flagValid != null">FLAG_VALID = #{flagValid},</if>
  85. </trim>
  86. <where>ID = #{id}</where>
  87. </update>
  88. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspUplog">
  89. update BIS_INSP_UPLOG
  90. <trim prefix="set" suffixOverrides=",">
  91. <if test="persid != null and persid != ''">PERSID = #{persid},</if>
  92. <if test="intm != null">INTM = #{intm},</if>
  93. <if test="content != null and content != ''">CONTENT = #{content},</if>
  94. <if test="flagValid != null">FLAG_VALID = #{flagValid},</if>
  95. </trim>
  96. <include refid="page_where"/>
  97. </update>
  98. <!-- 其他自定义SQL -->
  99. <select id="findLogByPersonId" parameterType="cn.com.goldenwater.dcproj.param.BisInspUplogParam"
  100. resultType="cn.com.goldenwater.dcproj.dto.BisInspUplogDto">
  101. select A.*,B.PERS_NAME,C.file_path from BIS_INSP_UPLOG A
  102. LEFT JOIN BIS_INSP_ALL_RLATION_PERS B
  103. ON A.PERSID=B.GUID
  104. LEFT JOIN gw_com_file C ON A.ID=C.BIZ_ID
  105. WHERE A.FLAG_VALID='1'
  106. <if test="persid != null and persid != ''">AND A.persid = #{persid}</if>
  107. </select>
  108. </mapper>