change - add员工打卡记录
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,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…
Reference in New Issue