123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <?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.LeadingGroupMemberMapper">
- <resultMap id="LeadingGroupMemberDtoResultMap" type="com.zhyc.xps.sys.dto.LeadingGroupMemberDto">
- <result column="lgm_id" property="lgmId" jdbcType="BIGINT" />
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="lg_id" property="lgId" jdbcType="BIGINT" />
- <result column="lgp_id" property="lgpId" jdbcType="BIGINT" />
- <result column="lgp_name" property="lgpName" jdbcType="VARCHAR" />
- <result column="account_id" property="accountId" jdbcType="BIGINT" />
- <result column="account_name" property="accountName" jdbcType="VARCHAR" />
- <result column="account_real_name" property="accountRealName" jdbcType="VARCHAR" />
- <result column="account_avatar" property="accountAvatar" jdbcType="VARCHAR" />
- <result column="account_phone" property="accountPhone" jdbcType="VARCHAR" />
- <result column="group_id" property="groupId" jdbcType="BIGINT" />
- <result column="group_name" property="groupName" jdbcType="VARCHAR" />
- <result column="position_id" property="positionId" jdbcType="BIGINT" />
- <result column="position_name" property="positionName" jdbcType="VARCHAR" />
- <result column="duty" property="duty" jdbcType="VARCHAR" />
- <result column="remark" property="remark" jdbcType="VARCHAR" />
- <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
- </resultMap>
- <sql id="LeadingGroupMemberDto_Cols">
- A.lgm_id,
- A.oc_id,
- A.lg_id,
- A.account_id,
- A.lgp_id,
- B.lgp_name,
- C.account_name,
- C.account_real_name,
- C.account_avatar,
- C.account_phone,
- A.group_id,
- D.group_name,
- A.position_id,
- E.position_name,
- A.duty,
- A.remark,
- A.sort_no
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="LeadingGroupMemberDtoResultMap">
- SELECT
- <include refid="LeadingGroupMemberDto_Cols"/>
- FROM leading_group_member AS A
- LEFT JOIN leading_group_position AS B ON (A.oc_id = B.oc_id AND A.lgp_id = B.lgp_id)
- LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.account_id = C.account_id)
- LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
- LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id )
- WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0
- <if test="lgId != null">
- AND A.lg_id = #{lgId ,jdbcType=BIGINT}
- </if>
- <if test="lgmId != null">
- AND A.lgm_id = #{lgmId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="LeadingGroupMemberDtoResultMap">
- SELECT
- <include refid="LeadingGroupMemberDto_Cols"/>
- FROM leading_group_member AS A
- LEFT JOIN leading_group_position AS B ON (A.oc_id = B.oc_id AND A.lgp_id = B.lgp_id)
- LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.account_id = C.account_id)
- LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
- LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id )
- WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0
- <if test="lgId != null">
- AND A.lg_id = #{lgId ,jdbcType=BIGINT}
- </if>
- <if test="groupId != null">
- AND A.group_id = #{groupId ,jdbcType = BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND C.account_name LIKE "%"#{keywords}"%"
- </if>
- ORDER BY A.lgp_id ASC, A.sort_no ASC
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="LeadingGroupMemberDtoResultMap">
- SELECT
- <include refid="LeadingGroupMemberDto_Cols"/>
- FROM leading_group_member AS A
- LEFT JOIN leading_group_position AS B ON (A.oc_id = B.oc_id AND A.lgp_id = B.lgp_id)
- LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.account_id = C.account_id)
- LEFT JOIN s_group AS D ON (A.oc_id = D.oc_id AND A.group_id = D.group_id)
- LEFT JOIN s_position AS E ON (A.oc_id = E.oc_id AND A.position_id = E.position_id )
- WHERE A.oc_id = #{ocId ,jdbcType = BIGINT} AND A.deleted_flag = 0
- <if test="lgId != null">
- AND A.lg_id = #{lgId ,jdbcType=BIGINT}
- </if>
- <if test="groupId != null">
- AND A.group_id = #{groupId ,jdbcType = BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND C.account_name LIKE "%"#{keywords}"%"
- </if>
- ORDER BY A.sort_no ASC
- </select>
- <!--新增Create-->
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.LeadingGroupMember">
- INSERT INTO leading_group_member
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="lgmId != null">
- lgm_id,
- </if>
- <if test="lgId != null">
- lg_id,
- </if>
- <if test="lgpId != null">
- lgp_id,
- </if>
- <if test="groupId != null">
- group_id,
- </if>
- <if test="positionId != null">
- position_id,
- </if>
- <if test="accountId != null">
- account_id,
- </if>
- <if test="duty != null and duty != ''">
- duty,
- </if>
- <if test="remark != null and remark != ''">
- remark,
- </if>
- <if test="sortNo != null">
- sort_no,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null ">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="lgmId != null">
- #{lgmId ,jdbcType=BIGINT},
- </if>
- <if test="lgId != null">
- #{lgId ,jdbcType=BIGINT},
- </if>
- <if test="lgpId != null">
- #{lgpId ,jdbcType=BIGINT},
- </if>
- <if test="groupId != null">
- #{groupId ,jdbcType=BIGINT},
- </if>
- <if test="positionId != null">
- #{positionId ,jdbcType=BIGINT},
- </if>
- <if test="accountId != null">
- #{accountId ,jdbcType=BIGINT},
- </if>
- <if test="duty != null and duty != ''">
- #{duty ,jdbcType=VARCHAR},
- </if>
- <if test="remark != null and remark != ''">
- #{remark ,jdbcType=VARCHAR},
- </if>
- <if test="sortNo != null">
- #{sortNo ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.LeadingGroupMember">
- UPDATE leading_group_member
- <trim suffixOverrides=",">
- <set>
- <if test="lgpId != null">
- lgp_Id = #{lgpId ,jdbcType=BIGINT},
- </if>
- <if test="groupId != null">
- group_id = #{groupId ,jdbcType=BIGINT},
- </if>
- <if test="positionId != null">
- position_id = #{positionId ,jdbcType=BIGINT},
- </if>
- <if test="accountId != null">
- account_id = #{accountId ,jdbcType=BIGINT},
- </if>
- <if test="duty != null and duty != ''">
- duty = #{duty ,jdbcType=VARCHAR},
- </if>
- <if test="remark != null and remark != ''">
- remark = #{remark ,jdbcType=VARCHAR},
- </if>
- <if test="sortNo != null">
- sort_no = #{sortNo ,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 oc_Id = #{ocId ,jdbcType=BIGINT} AND lgm_id = #{lgmId ,jdbcType=BIGINT}
- </update>
- <!--基于ID查询-->
- <update id="updatePositionByAccountId">
- UPDATE leading_group_member
- <trim suffixOverrides=",">
- <set>
- <if test="positionId != null">
- position_id = #{positionId ,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE oc_Id = #{ocId ,jdbcType=BIGINT} AND account_id = #{accountId ,jdbcType=BIGINT}
- </update>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM leading_group_member
- WHERE oc_id = #{ocId ,jdbcType=BIGINT} AND deleted_flag = 0
- <if test="lgmId != null">
- AND lgm_id = #{lgmId ,jdbcType=BIGINT}
- </if>
- <if test="lgId != null">
- AND lg_id = #{lgId ,jdbcType=BIGINT}
- </if>
- <if test="accountId != null">
- AND account_id = #{accountId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|