KwsReportTemplateMapper.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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="com.sckw.slope.detection.dao.mysql.KwsReportTemplateMapper">
  4. <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsReportTemplate">
  5. <!--@mbg.generated-->
  6. <!--@Table kws_report_template-->
  7. <id column="id" jdbcType="BIGINT" property="id"/>
  8. <result column="name" jdbcType="VARCHAR" property="name"/>
  9. <result column="type" jdbcType="INTEGER" property="type"/>
  10. <result column="company_id" jdbcType="VARCHAR" property="companyId"/>
  11. <result column="mountain_id" jdbcType="VARCHAR" property="mountainId"/>
  12. <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
  13. <result column="part_names" jdbcType="VARCHAR" property="partNames"/>
  14. <result column="tabulation_time" jdbcType="VARCHAR" property="tabulationTime"/>
  15. <result column="intergration_names" jdbcType="VARCHAR" property="intergrationNames"/>
  16. <result column="status" jdbcType="INTEGER" property="status"/>
  17. <result column="create_by" jdbcType="BIGINT" property="createBy"/>
  18. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  19. <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
  20. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  21. <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
  22. </resultMap>
  23. <sql id="Base_Column_List">
  24. <!--@mbg.generated-->
  25. id,
  26. `name`,
  27. `type`,
  28. part_names,
  29. project_id,
  30. intergration_names,
  31. `status`,
  32. create_by,
  33. create_time,
  34. update_by,
  35. update_time,
  36. del_flag,
  37. company_id,
  38. mountain_id,
  39. tabulation_time
  40. </sql>
  41. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  42. <!--@mbg.generated-->
  43. select
  44. <include refid="Base_Column_List"/>
  45. from kws_report_template
  46. where id = #{id,jdbcType=BIGINT}
  47. </select>
  48. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  49. <!--@mbg.generated-->
  50. delete
  51. from kws_report_template
  52. where id = #{id,jdbcType=BIGINT}
  53. </delete>
  54. <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsReportTemplate">
  55. <!--@mbg.generated-->
  56. insert into kws_report_template
  57. <trim prefix="(" suffix=")" suffixOverrides=",">
  58. <if test="id != null">
  59. id,
  60. </if>
  61. <if test="name != null">
  62. `name`,
  63. </if>
  64. <if test="type != null">
  65. `type`,
  66. </if>
  67. <if test="partNames != null">
  68. part_names,
  69. </if>
  70. <if test="intergrationNames != null">
  71. intergration_names,
  72. </if>
  73. <if test="status != null">
  74. `status`,
  75. </if>
  76. <if test="createBy != null">
  77. create_by,
  78. </if>
  79. <if test="createTime != null">
  80. create_time,
  81. </if>
  82. <if test="updateBy != null">
  83. update_by,
  84. </if>
  85. <if test="updateTime != null">
  86. update_time,
  87. </if>
  88. <if test="delFlag != null">
  89. del_flag,
  90. </if>
  91. </trim>
  92. <trim prefix="values (" suffix=")" suffixOverrides=",">
  93. <if test="id != null">
  94. #{id,jdbcType=BIGINT},
  95. </if>
  96. <if test="name != null">
  97. #{name,jdbcType=VARCHAR},
  98. </if>
  99. <if test="type != null">
  100. #{type,jdbcType=INTEGER},
  101. </if>
  102. <if test="partNames != null">
  103. #{partNames,jdbcType=VARCHAR},
  104. </if>
  105. <if test="intergrationNames != null">
  106. #{intergrationNames,jdbcType=VARCHAR},
  107. </if>
  108. <if test="status != null">
  109. #{status,jdbcType=TINYINT},
  110. </if>
  111. <if test="createBy != null">
  112. #{createBy,jdbcType=BIGINT},
  113. </if>
  114. <if test="createTime != null">
  115. #{createTime,jdbcType=TIMESTAMP},
  116. </if>
  117. <if test="updateBy != null">
  118. #{updateBy,jdbcType=BIGINT},
  119. </if>
  120. <if test="updateTime != null">
  121. #{updateTime,jdbcType=TIMESTAMP},
  122. </if>
  123. <if test="delFlag != null">
  124. #{delFlag,jdbcType=TINYINT},
  125. </if>
  126. </trim>
  127. </insert>
  128. <update id="updateByPrimaryKeySelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsReportTemplate">
  129. <!--@mbg.generated-->
  130. update kws_report_template
  131. <set>
  132. <if test="name != null">
  133. `name` = #{name,jdbcType=VARCHAR},
  134. </if>
  135. <if test="type != null">
  136. `type` = #{type,jdbcType=INTEGER},
  137. </if>
  138. <if test="partNames != null">
  139. part_names = #{partNames,jdbcType=VARCHAR},
  140. </if>
  141. <if test="intergrationNames != null">
  142. intergration_names = #{intergrationNames,jdbcType=VARCHAR},
  143. </if>
  144. <if test="status != null">
  145. `status` = #{status,jdbcType=TINYINT},
  146. </if>
  147. <if test="createBy != null">
  148. create_by = #{createBy,jdbcType=BIGINT},
  149. </if>
  150. <if test="createTime != null">
  151. create_time = #{createTime,jdbcType=TIMESTAMP},
  152. </if>
  153. <if test="updateBy != null">
  154. update_by = #{updateBy,jdbcType=BIGINT},
  155. </if>
  156. <if test="updateTime != null">
  157. update_time = #{updateTime,jdbcType=TIMESTAMP},
  158. </if>
  159. <if test="delFlag != null">
  160. del_flag = #{delFlag,jdbcType=TINYINT},
  161. </if>
  162. </set>
  163. where id = #{id,jdbcType=BIGINT}
  164. </update>
  165. <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsReportTemplate">
  166. <!--@mbg.generated-->
  167. update kws_report_template
  168. set `name` = #{name,jdbcType=VARCHAR},
  169. `type` = #{type,jdbcType=INTEGER},
  170. part_names = #{partNames,jdbcType=VARCHAR},
  171. intergration_names = #{intergrationNames,jdbcType=VARCHAR},
  172. `status` = #{status,jdbcType=TINYINT},
  173. create_by = #{createBy,jdbcType=BIGINT},
  174. create_time = #{createTime,jdbcType=TIMESTAMP},
  175. update_by = #{updateBy,jdbcType=BIGINT},
  176. update_time = #{updateTime,jdbcType=TIMESTAMP},
  177. del_flag = #{delFlag,jdbcType=TINYINT}
  178. where id = #{id,jdbcType=BIGINT}
  179. </update>
  180. <select id="selectListByReportNameAndProjectIdAndCompany"
  181. resultType="com.sckw.slope.detection.model.vo.ReportStatementVO">
  182. SELECT STATUS,
  183. `name` AS reportName,
  184. type AS reportType,
  185. project_id AS projectId,
  186. tabulation_time AS tabulationTime,
  187. create_time AS createTime,
  188. id as id
  189. FROM kws_report_template
  190. WHERE del_flag = 0
  191. <if test="query.projectId != null and query.projectId != ''">
  192. and project_id = #{query.projectId}
  193. </if>
  194. <if test="companyId != null and companyId != ''">
  195. and mountain_id = #{companyId,jdbcType=VARCHAR}
  196. </if>
  197. <if test="query.name != null and query.name != ''">
  198. and name like concat('%', #{query.name}
  199. , '%')
  200. </if>
  201. <if test="query.type != null and query.type != ''">
  202. and type =#{query.type}
  203. </if>
  204. </select>
  205. <select id="selectListByReportNameAndProjectId" resultType="com.sckw.slope.detection.model.vo.ReportStatementVO">
  206. </select>
  207. <select id="selectDataAndTemplate" resultType="com.sckw.slope.detection.model.vo.ReportDetailVO">
  208. SELECT a.id,
  209. a.part_names AS partNames,
  210. a.intergration_names AS intergrationNames,
  211. a.type AS type,
  212. a.`status` AS STATUS,
  213. b.NAME AS NAME,
  214. FROM kws_report_template a
  215. LEFT JOIN kws_report_data b ON a.id = b.template_id
  216. WHERE id = #{id,jdbcType=BIGINT}
  217. </select>
  218. </mapper>