Jelajahi Sumber

维修人员接口

zhj 2 tahun lalu
induk
melakukan
018aa9a939

+ 8 - 0
src/main/java/com/welampiot/common/InterfaceResultEnum.java

@@ -61,6 +61,14 @@ public enum InterfaceResultEnum {
     LACK_WATER_IMMERSION_MODEL_ERROR("0254","请选择水浸设备型号","",""),
     LACK_WATER_IMMERSION_LEVEL_ERROR("0255","请选择报警等级","",""),
     LACK_WATER_IMMERSION_POWER_STATUS_ERROR("0256","请选择报警时配电箱断电状态","",""),
+    LACK_REPAIR_PERSONNEL_NAME_ERROR("0257","维修人员名称不能为空","",""),
+    REPAIR_PERSONNEL_NAME_UNIQUE_ERROR("0258","维修人员名称重复","",""),
+    LACK_REPAIR_PERSONNEL_NUMBER_ERROR("0259","维修人员工号不能为空","",""),
+    REPAIR_PERSONNEL_NUMBER_UNIQUE_ERROR("0260","维修人员工号重复","",""),
+    LACK_REPAIR_PERSONNEL_PHONE_ERROR("0261","维修人员手机号不能为空","",""),
+    LACK_REPAIR_PERSONNEL_GROUP_ID_ERROR("0262","维修人员组别不能为空","",""),
+    LACK_REPAIR_PERSONNEL_EMAIL_ERROR("0263","维修人员邮箱不能为空","",""),
+    USER_HAS_NOT_MODIFY_PRIVILEGE("0264","用户没有修改权限","",""),
     ;
     private String code;
     private String msgCn;

+ 228 - 0
src/main/java/com/welampiot/controller/RepairController.java

@@ -0,0 +1,228 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.RepairInfoDTO;
+import com.welampiot.dto.RepairPersonnelDTO;
+import com.welampiot.service.RepairInfoService;
+import com.welampiot.service.RepairPersonnelService;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.RepairInfoVO;
+import com.welampiot.vo.RepairPersonnelDetailsVO;
+import com.welampiot.vo.RepairPersonnelVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Objects;
+
+/**
+ * ClassName: RepairController
+ * Package: com.welampiot.controller
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 10:33
+ * @Version: v1.0
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/repair")
+public class RepairController {
+    @Autowired
+    private RepairPersonnelService repairPersonnelService;
+
+    @Autowired
+    private ToolUtils toolUtils;
+
+    @Autowired
+    private RepairInfoService repairInfoService;
+
+    /**
+     * 获取维修人员列表
+     * @param request 分页、维修人员名称关键字搜索、用户id筛选
+     * @return 维修人员list
+     */
+    @RequestMapping(value = "getList", method = RequestMethod.POST)
+    public BaseResult getList(HttpServletRequest request) {
+        int version = (int) toolUtils.getRequestContent(request,"version",1);
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+        String username = (String) toolUtils.getRequestContent(request,"username",2);
+        String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
+
+        RepairPersonnelDTO dto = new RepairPersonnelDTO();
+        dto.setPage(count * (page - 1));
+        dto.setCount(count);
+        dto.setKeyword(keyword);
+        Integer userId = repairPersonnelService.getUserIdByUsername(username);
+        dto.setOwnId(userId);
+        RepairPersonnelVO repairPersonnelVO = repairPersonnelService.getListByRepairPersonnelDTO(dto);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,repairPersonnelVO);
+    }
+
+    /**
+     * 获取维修人员详情
+     * @param request 维修人员id
+     * @return 维修人员详情对象 RepairPersonnelDetailsVO
+     */
+    @RequestMapping(value = "/details", method = RequestMethod.POST)
+    public BaseResult details(HttpServletRequest request) {
+        int version = (int) toolUtils.getRequestContent(request,"version",1);
+        int userId = (int) toolUtils.getRequestContent(request,"userId",1);
+        if (userId == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        RepairPersonnelDetailsVO repairPersonnelDetailsVO = repairPersonnelService.getDetailsByRepairPersonnelDTO(userId);
+        if (repairPersonnelDetailsVO == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,repairPersonnelDetailsVO);
+    }
+
+    /**
+     * 添加编辑维修人员
+     * @param request 需要添加编辑的维修人员的属性
+     * @return 更新维修人员数据
+     */
+    @RequestMapping(value = "save", method = RequestMethod.POST)
+    public BaseResult save(HttpServletRequest request) {
+        int version = (int) toolUtils.getRequestContent(request,"version",1);
+        int id = (int) toolUtils.getRequestContent(request,"id",1);
+        int groupId = (int) toolUtils.getRequestContent(request,"groupId",1);
+        String name = request.getParameter("name");
+        String section = request.getParameter("section");
+        String email = request.getParameter("email");
+        String phone = request.getParameter("phone");
+        String number = request.getParameter("number");
+        String company = request.getParameter("company");
+        String username = request.getParameter("username");
+
+        RepairPersonnelDTO dto = new RepairPersonnelDTO();
+        dto.setName(name);
+        dto.setNumber(number);
+        dto.setSection(section);
+        dto.setEmail(email);
+        dto.setPhone(phone);
+        dto.setCompany(company);
+        dto.setGroupId(groupId);
+
+        if (id == 0) { // 添加
+            Integer userId = repairPersonnelService.getUserIdByUsername(username);
+            dto.setOwnId(userId);
+            if (name == null || name.length() == 0)
+                return toolUtils.response(InterfaceResultEnum.LACK_REPAIR_PERSONNEL_NAME_ERROR,version);
+            if (number == null || number.length() == 0)
+                return toolUtils.response(InterfaceResultEnum.LACK_REPAIR_PERSONNEL_NUMBER_ERROR,version);
+            if (email == null || email.length() == 0)
+                return toolUtils.response(InterfaceResultEnum.LACK_REPAIR_PERSONNEL_EMAIL_ERROR,version);
+            if (phone == null || phone.length() == 0)
+                return toolUtils.response(InterfaceResultEnum.LACK_REPAIR_PERSONNEL_PHONE_ERROR,version);
+            if (groupId == 0 || String.valueOf(groupId).length() == 0)
+                return toolUtils.response(InterfaceResultEnum.LACK_REPAIR_PERSONNEL_GROUP_ID_ERROR,version);
+
+            RepairPersonnelDTO repairPersonnelDTO = new RepairPersonnelDTO();
+            repairPersonnelDTO.setName(name);
+            repairPersonnelDTO.setOwnId(userId);
+            if (repairPersonnelService.findRepairPersonnelByDTO(repairPersonnelDTO) > 0)
+                return toolUtils.response(InterfaceResultEnum.REPAIR_PERSONNEL_NAME_UNIQUE_ERROR,version);
+            repairPersonnelDTO = new RepairPersonnelDTO();
+            repairPersonnelDTO.setNumber(number);
+            repairPersonnelDTO.setOwnId(userId);
+            if (repairPersonnelService.findRepairPersonnelByDTO(repairPersonnelDTO) > 0)
+                return toolUtils.response(InterfaceResultEnum.REPAIR_PERSONNEL_NUMBER_UNIQUE_ERROR,version);
+            repairPersonnelService.addRepairPersonnelDataByDTO(dto);
+        } else { // 编辑
+            dto.setId(id);
+            Integer userId = repairPersonnelService.getUserIdByUsername(username);
+            dto.setOwnId(userId);
+            Integer userIdById = repairPersonnelService.findUserIdById(id);
+            if (!Objects.equals(userIdById, userId))
+                return toolUtils.response(InterfaceResultEnum.USER_HAS_NOT_MODIFY_PRIVILEGE,version);
+            RepairPersonnelDTO repairPersonnelDTO = new RepairPersonnelDTO();
+            repairPersonnelDTO.setId(id);
+            repairPersonnelDTO.setName(name);
+            repairPersonnelDTO.setOwnId(userId);
+            if (repairPersonnelService.findRepairPersonnelByDTO(repairPersonnelDTO) > 0)
+                return toolUtils.response(InterfaceResultEnum.REPAIR_PERSONNEL_NAME_UNIQUE_ERROR,version);
+            repairPersonnelDTO = new RepairPersonnelDTO();
+            repairPersonnelDTO.setId(id);
+            repairPersonnelDTO.setNumber(number);
+            repairPersonnelDTO.setOwnId(userId);
+            if (repairPersonnelService.findRepairPersonnelByDTO(repairPersonnelDTO) > 0)
+                return toolUtils.response(InterfaceResultEnum.REPAIR_PERSONNEL_NUMBER_UNIQUE_ERROR,version);
+            repairPersonnelService.updateRepairPersonnelDataByDTO(dto);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 删除维修人员
+     * @param request 要删除的维修人员的id
+     * @return 删除成功
+     */
+    @RequestMapping(value = "/del", method = RequestMethod.POST)
+    public BaseResult del(HttpServletRequest request){
+        int version = (int) toolUtils.getRequestContent(request,"version",1);
+        String id = request.getParameter("id");
+        if (id == null || id.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        String[] split = id.split(",");
+        for (String repairPersonnelId : split) {
+            int l = Integer.parseInt(repairPersonnelId);
+            repairPersonnelService.deleteRepairPersonnelDataByDTO(l);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 获取维修记录
+     * @param request 维修人员id
+     * @return 维修记录
+     */
+    @RequestMapping(value = "/repairInfo", method = RequestMethod.POST)
+    public BaseResult repairInfo(HttpServletRequest request) {
+        int version = (int) toolUtils.getRequestContent(request,"version",1);
+        int id = (int) toolUtils.getRequestContent(request,"id",1);
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+
+        RepairInfoDTO dto = new RepairInfoDTO();
+        dto.setRepairUserid(id);
+        dto.setPage(count * (page - 1));
+        dto.setCount(count);
+
+        RepairInfoVO repairInfoVO = repairInfoService.getRepairInfoByDTO(dto);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,repairInfoVO);
+    }
+
+    /**
+     * 获取维修人员下拉列表
+     * @param request 用户id
+     * @return 返回维修人员下拉列表
+     */
+    @RequestMapping(value = "/nav", method = RequestMethod.POST)
+    public BaseResult nav(HttpServletRequest request) {
+        int version = (int) toolUtils.getRequestContent(request,"version",1);
+        String username = request.getParameter("username");
+        Integer id = repairPersonnelService.getUserIdByUsername(username);
+        RepairPersonnelVO repairPersonnelVO = repairPersonnelService.getRepairPersonnelDropDownListByDTO(id);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,repairPersonnelVO);
+    }
+
+    /**
+     * 删除维修记录
+     * @param request 要删除的维修记录的id
+     * @return 操作成功
+     */
+    @RequestMapping(value = "/delInfo", method = RequestMethod.POST)
+    public BaseResult delInfo(HttpServletRequest request) {
+        int version = (int) toolUtils.getRequestContent(request,"version",1);
+        String id = request.getParameter("id");
+        if (id == null || id.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        String[] split = id.split(",");
+        for (String repairInfoId : split) {
+            int l = Integer.parseInt(repairInfoId);
+            repairInfoService.deleteRepairInfoDataById(l);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+}

+ 21 - 0
src/main/java/com/welampiot/dao/RepairInfoDao.java

@@ -0,0 +1,21 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.RepairInfoDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: RepairInfoDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 19:18
+ * @Version: v1.0
+ */
+public interface RepairInfoDao {
+    List<RepairInfoDTO> getRepairInfoByDTO(RepairInfoDTO dto);
+
+    void deleteRepairInfoDataById(@Param("id") Integer id);
+}

+ 35 - 0
src/main/java/com/welampiot/dao/RepairPersonnelDao.java

@@ -0,0 +1,35 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.RepairPersonnelDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: RepairPersonnelDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 10:19
+ * @Version: v1.0
+ */
+public interface RepairPersonnelDao {
+    List<RepairPersonnelDTO> getListByRepairPersonnelDTO(RepairPersonnelDTO dto);
+
+    Integer getUserIdByUsername(@Param("username") String username);
+
+    RepairPersonnelDTO getDetailsByRepairPersonnelDTO(@Param("id") Integer id);
+
+    void addRepairPersonnelDataByDTO(RepairPersonnelDTO dto);
+
+    void updateRepairPersonnelDataByDTO(RepairPersonnelDTO dto);
+
+    Integer findRepairPersonnelByDTO(RepairPersonnelDTO dto);
+
+    Integer findUserIdById(@Param("id") Integer id);
+
+    void deleteRepairPersonnelDataByDTO(@Param("id") Integer id);
+
+    List<RepairPersonnelDTO> getRepairPersonnelDropDownListByDTO(@Param("id") Integer id);
+}

+ 55 - 0
src/main/java/com/welampiot/dto/RepairInfoDTO.java

@@ -0,0 +1,55 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: RepairInfoDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 18:24
+ * @Version: v1.0
+ */
+@Data
+public class RepairInfoDTO implements Serializable {
+    /** 维修信息流水id **/
+    private Integer id;
+
+    /** 维修人员id **/
+    private Integer repairUserid;
+
+    /** 行政区 **/
+    private String area;
+
+    /** 路段 **/
+    private String section;
+
+    /** 故障id **/
+    private Integer alarmId;
+
+    /** 路灯id **/
+    private Integer lampId;
+
+    /** 维修人员名称 **/
+    private String username;
+
+    /** 故障类型 **/
+    private String alarmType;
+
+    /** 故障时间 **/
+    private String alarmTime;
+
+    /** 维修时间 **/
+    private String repairTime;
+
+    private String number;
+
+    private Integer page;
+
+    private Integer count;
+
+    private static final long serialVersionUID = 1L;
+}

+ 61 - 0
src/main/java/com/welampiot/dto/RepairPersonnelDTO.java

@@ -0,0 +1,61 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: RepairPersonnelDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 9:41
+ * @Version: v1.0
+ */
+@Data
+public class RepairPersonnelDTO implements Serializable {
+    /** 主键 **/
+    private Integer id;
+
+    /** 创建人id **/
+    private Integer ownId;
+
+    /** 姓名 **/
+    private String name;
+
+    /** 部门 **/
+    private String section;
+
+    /** 邮箱 **/
+    private String email;
+
+    /** 手机 **/
+    private String phone;
+
+    /** 工号 **/
+    private String number;
+
+    /** 公司名称 **/
+    private String company;
+
+    /** 登录账号 **/
+    private String username;
+
+    /** 登录密码 **/
+    private String password;
+
+    /** 角色 **/
+    private Integer role;
+
+    /** 分组id **/
+    private Integer groupId;
+
+    private Integer page;
+
+    private Integer count;
+
+    private String keyword;
+
+    private static final long serialVersionUID = 1L;
+}

+ 19 - 0
src/main/java/com/welampiot/service/RepairInfoService.java

@@ -0,0 +1,19 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.RepairInfoDTO;
+import com.welampiot.vo.RepairInfoVO;
+
+/**
+ * ClassName: RepairInfoService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 19:20
+ * @Version: v1.0
+ */
+public interface RepairInfoService {
+    RepairInfoVO getRepairInfoByDTO(RepairInfoDTO dto);
+
+    void deleteRepairInfoDataById(Integer id);
+}

+ 35 - 0
src/main/java/com/welampiot/service/RepairPersonnelService.java

@@ -0,0 +1,35 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.RepairPersonnelDTO;
+import com.welampiot.vo.RepairPersonnelDetailsVO;
+import com.welampiot.vo.RepairPersonnelVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * ClassName: RepairPersonnelService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 10:21
+ * @Version: v1.0
+ */
+public interface RepairPersonnelService {
+    RepairPersonnelVO getListByRepairPersonnelDTO(RepairPersonnelDTO dto);
+
+    Integer getUserIdByUsername(String username);
+
+    RepairPersonnelDetailsVO getDetailsByRepairPersonnelDTO(@Param("id") Integer id);
+
+    void addRepairPersonnelDataByDTO(RepairPersonnelDTO dto);
+
+    void updateRepairPersonnelDataByDTO(RepairPersonnelDTO dto);
+
+    Integer findRepairPersonnelByDTO(RepairPersonnelDTO dto);
+
+    Integer findUserIdById(@Param("id") Integer id);
+
+    void deleteRepairPersonnelDataByDTO(@Param("id") Integer id);
+
+    RepairPersonnelVO getRepairPersonnelDropDownListByDTO(Integer id);
+}

+ 70 - 0
src/main/java/com/welampiot/service/impl/RepairInfoServiceImpl.java

@@ -0,0 +1,70 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.RepairInfoDao;
+import com.welampiot.dto.RepairInfoDTO;
+import com.welampiot.service.RepairInfoService;
+import com.welampiot.vo.RepairInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ClassName: RepairInfoServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 19:20
+ * @Version: v1.0
+ */
+@Service
+public class RepairInfoServiceImpl implements RepairInfoService {
+    @Autowired
+    private RepairInfoDao repairInfoDao;
+
+    @Override
+    public RepairInfoVO getRepairInfoByDTO(RepairInfoDTO dto) {
+        RepairInfoVO vo = new RepairInfoVO();
+        List<RepairInfoDTO> repairInfoByDTO = repairInfoDao.getRepairInfoByDTO(dto);
+        List<RepairInfoDTO> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        repairInfoByDTO.forEach(repairInfoDTO -> {
+            if (repairInfoDTO.getNumber() == null) {
+                repairInfoDTO.setNumber("000000");
+            }
+            if (repairInfoDTO.getAlarmType() == null) {
+                repairInfoDTO.setAlarmType("");
+            }
+            if (repairInfoDTO.getAlarmTime() != null && !repairInfoDTO.getAlarmTime().equals("")) {
+                try {
+                    repairInfoDTO.setAlarmTime(simpleDateFormat.format(simpleDateFormat.parse(repairInfoDTO.getAlarmTime())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            } else {
+                repairInfoDTO.setAlarmTime("");
+            }
+            if (repairInfoDTO.getRepairTime() != null && !repairInfoDTO.getRepairTime().equals("")) {
+                try {
+                    repairInfoDTO.setRepairTime(simpleDateFormat.format(simpleDateFormat.parse(repairInfoDTO.getRepairTime())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            } else {
+                repairInfoDTO.setRepairTime("");
+            }
+            list.add(repairInfoDTO);
+        });
+        vo.setList(list);
+        return vo;
+    }
+
+    @Override
+    public void deleteRepairInfoDataById(Integer id) {
+        repairInfoDao.deleteRepairInfoDataById(id);
+    }
+}

+ 83 - 0
src/main/java/com/welampiot/service/impl/RepairPersonnelServiceImpl.java

@@ -0,0 +1,83 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.RepairPersonnelDao;
+import com.welampiot.dto.RepairPersonnelDTO;
+import com.welampiot.service.RepairPersonnelService;
+import com.welampiot.vo.RepairPersonnelDetailsVO;
+import com.welampiot.vo.RepairPersonnelVO;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: RepairPersonnelServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 10:22
+ * @Version: v1.0
+ */
+@Service
+public class RepairPersonnelServiceImpl implements RepairPersonnelService {
+    @Autowired
+    private RepairPersonnelDao repairPersonnelDao;
+
+    @Override
+    public RepairPersonnelVO getListByRepairPersonnelDTO(RepairPersonnelDTO dto) {
+        RepairPersonnelVO vo = new RepairPersonnelVO();
+        List<RepairPersonnelDTO> listByRepairPersonnelDTO = repairPersonnelDao.getListByRepairPersonnelDTO(dto);
+        vo.setList(listByRepairPersonnelDTO);
+        return vo;
+    }
+
+    @Override
+    public Integer getUserIdByUsername(String username) {
+        return repairPersonnelDao.getUserIdByUsername(username);
+    }
+
+    @Override
+    public RepairPersonnelDetailsVO getDetailsByRepairPersonnelDTO(Integer id) {
+        RepairPersonnelDetailsVO repairPersonnelDetailsVO = new RepairPersonnelDetailsVO();
+        RepairPersonnelDTO detailsPersonnelDTO = repairPersonnelDao.getDetailsByRepairPersonnelDTO(id);
+        if (detailsPersonnelDTO == null) return null;
+        BeanUtils.copyProperties(detailsPersonnelDTO,repairPersonnelDetailsVO);
+        repairPersonnelDetailsVO.setId(detailsPersonnelDTO.getId().toString());
+        return repairPersonnelDetailsVO;
+    }
+
+    @Override
+    public void addRepairPersonnelDataByDTO(RepairPersonnelDTO dto) {
+        repairPersonnelDao.addRepairPersonnelDataByDTO(dto);
+    }
+
+    @Override
+    public void updateRepairPersonnelDataByDTO(RepairPersonnelDTO dto) {
+        repairPersonnelDao.updateRepairPersonnelDataByDTO(dto);
+    }
+
+    @Override
+    public Integer findRepairPersonnelByDTO(RepairPersonnelDTO dto) {
+        return repairPersonnelDao.findRepairPersonnelByDTO(dto);
+    }
+
+    @Override
+    public Integer findUserIdById(Integer id) {
+        return repairPersonnelDao.findUserIdById(id);
+    }
+
+    @Override
+    public void deleteRepairPersonnelDataByDTO(Integer id) {
+        repairPersonnelDao.deleteRepairPersonnelDataByDTO(id);
+    }
+
+    @Override
+    public RepairPersonnelVO getRepairPersonnelDropDownListByDTO(Integer id) {
+        RepairPersonnelVO vo = new RepairPersonnelVO();
+        List<RepairPersonnelDTO> dropDownListByDTO = repairPersonnelDao.getRepairPersonnelDropDownListByDTO(id);
+        vo.setList(dropDownListByDTO);
+        return vo;
+    }
+}

+ 24 - 0
src/main/java/com/welampiot/vo/RepairInfoVO.java

@@ -0,0 +1,24 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.RepairInfoDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: RepairInfoVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 19:20
+ * @Version: v1.0
+ */
+@Data
+public class RepairInfoVO implements Serializable {
+
+    private List<RepairInfoDTO> list;
+
+    private static final long serialVersionUID = 1L;
+}

+ 49 - 0
src/main/java/com/welampiot/vo/RepairPersonnelDetailsVO.java

@@ -0,0 +1,49 @@
+package com.welampiot.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: RepairPersonnelDetailsVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 11:23
+ * @Version: v1.0
+ */
+@Data
+public class RepairPersonnelDetailsVO implements Serializable {
+    /** 主键 **/
+    private String id;
+
+    /** 创建人id **/
+    private String ownId;
+
+    /** 姓名 **/
+    private String name;
+
+    /** 部门 **/
+    private String section;
+
+    /** 邮箱 **/
+    private String email;
+
+    /** 手机 **/
+    private String phone;
+
+    /** 工号 **/
+    private String number;
+
+    /** 公司名称 **/
+    private String company;
+
+    /** 登录账号 **/
+    private String username;
+
+    /** 登录密码 **/
+    private String password;
+
+    private static final long serialVersionUID = 1L;
+}

+ 24 - 0
src/main/java/com/welampiot/vo/RepairPersonnelVO.java

@@ -0,0 +1,24 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.RepairPersonnelDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: RepairPersonnelVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/5/16 - 10:22
+ * @Version: v1.0
+ */
+@Data
+public class RepairPersonnelVO implements Serializable {
+
+    private List<RepairPersonnelDTO> list;
+
+    private static final long serialVersionUID = 1L;
+}

+ 20 - 0
src/main/resources/mapper/RepairInfoMapper.xml

@@ -0,0 +1,20 @@
+<?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.welampiot.dao.RepairInfoDao">
+
+    <select id="getRepairInfoByDTO" resultType="RepairInfoDTO">
+        select r.id,r.alarm_type alarmType,r.alarm_time alarmTime,r.area,r.section,r.repair_time repairTime,l.number
+        from repair_info r left join lampinfo l on r.lampid = l.id
+        where r.repair_userid = #{repairUserid}
+        <if test="page >= 0 and count > 0">
+            limit #{page},#{count}
+        </if>
+    </select>
+
+    <delete id="deleteRepairInfoDataById">
+        delete
+        from repair_info
+        where id = #{id};
+    </delete>
+    
+</mapper>

+ 88 - 0
src/main/resources/mapper/RepairPersonnelMapper.xml

@@ -0,0 +1,88 @@
+<?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.welampiot.dao.RepairPersonnelDao">
+
+    <select id="getListByRepairPersonnelDTO" resultType="com.welampiot.dto.RepairPersonnelDTO">
+        select r.id,r.name,r.section,r.email,r.phone,r.number,r.company,r.username
+        from repair_personnel r
+        where r.own_id = #{ownId}
+            <if test="keyword != null and keyword != ''">
+                and r.name like '%${keyword}%'
+            </if>
+            order by convert(r.name using gbk) asc,r.id desc
+            <if test="page >= 0 and count > 0">
+                limit #{page},#{count}
+            </if>
+    </select>
+
+    <!-- 根据用户名查出对应的用户id -->
+    <select id="getUserIdByUsername" resultType="Integer">
+        select u.id
+        from `user` u
+        where u.username = #{username}
+    </select>
+
+    <!-- 编辑时根据要编辑的id查出对应的用户id -->
+    <select id="findUserIdById" resultType="Integer">
+        select r.own_id
+        from repair_personnel r
+        where r.id = #{id}
+    </select>
+
+    <select id="getDetailsByRepairPersonnelDTO" resultType="com.welampiot.dto.RepairPersonnelDTO">
+        select r.id,r.name,r.section,r.email,r.phone,r.number,r.company
+        from repair_personnel r
+        where r.id = #{id}
+    </select>
+    
+    <insert id="addRepairPersonnelDataByDTO" parameterType="com.welampiot.dto.RepairPersonnelDTO" keyProperty="id" useGeneratedKeys="true">
+        insert into
+            repair_personnel(`name`,own_id,section,email,phone,`number`,company,groupid)
+        values
+            (#{name},#{ownId},#{section},#{email},#{phone},#{number},#{company},#{groupId})
+    </insert>
+
+    <update id="updateRepairPersonnelDataByDTO" parameterType="com.welampiot.dto.RepairPersonnelDTO">
+        update repair_personnel
+        set
+            `name` = #{name},
+            section = #{section},
+            email = #{email},
+            phone = #{phone},
+            `number` = #{number},
+            company = #{company},
+            groupid = #{groupId}
+        where id = #{id} and own_id = #{ownId}
+    </update>
+
+    <select id="findRepairPersonnelByDTO" resultType="Integer">
+        select count(*)
+        from `repair_personnel` r
+        where 1=1
+        <if test="ownId != null">
+            and r.own_id = #{ownId}
+        </if>
+        <if test="name != null">
+            and r.name = #{name}
+        </if>
+        <if test="number != null">
+            and r.number = #{number}
+        </if>
+        <if test="id != null">
+            and r.id != #{id}
+        </if>
+    </select>
+    
+    <delete id="deleteRepairPersonnelDataByDTO">
+        delete
+        from repair_personnel
+        where id = #{id};
+    </delete>
+
+    <select id="getRepairPersonnelDropDownListByDTO" resultType="com.welampiot.dto.RepairPersonnelDTO">
+        select r.id,r.name
+        from repair_personnel r
+        where r.own_id = #{id}
+    </select>
+    
+</mapper>