This commit is contained in:
zhangchenbiao
2023-05-31 15:36:25 +08:00
parent de94c572ef
commit 39cef07e6a
74 changed files with 4033 additions and 67 deletions

View File

@@ -468,7 +468,6 @@
jobnumber=values(jobnumber)
</insert>
<update id="batchUpdateDiffUserDiffRegionIds">
update enterprise_user_${eid}
set user_region_ids =
@@ -480,4 +479,195 @@
#{item.userId}
</foreach>
</update>
<select id="fuzzyUsersByDepartment" resultType="com.cool.store.entity.EnterpriseUserDO">
select
u.user_id as userId,
u.name as name,
u.roles as roles,
u.jobnumber as jobnumber,
u.remark as remark,
u.mobile as mobile,
u.email as email,
u.org_email as orgEmail,
u.avatar as avatar,
u.user_status as userStatus,
u.unionid as unionid
from enterprise_user_${eid} u
left join enterprise_user_role_${eid} ul on u.user_id=ul.user_id
left join sys_role_${eid} r on ul.role_id=r.id
<where>
u.active = true and u.user_id != 'a100000001'
<if test="deptId !=null and deptId !=''">
and u.departments like concat('%/',#{deptId},'/%')
</if>
<if test="userName !=null and userName !=''">
and u.name like concat('%',#{userName},'%')
</if>
<if test="jobNumber !=null and jobNumber !=''">
and u.jobnumber = #{jobNumber}
</if>
<if test="roleId !=null ">
and r.id=#{roleId}
</if>
<if test="userStatus !=null ">
and u.user_status=#{userStatus}
</if>
<if test="regionId !=null and regionId !=''">
and user_region_ids like concat('%/',#{regionId},'/%')
</if>
<if test="userIdList != null and userIdList.size > 0">
and u.user_id in
<foreach collection="userIdList" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
</where>
GROUP BY u.user_id
<if test="orderBy != null and orderBy != '' ">
order by u.${orderBy} ${orderRule}
</if>
</select>
<select id="fuzzyUsersByNotRole" resultType="com.cool.store.entity.EnterpriseUserDO">
select
user_id as userId,
name as name,
jobnumber as jobnumber,
remark as remark,
mobile as mobile,
email as email,
org_email as orgEmail,
avatar as avatar,
roles as roles,
departments as departments,
user_status as userStatus,
unionid
from enterprise_user_${eid}
<where>
active = true and user_id != 'a100000001'
<if test="deptId !=null and deptId !=''">
and departments like concat('%/',#{deptId},'/%')
</if>
<if test="userName !=null and userName !=''">
and name like concat('%',#{userName},'%')
</if>
<if test="jobNumber !=null and jobNumber !=''">
and jobnumber = #{jobNumber}
</if>
<if test="userStatus !=null">
and user_status = #{userStatus}
</if>
<if test="regionId !=null and regionId !=''">
and user_region_ids like concat('%/',#{regionId},'/%')
</if>
<if test="userIdList != null and userIdList.size > 0">
and user_id in
<foreach collection="userIdList" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
</where>
ORDER BY user_id
<if test="orderBy != null and orderBy != '' ">
, ${orderBy}
</if>
</select>
<select id="selectUsersByUserIds" resultType="com.cool.store.entity.EnterpriseUserDO">
select
id,
user_id as userId,
`name` as name,
avatar,
active,
mobile,
jobnumber,
`language`,
user_status as userStatus,
subordinate_range as subordinateRange
from enterprise_user_${eid}
<where>
user_id != 'a100000001'
and
<if test="userIds.size()>0 and userIds!=null">or
user_id in
<foreach
collection="userIds" item="userId" separator="," open="(" close=")">
#{userId, jdbcType=VARCHAR}
</foreach>
</if>
</where>
</select>
<select id="listUserByGroupId" resultType="com.cool.store.entity.EnterpriseUserDO">
select
u.user_id as userId,
u.name as name,
u.roles as roles,
u.jobnumber as jobnumber,
u.mobile as mobile,
u.email as email,
u.org_email as orgEmail,
u.avatar as avatar,
u.departments as departments,
u.user_status as userStatus,
u.unionid as unionid
from enterprise_user_${eid} u
left join enterprise_user_group_mapping_${eid} ug on u.user_id=ug.user_id
<where>
ug.group_id = #{groupId} and u.active = true and u.user_id != 'a100000001'
<if test="userName !=null and userName !=''">
and u.name like concat('%',#{userName},'%')
</if>
<if test="userIdList != null and userIdList.size > 0">
and u.user_id in
<foreach collection="userIdList" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
</where>
GROUP BY u.user_id
</select>
<select id="listByRegionIdList" resultType="com.cool.store.entity.EnterpriseUserDO">
select
id as id,
user_id as userId,
`name` as name,
tel as tel,
work_place as workPlace,
remark as remark,
mobile as mobile,
email as email,
org_email as orgEmail,
active as active,
order_in_depts as orderInDepts,
is_admin as isAdmin,
is_boss as isBoss,
dingId as dingId,
unionid as unionid,
is_leader_in_depts as isLeaderInDepts,
is_hide as isHide,
`position` as position,
avatar as avatar,
jobnumber as jobnumber,
extattr as extattr,
is_enterprise as isEnterprise,
roles as roles,
monitored_departments as monitoredDepartments,
departments as departments,
is_leader as isLeader,
face_url as faceUrl,
create_time as createTime,
`language` as language
from enterprise_user_${eid} where user_id != 'a100000001'
<foreach collection="regionIdList" item="regionId" separator=" or " open="and (" close=" )">
user_region_ids like concat('%/', #{regionId}, '/%')
</foreach>
order by id
</select>
</mapper>

View File

@@ -69,4 +69,35 @@
(#{userRole.roleId}, #{userRole.userId} ,#{userRole.createTime})
</foreach>
</insert>
<select id="getUserAndRolesByUserId" resultType="com.cool.store.dto.buser.UserRoleDTO">
select
a.role_id as roleId,
a.user_id as userId,
b.role_name as roleName,
b.role_auth as roleAuth,
b.role_enum as roleEnum,
b.priority as priority
from enterprise_user_role_${eip} a left join sys_role_${eip} b on a.role_id=b.id
<where>
<if test="userIdList != null and userIdList.size>0">
<foreach collection="userIdList" item="userId" separator="," open="a.user_id in (" close=")">
#{userId}
</foreach>
</if>
AND b.role_name IS NOT NULL
</where>
</select>
<select id="listRoleByUserId" resultType="com.cool.store.entity.SysRoleDO">
select
c.id as id,
c.role_name as roleName,
c.role_auth as roleAuth,
c.source as source,
c.role_enum as roleEnum
from enterprise_user_role_${eip} b
left join sys_role_${eip} c on c.id = b.role_id
where b.user_id = #{userId}
</select>
</mapper>

View File

@@ -9,7 +9,7 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.model.entity.HyPartnerInterviewLogDO">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.HyPartnerInterviewLogDO">
<result column="change_before_cpoy" jdbcType="LONGVARCHAR" property="changeBeforeCpoy" />
</resultMap>
<sql id="Base_Column_List">

View File

@@ -13,7 +13,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="partner_id" jdbcType="BIGINT" property="partnerId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.model.entity.HyPartnerTaskInfoLogDO">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.HyPartnerTaskInfoLogDO">
<result column="field_copy" jdbcType="LONGVARCHAR" property="fieldCopy" />
</resultMap>
<sql id="Base_Column_List">

View File

@@ -340,4 +340,49 @@
</foreach>
)
</select>
<select id="getAllRegion" resultType="com.cool.store.entity.RegionDO">
select
id ,
id as regionId,
name ,
parent_id as parentId,
group_id as groupId,
create_time as createTime,
create_name as createName,
update_time as updateTime,
update_name as updateName,
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
region_path as regionPath,
deleted as deleted,
third_dept_id as thirdDeptId
from region_${eid}
where deleted = 0 and id > 0
and region_type != 'store'
</select>
<select id="listStoreRegionByIds" resultType="com.cool.store.entity.RegionDO">
select
id ,
region_id as regionId,
name as name ,
parent_id as parentId,
group_id as groupId,
create_time as createTime,
create_name as createName,
update_time as updateTime,
update_name as updateName,
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
deleted as deleted,
store_id as storeId
from region_${eid}
where region_type = 'store'
and id in (
<foreach collection="regionIds" item="item" separator=",">
#{item}
</foreach>
)
</select>
</mapper>

View File

@@ -100,4 +100,16 @@
</set>
where id = #{record.id}
</update>
<select id="listUserAuthMappingByUserId" resultMap="BaseResultMap">
select * from user_auth_mapping_${eid}
where user_id=#{userId}
</select>
<select id="listUserAuthMappingByUserIds" resultMap="BaseResultMap">
select * from user_auth_mapping_${eid}
<foreach collection="userIds" item="userId" open="user_id in (" separator="," close=")">
#{userId}
</foreach>
</select>
</mapper>