考勤规则-人员树修改
This commit is contained in:
parent
a0713ca6d3
commit
80f13e68c7
|
|
@ -104,7 +104,7 @@ public interface AttGroupDao {
|
|||
* 查询出可选中人员
|
||||
* @return list bean
|
||||
*/
|
||||
List<SysTree> getAttGroupCheckPerson();
|
||||
List<SysTree> getAttGroupCheckPerson(Long groupId);
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class AttGroupServiceImpl implements AttGroupService {
|
|||
|
||||
@Override
|
||||
public List<SysTree> selectOrgList() {
|
||||
List<SysTree> listTree = attGroupDao.getAttGroupCheckPerson();
|
||||
List<SysTree> listTree = attGroupDao.getAttGroupCheckPerson(null);
|
||||
// 返回处理后的树形结构
|
||||
return listTree.stream()
|
||||
.filter(m -> m.getParentId() == null)
|
||||
|
|
@ -80,14 +80,14 @@ public class AttGroupServiceImpl implements AttGroupService {
|
|||
@Override
|
||||
public AttGroupBean selectAttGroupById(Long groupId) {
|
||||
//查出选择的人员
|
||||
List<AttGroupCheckOrgBean> checkList = attGroupDao.selectAttGroupUserById(groupId);
|
||||
// List<AttGroupCheckOrgBean> checkList = attGroupDao.selectAttGroupUserById(groupId);
|
||||
//查出组织人员
|
||||
List<SysTree> orgList = attGroupDao.getAttGroupCheckPerson();
|
||||
List<SysTree> orgList = attGroupDao.getAttGroupCheckPerson(groupId);
|
||||
//查出考勤组详细数据
|
||||
AttGroupBean attGroupBean = attGroupDao.selectAttGroupById(groupId);
|
||||
List<SysTree> treeList = getOrgCheckList(orgList, checkList);
|
||||
attGroupBean.setTreeList(treeList.stream().filter(m -> m.getParentId() == null).peek((m) ->
|
||||
m.setChildren(TreeUtils.getOrgTreeChild(m, treeList, 0))).collect(Collectors.toList()));
|
||||
// List<SysTree> treeList = getOrgCheckList(orgList, checkList);
|
||||
attGroupBean.setTreeList(orgList.stream().filter(m -> m.getParentId() == null).peek((m) ->
|
||||
m.setChildren(TreeUtils.getOrgTreeChild(m, orgList, 0))).collect(Collectors.toList()));
|
||||
return attGroupBean;
|
||||
}
|
||||
|
||||
|
|
@ -205,8 +205,8 @@ public class AttGroupServiceImpl implements AttGroupService {
|
|||
|
||||
private List<SysTree> getOrgCheckList(List<SysTree> orgList, List<AttGroupCheckOrgBean> checkList) {
|
||||
// 使用forEach结合stream进行比对
|
||||
checkList.forEach(c -> orgList.stream().filter(v -> (c.getUserId() + Constants.VERTICAL +
|
||||
c.getOrgId()).equals(v.getId())).forEach(x -> x.setIsChecked(true)));
|
||||
// checkList.forEach(c -> orgList.stream().filter(v -> (c.getUserId() + Constants.VERTICAL +
|
||||
// c.getOrgId()).equals(v.getId())).forEach(x -> x.setIsChecked(true)));
|
||||
return orgList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,16 +5,14 @@
|
|||
<mapper namespace="com.bonus.system.att.dao.AttGroupDao">
|
||||
|
||||
<select id="selectAttGroupList" resultType="com.bonus.system.att.entity.AttGroupBean">
|
||||
select ags.*, ag.id as groupId, ag.group_name, ag.att_type,agpr.org_id from att_group ag
|
||||
select ags.*, ag.id as groupId, ag.group_name, ag.att_type
|
||||
from att_group ag
|
||||
left join att_group_setting ags on ags.group_id = ag.id and ags.is_active = 1
|
||||
left join att_group_person_relation agpr on agpr.group_id = ag.id and agpr.is_active = 1
|
||||
where ag.is_active = 1
|
||||
<if test="groupName != null and groupName != '' ">
|
||||
and ag.group_name = #{groupName}
|
||||
</if>
|
||||
<if test="orgId != null and orgId != '' ">
|
||||
and agpr.org_id = #{orgId}
|
||||
</if>
|
||||
GROUP BY ag.id
|
||||
</select>
|
||||
|
||||
|
|
@ -41,7 +39,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectAttGroupUserById" resultType="com.bonus.system.att.entity.AttGroupCheckOrgBean">
|
||||
select *
|
||||
select user_id AS userId
|
||||
from att_group_person_relation
|
||||
where group_id = #{groupId}
|
||||
and is_active = 1
|
||||
|
|
@ -56,20 +54,26 @@
|
|||
</select>
|
||||
|
||||
<select id="getAttGroupCheckPerson" resultType="com.bonus.system.basic.domain.SysTree">
|
||||
select id, org_name as name, parent_id, false as disabled, '' as userId, id as orgId
|
||||
select CONCAT('org', '|', id) AS id, org_name as name, CONCAT('org', '|', parent_id) AS parent_id,'' as userId, id as orgId,false AS isChecked
|
||||
from sys_organization
|
||||
where is_active = 1
|
||||
union
|
||||
select CONCAT(su.user_id, '|', suo.org_id) as id,
|
||||
select CONCAT('user', '|',su.user_id) as id,
|
||||
user_name as name,
|
||||
suo.org_id as parnet_id,
|
||||
if(agpr.is_active is null, false, true) as disabled,
|
||||
CONCAT('org', '|', suo.org_id ) as parnet_id,
|
||||
su.user_id,
|
||||
suo.org_id
|
||||
suo.org_id,
|
||||
IF(agpr.user_id IS NULL,false,true) AS isChecked
|
||||
from sys_user su
|
||||
left join sys_user_org suo on suo.user_id = su.user_id and suo.is_active = 1
|
||||
left join att_group_person_relation agpr on agpr.user_id = su.user_id and agpr.is_active = 1
|
||||
left join sys_user_org suo on suo.user_id = su.user_id and suo.is_active = 1
|
||||
left join att_group_person_relation agpr on agpr.user_id = su.user_id and agpr.is_active = 1
|
||||
where su.is_active = 1
|
||||
<if test="groupId==null">
|
||||
AND agpr.group_id IS NULL
|
||||
</if>
|
||||
<if test="groupId!=null">
|
||||
AND (agpr.group_id = #{groupId} OR agpr.group_id IS NULL)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getUserByOrg" resultType="com.bonus.system.att.entity.AttGroupCheckOrgBean">
|
||||
|
|
@ -158,10 +162,10 @@
|
|||
</insert>
|
||||
|
||||
<insert id="insertAttGroupPerson">
|
||||
insert into att_group_person_relation(group_id, org_id, user_id, effective_time)
|
||||
insert into att_group_person_relation(group_id, user_id, effective_time)
|
||||
values
|
||||
<foreach item="params" collection="list" separator=",">
|
||||
(#{params.groupId}, #{params.orgId}, #{params.userId}, now())
|
||||
(#{params.groupId}, #{params.userId}, now())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue