Administrator 1 рік тому
батько
коміт
b825c7a8d1

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/RecordLeaveController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.web.controller.system;
+
+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.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.RecordLeave;
+import com.ruoyi.system.service.IRecordLeaveService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 请假记录信息Controller
+ * 
+ * @author boman
+ * @date 2023-08-08
+ */
+@RestController
+@RequestMapping("/system/leave")
+public class RecordLeaveController extends BaseController
+{
+    @Autowired
+    private IRecordLeaveService recordLeaveService;
+
+    /**
+     * 查询请假记录信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:leave:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(RecordLeave recordLeave)
+    {
+        startPage();
+        List<RecordLeave> list = recordLeaveService.selectRecordLeaveList(recordLeave);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出请假记录信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:leave:export')")
+    @Log(title = "请假记录信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, RecordLeave recordLeave)
+    {
+        List<RecordLeave> list = recordLeaveService.selectRecordLeaveList(recordLeave);
+        ExcelUtil<RecordLeave> util = new ExcelUtil<RecordLeave>(RecordLeave.class);
+        util.exportExcel(response, list, "请假记录信息数据");
+    }
+
+    /**
+     * 获取请假记录信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:leave:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(recordLeaveService.selectRecordLeaveById(id));
+    }
+
+    /**
+     * 新增请假记录信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:leave:add')")
+    @Log(title = "请假记录信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody RecordLeave recordLeave)
+    {
+        return toAjax(recordLeaveService.insertRecordLeave(recordLeave));
+    }
+
+    /**
+     * 修改请假记录信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:leave:edit')")
+    @Log(title = "请假记录信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody RecordLeave recordLeave)
+    {
+        return toAjax(recordLeaveService.updateRecordLeave(recordLeave));
+    }
+
+    /**
+     * 删除请假记录信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:leave:remove')")
+    @Log(title = "请假记录信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(recordLeaveService.deleteRecordLeaveByIds(ids));
+    }
+}

+ 243 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/RecordLeave.java

@@ -0,0 +1,243 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 请假记录信息对象 record_leave
+ * 
+ * @author boman
+ * @date 2023-08-08
+ */
+public class RecordLeave extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 类型 1:临时请假 2:事假 */
+    @Excel(name = "类型 1:临时请假 2:事假")
+    private String type;
+
+    /** 请假开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "请假开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date startTime;
+
+    /** 请假结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "请假结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date endTime;
+
+    /** 请假理由 */
+    @Excel(name = "请假理由")
+    private String reason;
+
+    /** 部门id */
+    @Excel(name = "部门id")
+    private Long classId;
+
+    /** 部门名称 */
+    @Excel(name = "部门名称")
+    private String clasName;
+
+    /** 请假人id */
+    @Excel(name = "请假人id")
+    private String absenteeId;
+
+    /** 请假人姓名 */
+    @Excel(name = "请假人姓名")
+    private String absenteeName;
+
+    /** 审批人员id */
+    @Excel(name = "审批人员id")
+    private Long examinersId;
+
+    /** 审批人员姓名 */
+    @Excel(name = "审批人员姓名")
+    private String examinersName;
+
+    /** 请假类别 1:病假,2:产假,3:陪产假,4:婚假,5:丧假,6:其他 */
+    @Excel(name = "请假类别 1:病假,2:产假,3:陪产假,4:婚假,5:丧假,6:其他")
+    private String category;
+
+    /** 是否通过 0:未处理,1:不通过,2:通过 */
+    @Excel(name = "是否通过 0:未处理,1:不通过,2:通过")
+    private String isPass;
+
+    /** 图片地址 */
+    @Excel(name = "图片地址")
+    private String photo;
+
+    /** 提交时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "提交时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date submitTime;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setType(String type) 
+    {
+        this.type = type;
+    }
+
+    public String getType() 
+    {
+        return type;
+    }
+    public void setStartTime(Date startTime) 
+    {
+        this.startTime = startTime;
+    }
+
+    public Date getStartTime() 
+    {
+        return startTime;
+    }
+    public void setEndTime(Date endTime) 
+    {
+        this.endTime = endTime;
+    }
+
+    public Date getEndTime() 
+    {
+        return endTime;
+    }
+    public void setReason(String reason) 
+    {
+        this.reason = reason;
+    }
+
+    public String getReason() 
+    {
+        return reason;
+    }
+    public void setClassId(Long classId) 
+    {
+        this.classId = classId;
+    }
+
+    public Long getClassId() 
+    {
+        return classId;
+    }
+    public void setClasName(String clasName) 
+    {
+        this.clasName = clasName;
+    }
+
+    public String getClasName() 
+    {
+        return clasName;
+    }
+    public void setAbsenteeId(String absenteeId) 
+    {
+        this.absenteeId = absenteeId;
+    }
+
+    public String getAbsenteeId() 
+    {
+        return absenteeId;
+    }
+    public void setAbsenteeName(String absenteeName) 
+    {
+        this.absenteeName = absenteeName;
+    }
+
+    public String getAbsenteeName() 
+    {
+        return absenteeName;
+    }
+    public void setExaminersId(Long examinersId) 
+    {
+        this.examinersId = examinersId;
+    }
+
+    public Long getExaminersId() 
+    {
+        return examinersId;
+    }
+    public void setExaminersName(String examinersName) 
+    {
+        this.examinersName = examinersName;
+    }
+
+    public String getExaminersName() 
+    {
+        return examinersName;
+    }
+    public void setCategory(String category) 
+    {
+        this.category = category;
+    }
+
+    public String getCategory() 
+    {
+        return category;
+    }
+    public void setIsPass(String isPass) 
+    {
+        this.isPass = isPass;
+    }
+
+    public String getIsPass() 
+    {
+        return isPass;
+    }
+    public void setPhoto(String photo) 
+    {
+        this.photo = photo;
+    }
+
+    public String getPhoto() 
+    {
+        return photo;
+    }
+    public void setSubmitTime(Date submitTime) 
+    {
+        this.submitTime = submitTime;
+    }
+
+    public Date getSubmitTime() 
+    {
+        return submitTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("type", getType())
+            .append("startTime", getStartTime())
+            .append("endTime", getEndTime())
+            .append("reason", getReason())
+            .append("classId", getClassId())
+            .append("clasName", getClasName())
+            .append("absenteeId", getAbsenteeId())
+            .append("absenteeName", getAbsenteeName())
+            .append("examinersId", getExaminersId())
+            .append("examinersName", getExaminersName())
+            .append("category", getCategory())
+            .append("isPass", getIsPass())
+            .append("photo", getPhoto())
+            .append("submitTime", getSubmitTime())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/RecordLeaveMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.RecordLeave;
+
+/**
+ * 请假记录信息Mapper接口
+ * 
+ * @author boman
+ * @date 2023-08-08
+ */
+public interface RecordLeaveMapper 
+{
+    /**
+     * 查询请假记录信息
+     * 
+     * @param id 请假记录信息主键
+     * @return 请假记录信息
+     */
+    public RecordLeave selectRecordLeaveById(Long id);
+
+    /**
+     * 查询请假记录信息列表
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 请假记录信息集合
+     */
+    public List<RecordLeave> selectRecordLeaveList(RecordLeave recordLeave);
+
+    /**
+     * 新增请假记录信息
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 结果
+     */
+    public int insertRecordLeave(RecordLeave recordLeave);
+
+    /**
+     * 修改请假记录信息
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 结果
+     */
+    public int updateRecordLeave(RecordLeave recordLeave);
+
+    /**
+     * 删除请假记录信息
+     * 
+     * @param id 请假记录信息主键
+     * @return 结果
+     */
+    public int deleteRecordLeaveById(Long id);
+
+    /**
+     * 批量删除请假记录信息
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteRecordLeaveByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IRecordLeaveService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.RecordLeave;
+
+/**
+ * 请假记录信息Service接口
+ * 
+ * @author boman
+ * @date 2023-08-08
+ */
+public interface IRecordLeaveService 
+{
+    /**
+     * 查询请假记录信息
+     * 
+     * @param id 请假记录信息主键
+     * @return 请假记录信息
+     */
+    public RecordLeave selectRecordLeaveById(Long id);
+
+    /**
+     * 查询请假记录信息列表
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 请假记录信息集合
+     */
+    public List<RecordLeave> selectRecordLeaveList(RecordLeave recordLeave);
+
+    /**
+     * 新增请假记录信息
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 结果
+     */
+    public int insertRecordLeave(RecordLeave recordLeave);
+
+    /**
+     * 修改请假记录信息
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 结果
+     */
+    public int updateRecordLeave(RecordLeave recordLeave);
+
+    /**
+     * 批量删除请假记录信息
+     * 
+     * @param ids 需要删除的请假记录信息主键集合
+     * @return 结果
+     */
+    public int deleteRecordLeaveByIds(Long[] ids);
+
+    /**
+     * 删除请假记录信息信息
+     * 
+     * @param id 请假记录信息主键
+     * @return 结果
+     */
+    public int deleteRecordLeaveById(Long id);
+}

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RecordLeaveServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.RecordLeaveMapper;
+import com.ruoyi.system.domain.RecordLeave;
+import com.ruoyi.system.service.IRecordLeaveService;
+
+/**
+ * 请假记录信息Service业务层处理
+ * 
+ * @author boman
+ * @date 2023-08-08
+ */
+@Service
+public class RecordLeaveServiceImpl implements IRecordLeaveService 
+{
+    @Autowired
+    private RecordLeaveMapper recordLeaveMapper;
+
+    /**
+     * 查询请假记录信息
+     * 
+     * @param id 请假记录信息主键
+     * @return 请假记录信息
+     */
+    @Override
+    public RecordLeave selectRecordLeaveById(Long id)
+    {
+        return recordLeaveMapper.selectRecordLeaveById(id);
+    }
+
+    /**
+     * 查询请假记录信息列表
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 请假记录信息
+     */
+    @Override
+    public List<RecordLeave> selectRecordLeaveList(RecordLeave recordLeave)
+    {
+        return recordLeaveMapper.selectRecordLeaveList(recordLeave);
+    }
+
+    /**
+     * 新增请假记录信息
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 结果
+     */
+    @Override
+    public int insertRecordLeave(RecordLeave recordLeave)
+    {
+        recordLeave.setCreateTime(DateUtils.getNowDate());
+        return recordLeaveMapper.insertRecordLeave(recordLeave);
+    }
+
+    /**
+     * 修改请假记录信息
+     * 
+     * @param recordLeave 请假记录信息
+     * @return 结果
+     */
+    @Override
+    public int updateRecordLeave(RecordLeave recordLeave)
+    {
+        recordLeave.setUpdateTime(DateUtils.getNowDate());
+        return recordLeaveMapper.updateRecordLeave(recordLeave);
+    }
+
+    /**
+     * 批量删除请假记录信息
+     * 
+     * @param ids 需要删除的请假记录信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRecordLeaveByIds(Long[] ids)
+    {
+        return recordLeaveMapper.deleteRecordLeaveByIds(ids);
+    }
+
+    /**
+     * 删除请假记录信息信息
+     * 
+     * @param id 请假记录信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRecordLeaveById(Long id)
+    {
+        return recordLeaveMapper.deleteRecordLeaveById(id);
+    }
+}

+ 141 - 0
ruoyi-system/src/main/resources/mapper/system/RecordLeaveMapper.xml

@@ -0,0 +1,141 @@
+<?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.ruoyi.system.mapper.RecordLeaveMapper">
+    
+    <resultMap type="RecordLeave" id="RecordLeaveResult">
+        <result property="id"    column="id"    />
+        <result property="type"    column="type"    />
+        <result property="startTime"    column="start_time"    />
+        <result property="endTime"    column="end_time"    />
+        <result property="reason"    column="reason"    />
+        <result property="classId"    column="class_id"    />
+        <result property="clasName"    column="clas_name"    />
+        <result property="absenteeId"    column="absentee_id"    />
+        <result property="absenteeName"    column="absentee_name"    />
+        <result property="examinersId"    column="examiners_id"    />
+        <result property="examinersName"    column="examiners_name"    />
+        <result property="category"    column="category"    />
+        <result property="isPass"    column="is_pass"    />
+        <result property="photo"    column="photo"    />
+        <result property="submitTime"    column="submit_time"    />
+        <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="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectRecordLeaveVo">
+        select id, type, start_time, end_time, reason, class_id, clas_name, absentee_id, absentee_name, examiners_id, examiners_name, category, is_pass, photo, submit_time, create_by, create_time, update_by, update_time, remark from record_leave
+    </sql>
+
+    <select id="selectRecordLeaveList" parameterType="RecordLeave" resultMap="RecordLeaveResult">
+        <include refid="selectRecordLeaveVo"/>
+        <where>  
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="startTime != null "> and start_time = #{startTime}</if>
+            <if test="endTime != null "> and end_time = #{endTime}</if>
+            <if test="reason != null  and reason != ''"> and reason = #{reason}</if>
+            <if test="classId != null "> and class_id = #{classId}</if>
+            <if test="clasName != null  and clasName != ''"> and clas_name like concat('%', #{clasName}, '%')</if>
+            <if test="absenteeId != null  and absenteeId != ''"> and absentee_id = #{absenteeId}</if>
+            <if test="absenteeName != null  and absenteeName != ''"> and absentee_name like concat('%', #{absenteeName}, '%')</if>
+            <if test="examinersId != null "> and examiners_id = #{examinersId}</if>
+            <if test="examinersName != null  and examinersName != ''"> and examiners_name like concat('%', #{examinersName}, '%')</if>
+            <if test="category != null  and category != ''"> and category = #{category}</if>
+            <if test="isPass != null  and isPass != ''"> and is_pass = #{isPass}</if>
+            <if test="photo != null  and photo != ''"> and photo = #{photo}</if>
+            <if test="submitTime != null "> and submit_time = #{submitTime}</if>
+        </where>
+    </select>
+    
+    <select id="selectRecordLeaveById" parameterType="Long" resultMap="RecordLeaveResult">
+        <include refid="selectRecordLeaveVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertRecordLeave" parameterType="RecordLeave" useGeneratedKeys="true" keyProperty="id">
+        insert into record_leave
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="type != null">type,</if>
+            <if test="startTime != null">start_time,</if>
+            <if test="endTime != null">end_time,</if>
+            <if test="reason != null">reason,</if>
+            <if test="classId != null">class_id,</if>
+            <if test="clasName != null">clas_name,</if>
+            <if test="absenteeId != null">absentee_id,</if>
+            <if test="absenteeName != null">absentee_name,</if>
+            <if test="examinersId != null">examiners_id,</if>
+            <if test="examinersName != null">examiners_name,</if>
+            <if test="category != null">category,</if>
+            <if test="isPass != null">is_pass,</if>
+            <if test="photo != null">photo,</if>
+            <if test="submitTime != null">submit_time,</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="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="type != null">#{type},</if>
+            <if test="startTime != null">#{startTime},</if>
+            <if test="endTime != null">#{endTime},</if>
+            <if test="reason != null">#{reason},</if>
+            <if test="classId != null">#{classId},</if>
+            <if test="clasName != null">#{clasName},</if>
+            <if test="absenteeId != null">#{absenteeId},</if>
+            <if test="absenteeName != null">#{absenteeName},</if>
+            <if test="examinersId != null">#{examinersId},</if>
+            <if test="examinersName != null">#{examinersName},</if>
+            <if test="category != null">#{category},</if>
+            <if test="isPass != null">#{isPass},</if>
+            <if test="photo != null">#{photo},</if>
+            <if test="submitTime != null">#{submitTime},</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="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateRecordLeave" parameterType="RecordLeave">
+        update record_leave
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="type != null">type = #{type},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="endTime != null">end_time = #{endTime},</if>
+            <if test="reason != null">reason = #{reason},</if>
+            <if test="classId != null">class_id = #{classId},</if>
+            <if test="clasName != null">clas_name = #{clasName},</if>
+            <if test="absenteeId != null">absentee_id = #{absenteeId},</if>
+            <if test="absenteeName != null">absentee_name = #{absenteeName},</if>
+            <if test="examinersId != null">examiners_id = #{examinersId},</if>
+            <if test="examinersName != null">examiners_name = #{examinersName},</if>
+            <if test="category != null">category = #{category},</if>
+            <if test="isPass != null">is_pass = #{isPass},</if>
+            <if test="photo != null">photo = #{photo},</if>
+            <if test="submitTime != null">submit_time = #{submitTime},</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="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteRecordLeaveById" parameterType="Long">
+        delete from record_leave where id = #{id}
+    </delete>
+
+    <delete id="deleteRecordLeaveByIds" parameterType="String">
+        delete from record_leave where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>