OcAccessMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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.zhyc.xps.sys.mapper.OcAccessMapper">
  4. <resultMap id="AccessDtoResultMap" type="com.zhyc.xps.sys.dto.OcAccessDto">
  5. <result column="access_id" property="accessId" jdbcType="BIGINT" />
  6. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  7. <result column="oc_name" property="ocName" jdbcType="VARCHAR"/>
  8. <result column="access_url" property="accessUrl" jdbcType="VARCHAR"/>
  9. <result column="access_app_id" property="accessAppId" jdbcType="VARCHAR"/>
  10. <result column="access_app_key" property="accessAppKey" jdbcType="VARCHAR"/>
  11. <result column="access_app_secret" property="accessAppSecret" jdbcType="VARCHAR"/>
  12. <result column="access_token" property="accessToken" jdbcType="VARCHAR"/>
  13. <result column="status" property="status" jdbcType="BIGINT" />
  14. <result column="remark" property="remark" jdbcType="VARCHAR"/>
  15. <result column="access_time" property="accessTime" jdbcType="DATE" />
  16. </resultMap>
  17. <sql id="AccessDto_Cols">
  18. A.access_id,
  19. A.oc_id,
  20. B.oc_name,
  21. A.access_url,
  22. A.access_app_id,
  23. A.access_app_key,
  24. A.access_app_secret,
  25. A.access_token,
  26. A.status,
  27. A.remark,
  28. A.access_time
  29. </sql>
  30. <!--基于ID查询-->
  31. <select id="getById" resultMap="AccessDtoResultMap">
  32. SELECT
  33. <include refid="AccessDto_Cols"/>
  34. FROM oc_access AS A
  35. LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
  36. WHERE A.deleted_flag = 0
  37. <if test="accessId != null">
  38. AND access_id = #{accessId ,jdbcType=BIGINT}
  39. </if>
  40. </select>
  41. <!--分页查询-->
  42. <select id="getByPage" parameterType="java.util.Map" resultMap="AccessDtoResultMap">
  43. SELECT
  44. <include refid="AccessDto_Cols"/>
  45. FROM oc_access AS A
  46. LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
  47. WHERE A.deleted_flag = 0
  48. <if test="keywords != null and keywords != ''">
  49. AND B.oc_name like "%"#{keywords}"%"
  50. </if>
  51. ORDER BY A.access_time DESC
  52. </select>
  53. <!--列表查询-->
  54. <select id="getByList" parameterType="java.util.Map" resultMap="AccessDtoResultMap">
  55. SELECT
  56. <include refid="AccessDto_Cols"/>
  57. FROM oc_access AS A
  58. LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
  59. WHERE A.deleted_flag = 0
  60. <if test="keywords != null and keywords != ''">
  61. AND B.oc_name like "%"#{keywords}"%"
  62. </if>
  63. ORDER BY A.access_time DESC
  64. </select>
  65. <insert id="create" parameterType="com.zhyc.xps.sys.entity.OcAccess">
  66. INSERT INTO oc_access
  67. <trim prefix="(" suffix=")" suffixOverrides=",">
  68. <if test="accessId != null">
  69. access_id,
  70. </if>
  71. <if test="ocId != null">
  72. oc_id,
  73. </if>
  74. <if test="accessUrl != null and accessUrl != ''">
  75. access_url,
  76. </if>
  77. <if test="accessAppId != null and accessAppId !=''">
  78. access_app_id,
  79. </if>
  80. <if test="accessAppKey != null and accessAppKey !=''">
  81. access_app_key,
  82. </if>
  83. <if test="accessAppSecret != null and accessAppSecret !=''">
  84. access_app_secret,
  85. </if>
  86. <if test="accessToken != null and accessToken !=''">
  87. access_token,
  88. </if>
  89. <if test="status != null and status !=''">
  90. status,
  91. </if>
  92. <if test="remark != null and remark !=''">
  93. remark,
  94. </if>
  95. <if test="accessTime != null">
  96. access_time,
  97. </if>
  98. <if test="createdBy != null">
  99. created_by,
  100. </if>
  101. <if test="createdAt != null">
  102. created_at,
  103. </if>
  104. </trim>
  105. <trim prefix="values (" suffix=")" suffixOverrides=",">
  106. <if test="accessId != null">
  107. #{accessId ,jdbcType=BIGINT},
  108. </if>
  109. <if test="ocId != null">
  110. #{ocId ,jdbcType=BIGINT},
  111. </if>
  112. <if test="accessUrl != null and accessUrl != ''">
  113. #{accessUrl ,jdbcType=VARCHAR},
  114. </if>
  115. <if test="accessAppId != null and accessAppId !=''">
  116. #{accessAppId ,jdbcType=VARCHAR},
  117. </if>
  118. <if test="accessAppKey != null and accessAppKey !=''">
  119. #{accessAppKey ,jdbcType=VARCHAR},
  120. </if>
  121. <if test="accessAppSecret != null and accessAppSecret !=''">
  122. #{accessAppSecret ,jdbcType=VARCHAR},
  123. </if>
  124. <if test="accessToken != null and accessToken !=''">
  125. #{accessToken ,jdbcType=VARCHAR},
  126. </if>
  127. <if test="status != null and status !=''">
  128. #{status ,jdbcType=BIGINT},
  129. </if>
  130. <if test="remark != null and remark !=''">
  131. #{remark ,jdbcType=VARCHAR},
  132. </if>
  133. <if test="accessTime != null">
  134. #{accessTime ,jdbcType=DATE},
  135. </if>
  136. <if test="createdBy != null">
  137. #{createdBy ,jdbcType=BIGINT},
  138. </if>
  139. <if test="createdAt != null">
  140. #{createdAt ,jdbcType=TIMESTAMP},
  141. </if>
  142. </trim>
  143. </insert>
  144. <!--更新-->
  145. <update id="update" parameterType="com.zhyc.xps.sys.entity.OcAccess">
  146. UPDATE oc_access
  147. <trim suffixOverrides=",">
  148. <set>
  149. <if test="accessUrl != null and accessUrl != ''">
  150. access_url = #{accessUrl ,jdbcType=VARCHAR},
  151. </if>
  152. <if test="accessAppId != null and accessAppId !=''">
  153. access_app_id = #{accessAppId ,jdbcType=VARCHAR},
  154. </if>
  155. <if test="accessAppKey != null and accessAppKey !=''">
  156. access_app_key = #{accessAppKey ,jdbcType=VARCHAR},
  157. </if>
  158. <if test="accessAppSecret != null and accessAppSecret !=''">
  159. access_app_secret = #{accessAppSecret ,jdbcType=VARCHAR},
  160. </if>
  161. <if test="accessToken != null and accessToken !=''">
  162. access_token = #{accessToken ,jdbcType=VARCHAR},
  163. </if>
  164. <if test="status != null and status !=''">
  165. status = #{status ,jdbcType=BIGINT},
  166. </if>
  167. <if test="remark != null and remark !=''">
  168. remark = #{remark ,jdbcType=VARCHAR},
  169. </if>
  170. <if test="accessTime != null">
  171. access_time = #{accessTime ,jdbcType=DATE},
  172. </if>
  173. <if test="updatedBy != null ">
  174. updated_by = #{updatedBy ,jdbcType=BIGINT},
  175. </if>
  176. <if test="updatedAt != null">
  177. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  178. </if>
  179. </set>
  180. </trim>
  181. WHERE 1 = 1
  182. <if test="accessId != null">
  183. AND access_id = #{accessId ,jdbcType=BIGINT}
  184. </if>
  185. </update>
  186. <!--删除-->
  187. <update id="delete" parameterType="java.util.Map">
  188. UPDATE oc_access
  189. <trim suffixOverrides=",">
  190. <set>
  191. <if test="deletedFlag != null">
  192. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  193. </if>
  194. <if test="deletedTime != null">
  195. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  196. </if>
  197. <if test="deletedBy != null">
  198. deleted_by = #{deletedBy,jdbcType=BIGINT},
  199. </if>
  200. </set>
  201. </trim>
  202. WHERE 1 = 1
  203. <if test="accessId != null">
  204. AND access_id = #{accessId ,jdbcType=BIGINT}
  205. </if>
  206. </update>
  207. </mapper>