班组删除
This commit is contained in:
parent
f2f7207c42
commit
4d07b5787a
|
|
@ -19,6 +19,7 @@ public enum ExceptionEnum {
|
|||
INVALID_LATITUDE_FORMAT(1114, "纬度格式不正确"),
|
||||
IMPORT_TO_DATABASE(1003, "该表单中存在相同名称的数据,请修改后重新提交"),
|
||||
SUCCESS(200, "操作成功"),
|
||||
FAIL(400, "操作失败"),
|
||||
EXISTENCE_OF_TEAM(1112, "该人员还绑定相关班组,无法删除"),
|
||||
SAVE_TO_DATABASE(500, "新增保存失败,请联系管理员"),
|
||||
DELETE_TO_DATABASE(500, "删除失败,请联系管理员"),
|
||||
|
|
|
|||
|
|
@ -98,6 +98,17 @@ public class TbTeamController extends BaseController {
|
|||
return tbTeamService.bind(tbTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param tbTeam 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public AjaxResult delete(@RequestBody TbTeam tbTeam) {
|
||||
return tbTeamService.delete(tbTeam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑操作
|
||||
*
|
||||
|
|
|
|||
|
|
@ -40,12 +40,10 @@ public class TbTeam implements Serializable {
|
|||
*/
|
||||
@Excel(name = "班组名称")
|
||||
@Size(max = 50,message = "班组名称最大长度要小于 50")
|
||||
@NotBlank(message = "班组名称不能为空")
|
||||
private String teamName;
|
||||
/**
|
||||
* 班组长id
|
||||
*/
|
||||
@NotNull(message = "班组长不能为空")
|
||||
private Long relId;
|
||||
|
||||
/**
|
||||
|
|
@ -55,7 +53,6 @@ public class TbTeam implements Serializable {
|
|||
/**
|
||||
* 工程id
|
||||
*/
|
||||
@NotNull(message = "所属工程不能为空")
|
||||
private String proId;
|
||||
/**
|
||||
* 工程名称
|
||||
|
|
@ -136,7 +133,6 @@ public class TbTeam implements Serializable {
|
|||
/**
|
||||
* 班组人员id集合
|
||||
*/
|
||||
@NotNull(message = "班组成员不能为空")
|
||||
private List<Long> idList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -159,5 +159,12 @@ public interface TbTeamMapper {
|
|||
* @return
|
||||
*/
|
||||
List<TbTeam> selectListById(Long id);
|
||||
|
||||
/**
|
||||
* 根据id删除班组信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,4 +91,10 @@ public interface TbTeamService {
|
|||
*/
|
||||
List<TbTeam> getList();
|
||||
|
||||
/**
|
||||
* 删除班组
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult delete(TbTeam tbTeam);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,4 +329,23 @@ public class TbTeamServiceImpl implements TbTeamService {
|
|||
}*/
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除班组
|
||||
* @param tbTeam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult delete(TbTeam tbTeam) {
|
||||
//根据id查询班组,判断班组是否处于解散状态,解散状态的班组才能删除
|
||||
TbTeam team = tbTeamDao.queryById(tbTeam.getId());
|
||||
if (team != null && team.getJsTime() == null) {
|
||||
return AjaxResult.error(ExceptionEnum.FAIL.getCode(), "该班组还未解散,无法进行删除");
|
||||
}
|
||||
int result = tbTeamDao.deleteById(tbTeam.getId());
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(ExceptionEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(ExceptionEnum.DELETE_TO_DATABASE.getCode(), ExceptionEnum.DELETE_TO_DATABASE.getMsg());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ProjectDetailsViewServiceImpl {
|
|||
public AjaxResult getDevAttributeRecordByDevId(Integer devId) {
|
||||
List<DevAttributeVo> records = tbDeviceDataRecordMapper.getDevAttributeRecordByDevId(devId);
|
||||
if (records.isEmpty()) {
|
||||
return AjaxResult.error("暂无数据");
|
||||
return AjaxResult.success("暂无数据");
|
||||
}
|
||||
for (DevAttributeVo record : records) {
|
||||
// 截取时间 定义x轴
|
||||
|
|
@ -75,7 +75,7 @@ public class ProjectDetailsViewServiceImpl {
|
|||
public AjaxResult getPitDevAttributeRecordByDeviceId(Integer devId) {
|
||||
List<DevAttributeVo> records = tbDeviceDataRecordMapper.getPitDevAttributeRecordByDeviceId(devId);
|
||||
if (records.isEmpty()) {
|
||||
return AjaxResult.error("暂无数据");
|
||||
return AjaxResult.success("暂无数据");
|
||||
}
|
||||
for (DevAttributeVo record : records) {
|
||||
// 截取时间 定义x轴
|
||||
|
|
@ -92,7 +92,7 @@ public class ProjectDetailsViewServiceImpl {
|
|||
public AjaxResult getTowerDevAttributeRecordByDay(Integer proId) {
|
||||
List<DevAttributeVo> records = tbDeviceDataRecordMapper.getTowerDevAttributeRecordByDay(proId);
|
||||
if (records.isEmpty()) {
|
||||
return AjaxResult.error("暂无数据");
|
||||
return AjaxResult.success("暂无数据");
|
||||
}
|
||||
for (DevAttributeVo record : records) {
|
||||
// 截取时间 定义x轴
|
||||
|
|
@ -126,7 +126,7 @@ public class ProjectDetailsViewServiceImpl {
|
|||
public AjaxResult getTowerDevAttributeRecordByDeviceId(Integer devId) {
|
||||
List<DevAttributeVo> records = tbDeviceDataRecordMapper.getTowerDevAttributeRecordByDeviceId(devId);
|
||||
if (records.isEmpty()) {
|
||||
return AjaxResult.error("暂无数据");
|
||||
return AjaxResult.success("暂无数据");
|
||||
}
|
||||
for (DevAttributeVo record : records) {
|
||||
// 截取时间 定义x轴
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
<?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.bonus.base.mapper.TbTeamMapper">
|
||||
<delete id="deleteById">
|
||||
update tb_team
|
||||
set del_flag = '1'
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryByPage" resultType="com.bonus.base.domain.TbTeam">
|
||||
select
|
||||
|
|
@ -54,7 +59,7 @@
|
|||
update_user as updateUser,
|
||||
del_flag as delFlag
|
||||
from tb_team
|
||||
where id = #{id}
|
||||
where del_flag = '0' and id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getList" resultType="com.bonus.base.domain.TbPeople">
|
||||
|
|
@ -279,9 +284,9 @@
|
|||
tp.dev_id
|
||||
FROM
|
||||
tb_people tp
|
||||
LEFT JOIN tb_team tt ON tp.id = tt.rel_id
|
||||
LEFT JOIN tb_team tt ON tp.id = tt.rel_id and tt.del_flag = '0'
|
||||
WHERE
|
||||
tt.id = #{id}
|
||||
tp.del_flag = '0' and tt.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultType="com.bonus.base.domain.TbTeam">
|
||||
|
|
@ -300,7 +305,7 @@
|
|||
del_flag as delFlag
|
||||
from tb_team
|
||||
where
|
||||
js_time IS NULL
|
||||
del_flag = '0' and js_time IS NULL
|
||||
AND rel_id = #{id}
|
||||
</select>
|
||||
|
||||
|
|
@ -319,7 +324,7 @@
|
|||
update_user as updateUser,
|
||||
del_flag as delFlag
|
||||
from tb_team
|
||||
where rel_id = #{id}
|
||||
where del_flag = '0' and rel_id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue