change - add员工打卡记录

main
yinq 6 months ago
parent 644cddc469
commit ae102e7f75

@ -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<RecordStaffAttendance> 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<RecordStaffAttendance> list = recordStaffAttendanceService.selectRecordStaffAttendanceList(recordStaffAttendance);
ExcelUtil<RecordStaffAttendance> util = new ExcelUtil<RecordStaffAttendance>(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));
}
}

@ -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();
}
}

@ -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<RecordStaffAttendance> 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);
}

@ -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<RecordStaffAttendance> 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);
}

@ -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<RecordStaffAttendance> 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);
}
}

@ -0,0 +1,102 @@
<?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.os.mes.record.mapper.RecordStaffAttendanceMapper">
<resultMap type="RecordStaffAttendance" id="RecordStaffAttendanceResult">
<result property="objId" column="obj_id" />
<result property="staffId" column="staff_id" />
<result property="attendanceType" column="attendance_type" />
<result property="teamCode" column="team_code" />
<result property="classes" column="classes" />
<result property="remark" column="remark" />
<result property="isFlag" column="is_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="machineCode" column="machine_code" />
</resultMap>
<sql id="selectRecordStaffAttendanceVo">
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
</sql>
<select id="selectRecordStaffAttendanceList" parameterType="RecordStaffAttendance" resultMap="RecordStaffAttendanceResult">
<include refid="selectRecordStaffAttendanceVo"/>
<where>
<if test="staffId != null and staffId != ''"> and staff_id = #{staffId}</if>
<if test="attendanceType != null and attendanceType != ''"> and attendance_type = #{attendanceType}</if>
<if test="teamCode != null and teamCode != ''"> and team_code = #{teamCode}</if>
<if test="classes != null and classes != ''"> and classes = #{classes}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="machineCode != null and machineCode != ''"> and machine_code = #{machineCode}</if>
</where>
</select>
<select id="selectRecordStaffAttendanceByObjId" parameterType="Long" resultMap="RecordStaffAttendanceResult">
<include refid="selectRecordStaffAttendanceVo"/>
where obj_id = #{objId}
</select>
<insert id="insertRecordStaffAttendance" parameterType="RecordStaffAttendance" useGeneratedKeys="true" keyProperty="objId">
insert into record_staff_attendance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="staffId != null">staff_id,</if>
<if test="attendanceType != null">attendance_type,</if>
<if test="teamCode != null">team_code,</if>
<if test="classes != null">classes,</if>
<if test="remark != null">remark,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="machineCode != null">machine_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="staffId != null">#{staffId},</if>
<if test="attendanceType != null">#{attendanceType},</if>
<if test="teamCode != null">#{teamCode},</if>
<if test="classes != null">#{classes},</if>
<if test="remark != null">#{remark},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="machineCode != null">#{machineCode},</if>
</trim>
</insert>
<update id="updateRecordStaffAttendance" parameterType="RecordStaffAttendance">
update record_staff_attendance
<trim prefix="SET" suffixOverrides=",">
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="attendanceType != null">attendance_type = #{attendanceType},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="classes != null">classes = #{classes},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="machineCode != null">machine_code = #{machineCode},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteRecordStaffAttendanceByObjId" parameterType="Long">
delete from record_staff_attendance where obj_id = #{objId}
</delete>
<delete id="deleteRecordStaffAttendanceByObjIds" parameterType="String">
delete from record_staff_attendance where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save