change - add员工上下班记录
parent
629c9f18d2
commit
df167fbb8f
@ -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.RecordStaffCommute;
|
||||
import com.os.mes.record.service.IRecordStaffCommuteService;
|
||||
import com.os.common.utils.poi.ExcelUtil;
|
||||
import com.os.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 员工上下班记录Controller
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-07-01
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mes/record/recordStaffCommute")
|
||||
public class RecordStaffCommuteController extends BaseController {
|
||||
@Autowired
|
||||
private IRecordStaffCommuteService recordStaffCommuteService;
|
||||
|
||||
/**
|
||||
* 查询员工上下班记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RecordStaffCommute recordStaffCommute) {
|
||||
startPage();
|
||||
List<RecordStaffCommute> list = recordStaffCommuteService.selectRecordStaffCommuteList(recordStaffCommute);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出员工上下班记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:export')")
|
||||
@Log(title = "员工上下班记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RecordStaffCommute recordStaffCommute) {
|
||||
List<RecordStaffCommute> list = recordStaffCommuteService.selectRecordStaffCommuteList(recordStaffCommute);
|
||||
ExcelUtil<RecordStaffCommute> util = new ExcelUtil<RecordStaffCommute>(RecordStaffCommute.class);
|
||||
util.exportExcel(response, list, "员工上下班记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工上下班记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:query')")
|
||||
@GetMapping(value = "/{objId}")
|
||||
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
|
||||
return success(recordStaffCommuteService.selectRecordStaffCommuteByObjId(objId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增员工上下班记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:add')")
|
||||
@Log(title = "员工上下班记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RecordStaffCommute recordStaffCommute) {
|
||||
recordStaffCommute.setCreateBy(getUsername());
|
||||
return toAjax(recordStaffCommuteService.insertRecordStaffCommute(recordStaffCommute));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改员工上下班记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:edit')")
|
||||
@Log(title = "员工上下班记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RecordStaffCommute recordStaffCommute) {
|
||||
recordStaffCommute.setUpdateBy(getUsername());
|
||||
return toAjax(recordStaffCommuteService.updateRecordStaffCommute(recordStaffCommute));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工上下班记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:remove')")
|
||||
@Log(title = "员工上下班记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{objIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] objIds) {
|
||||
return toAjax(recordStaffCommuteService.deleteRecordStaffCommuteByObjIds(objIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.os.mes.record.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.os.mes.record.domain.RecordStaffCommute;
|
||||
|
||||
/**
|
||||
* 员工上下班记录Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-07-01
|
||||
*/
|
||||
public interface RecordStaffCommuteMapper {
|
||||
/**
|
||||
* 查询员工上下班记录
|
||||
*
|
||||
* @param objId 员工上下班记录主键
|
||||
* @return 员工上下班记录
|
||||
*/
|
||||
public RecordStaffCommute selectRecordStaffCommuteByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询员工上下班记录列表
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 员工上下班记录集合
|
||||
*/
|
||||
public List<RecordStaffCommute> selectRecordStaffCommuteList(RecordStaffCommute recordStaffCommute);
|
||||
|
||||
/**
|
||||
* 新增员工上下班记录
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRecordStaffCommute(RecordStaffCommute recordStaffCommute);
|
||||
|
||||
/**
|
||||
* 修改员工上下班记录
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRecordStaffCommute(RecordStaffCommute recordStaffCommute);
|
||||
|
||||
/**
|
||||
* 删除员工上下班记录
|
||||
*
|
||||
* @param objId 员工上下班记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordStaffCommuteByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除员工上下班记录
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordStaffCommuteByObjIds(Long[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.os.mes.record.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.os.mes.record.domain.RecordStaffCommute;
|
||||
|
||||
/**
|
||||
* 员工上下班记录Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-07-01
|
||||
*/
|
||||
public interface IRecordStaffCommuteService {
|
||||
/**
|
||||
* 查询员工上下班记录
|
||||
*
|
||||
* @param objId 员工上下班记录主键
|
||||
* @return 员工上下班记录
|
||||
*/
|
||||
public RecordStaffCommute selectRecordStaffCommuteByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询员工上下班记录列表
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 员工上下班记录集合
|
||||
*/
|
||||
public List<RecordStaffCommute> selectRecordStaffCommuteList(RecordStaffCommute recordStaffCommute);
|
||||
|
||||
/**
|
||||
* 新增员工上下班记录
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRecordStaffCommute(RecordStaffCommute recordStaffCommute);
|
||||
|
||||
/**
|
||||
* 修改员工上下班记录
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRecordStaffCommute(RecordStaffCommute recordStaffCommute);
|
||||
|
||||
/**
|
||||
* 批量删除员工上下班记录
|
||||
*
|
||||
* @param objIds 需要删除的员工上下班记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordStaffCommuteByObjIds(Long[] objIds);
|
||||
|
||||
/**
|
||||
* 删除员工上下班记录信息
|
||||
*
|
||||
* @param objId 员工上下班记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordStaffCommuteByObjId(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.RecordStaffCommuteMapper;
|
||||
import com.os.mes.record.domain.RecordStaffCommute;
|
||||
import com.os.mes.record.service.IRecordStaffCommuteService;
|
||||
|
||||
/**
|
||||
* 员工上下班记录Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-07-01
|
||||
*/
|
||||
@Service
|
||||
public class RecordStaffCommuteServiceImpl implements IRecordStaffCommuteService {
|
||||
@Autowired
|
||||
private RecordStaffCommuteMapper recordStaffCommuteMapper;
|
||||
|
||||
/**
|
||||
* 查询员工上下班记录
|
||||
*
|
||||
* @param objId 员工上下班记录主键
|
||||
* @return 员工上下班记录
|
||||
*/
|
||||
@Override
|
||||
public RecordStaffCommute selectRecordStaffCommuteByObjId(Long objId) {
|
||||
return recordStaffCommuteMapper.selectRecordStaffCommuteByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询员工上下班记录列表
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 员工上下班记录
|
||||
*/
|
||||
@Override
|
||||
public List<RecordStaffCommute> selectRecordStaffCommuteList(RecordStaffCommute recordStaffCommute) {
|
||||
return recordStaffCommuteMapper.selectRecordStaffCommuteList(recordStaffCommute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增员工上下班记录
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRecordStaffCommute(RecordStaffCommute recordStaffCommute) {
|
||||
recordStaffCommute.setCreateTime(DateUtils.getNowDate());
|
||||
return recordStaffCommuteMapper.insertRecordStaffCommute(recordStaffCommute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改员工上下班记录
|
||||
*
|
||||
* @param recordStaffCommute 员工上下班记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRecordStaffCommute(RecordStaffCommute recordStaffCommute) {
|
||||
recordStaffCommute.setUpdateTime(DateUtils.getNowDate());
|
||||
return recordStaffCommuteMapper.updateRecordStaffCommute(recordStaffCommute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除员工上下班记录
|
||||
*
|
||||
* @param objIds 需要删除的员工上下班记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRecordStaffCommuteByObjIds(Long[] objIds) {
|
||||
return recordStaffCommuteMapper.deleteRecordStaffCommuteByObjIds(objIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工上下班记录信息
|
||||
*
|
||||
* @param objId 员工上下班记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRecordStaffCommuteByObjId(Long objId) {
|
||||
return recordStaffCommuteMapper.deleteRecordStaffCommuteByObjId(objId);
|
||||
}
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
<?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.RecordStaffCommuteMapper">
|
||||
|
||||
<resultMap type="RecordStaffCommute" id="RecordStaffCommuteResult">
|
||||
<result property="objId" column="obj_id"/>
|
||||
<result property="staffId" column="staff_id"/>
|
||||
<result property="teamCode" column="team_code"/>
|
||||
<result property="classes" column="classes"/>
|
||||
<result property="startWorkTime" column="start_work_time"/>
|
||||
<result property="endWorkTime" column="end_work_time"/>
|
||||
<result property="clockingRatio" column="clocking_ratio"/>
|
||||
<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"/>
|
||||
<result property="staffName" column="staff_name"/>
|
||||
<result property="teamName" column="team_name"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRecordStaffCommuteVo">
|
||||
select rsc.obj_id,
|
||||
rsc.staff_id,
|
||||
bsi.staff_name,
|
||||
rsc.team_code,
|
||||
btm.team_name,
|
||||
rsc.classes,
|
||||
rsc.start_work_time,
|
||||
rsc.end_work_time,
|
||||
rsc.clocking_ratio,
|
||||
rsc.remark,
|
||||
rsc.is_flag,
|
||||
rsc.create_by,
|
||||
rsc.create_time,
|
||||
rsc.update_by,
|
||||
rsc.update_time,
|
||||
rsc.machine_code
|
||||
from record_staff_commute rsc
|
||||
left join base_staff_info bsi on bsi.staff_id = rsc.staff_id
|
||||
left join base_team_members btm on btm.team_code = rsc.team_code
|
||||
</sql>
|
||||
|
||||
<select id="selectRecordStaffCommuteList" parameterType="RecordStaffCommute" resultMap="RecordStaffCommuteResult">
|
||||
<include refid="selectRecordStaffCommuteVo"/>
|
||||
<where>
|
||||
<if test="staffId != null and staffId != ''">and rsc.staff_id = #{staffId}</if>
|
||||
<if test="teamCode != null and teamCode != ''">and rsc.team_code = #{teamCode}</if>
|
||||
<if test="classes != null and classes != ''">and rsc.classes = #{classes}</if>
|
||||
<if test="params.beginStartWorkTime != null and params.beginStartWorkTime != '' and params.endStartWorkTime != null and params.endStartWorkTime != ''">
|
||||
and rsc.start_work_time between #{params.beginStartWorkTime} and #{params.endStartWorkTime}
|
||||
</if>
|
||||
<if test="params.beginEndWorkTime != null and params.beginEndWorkTime != '' and params.endEndWorkTime != null and params.endEndWorkTime != ''">
|
||||
and rsc.end_work_time between #{params.beginEndWorkTime} and #{params.endEndWorkTime}
|
||||
</if>
|
||||
<if test="clockingRatio != null ">and rsc.clocking_ratio = #{clockingRatio}</if>
|
||||
<if test="isFlag != null and isFlag != ''">and rsc.is_flag = #{isFlag}</if>
|
||||
<if test="machineCode != null and machineCode != ''">and rsc.machine_code = #{machineCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRecordStaffCommuteByObjId" parameterType="Long" resultMap="RecordStaffCommuteResult">
|
||||
<include refid="selectRecordStaffCommuteVo"/>
|
||||
where rsc.obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertRecordStaffCommute" parameterType="RecordStaffCommute" useGeneratedKeys="true"
|
||||
keyProperty="objId">
|
||||
insert into record_staff_commute
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="staffId != null and staffId != ''">staff_id,</if>
|
||||
<if test="teamCode != null">team_code,</if>
|
||||
<if test="classes != null">classes,</if>
|
||||
<if test="startWorkTime != null">start_work_time,</if>
|
||||
<if test="endWorkTime != null">end_work_time,</if>
|
||||
<if test="clockingRatio != null">clocking_ratio,</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 and staffId != ''">#{staffId},</if>
|
||||
<if test="teamCode != null">#{teamCode},</if>
|
||||
<if test="classes != null">#{classes},</if>
|
||||
<if test="startWorkTime != null">#{startWorkTime},</if>
|
||||
<if test="endWorkTime != null">#{endWorkTime},</if>
|
||||
<if test="clockingRatio != null">#{clockingRatio},</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="updateRecordStaffCommute" parameterType="RecordStaffCommute">
|
||||
update record_staff_commute
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="staffId != null and staffId != ''">staff_id = #{staffId},</if>
|
||||
<if test="teamCode != null">team_code = #{teamCode},</if>
|
||||
<if test="classes != null">classes = #{classes},</if>
|
||||
<if test="startWorkTime != null">start_work_time = #{startWorkTime},</if>
|
||||
<if test="endWorkTime != null">end_work_time = #{endWorkTime},</if>
|
||||
<if test="clockingRatio != null">clocking_ratio = #{clockingRatio},</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="deleteRecordStaffCommuteByObjId" parameterType="Long">
|
||||
delete
|
||||
from record_staff_commute
|
||||
where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRecordStaffCommuteByObjIds" parameterType="String">
|
||||
delete from record_staff_commute where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue