123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.zhyc.xps.common.mapper.CommonMapper">
- <resultMap id="GetResultMap" type="com.zhyc.xps.common.vo.GroupVo" >
- <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--ID-->
- <result column="group_id" property="groupId" jdbcType="BIGINT" /><!--群组ID-->
- <result column="group_name" property="groupName" jdbcType="VARCHAR" /><!--群组Name-->
- <result column="group_code" property="groupCode" jdbcType="VARCHAR" /><!--群组Code-->
- <result column="group_cat_id" property="groupCatId" jdbcType="BIGINT" /><!--群组类别ID-->
- <result column="parent_id" property="parentId" jdbcType="BIGINT" /><!--父群组-->
- <result column="root_id" property="rootId" jdbcType="BIGINT" /><!--根群组ID-->
- <result column="node_left" property="nodeLeft" jdbcType="BIGINT" /><!--Node Left-->
- <result column="node_right" property="nodeRight" jdbcType="BIGINT" /><!--Node Right-->
- <result column="node_level" property="nodeLevel" jdbcType="BIGINT" /><!--Node Leve-->
- <result column="is_leaf" property="isLeaf" jdbcType="BIGINT" /><!--Leaf-->
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT" /><!--是否可删除-->
- <result column="group_desc" property="groupDesc" jdbcType="VARCHAR" /><!--描述-->
- <result column="group_select" property="groupSelect" jdbcType="VARCHAR" /><!--供首字母等检索用-->
- <result column="parent_name" property="parentName" jdbcType="VARCHAR" />
- <result column="group_cat_title" property="groupCatTitle" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="GroupVo_Cols">
- A.oc_id,
- A.group_id,
- A.group_name,
- A.group_code,
- A.group_cat_id,
- C.group_cat_title,
- A.node_left,
- A.node_right,
- A.parent_id,
- A.root_id,
- B.group_name as parent_name,
- A.node_level,
- A.is_leaf,
- A.is_fixed,
- A.group_desc
- </sql>
- <!--根据ID获取群组信息-->
- <select id="getGroupById" resultMap="GetResultMap">
- SELECT
- <include refid="GroupVo_Cols"/>
- FROM s_group AS A
- LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.parent_id = B.group_id )
- LEFT JOIN s_group_cat AS C ON (A.oc_id = C.oc_id AND A.group_cat_id = C.group_cat_id)
- WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0 AND A.group_id = #{groupId ,jdbcType=BIGINT}
- </select>
- <!--根据条件返回相应的群组列表-->
- <select id="getGroupByList" parameterType="java.util.Map" resultMap="GetResultMap">
- SELECT
- <include refid="GroupVo_Cols"/>
- FROM s_group AS A
- LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.parent_id = B.group_id)
- LEFT JOIN s_group_cat AS C ON (A.oc_id = C.oc_id AND A.group_cat_id = C.group_cat_id)
- WHERE A.oc_id = #{ocId,jdbcType=BIGINT} AND A.deleted_flag = 0
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND A.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND A.node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- <if test="groupCatId!=null">
- AND A.group_cat_id = #{groupCatId ,jdbcType=BIGINT}
- </if>
- <if test="groupId !=null">
- AND A.group_id = #{groupId,jdbcType=BIGINT}
- </if>
- <if test="parentId != null">
- AND A.parent_id = #{parentId, jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND ( A.group_name LIKE "%"#{keywords}"%"
- </if>
- </select>
- <resultMap id="GroupMemberDoResultMap" type="com.zhyc.xps.common.vo.GroupMemberVo">
- <result column="gm_id" property="gmId" jdbcType="BIGINT" /><!--群组成员ID-->
- <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--公司机构ID-->
- <result column="group_id" property="groupId" jdbcType="BIGINT" /><!--群组ID-->
- <result column="account_id" property="accountId" jdbcType="BIGINT" /><!--帐号ID-->
- </resultMap>
- <sql id="GroupMemberVo_Cols">
- A.gm_id,
- A.oc_id,
- A.group_id,
- A.account_id
- </sql>
- <!--条件列表查询-->
- <select id="getGroupMemberByList" parameterType="java.util.Map" resultMap="GroupMemberDoResultMap">
- SELECT
- <include refid="GroupMemberVo_Cols"/>
- FROM s_group_member AS A
- LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.group_id = B.group_id)
- WHERE B.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND B.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND B.node_right <= #{nodeRight,jdbcType=BIGINT}
- ]]>
- </if>
- </select>
- </mapper>
|