APP智能安全帽

This commit is contained in:
cwchen 2024-08-08 09:38:37 +08:00
parent 9ee362413a
commit 4dfa5a429c
3 changed files with 46 additions and 28 deletions

View File

@ -32,7 +32,7 @@ public class TeamVo {
@Length(max = 64, message = "班组名称字符长度不能超过64")
private String teamName;
// @NotNull(message = "班组长ID不能为空")
@NotNull(message = "班组长ID不能为空")
private Long teamLeaderId;
/**

View File

@ -1,14 +1,12 @@
package com.bonus.bracelet.service.impl;
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
import com.bonus.bracelet.mapper.TeamMgeMapper;
import com.bonus.bracelet.service.ITeamMgeService;
import com.bonus.common.core.constant.BusinessConstants;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.entity.bracelet.BraceletParamsDto;
import com.bonus.common.entity.bracelet.exportVo.PersonExportVo;
import com.bonus.common.entity.bracelet.importVo.PersonImportVo;
import com.bonus.common.entity.bracelet.vo.TeamPeopleVo;
import com.bonus.common.entity.bracelet.vo.TeamVo;
import lombok.extern.slf4j.Slf4j;
@ -18,10 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
/**
* @className:TeamMgeServiceImpl
@ -148,7 +143,10 @@ public class TeamMgeServiceImpl implements ITeamMgeService {
@Override
public AjaxResult getPersonList(BraceletParamsDto dto) {
try {
List<Map<String, Object>> list = mapper.getPersonList(dto);
// type 1.全部人员 2.未分配人员 3.已分配人员 4.班组长
List<Map<String, Object>> list = new ArrayList<>();
list = mapper.getPersonList(dto);
list = Lists.newArrayList(new HashSet(list));
return AjaxResult.success(handleList(list));
} catch (Exception e) {
log.error(e.toString(), e);
@ -210,5 +208,4 @@ public class TeamMgeServiceImpl implements ITeamMgeService {
}
return list;
}
}

View File

@ -17,7 +17,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time,
update_user,
del_flag,
team_id
team_id,
team_leader_id
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="teamName != null and teamName != ''">#{teamName},</if>
@ -30,12 +31,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{updateTime},
#{updateUser},
0,
null
null,
#{teamLeaderId}
</trim>
</insert>
<!--修改班组-->
<update id="updateTeam">
UPDATE t_work_team SET team_name = #{teamName},team_leader = #{teamLeader},leader_phone = #{leaderPhone},pro_id = #{proId},update_time = #{updateTime},update_user = #{updateUser} WHERE team_id = #{teamId}
UPDATE t_work_team SET team_name = #{teamName},team_leader = #{teamLeader},leader_phone = #{leaderPhone},pro_id = #{proId},update_time = #{updateTime},update_user = #{updateUser},team_leader_id = #{teamLeaderId} WHERE team_id = #{teamId}
</update>
<!--解散班组-->
<update id="dissolutionTeam">
@ -114,22 +116,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="isExistPerson" resultType="java.lang.Integer">
SELECT COUNT(*) FROM tb_people WHERE team_id = #{id} AND del_flag = 0
</select>
<!--查询人员列表-->
<!--查询人员列表 type 1.全部人员 2.未分配人员 3.已分配人员 4.班组长-->
<select id="getPersonList" resultType="java.util.Map">
SELECT id,
name,
id_card AS idCard,
phone AS phone
FROM tb_people
WHERE del_flag = 0
<if test="type == 2">
AND team_id IS NULL
<if test="type == 4">
SELECT id,
name,
id_card AS idCard,
phone AS phone
FROM tb_people
WHERE del_flag = 0 AND team_id IS NULL
UNION ALL
SELECT tp.id,
tp.name,
tp.id_card AS idCard,
tp.phone AS phone
FROM t_work_team twt
LEFT JOIN tb_people tp ON twt.team_leader_id = tp.id AND tp.del_flag = 0
WHERE twt.del_flag = 0 AND twt.team_id = #{teamId}
</if>
<if test="type == 3 and teamId==null">
AND team_id IS NOT NULL
</if>
<if test="type == 3 and teamId!=null">
AND team_id =#{teamId}
<if test="type!=4">
SELECT id,
name,
id_card AS idCard,
phone AS phone
FROM tb_people
WHERE del_flag = 0
<if test="type == 2">
AND team_id IS NULL
</if>
<if test="type == 3 and teamId==null">
AND team_id IS NOT NULL
</if>
<if test="type == 3 and teamId!=null">
AND team_id =#{teamId}
</if>
</if>
</select>
<!--班组详情-->
@ -138,7 +158,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
team_name AS teamName,
team_leader AS teamLeader,
leader_phone AS leaderPhone,
pro_id AS proId
pro_id AS proId,
team_leader_id AS teamLeaderId
FROM t_work_team WHERE team_id = #{id}
</select>
<!--班组在施和未施人员-->