diff --git a/os-mes/src/main/java/com/os/mes/record/controller/RecordStaffAttendanceController.java b/os-mes/src/main/java/com/os/mes/record/controller/RecordStaffAttendanceController.java new file mode 100644 index 0000000..d321de0 --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/record/controller/RecordStaffAttendanceController.java @@ -0,0 +1,100 @@ +package com.os.mes.record.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.os.common.annotation.Log; +import com.os.common.core.controller.BaseController; +import com.os.common.core.domain.AjaxResult; +import com.os.common.enums.BusinessType; +import com.os.mes.record.domain.RecordStaffAttendance; +import com.os.mes.record.service.IRecordStaffAttendanceService; +import com.os.common.utils.poi.ExcelUtil; +import com.os.common.core.page.TableDataInfo; + +/** + * 员工打卡记录Controller + * + * @author Yinq + * @date 2024-05-24 + */ +@RestController +@RequestMapping("/mes/record/recordStaffAttendance") +public class RecordStaffAttendanceController extends BaseController { + @Autowired + private IRecordStaffAttendanceService recordStaffAttendanceService; + + /** + * 查询员工打卡记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes/record:recordStaffAttendance:list')") + @GetMapping("/list") + public TableDataInfo list(RecordStaffAttendance recordStaffAttendance) { + startPage(); + List list = recordStaffAttendanceService.selectRecordStaffAttendanceList(recordStaffAttendance); + return getDataTable(list); + } + + /** + * 导出员工打卡记录列表 + */ + @PreAuthorize("@ss.hasPermi('mes/record:recordStaffAttendance:export')") + @Log(title = "员工打卡记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, RecordStaffAttendance recordStaffAttendance) { + List list = recordStaffAttendanceService.selectRecordStaffAttendanceList(recordStaffAttendance); + ExcelUtil util = new ExcelUtil(RecordStaffAttendance.class); + util.exportExcel(response, list, "员工打卡记录数据"); + } + + /** + * 获取员工打卡记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes/record:recordStaffAttendance:query')") + @GetMapping(value = "/{objId}") + public AjaxResult getInfo(@PathVariable("objId") Long objId) { + return success(recordStaffAttendanceService.selectRecordStaffAttendanceByObjId(objId)); + } + + /** + * 新增员工打卡记录 + */ + @PreAuthorize("@ss.hasPermi('mes/record:recordStaffAttendance:add')") + @Log(title = "员工打卡记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody RecordStaffAttendance recordStaffAttendance) { + recordStaffAttendance.setCreateBy(getUsername()); + return toAjax(recordStaffAttendanceService.insertRecordStaffAttendance(recordStaffAttendance)); + } + + /** + * 修改员工打卡记录 + */ + @PreAuthorize("@ss.hasPermi('mes/record:recordStaffAttendance:edit')") + @Log(title = "员工打卡记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody RecordStaffAttendance recordStaffAttendance) { + recordStaffAttendance.setUpdateBy(getUsername()); + return toAjax(recordStaffAttendanceService.updateRecordStaffAttendance(recordStaffAttendance)); + } + + /** + * 删除员工打卡记录 + */ + @PreAuthorize("@ss.hasPermi('mes/record:recordStaffAttendance:remove')") + @Log(title = "员工打卡记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}") + public AjaxResult remove(@PathVariable Long[] objIds) { + return toAjax(recordStaffAttendanceService.deleteRecordStaffAttendanceByObjIds(objIds)); + } +} diff --git a/os-mes/src/main/java/com/os/mes/record/domain/RecordStaffAttendance.java b/os-mes/src/main/java/com/os/mes/record/domain/RecordStaffAttendance.java new file mode 100644 index 0000000..469f61c --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/record/domain/RecordStaffAttendance.java @@ -0,0 +1,131 @@ +package com.os.mes.record.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.os.common.annotation.Excel; +import com.os.common.core.domain.BaseEntity; + +/** + * 员工打卡记录对象 record_staff_attendance + * + * @author Yinq + * @date 2024-05-24 + */ +public class RecordStaffAttendance extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + private Long objId; + + /** + * 员工ID + */ + @Excel(name = "员工ID") + private String staffId; + + /** + * 打卡类型(0上班 1下班) + */ + @Excel(name = "打卡类型", readConverterExp = "0=上班,1=下班") + private String attendanceType; + + /** + * 班组编号 + */ + @Excel(name = "班组编号") + private String teamCode; + + /** + * 班次(1早班 2晚班) + */ + @Excel(name = "班次", readConverterExp = "1=早班,2=晚班") + private String classes; + + /** + * 是否标识 + */ + @Excel(name = "是否标识") + private String isFlag; + + /** + * 机台编号 + */ + @Excel(name = "机台编号") + private String machineCode; + + public void setObjId(Long objId) { + this.objId = objId; + } + + public Long getObjId() { + return objId; + } + + public void setStaffId(String staffId) { + this.staffId = staffId; + } + + public String getStaffId() { + return staffId; + } + + public void setAttendanceType(String attendanceType) { + this.attendanceType = attendanceType; + } + + public String getAttendanceType() { + return attendanceType; + } + + public void setTeamCode(String teamCode) { + this.teamCode = teamCode; + } + + public String getTeamCode() { + return teamCode; + } + + public void setClasses(String classes) { + this.classes = classes; + } + + public String getClasses() { + return classes; + } + + public void setIsFlag(String isFlag) { + this.isFlag = isFlag; + } + + public String getIsFlag() { + return isFlag; + } + + public void setMachineCode(String machineCode) { + this.machineCode = machineCode; + } + + public String getMachineCode() { + return machineCode; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("staffId", getStaffId()) + .append("attendanceType", getAttendanceType()) + .append("teamCode", getTeamCode()) + .append("classes", getClasses()) + .append("remark", getRemark()) + .append("isFlag", getIsFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("machineCode", getMachineCode()) + .toString(); + } +} diff --git a/os-mes/src/main/java/com/os/mes/record/mapper/RecordStaffAttendanceMapper.java b/os-mes/src/main/java/com/os/mes/record/mapper/RecordStaffAttendanceMapper.java new file mode 100644 index 0000000..3b62a46 --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/record/mapper/RecordStaffAttendanceMapper.java @@ -0,0 +1,61 @@ +package com.os.mes.record.mapper; + +import java.util.List; +import com.os.mes.record.domain.RecordStaffAttendance; + +/** + * 员工打卡记录Mapper接口 + * + * @author Yinq + * @date 2024-05-24 + */ +public interface RecordStaffAttendanceMapper +{ + /** + * 查询员工打卡记录 + * + * @param objId 员工打卡记录主键 + * @return 员工打卡记录 + */ + public RecordStaffAttendance selectRecordStaffAttendanceByObjId(Long objId); + + /** + * 查询员工打卡记录列表 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 员工打卡记录集合 + */ + public List selectRecordStaffAttendanceList(RecordStaffAttendance recordStaffAttendance); + + /** + * 新增员工打卡记录 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 结果 + */ + public int insertRecordStaffAttendance(RecordStaffAttendance recordStaffAttendance); + + /** + * 修改员工打卡记录 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 结果 + */ + public int updateRecordStaffAttendance(RecordStaffAttendance recordStaffAttendance); + + /** + * 删除员工打卡记录 + * + * @param objId 员工打卡记录主键 + * @return 结果 + */ + public int deleteRecordStaffAttendanceByObjId(Long objId); + + /** + * 批量删除员工打卡记录 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteRecordStaffAttendanceByObjIds(Long[] objIds); +} diff --git a/os-mes/src/main/java/com/os/mes/record/service/IRecordStaffAttendanceService.java b/os-mes/src/main/java/com/os/mes/record/service/IRecordStaffAttendanceService.java new file mode 100644 index 0000000..b5784af --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/record/service/IRecordStaffAttendanceService.java @@ -0,0 +1,61 @@ +package com.os.mes.record.service; + +import java.util.List; + +import com.os.mes.record.domain.RecordStaffAttendance; + +/** + * 员工打卡记录Service接口 + * + * @author Yinq + * @date 2024-05-24 + */ +public interface IRecordStaffAttendanceService { + /** + * 查询员工打卡记录 + * + * @param objId 员工打卡记录主键 + * @return 员工打卡记录 + */ + public RecordStaffAttendance selectRecordStaffAttendanceByObjId(Long objId); + + /** + * 查询员工打卡记录列表 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 员工打卡记录集合 + */ + public List selectRecordStaffAttendanceList(RecordStaffAttendance recordStaffAttendance); + + /** + * 新增员工打卡记录 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 结果 + */ + public int insertRecordStaffAttendance(RecordStaffAttendance recordStaffAttendance); + + /** + * 修改员工打卡记录 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 结果 + */ + public int updateRecordStaffAttendance(RecordStaffAttendance recordStaffAttendance); + + /** + * 批量删除员工打卡记录 + * + * @param objIds 需要删除的员工打卡记录主键集合 + * @return 结果 + */ + public int deleteRecordStaffAttendanceByObjIds(Long[] objIds); + + /** + * 删除员工打卡记录信息 + * + * @param objId 员工打卡记录主键 + * @return 结果 + */ + public int deleteRecordStaffAttendanceByObjId(Long objId); +} diff --git a/os-mes/src/main/java/com/os/mes/record/service/impl/RecordStaffAttendanceServiceImpl.java b/os-mes/src/main/java/com/os/mes/record/service/impl/RecordStaffAttendanceServiceImpl.java new file mode 100644 index 0000000..c4f9e9f --- /dev/null +++ b/os-mes/src/main/java/com/os/mes/record/service/impl/RecordStaffAttendanceServiceImpl.java @@ -0,0 +1,90 @@ +package com.os.mes.record.service.impl; + +import java.util.List; + +import com.os.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.os.mes.record.mapper.RecordStaffAttendanceMapper; +import com.os.mes.record.domain.RecordStaffAttendance; +import com.os.mes.record.service.IRecordStaffAttendanceService; + +/** + * 员工打卡记录Service业务层处理 + * + * @author Yinq + * @date 2024-05-24 + */ +@Service +public class RecordStaffAttendanceServiceImpl implements IRecordStaffAttendanceService { + @Autowired + private RecordStaffAttendanceMapper recordStaffAttendanceMapper; + + /** + * 查询员工打卡记录 + * + * @param objId 员工打卡记录主键 + * @return 员工打卡记录 + */ + @Override + public RecordStaffAttendance selectRecordStaffAttendanceByObjId(Long objId) { + return recordStaffAttendanceMapper.selectRecordStaffAttendanceByObjId(objId); + } + + /** + * 查询员工打卡记录列表 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 员工打卡记录 + */ + @Override + public List selectRecordStaffAttendanceList(RecordStaffAttendance recordStaffAttendance) { + return recordStaffAttendanceMapper.selectRecordStaffAttendanceList(recordStaffAttendance); + } + + /** + * 新增员工打卡记录 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 结果 + */ + @Override + public int insertRecordStaffAttendance(RecordStaffAttendance recordStaffAttendance) { + recordStaffAttendance.setCreateTime(DateUtils.getNowDate()); + return recordStaffAttendanceMapper.insertRecordStaffAttendance(recordStaffAttendance); + } + + /** + * 修改员工打卡记录 + * + * @param recordStaffAttendance 员工打卡记录 + * @return 结果 + */ + @Override + public int updateRecordStaffAttendance(RecordStaffAttendance recordStaffAttendance) { + recordStaffAttendance.setUpdateTime(DateUtils.getNowDate()); + return recordStaffAttendanceMapper.updateRecordStaffAttendance(recordStaffAttendance); + } + + /** + * 批量删除员工打卡记录 + * + * @param objIds 需要删除的员工打卡记录主键 + * @return 结果 + */ + @Override + public int deleteRecordStaffAttendanceByObjIds(Long[] objIds) { + return recordStaffAttendanceMapper.deleteRecordStaffAttendanceByObjIds(objIds); + } + + /** + * 删除员工打卡记录信息 + * + * @param objId 员工打卡记录主键 + * @return 结果 + */ + @Override + public int deleteRecordStaffAttendanceByObjId(Long objId) { + return recordStaffAttendanceMapper.deleteRecordStaffAttendanceByObjId(objId); + } +} diff --git a/os-mes/src/main/resources/mapper/mes/record/RecordStaffAttendanceMapper.xml b/os-mes/src/main/resources/mapper/mes/record/RecordStaffAttendanceMapper.xml new file mode 100644 index 0000000..bed9739 --- /dev/null +++ b/os-mes/src/main/resources/mapper/mes/record/RecordStaffAttendanceMapper.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + select obj_id, staff_id, attendance_type, team_code, classes, remark, is_flag, create_by, create_time, update_by, update_time, machine_code from record_staff_attendance + + + + + + + + insert into record_staff_attendance + + staff_id, + attendance_type, + team_code, + classes, + remark, + is_flag, + create_by, + create_time, + update_by, + update_time, + machine_code, + + + #{staffId}, + #{attendanceType}, + #{teamCode}, + #{classes}, + #{remark}, + #{isFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{machineCode}, + + + + + update record_staff_attendance + + staff_id = #{staffId}, + attendance_type = #{attendanceType}, + team_code = #{teamCode}, + classes = #{classes}, + remark = #{remark}, + is_flag = #{isFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + machine_code = #{machineCode}, + + where obj_id = #{objId} + + + + delete from record_staff_attendance where obj_id = #{objId} + + + + delete from record_staff_attendance where obj_id in + + #{objId} + + + \ No newline at end of file