PartnerMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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.PartnerMapper">
  4. <resultMap id="BaseResultMap" type="com.zhyc.xps.sys.entity.Partner">
  5. <id column="oc_id" property="ocId" jdbcType="BIGINT" />
  6. <result column="partner_name" property="partnerName" jdbcType="VARCHAR" />
  7. <result column="partner_cat_id" property="partnerCatId" jdbcType="BIGINT" />
  8. <result column="partner_lxr" property="partnerLxr" jdbcType="VARCHAR" />
  9. <result column="partner_lxdh" property="partnerLxdh" jdbcType="VARCHAR" />
  10. <result column="partner_tyshxydm" property="partnerTyshxydm" jdbcType="VARCHAR" />
  11. <result column="partner_clrq" property="partnerClrq" jdbcType="DATE" />
  12. <result column="partner_dzyx" property="partnerDzyx" jdbcType="VARCHAR" />
  13. <result column="partner_area_code" property="partnerAreaCode" jdbcType="VARCHAR" />
  14. <result column="partner_area_name" property="partnerAreaName" jdbcType="VARCHAR" />
  15. <result column="partner_address" property="partnerAddress" jdbcType="VARCHAR" />
  16. <result column="partner_wzjd" property="partnerWzjd" jdbcType="DECIMAL"/><!--位置经度-->
  17. <result column="partner_wzwd" property="partnerWzwd" jdbcType="DECIMAL"/><!--位置纬度-->
  18. <result column="partner_desc" property="partnerDesc" jdbcType="VARCHAR" />
  19. </resultMap>
  20. <resultMap id="PartnerDtoMap" type="com.zhyc.xps.sys.dto.PartnerDto" extends="BaseResultMap">
  21. <result column="partner_cat_title" property="partnerCatTitle" jdbcType="VARCHAR"/>
  22. <result column="root_id" property="rootId" jdbcType="BIGINT"/>
  23. <result column="parent_id" property="parentId" jdbcType="BIGINT"/>
  24. <result column="admin_id" property="adminId" jdbcType="BIGINT"/>
  25. <result column="admin_name" property="adminName" jdbcType="VARCHAR"/>
  26. <result column="group_id" property="groupId" jdbcType="BIGINT"/>
  27. <result column="node_left" property="nodeLeft" jdbcType="BIGINT"/>
  28. <result column="node_right" property="nodeRight" jdbcType="BIGINT"/>
  29. <result column="node_level" property="nodeLevel" jdbcType="BIGINT"/>
  30. <result column="is_leaf" property="isLeaf" jdbcType="BIGINT"/>
  31. <result column="status" property="status" jdbcType="BIGINT"/>
  32. </resultMap>
  33. <sql id="PartnerDto_Cols" >
  34. A.oc_id,
  35. A.partner_name,
  36. A.partner_cat_id,
  37. D.partner_cat_title,
  38. A.partner_lxr,
  39. A.partner_lxdh,
  40. A.partner_dzyx,
  41. A.partner_tyshxydm,
  42. A.partner_clrq,
  43. A.partner_area_code,
  44. A.partner_area_name,
  45. A.partner_address,
  46. A.partner_wzjd,
  47. A.partner_wzwd,
  48. A.partner_desc,
  49. B.parent_id,
  50. B.root_id,
  51. B.admin_id,
  52. C.account_name AS admin_name,
  53. B.group_id,
  54. B.node_left,
  55. B.node_right,
  56. B.node_level,
  57. B.is_leaf,
  58. B.status
  59. </sql>
  60. <!-- 分页查询 -->
  61. <select id="getByPage" parameterType="java.util.Map" resultMap="PartnerDtoMap">
  62. SELECT
  63. <include refid="PartnerDto_Cols"/>
  64. FROM partner AS A
  65. LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
  66. LEFT JOIN account AS C ON (B.oc_id = C.oc_id AND B.admin_id = C.account_id)
  67. LEFT JOIN partner_cat AS D ON (A.partner_cat_id = D.partner_cat_id)
  68. WHERE A.deleted_flag=0
  69. <if test="ocId != null">
  70. AND A.oc_id = #{ocId}
  71. </if>
  72. <if test="keywords != null and keywords != ''">
  73. AND A.partner_name LIKE "%"#{keywords}"%"
  74. </if>
  75. ORDER BY A.oc_id DESC
  76. </select>
  77. <!-- 列表查询 -->
  78. <select id="getByList" parameterType="java.util.Map" resultMap="PartnerDtoMap">
  79. SELECT
  80. <include refid="PartnerDto_Cols"/>
  81. FROM partner AS A
  82. LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
  83. LEFT JOIN account AS C ON (B.oc_id = C.oc_id AND B.admin_id = C.account_id)
  84. LEFT JOIN partner_cat AS D ON (A.partner_cat_id = D.partner_cat_id)
  85. WHERE A.deleted_flag = 0
  86. <if test="ocId != null">
  87. AND A.oc_id = #{ocId}
  88. </if>
  89. <if test="keywords != null and keywords != ''">
  90. AND A.partner_name LIKE "%"#{keywords}"%"
  91. </if>
  92. ORDER BY A.oc_id DESC
  93. </select>
  94. <!--基于ID查询-->
  95. <select id="getById" resultMap="PartnerDtoMap" >
  96. SELECT
  97. <include refid="PartnerDto_Cols"/>
  98. FROM partner AS A
  99. LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
  100. LEFT JOIN account AS C ON (B.oc_id = C.oc_id AND B.admin_id = C.account_id)
  101. LEFT JOIN partner_cat AS D ON (A.partner_cat_id = D.partner_cat_id)
  102. WHERE 1=1 AND A.deleted_flag=0
  103. AND A.oc_id = #{ocId, jdbcType=BIGINT}
  104. </select>
  105. <!--新增Insert-->
  106. <insert id="create" useGeneratedKeys="true" keyProperty="ocId" parameterType="com.zhyc.xps.sys.entity.Partner">
  107. INSERT INTO partner
  108. <trim prefix="(" suffix=")" suffixOverrides=",">
  109. <if test="ocId != null">
  110. oc_id,
  111. </if>
  112. <if test="partnerName != null and partnerName != ''">
  113. partner_name,
  114. </if>
  115. <if test="partnerCatId != null">
  116. partner_cat_id,
  117. </if>
  118. <if test="partnerLxr != null and partnerLxr != ''">
  119. partner_lxr,
  120. </if>
  121. <if test="partnerLxdh != null and partnerLxdh != ''">
  122. partner_lxdh,
  123. </if>
  124. <if test="partnerDzyx != null and partnerDzyx != ''">
  125. partner_dzyx,
  126. </if>
  127. <if test="partnerTyshxydm != null and partnerTyshxydm != ''">
  128. partner_tyshxydm,
  129. </if>
  130. <if test="partnerClrq != null">
  131. partner_clrq,
  132. </if>
  133. <if test="partnerAreaCode != null and partnerAreaCode != ''">
  134. partner_area_code,
  135. </if>
  136. <if test="partnerAreaName != null and partnerAreaName != ''">
  137. partner_area_name,
  138. </if>
  139. <if test="partnerAddress != null and partnerAddress != '' ">
  140. partner_address,
  141. </if>
  142. <if test="partnerWzjd != null">
  143. partner_wzjd,
  144. </if>
  145. <if test="partnerWzwd != null">
  146. partner_wzwd,
  147. </if>
  148. <if test="createdBy != null">
  149. created_by,
  150. </if>
  151. <if test="createdAt != null">
  152. created_at,
  153. </if>
  154. </trim>
  155. <trim prefix="values (" suffix=")" suffixOverrides=",">
  156. <if test="ocId != null">
  157. #{ocId, jdbcType=BIGINT},
  158. </if>
  159. <if test="partnerName != null and partnerName != ''">
  160. #{partnerName,jdbcType=VARCHAR},
  161. </if>
  162. <if test="partnerCatId != null">
  163. #{partnerCatId,jdbcType=BIGINT},
  164. </if>
  165. <if test="partnerLxr != null and partnerLxr != ''">
  166. #{partnerLxr , jdbcType=VARCHAR},
  167. </if>
  168. <if test="partnerLxdh != null and partnerLxdh != ''">
  169. #{partnerLxdh , jdbcType=VARCHAR},
  170. </if>
  171. <if test="partnerDzyx != null and partnerDzyx != ''">
  172. #{partnerDzyx , jdbcType=VARCHAR},
  173. </if>
  174. <if test="partnerTyshxydm != null and partnerTyshxydm != ''">
  175. #{partnerTyshxydm , jdbcType=VARCHAR},
  176. </if>
  177. <if test="partnerClrq != null">
  178. #{partnerClrq , jdbcType=DATE},
  179. </if>
  180. <if test="partnerAreaCode != null and partnerAreaCode != ''">
  181. #{partnerAreaCode , jdbcType=VARCHAR},
  182. </if>
  183. <if test="partnerAreaName != null and partnerAreaName != ''">
  184. #{partnerAreaName , jdbcType=VARCHAR},
  185. </if>
  186. <if test="partnerAddress != null and partnerAddress != ''">
  187. #{partnerAddress , jdbcType=VARCHAR},
  188. </if>
  189. <if test="partnerWzjd != null">
  190. #{partnerWzjd, jdbcType=DECIMAL},
  191. </if>
  192. <if test="partnerWzwd != null">
  193. #{partnerWzwd, jdbcType=DECIMAL},
  194. </if>
  195. <if test="createdBy != null">
  196. #{createdBy , jdbcType=BIGINT},
  197. </if>
  198. <if test="createdAt != null">
  199. #{createdAt, jdbcType=TIMESTAMP},
  200. </if>
  201. </trim>
  202. </insert>
  203. <!--Update更新-->
  204. <update id="update" parameterType="com.zhyc.xps.sys.entity.Partner">
  205. UPDATE partner
  206. <trim suffixOverrides=",">
  207. <set>
  208. <if test="partnerName != null and partnerName != ''">
  209. partner_name = #{partnerName,jdbcType=VARCHAR},
  210. </if>
  211. <if test="partnerCatId != null">
  212. partner_cat_id = #{partnerCatId,jdbcType=BIGINT},
  213. </if>
  214. <if test="partnerLxr != null">
  215. partner_lxr = #{partnerLxr,jdbcType=VARCHAR},
  216. </if>
  217. <if test="partnerLxdh != null">
  218. partner_lxdh = #{partnerLxdh,jdbcType=VARCHAR},
  219. </if>
  220. <if test="partnerDzyx != null">
  221. partner_dzyx = #{partnerDzyx , jdbcType=VARCHAR},
  222. </if>
  223. <if test="partnerTyshxydm != null">
  224. partner_tyshxydm = #{partnerTyshxydm , jdbcType=VARCHAR},
  225. </if>
  226. <if test="partnerClrq != null">
  227. partner_clrq = #{partnerClrq , jdbcType=DATE},
  228. </if>
  229. <if test="partnerAreaCode != null">
  230. partner_area_code = #{partnerAreaCode , jdbcType=VARCHAR},
  231. </if>
  232. <if test="partnerAreaName != null">
  233. partner_area_name = #{partnerAreaName , jdbcType=VARCHAR},
  234. </if>
  235. <if test="partnerAddress != null">
  236. partner_address = #{partnerAddress , jdbcType=VARCHAR},
  237. </if>
  238. <if test="partnerWzjd != null">
  239. partner_wzjd = #{partnerWzjd, jdbcType=DECIMAL},
  240. </if>
  241. <if test="partnerWzwd != null">
  242. partner_wzwd = #{partnerWzwd, jdbcType=DECIMAL},
  243. </if>
  244. <if test="partnerDesc != null">
  245. partner_desc = #{partnerDesc, jdbcType=VARCHAR},
  246. </if>
  247. <if test="updatedBy != null">
  248. updated_by = #{updatedBy,jdbcType=BIGINT},
  249. </if>
  250. <if test="updatedAt != null">
  251. updated_at = #{updatedAt,jdbcType=TIMESTAMP},
  252. </if>
  253. </set>
  254. </trim>
  255. WHERE oc_id = #{ocId, jdbcType=BIGINT}
  256. </update>
  257. <!--删除-->
  258. <update id="delete" parameterType="java.util.Map">
  259. UPDATE partner
  260. <trim suffixOverrides=",">
  261. <set>
  262. <if test="deletedFlag != null">
  263. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  264. </if>
  265. <if test="deletedAt != null">
  266. deleted_at = #{deletedAt ,jdbcType=DATE},
  267. </if>
  268. <if test="deletedBy != null">
  269. deleted_by = #{deletedBy,jdbcType=BIGINT},
  270. </if>
  271. </set>
  272. </trim>
  273. WHERE 1 =1
  274. AND oc_id = #{ocId ,jdbcType = BIGINT}
  275. </update>
  276. </mapper>