LeadingGroupMemberMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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.LeadingGroupMemberMapper">
  4. <resultMap id="LeadingGroupMemberDtoResultMap" type="com.zhyc.xps.sys.dto.LeadingGroupMemberDto">
  5. <result column="lgm_id" property="lgmId" jdbcType="BIGINT" />
  6. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  7. <result column="lg_id" property="lgId" jdbcType="BIGINT" />
  8. <result column="lgp_id" property="lgpId" jdbcType="BIGINT" />
  9. <result column="lgp_name" property="lgpName" jdbcType="VARCHAR" />
  10. <result column="account_id" property="accountId" jdbcType="BIGINT" />
  11. <result column="account_name" property="accountName" jdbcType="VARCHAR" />
  12. <result column="account_real_name" property="accountRealName" jdbcType="VARCHAR" />
  13. <result column="account_avatar" property="accountAvatar" jdbcType="VARCHAR" />
  14. <result column="account_phone" property="accountPhone" jdbcType="VARCHAR" />
  15. <result column="group_id" property="groupId" jdbcType="BIGINT" />
  16. <result column="group_name" property="groupName" jdbcType="VARCHAR" />
  17. <result column="position_id" property="positionId" jdbcType="BIGINT" />
  18. <result column="position_name" property="positionName" jdbcType="VARCHAR" />
  19. <result column="duty" property="duty" jdbcType="VARCHAR" />
  20. <result column="remark" property="remark" jdbcType="VARCHAR" />
  21. <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
  22. </resultMap>
  23. <sql id="LeadingGroupMemberDto_Cols">
  24. A.lgm_id,
  25. A.oc_id,
  26. A.lg_id,
  27. A.account_id,
  28. A.lgp_id,
  29. B.lgp_name,
  30. C.account_name,
  31. C.account_real_name,
  32. C.account_avatar,
  33. C.account_phone,
  34. A.group_id,
  35. D.group_name,
  36. A.position_id,
  37. E.position_name,
  38. A.duty,
  39. A.remark,
  40. A.sort_no
  41. </sql>
  42. <!--基于ID查询-->
  43. <select id="getById" resultMap="LeadingGroupMemberDtoResultMap">
  44. SELECT
  45. <include refid="LeadingGroupMemberDto_Cols"/>
  46. FROM leading_group_member AS A
  47. LEFT JOIN leading_group_position AS B ON (A.oc_id = B.oc_id AND A.lgp_id = B.lgp_id)
  48. LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.account_id = C.account_id)
  49. LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
  50. LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id )
  51. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0
  52. <if test="lgId != null">
  53. AND A.lg_id = #{lgId ,jdbcType=BIGINT}
  54. </if>
  55. <if test="lgmId != null">
  56. AND A.lgm_id = #{lgmId ,jdbcType=BIGINT}
  57. </if>
  58. </select>
  59. <!--分页查询-->
  60. <select id="getByPage" parameterType="java.util.Map" resultMap="LeadingGroupMemberDtoResultMap">
  61. SELECT
  62. <include refid="LeadingGroupMemberDto_Cols"/>
  63. FROM leading_group_member AS A
  64. LEFT JOIN leading_group_position AS B ON (A.oc_id = B.oc_id AND A.lgp_id = B.lgp_id)
  65. LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.account_id = C.account_id)
  66. LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
  67. LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id )
  68. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0
  69. <if test="lgId != null">
  70. AND A.lg_id = #{lgId ,jdbcType=BIGINT}
  71. </if>
  72. <if test="groupId != null">
  73. AND A.group_id = #{groupId ,jdbcType = BIGINT}
  74. </if>
  75. <if test="keywords != null and keywords != ''">
  76. AND C.account_name LIKE "%"#{keywords}"%"
  77. </if>
  78. ORDER BY A.lgp_id ASC, A.sort_no ASC
  79. </select>
  80. <!--列表查询-->
  81. <select id="getByList" parameterType="java.util.Map" resultMap="LeadingGroupMemberDtoResultMap">
  82. SELECT
  83. <include refid="LeadingGroupMemberDto_Cols"/>
  84. FROM leading_group_member AS A
  85. LEFT JOIN leading_group_position AS B ON (A.oc_id = B.oc_id AND A.lgp_id = B.lgp_id)
  86. LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.account_id = C.account_id)
  87. LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
  88. LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id )
  89. WHERE A.oc_id = #{ocId ,jdbcType = BIGINT} AND A.deleted_flag = 0
  90. <if test="lgId != null">
  91. AND A.lg_id = #{lgId ,jdbcType=BIGINT}
  92. </if>
  93. <if test="groupId != null">
  94. AND A.group_id = #{groupId ,jdbcType = BIGINT}
  95. </if>
  96. <if test="keywords != null and keywords != ''">
  97. AND C.account_name LIKE "%"#{keywords}"%"
  98. </if>
  99. ORDER BY A.sort_no ASC
  100. </select>
  101. <!--新增Create-->
  102. <insert id="create" parameterType="com.zhyc.xps.sys.entity.LeadingGroupMember">
  103. INSERT INTO leading_group_member
  104. <trim prefix="(" suffix=")" suffixOverrides=",">
  105. <if test="ocId != null">
  106. oc_id,
  107. </if>
  108. <if test="lgmId != null">
  109. lgm_id,
  110. </if>
  111. <if test="lgId != null">
  112. lg_id,
  113. </if>
  114. <if test="lgpId != null">
  115. lgp_id,
  116. </if>
  117. <if test="groupId != null">
  118. group_id,
  119. </if>
  120. <if test="positionId != null">
  121. position_id,
  122. </if>
  123. <if test="accountId != null">
  124. account_id,
  125. </if>
  126. <if test="duty != null and duty != ''">
  127. duty,
  128. </if>
  129. <if test="remark != null and remark != ''">
  130. remark,
  131. </if>
  132. <if test="sortNo != null">
  133. sort_no,
  134. </if>
  135. <if test="createdBy != null">
  136. created_by,
  137. </if>
  138. <if test="createdAt != null">
  139. created_at,
  140. </if>
  141. </trim>
  142. <trim prefix="values (" suffix=")" suffixOverrides=",">
  143. <if test="ocId != null ">
  144. #{ocId ,jdbcType=BIGINT},
  145. </if>
  146. <if test="lgmId != null">
  147. #{lgmId ,jdbcType=BIGINT},
  148. </if>
  149. <if test="lgId != null">
  150. #{lgId ,jdbcType=BIGINT},
  151. </if>
  152. <if test="lgpId != null">
  153. #{lgpId ,jdbcType=BIGINT},
  154. </if>
  155. <if test="groupId != null">
  156. #{groupId ,jdbcType=BIGINT},
  157. </if>
  158. <if test="positionId != null">
  159. #{positionId ,jdbcType=BIGINT},
  160. </if>
  161. <if test="accountId != null">
  162. #{accountId ,jdbcType=BIGINT},
  163. </if>
  164. <if test="duty != null and duty != ''">
  165. #{duty ,jdbcType=VARCHAR},
  166. </if>
  167. <if test="remark != null and remark != ''">
  168. #{remark ,jdbcType=VARCHAR},
  169. </if>
  170. <if test="sortNo != null">
  171. #{sortNo ,jdbcType=BIGINT},
  172. </if>
  173. <if test="createdBy != null">
  174. #{createdBy ,jdbcType=BIGINT},
  175. </if>
  176. <if test="createdAt != null">
  177. #{createdAt ,jdbcType=TIMESTAMP},
  178. </if>
  179. </trim>
  180. </insert>
  181. <!--更新-->
  182. <update id="update" parameterType="com.zhyc.xps.sys.entity.LeadingGroupMember">
  183. UPDATE leading_group_member
  184. <trim suffixOverrides=",">
  185. <set>
  186. <if test="lgpId != null">
  187. lgp_Id = #{lgpId ,jdbcType=BIGINT},
  188. </if>
  189. <if test="groupId != null">
  190. group_id = #{groupId ,jdbcType=BIGINT},
  191. </if>
  192. <if test="positionId != null">
  193. position_id = #{positionId ,jdbcType=BIGINT},
  194. </if>
  195. <if test="accountId != null">
  196. account_id = #{accountId ,jdbcType=BIGINT},
  197. </if>
  198. <if test="duty != null and duty != ''">
  199. duty = #{duty ,jdbcType=VARCHAR},
  200. </if>
  201. <if test="remark != null and remark != ''">
  202. remark = #{remark ,jdbcType=VARCHAR},
  203. </if>
  204. <if test="sortNo != null">
  205. sort_no = #{sortNo ,jdbcType=BIGINT},
  206. </if>
  207. <if test="updatedBy != null ">
  208. updated_by = #{updatedBy ,jdbcType=BIGINT},
  209. </if>
  210. <if test="updatedAt != null">
  211. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  212. </if>
  213. </set>
  214. </trim>
  215. WHERE oc_Id = #{ocId ,jdbcType=BIGINT} AND lgm_id = #{lgmId ,jdbcType=BIGINT}
  216. </update>
  217. <!--基于ID查询-->
  218. <update id="updatePositionByAccountId">
  219. UPDATE leading_group_member
  220. <trim suffixOverrides=",">
  221. <set>
  222. <if test="positionId != null">
  223. position_id = #{positionId ,jdbcType=BIGINT},
  224. </if>
  225. </set>
  226. </trim>
  227. WHERE oc_Id = #{ocId ,jdbcType=BIGINT} AND account_id = #{accountId ,jdbcType=BIGINT}
  228. </update>
  229. <!--删除-->
  230. <delete id="delete" parameterType="java.util.Map">
  231. DELETE FROM leading_group_member
  232. WHERE oc_id = #{ocId ,jdbcType=BIGINT} AND deleted_flag = 0
  233. <if test="lgmId != null">
  234. AND lgm_id = #{lgmId ,jdbcType=BIGINT}
  235. </if>
  236. <if test="lgId != null">
  237. AND lg_id = #{lgId ,jdbcType=BIGINT}
  238. </if>
  239. <if test="accountId != null">
  240. AND account_id = #{accountId ,jdbcType=BIGINT}
  241. </if>
  242. </delete>
  243. </mapper>