diff --git a/src/main/java/com/bonus/aqgqj/basis/controller/TeamController.java b/src/main/java/com/bonus/aqgqj/basis/controller/TeamController.java index 62e3141..5970a54 100644 --- a/src/main/java/com/bonus/aqgqj/basis/controller/TeamController.java +++ b/src/main/java/com/bonus/aqgqj/basis/controller/TeamController.java @@ -2,6 +2,7 @@ package com.bonus.aqgqj.basis.controller; import com.bonus.aqgqj.annotation.DecryptAndVerify; import com.bonus.aqgqj.annotation.LogAnnotation; +import com.bonus.aqgqj.base.entity.SelectEntity; import com.bonus.aqgqj.basis.dao.CustomDao; import com.bonus.aqgqj.basis.entity.vo.BaseCustom; import com.bonus.aqgqj.basis.entity.vo.BaseTeam; @@ -10,6 +11,7 @@ import com.bonus.aqgqj.basis.service.CustomService; import com.bonus.aqgqj.basis.service.TeamService; import com.bonus.aqgqj.system.vo.EncryptedReq; import com.bonus.aqgqj.utils.ServerResponse; +import com.bonus.aqgqj.webResult.StringUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; @@ -84,12 +86,9 @@ public class TeamController { if (u != null) { return ServerResponse.createErroe("班组名称 “"+data.getData().getTeamName() + "” 已存在"); } -// if(StringHelper.isNotEmpty(data.getData().getCustomPhone())){ -// BaseCustom u2 = customService.getCustomPhone(data.getData().getCustomPhone(),data.getData().getCustomId()); -// if (u2 != null ) { -// return ServerResponse.createErroe("手机号"+data.getData().getCustomPhone() + "已存在"); -// } -// } + + String teamTypeName = teamService.getTypeName(data.getData().getTeamTypeCode()); + data.getData().setTeamTypeName(teamTypeName); teamService.updateTeam(data.getData()); return ServerResponse.createBySuccessMsg("操作成功"); }catch (Exception e){ @@ -108,6 +107,8 @@ public class TeamController { if (u != null) { return ServerResponse.createErroe("客户名称 “"+data.getData().getTeamName() + "” 已存在"); } + String teamTypeName = teamService.getTypeName(data.getData().getTeamTypeCode()); + data.getData().setTeamTypeName(teamTypeName); teamService.add(data.getData()); return ServerResponse.createBySuccessMsg("操作成功"); }catch (Exception e){ @@ -118,19 +119,41 @@ public class TeamController { @PostMapping(value = "delById") @DecryptAndVerify(decryptedClass = BaseTeam.class)//加解密统一管理 - @LogAnnotation(operModul = "基础管理-客户管理", operation = "注销客户", operDesc = "系统级事件",operType="删除") + @LogAnnotation(operModul = "基础管理-班组管理", operation = "删除班组", operDesc = "系统级事件",operType="删除") @PreAuthorize("@pms.hasPermission('base:team:del')") public ServerResponse delTeam(EncryptedReq data) { try { - if (teamService.delTeam(data.getData().getTeamId())== 1){ - return ServerResponse.createBySuccessMsg("注销成功"); - }else { - return ServerResponse.createErroe("注销失败"); + if(data.getData().getCountuser()!=0){ + return ServerResponse.createBySuccessMsg("该班组人数不为0,无法删除"); + }else{ + if (teamService.delTeam(data.getData().getTeamId())== 1){ + return ServerResponse.createBySuccessMsg("删除成功"); + }else { + return ServerResponse.createErroe("删除失败"); + } } }catch (Exception e){ log.error(e.toString(),e); } return ServerResponse.createErroe("操作失败"); + + } + + @PostMapping(value = "all") + @LogAnnotation(operModul = "班组成员配置", operation = "查询所有班组", operDesc = "系统级事件",operType="查询") + @PreAuthorize("@pms.hasPermission('base:teamconfig:query')" ) + public ServerResponse getAll() { + try { + String value = "team_type"; + SelectEntity dict = teamService.teamValue(value); + + List list = teamService.teamType(dict.getId()); + + return ServerResponse.createSuccess(list); + }catch (Exception e){ + log.error(e.toString(),e); + } + return ServerResponse.createErroe("操作失败"); } } diff --git a/src/main/java/com/bonus/aqgqj/basis/dao/TeamDao.java b/src/main/java/com/bonus/aqgqj/basis/dao/TeamDao.java index 49051f1..d3d77aa 100644 --- a/src/main/java/com/bonus/aqgqj/basis/dao/TeamDao.java +++ b/src/main/java/com/bonus/aqgqj/basis/dao/TeamDao.java @@ -1,5 +1,6 @@ package com.bonus.aqgqj.basis.dao; +import com.bonus.aqgqj.base.entity.SelectEntity; import com.bonus.aqgqj.basis.entity.vo.BaseCustom; import com.bonus.aqgqj.basis.entity.vo.BaseTeam; import org.apache.ibatis.annotations.Mapper; @@ -24,4 +25,10 @@ public interface TeamDao { int add(BaseTeam team); int delTeam(Long teamId); + + SelectEntity teamValue(String value); + + List teamType(String id); + + String getTypeName(String teamTypeId); } diff --git a/src/main/java/com/bonus/aqgqj/basis/entity/vo/BaseTeam.java b/src/main/java/com/bonus/aqgqj/basis/entity/vo/BaseTeam.java index adb7c06..e3c7531 100644 --- a/src/main/java/com/bonus/aqgqj/basis/entity/vo/BaseTeam.java +++ b/src/main/java/com/bonus/aqgqj/basis/entity/vo/BaseTeam.java @@ -14,6 +14,8 @@ public class BaseTeam extends PageEntity { private String teamName; + private String teamTypeCode; + private String teamTypeName; private String teamLeader; diff --git a/src/main/java/com/bonus/aqgqj/basis/service/TeamService.java b/src/main/java/com/bonus/aqgqj/basis/service/TeamService.java index 8c1fa7e..e150c10 100644 --- a/src/main/java/com/bonus/aqgqj/basis/service/TeamService.java +++ b/src/main/java/com/bonus/aqgqj/basis/service/TeamService.java @@ -1,5 +1,6 @@ package com.bonus.aqgqj.basis.service; +import com.bonus.aqgqj.base.entity.SelectEntity; import com.bonus.aqgqj.basis.entity.vo.BaseCustom; import com.bonus.aqgqj.basis.entity.vo.BaseTeam; import com.bonus.aqgqj.utils.ServerResponse; @@ -25,4 +26,9 @@ public interface TeamService { int delTeam(Long teamId); + SelectEntity teamValue(String value); + + List teamType(String id); + + String getTypeName(String teamTypeId); } diff --git a/src/main/java/com/bonus/aqgqj/basis/service/impl/TeamServiceImpl.java b/src/main/java/com/bonus/aqgqj/basis/service/impl/TeamServiceImpl.java index c50ee86..2e8e31a 100644 --- a/src/main/java/com/bonus/aqgqj/basis/service/impl/TeamServiceImpl.java +++ b/src/main/java/com/bonus/aqgqj/basis/service/impl/TeamServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.aqgqj.basis.service.impl; +import com.bonus.aqgqj.base.entity.SelectEntity; import com.bonus.aqgqj.basis.dao.CustomDao; import com.bonus.aqgqj.basis.dao.TeamDao; import com.bonus.aqgqj.basis.entity.vo.BaseCustom; @@ -91,4 +92,20 @@ public class TeamServiceImpl implements TeamService { public int delTeam(Long teamId) { return teamDao.delTeam(teamId); } + + @Override + public SelectEntity teamValue(String value) { + return teamDao.teamValue(value); + } + + @Override + public List teamType(String id) { + return teamDao.teamType(id); + } + + @Override + public String getTypeName(String teamTypeId) { + return teamDao.getTypeName(teamTypeId); + } + } diff --git a/src/main/resources/mappers/basis/TeamMapper.xml b/src/main/resources/mappers/basis/TeamMapper.xml index 5cb72e1..38a2200 100644 --- a/src/main/resources/mappers/basis/TeamMapper.xml +++ b/src/main/resources/mappers/basis/TeamMapper.xml @@ -4,6 +4,7 @@ + @@ -12,7 +13,7 @@ @@ -57,6 +58,7 @@ update tb_team set team_name = #{teamName}, + team_type_code = #{teamTypeCode}, team_type_name = #{teamTypeName}, team_leader = #{teamLeader}, team_leader_phone = #{teamLeaderPhone}, @@ -65,9 +67,9 @@ - insert into tb_team(team_name,team_type_name,team_leader,team_leader_phone,create_time,del_flag + insert into tb_team(team_name,team_type_code,team_type_name,team_leader,team_leader_phone,create_time,del_flag )values ( - #{teamName},#{teamTypeName},#{teamLeader},#{teamLeaderPhone},now(),0 + #{teamName},#{teamTypeCode},#{teamTypeName},#{teamLeader},#{teamLeaderPhone},now(),0 ) @@ -76,4 +78,24 @@ set del_flag = 1 where id = #{teamId} + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/js/basis/team.js b/src/main/resources/static/js/basis/team.js index 7cd66bd..850f37d 100644 --- a/src/main/resources/static/js/basis/team.js +++ b/src/main/resources/static/js/basis/team.js @@ -66,6 +66,7 @@ function initTable(dataList, limit, page) { }, {field: "teamId", title: "ID", unresize: true, align: "center",hide:true}, {field: "teamName", title: "班组名称", unresize: true, align: "center"}, + {field: "teamTypeCode", title: "班组id", unresize: true, align: "center",hide:true}, {field: "teamTypeName", title: "班组类型", unresize: true, align: "center"}, {field: "teamLeader", title: "班组负责人", unresize: true, align: "center"}, {field: "teamLeaderPhone", title: "联系方式", unresize: true, align: "center"}, @@ -144,9 +145,9 @@ function reloadData() { // 新增/修改平台用户 function addData(teamId) { console.log() - let title = '新增客户' + let title = '新增班组' if (teamId) { - title = '修改客户'; + title = '修改班组'; } let param = { 'teamId': teamId diff --git a/src/main/resources/static/js/basis/teamAddForm.js b/src/main/resources/static/js/basis/teamAddForm.js index 647e48c..259b9b4 100644 --- a/src/main/resources/static/js/basis/teamAddForm.js +++ b/src/main/resources/static/js/basis/teamAddForm.js @@ -4,7 +4,7 @@ let background, web, mobile, wx; let data = [], appResList = []; // 角色下拉选 let roleList; - +getTeamSelected() function setParams(params) { idParam = JSON.parse(params).teamId; console.log(idParam) @@ -67,6 +67,11 @@ function setFormData(data) { // $("#customStatus").prop("checked", 0); // // } + + teamTypeCode = data.teamTypeCode + // $('#teamTypeCode').val(data.id) + // $('#teamTypeName option[value=' + data.teamTypeName + ']').attr('selected', true) + console.log(teamTypeCode) form.render(); @@ -130,4 +135,29 @@ function closePage(type) { if (type === 1) { parent.reloadData() } +} + +function getTeamSelected() { + let url = dataUrl + '/teams/all'; + ajaxRequest(url, "POST", null, true, function () { + }, function (result) { + if (result.code === 200) { + setSelectValue(result.data, 'teamTypeCode'); + // return result.data + } else { + layer.alert(result.msg, {icon: 2}) + } + }, function (xhr) { + error(xhr) + }); +} + +/*下拉选表单赋值*/ +function setSelectValue(list, selectName) { + let html = ''; + $.each(list, function (index, item) { + html += ''; + }) + $('#' + selectName).empty().append(html); + layui.form.render(); } \ No newline at end of file diff --git a/src/main/resources/static/pages/basis/customAddForm.html b/src/main/resources/static/pages/basis/customAddForm.html index f67e3ab..6aede07 100644 --- a/src/main/resources/static/pages/basis/customAddForm.html +++ b/src/main/resources/static/pages/basis/customAddForm.html @@ -18,13 +18,6 @@
-
- -
- -
-
diff --git a/src/main/resources/static/pages/basis/teamAddForm.html b/src/main/resources/static/pages/basis/teamAddForm.html index a05b7b9..86b7575 100644 --- a/src/main/resources/static/pages/basis/teamAddForm.html +++ b/src/main/resources/static/pages/basis/teamAddForm.html @@ -12,7 +12,7 @@ - 用户-新增/修改 + 班组-新增/修改
@@ -28,8 +28,8 @@
- +