123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <?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.sys.mapper.GroupMemberPositionGrantMapper">
- <resultMap id="BaseResultMap" type="com.zhyc.xps.sys.entity.GroupMemberPositionGrant">
- <result column="gmpg_id" property="gmpgId" 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-->
- <result column="position_id" property="positionId" jdbcType="BIGINT" /> <!--岗位ID-->
- <result column="grant_group_id" property="grantGroupId" jdbcType="BIGINT" /> <!--授权群组ID-->
- </resultMap>
- <resultMap id="GroupMemberPositionGrantDtoResultMap" type="com.zhyc.xps.sys.dto.GroupMemberPositionGrantDto" extends="BaseResultMap">
- <result column="grant_group_name" property="grantGroupName" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="GroupMemberPositionGrantDto_Cols">
- A.gmpg_id,
- A.oc_id,
- A.group_id,
- A.account_id,
- A.position_id,
- A.grant_group_id,
- B.group_name AS grant_group_name
- </sql>
- <!--基于ID查询-->
- <select id="getById" parameterType="java.lang.Long" resultMap="GroupMemberPositionGrantDtoResultMap">
- SELECT
- <include refid="GroupMemberPositionGrantDto_Cols" />
- FROM s_group_member_position_grant A
- LEFT JOIN s_group B ON(A.oc_id = B.oc_id AND A.grant_group_id = B.group_id)
- WHERE
- A.gmpg_id = #{gmpgId, jdbcType=BIGINT}
- </select>
- <!--根据ID获取第1个授权群组-->
- <select id="getFirstGrantGroupByPosition" resultMap="GroupMemberPositionGrantDtoResultMap">
- SELECT
- <include refid="GroupMemberPositionGrantDto_Cols" />
- FROM s_group_member_position_grant A
- LEFT JOIN s_group B ON(A.oc_id = B.oc_id AND A.grant_group_id = B.group_id)
- WHERE A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId,jdbcType=BIGINT}
- </if>
- <if test="groupId != null">
- AND A.group_id = #{groupId, jdbcType=BIGINT}
- </if>
- <if test="accountId != null">
- AND A.account_id = #{accountId, jdbcType=BIGINT}
- </if>
- <if test="positionId != null">
- AND A.position_id = #{positionId, jdbcType=BIGINT}
- </if>
- LIMIT 1
- </select>
- <!--Insert新增-->
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.GroupMemberPositionGrant">
- insert into s_group_member_position_grant
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="gmpgId != null">
- gmpg_id,
- </if>
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="groupId != null">
- group_id,
- </if>
- <if test="accountId != null">
- account_id,
- </if>
- <if test="positionId != null">
- position_id,
- </if>
- <if test="grantGroupId != null">
- grant_group_id,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="gmpgId != null">
- #{gmpgId,jdbcType=BIGINT},
- </if>
- <if test="ocId != null">
- #{ocId,jdbcType=BIGINT},
- </if>
- <if test="groupId != null">
- #{groupId,jdbcType=BIGINT},
- </if>
- <if test="accountId != null">
- #{accountId,jdbcType=BIGINT},
- </if>
- <if test="positionId != null">
- #{positionId,jdbcType=BIGINT},
- </if>
- <if test="grantGroupId != null">
- #{grantGroupId,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
-
- <!--Update更新-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.GroupMemberPositionGrant">
- UPDATE s_group_member_position_grant
- <trim suffixOverrides=",">
- <set>
- <if test="groupId!= null">
- group_id = #{groupId,jdbcType=BIGINT},
- </if>
- <if test="accountId != null">
- account_id = #{accountId,jdbcType=BIGINT},
- </if>
- <if test="positionId != null">
- position_id = #{positionId,jdbcType=BIGINT},
- </if>
- <if test="grantGroupId != null">
- grant_group_id = #{grantGroupId,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE gmpg_id = #{gmpgId,jdbcType=BIGINT}
- </update>
- <!--删除-->
- <delete id="delete">
- DELETE
- FROM s_group_member_position_grant
- WHERE 1 = 1
- <if test="gmpgId!= null">
- AND gmpg_id = #{gmpgId,jdbcType=BIGINT}
- </if>
- <if test="ocId != null">
- and oc_id = #{ocId}
- </if>
- <if test="groupId!= null">
- AND group_id = #{groupId,jdbcType=BIGINT}
- </if>
- <if test="accountId != null">
- AND account_id = #{accountId,jdbcType=BIGINT}
- </if>
- <if test="positionId != null">
- AND position_id = #{pId,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|