KwsDeviceMapper.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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.KwsDeviceMapper">
  4. <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsDevice">
  5. <!--@mbg.generated-->
  6. <!--@Table kws_device-->
  7. <id column="id" jdbcType="BIGINT" property="id" />
  8. <result column="attribute" jdbcType="INTEGER" property="attribute" />
  9. <result column="name" jdbcType="VARCHAR" property="name" />
  10. <result column="alias" jdbcType="VARCHAR" property="alias" />
  11. <result column="sn_code" jdbcType="VARCHAR" property="snCode" />
  12. <result column="model_id" jdbcType="BIGINT" property="modelId" />
  13. <result column="company_id" jdbcType="VARCHAR" property="companyId" />
  14. <result column="valid_time" jdbcType="TIMESTAMP" property="validTime" />
  15. <result column="secret_key" jdbcType="VARCHAR" property="secretKey" />
  16. <result column="inter_face" jdbcType="VARCHAR" property="interFace" />
  17. <result column="remark" jdbcType="VARCHAR" property="remark" />
  18. <result column="status" jdbcType="TINYINT" property="status" />
  19. <result column="create_by" jdbcType="BIGINT" property="createBy" />
  20. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  21. <result column="update_by" jdbcType="BIGINT" property="updateBy" />
  22. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  23. <result column="del_flag" jdbcType="TINYINT" property="delFlag" />
  24. </resultMap>
  25. <sql id="Base_Column_List">
  26. <!--@mbg.generated-->
  27. id, `attribute`, `name`, `alias`, sn_code, model_id, valid_time, secret_key, inter_face,
  28. remark, `status`, create_by, create_time, update_by, update_time, del_flag,company_id
  29. </sql>
  30. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  31. <!--@mbg.generated-->
  32. select
  33. <include refid="Base_Column_List" />
  34. from kws_device
  35. where id = #{id,jdbcType=BIGINT}
  36. </select>
  37. <select id="selectByDeviceParam" resultType="com.sckw.slope.detection.model.vo.DeviceVo">
  38. select
  39. d.id, d.name,manufacturer,device_type,m.name as m_name,d.remark,d.update_by,d.update_time,p.`name` as project_name,d.status
  40. from kws_device as d
  41. inner join kws_device_model as m on d.model_id=m.id
  42. left join kws_project_device as pd on d.id=pd.device_id
  43. left join kws_project as p on pd.project_id=p.id
  44. WHERE d.del_flag = 0 and m.del_flag = 0
  45. <where>
  46. <if test="deviceQuery.deviceName != null and deviceQuery.deviceName != ''">
  47. and name like concat('%', #{deviceQuery.deviceName}, '%')
  48. </if>
  49. <if test="deviceQuery.id != null and deviceQuery.id != ''">
  50. and id = #{id,jdbcType=BIGINT}
  51. </if>
  52. </where>
  53. </select>
  54. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  55. <!--@mbg.generated-->
  56. delete from kws_device
  57. where id = #{id,jdbcType=BIGINT}
  58. </delete>
  59. <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDevice">
  60. <!--@mbg.generated-->
  61. insert into kws_device (id, `attribute`, `name`,
  62. `alias`, sn_code, model_id,
  63. valid_time, secret_key, inter_face,
  64. remark, `status`, create_by,
  65. create_time, update_by, update_time,
  66. del_flag,related)
  67. values (#{id,jdbcType=BIGINT}, #{attribute,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
  68. #{alias,jdbcType=VARCHAR}, #{snCode,jdbcType=VARCHAR}, #{modelId,jdbcType=BIGINT},
  69. #{validTime,jdbcType=TIMESTAMP}, #{secretKey,jdbcType=VARCHAR}, #{interFace,jdbcType=VARCHAR},
  70. #{remark,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT},
  71. #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
  72. #{delFlag,jdbcType=TINYINT},#{related,jdbcType=BIGINT})
  73. </insert>
  74. <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDevice">
  75. <!--@mbg.generated-->
  76. insert into kws_device
  77. <trim prefix="(" suffix=")" suffixOverrides=",">
  78. <if test="id != null">
  79. id,
  80. </if>
  81. <if test="attribute != null">
  82. `attribute`,
  83. </if>
  84. <if test="name != null">
  85. `name`,
  86. </if>
  87. <if test="alias != null">
  88. `alias`,
  89. </if>
  90. <if test="snCode != null">
  91. sn_code,
  92. </if>
  93. <if test="modelId != null">
  94. model_id,
  95. </if>
  96. <if test="validTime != null">
  97. valid_time,
  98. </if>
  99. <if test="secretKey != null">
  100. secret_key,
  101. </if>
  102. <if test="interFace != null">
  103. interface,
  104. </if>
  105. <if test="remark != null">
  106. remark,
  107. </if>
  108. <if test="status != null">
  109. `status`,
  110. </if>
  111. <if test="createBy != null">
  112. create_by,
  113. </if>
  114. <if test="createTime != null">
  115. create_time,
  116. </if>
  117. <if test="updateBy != null">
  118. update_by,
  119. </if>
  120. <if test="updateTime != null">
  121. update_time,
  122. </if>
  123. <if test="delFlag != null">
  124. del_flag,
  125. </if>
  126. </trim>
  127. <trim prefix="values (" suffix=")" suffixOverrides=",">
  128. <if test="id != null">
  129. #{id,jdbcType=BIGINT},
  130. </if>
  131. <if test="attribute != null">
  132. #{attribute,jdbcType=INTEGER},
  133. </if>
  134. <if test="name != null">
  135. #{name,jdbcType=VARCHAR},
  136. </if>
  137. <if test="alias != null">
  138. #{alias,jdbcType=VARCHAR},
  139. </if>
  140. <if test="snCode != null">
  141. #{snCode,jdbcType=VARCHAR},
  142. </if>
  143. <if test="modelId != null">
  144. #{modelId,jdbcType=BIGINT},
  145. </if>
  146. <if test="validTime != null">
  147. #{validTime,jdbcType=TIMESTAMP},
  148. </if>
  149. <if test="secretKey != null">
  150. #{secretKey,jdbcType=VARCHAR},
  151. </if>
  152. <if test="interFace != null">
  153. #{interFace,jdbcType=VARCHAR},
  154. </if>
  155. <if test="remark != null">
  156. #{remark,jdbcType=VARCHAR},
  157. </if>
  158. <if test="status != null">
  159. #{status,jdbcType=TINYINT},
  160. </if>
  161. <if test="createBy != null">
  162. #{createBy,jdbcType=BIGINT},
  163. </if>
  164. <if test="createTime != null">
  165. #{createTime,jdbcType=TIMESTAMP},
  166. </if>
  167. <if test="updateBy != null">
  168. #{updateBy,jdbcType=BIGINT},
  169. </if>
  170. <if test="updateTime != null">
  171. #{updateTime,jdbcType=TIMESTAMP},
  172. </if>
  173. <if test="delFlag != null">
  174. #{delFlag,jdbcType=TINYINT},
  175. </if>
  176. </trim>
  177. </insert>
  178. <update id="updateByPrimaryKeySelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDevice">
  179. <!--@mbg.generated-->
  180. update kws_device
  181. <set>
  182. <if test="attribute != null">
  183. `attribute` = #{attribute,jdbcType=INTEGER},
  184. </if>
  185. <if test="name != null">
  186. `name` = #{name,jdbcType=VARCHAR},
  187. </if>
  188. <if test="alias != null">
  189. `alias` = #{alias,jdbcType=VARCHAR},
  190. </if>
  191. <if test="snCode != null">
  192. sn_code = #{snCode,jdbcType=VARCHAR},
  193. </if>
  194. <if test="modelId != null">
  195. model_id = #{modelId,jdbcType=BIGINT},
  196. </if>
  197. <if test="validTime != null">
  198. valid_time = #{validTime,jdbcType=TIMESTAMP},
  199. </if>
  200. <if test="secretKey != null">
  201. secret_key = #{secretKey,jdbcType=VARCHAR},
  202. </if>
  203. <if test="interFace != null">
  204. inter_face = #{interFace,jdbcType=VARCHAR},
  205. </if>
  206. <if test="remark != null">
  207. remark = #{remark,jdbcType=VARCHAR},
  208. </if>
  209. <if test="status != null">
  210. `status` = #{status,jdbcType=TINYINT},
  211. </if>
  212. <if test="createBy != null">
  213. create_by = #{createBy,jdbcType=BIGINT},
  214. </if>
  215. <if test="createTime != null">
  216. create_time = #{createTime,jdbcType=TIMESTAMP},
  217. </if>
  218. <if test="updateBy != null">
  219. update_by = #{updateBy,jdbcType=BIGINT},
  220. </if>
  221. <if test="updateTime != null">
  222. update_time = #{updateTime,jdbcType=TIMESTAMP},
  223. </if>
  224. <if test="delFlag != null">
  225. del_flag = #{delFlag,jdbcType=TINYINT},
  226. </if>
  227. </set>
  228. where id = #{id,jdbcType=BIGINT}
  229. </update>
  230. <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDevice">
  231. <!--@mbg.generated-->
  232. update kws_device
  233. set `attribute` = #{attribute,jdbcType=INTEGER},
  234. `name` = #{name,jdbcType=VARCHAR},
  235. `alias` = #{alias,jdbcType=VARCHAR},
  236. sn_code = #{snCode,jdbcType=VARCHAR},
  237. model_id = #{modelId,jdbcType=BIGINT},
  238. valid_time = #{validTime,jdbcType=TIMESTAMP},
  239. secret_key = #{secretKey,jdbcType=VARCHAR},
  240. inter_face = #{interFace,jdbcType=VARCHAR},
  241. remark = #{remark,jdbcType=VARCHAR},
  242. `status` = #{status,jdbcType=TINYINT},
  243. create_by = #{createBy,jdbcType=BIGINT},
  244. create_time = #{createTime,jdbcType=TIMESTAMP},
  245. update_by = #{updateBy,jdbcType=BIGINT},
  246. update_time = #{updateTime,jdbcType=TIMESTAMP},
  247. del_flag = #{delFlag,jdbcType=TINYINT}
  248. where id = #{id,jdbcType=BIGINT}
  249. </update>
  250. <select id="selectDeviceAllNotDeviceRelation" resultType="com.sckw.slope.detection.model.dto.DeviceDataDTO">
  251. </select>
  252. </mapper>