ChkSafeStatListIndustryDao.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="cn.com.goldenwater.dcproj.dao.ChkSafeStatListIndustryDao">
  6. <resultMap type="cn.com.goldenwater.dcproj.model.ChkSafeStatListIndustry" id="chkSafeStatListIndustryResultMap">
  7. <result property="id" column="ID" />
  8. <result property="pid" column="PID" />
  9. <result property="industryType" column="INDUSTRY_TYPE" />
  10. <result property="ordr" column="ORDR" />
  11. <result property="note" column="NOTE" />
  12. <result property="persId" column="PERS_ID" />
  13. <result property="intm" column="INTM" />
  14. <result property="uptm" column="UPTM" />
  15. <result property="dataStat" column="DATA_STAT" />
  16. </resultMap>
  17. <!-- 数据库表字段列表 table_columns -->
  18. <sql id="table_columns">
  19. ID,
  20. PID,
  21. INDUSTRY_TYPE,
  22. ORDR,
  23. NOTE,
  24. PERS_ID,
  25. INTM,
  26. UPTM,
  27. DATA_STAT
  28. </sql>
  29. <!-- 实体类属性 列表 entity_properties -->
  30. <sql id="entity_properties">
  31. #{id},
  32. #{pid},
  33. #{industryType},
  34. #{ordr},
  35. #{note},
  36. #{persId},
  37. #{intm},
  38. #{uptm},
  39. #{dataStat}
  40. </sql>
  41. <!-- 查询条件 -->
  42. <sql id="page_where">
  43. <trim prefix="where" prefixOverrides="and | or ">
  44. <if test='pid != null and pid != ""'> and PID = #{pid}</if>
  45. <if test='industryType != null and industryType != ""'> and INDUSTRY_TYPE = #{industryType}</if>
  46. <if test='ordr != null '> and ORDR = #{ordr}</if>
  47. <if test='note != null and note != ""'> and NOTE = #{note}</if>
  48. <if test='persId != null and persId != ""'> and PERS_ID = #{persId}</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. <!-- 根据Id查询 -->
  55. <select id="get" resultMap="chkSafeStatListIndustryResultMap" parameterType="String">
  56. select
  57. <include refid="table_columns"/>
  58. from CHK_SAFE_STAT_LIST_INDUSTRY where ID = #{id}
  59. </select>
  60. <!-- 根据条件筛选查询 -->
  61. <select id="getBy" resultMap="chkSafeStatListIndustryResultMap" parameterType="cn.com.goldenwater.dcproj.param.ChkSafeStatListIndustryParam">
  62. select
  63. <include refid="table_columns"/>
  64. from CHK_SAFE_STAT_LIST_INDUSTRY
  65. <include refid="page_where"/>
  66. </select>
  67. <!-- 查询所有 -->
  68. <select id="findAll" resultMap="chkSafeStatListIndustryResultMap">
  69. select
  70. <include refid="table_columns"/>
  71. from CHK_SAFE_STAT_LIST_INDUSTRY
  72. order by ORDR asc
  73. </select>
  74. <!-- 根据条件筛选 查询所有 -->
  75. <select id="findList" resultMap="chkSafeStatListIndustryResultMap" parameterType="cn.com.goldenwater.dcproj.param.ChkSafeStatListIndustryParam">
  76. select
  77. <include refid="table_columns"/>
  78. from CHK_SAFE_STAT_LIST_INDUSTRY
  79. <include refid="page_where"/>
  80. order by ORDR asc
  81. </select>
  82. <!-- 根据条件筛选 统计记录数 -->
  83. <select id="selectCount" resultType="int" parameterType="cn.com.goldenwater.dcproj.param.ChkSafeStatListIndustryParam">
  84. select count( ID ) from CHK_SAFE_STAT_LIST_INDUSTRY
  85. <include refid="page_where"/>
  86. </select>
  87. <!-- 添加 -->
  88. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeStatListIndustry" >
  89. insert into CHK_SAFE_STAT_LIST_INDUSTRY(
  90. <include refid="table_columns"/>
  91. )
  92. values (
  93. <include refid="entity_properties"/>
  94. )
  95. </insert>
  96. <!-- 主键删除 -->
  97. <delete id="delete" parameterType="java.lang.String">
  98. update CHK_SAFE_STAT_LIST_INDUSTRY set DATA_STAT='9' where ID = #{id}
  99. </delete>
  100. <!-- 条件删除 -->
  101. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeStatListIndustry">
  102. update CHK_SAFE_STAT_LIST_INDUSTRY set DATA_STAT='9'
  103. <include refid="page_where"/>
  104. </delete>
  105. <!-- 逻辑删除 -->
  106. <update id="deleteInFlag" parameterType="java.lang.String">
  107. update CHK_SAFE_STAT_LIST_INDUSTRY set DATA_STAT = '9' where ID = #{id}
  108. </update>
  109. <!-- 主键更新 -->
  110. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeStatListIndustry">
  111. update CHK_SAFE_STAT_LIST_INDUSTRY
  112. <trim prefix="SET" suffixOverrides=",">
  113. <if test='pid != null'>PID = #{pid},</if>
  114. <if test='industryType != null'>INDUSTRY_TYPE = #{industryType},</if>
  115. <if test='ordr != null'>ORDR = #{ordr},</if>
  116. <if test='note != null'>NOTE = #{note},</if>
  117. <if test='uptm != null'>UPTM = #{uptm},</if>
  118. <if test='dataStat != null'>DATA_STAT = #{dataStat},</if>
  119. </trim>
  120. where ID = #{id}
  121. </update>
  122. <!-- 条件更新 -->
  123. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.ChkSafeStatListIndustry">
  124. update CHK_SAFE_STAT_LIST_INDUSTRY
  125. <trim prefix="SET" suffixOverrides=",">
  126. <if test='pid != null'>PID = #{pid},</if>
  127. <if test='industryType != null'>INDUSTRY_TYPE = #{industryType},</if>
  128. <if test='ordr != null'>ORDR = #{ordr},</if>
  129. <if test='note != null'>NOTE = #{note},</if>
  130. <if test='uptm != null'>UPTM = #{uptm},</if>
  131. <if test='dataStat != null'>DATA_STAT = #{dataStat},</if>
  132. </trim>
  133. <include refid="page_where"/>
  134. </update>
  135. <!-- 其他自定义SQL -->
  136. <!-- 查询所有根节点 PID 为空 -->
  137. <select id="findRootList" resultMap="chkSafeStatListIndustryResultMap">
  138. select
  139. <include refid="table_columns"/>
  140. from CHK_SAFE_STAT_LIST_INDUSTRY where PID is null and DATA_STAT = '0'
  141. order by ORDR asc
  142. </select>
  143. </mapper>