huangjiayang
2025-04-21 12d330109489501bcfa7a664f3218727b8d4079b
【ADD】增加事件管理相关CRUD代码
已添加6个文件
637 ■■■■■ 文件已修改
aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsWorkEventController.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsWorkEvent.java 196 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsWorkEventMapper.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsWorkEventService.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWorkEventServiceImpl.java 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkEventMapper.xml 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsWorkEventController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
package com.aps.core.controller.basicData;
import com.aps.common.core.utils.poi.ExcelUtil;
import com.aps.common.core.web.controller.BaseController;
import com.aps.common.core.web.domain.AjaxResult;
import com.aps.common.core.web.page.TableDataInfo;
import com.aps.common.log.annotation.Log;
import com.aps.common.log.enums.BusinessType;
import com.aps.common.security.annotation.RequiresPermissions;
import com.aps.core.domain.ApsWorkEvent;
import com.aps.core.service.IApsWorkEventService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * äº‹ä»¶ç®¡ç†Controller
 *
 * @author hjy
 * @date 2025-04-21
 */
@RestController
@RequestMapping("/event")
public class ApsWorkEventController extends BaseController
{
    @Autowired
    private IApsWorkEventService apsWorkEventService;
    /**
     * æŸ¥è¯¢äº‹ä»¶ç®¡ç†åˆ—表
     */
    @RequiresPermissions("basicData:event:list")
    @GetMapping("/list")
    public TableDataInfo list(ApsWorkEvent apsWorkEvent)
    {
        startPage();
        List<ApsWorkEvent> list = apsWorkEventService.selectApsWorkEventList(apsWorkEvent);
        return getDataTable(list);
    }
    /**
     * å¯¼å‡ºäº‹ä»¶ç®¡ç†åˆ—表
     */
    @RequiresPermissions("basicData:event:export")
    @Log(title = "事件管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ApsWorkEvent apsWorkEvent)
    {
        List<ApsWorkEvent> list = apsWorkEventService.selectApsWorkEventList(apsWorkEvent);
        ExcelUtil<ApsWorkEvent> util = new ExcelUtil<ApsWorkEvent>(ApsWorkEvent.class);
        util.exportExcel(response, list, "事件管理数据");
    }
    /**
     * èŽ·å–äº‹ä»¶ç®¡ç†è¯¦ç»†ä¿¡æ¯
     */
    @RequiresPermissions("basicData:event:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(apsWorkEventService.selectApsWorkEventById(id));
    }
    /**
     * æ–°å¢žäº‹ä»¶ç®¡ç†
     */
    @RequiresPermissions("basicData:event:add")
    @Log(title = "事件管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ApsWorkEvent apsWorkEvent)
    {
        return toAjax(apsWorkEventService.insertApsWorkEvent(apsWorkEvent));
    }
    /**
     * ä¿®æ”¹äº‹ä»¶ç®¡ç†
     */
    @RequiresPermissions("basicData:event:edit")
    @Log(title = "事件管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApsWorkEvent apsWorkEvent)
    {
        return toAjax(apsWorkEventService.updateApsWorkEvent(apsWorkEvent));
    }
    /**
     * åˆ é™¤äº‹ä»¶ç®¡ç†
     */
    @RequiresPermissions("basicData:event:remove")
    @Log(title = "事件管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(apsWorkEventService.deleteApsWorkEventByIds(ids));
    }
}
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsWorkEvent.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,196 @@
package com.aps.core.domain;
import com.aps.common.core.annotation.Excel;
import com.aps.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
 * äº‹ä»¶ç®¡ç†å¯¹è±¡ aps_work_event
 *
 * @author hjy
 * @date 2025-04-21
 */
public class ApsWorkEvent extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    /** $column.columnComment */
    private Long id;
    /** äº‹ä»¶æè¿° */
    @Excel(name = "事件描述")
    private String description;
    /** æŒç»­æ—¶é•¿ */
    @Excel(name = "持续时长")
    private String duration;
    /** äº‹ä»¶å¼€å§‹æ—¥æœŸ */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "事件开始日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date startDate;
    /** äº‹ä»¶ç»“束日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "事件结束日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date endDate;
    /** äº‹ä»¶å¼€å§‹æ—¶é—´ */
    @Excel(name = "事件开始时间")
    private String startTime;
    /** äº‹ä»¶ç»“束事件 */
    @Excel(name = "事件结束事件")
    private String endTime;
    /** é€‚用工厂 */
    @Excel(name = "适用工厂")
    private String applicableFactory;
    /** é€‚用车间 */
    @Excel(name = "适用车间")
    private String applicableWorkshop;
    /** é€‚用工序 */
    @Excel(name = "适用工序")
    private String applicableProcess;
    /** é€‚用日历 */
    @Excel(name = "适用日历")
    private String applicableCalendar;
    public void setId(Long id)
    {
        this.id = id;
    }
    public Long getId()
    {
        return id;
    }
    public void setDescription(String description)
    {
        this.description = description;
    }
    public String getDescription()
    {
        return description;
    }
    public void setDuration(String duration)
    {
        this.duration = duration;
    }
    public String getDuration()
    {
        return duration;
    }
    public void setStartDate(Date startDate)
    {
        this.startDate = startDate;
    }
    public Date getStartDate()
    {
        return startDate;
    }
    public void setEndDate(Date endDate)
    {
        this.endDate = endDate;
    }
    public Date getEndDate()
    {
        return endDate;
    }
    public void setStartTime(String startTime)
    {
        this.startTime = startTime;
    }
    public String getStartTime()
    {
        return startTime;
    }
    public void setEndTime(String endTime)
    {
        this.endTime = endTime;
    }
    public String getEndTime()
    {
        return endTime;
    }
    public void setApplicableFactory(String applicableFactory)
    {
        this.applicableFactory = applicableFactory;
    }
    public String getApplicableFactory()
    {
        return applicableFactory;
    }
    public void setApplicableWorkshop(String applicableWorkshop)
    {
        this.applicableWorkshop = applicableWorkshop;
    }
    public String getApplicableWorkshop()
    {
        return applicableWorkshop;
    }
    public void setApplicableProcess(String applicableProcess)
    {
        this.applicableProcess = applicableProcess;
    }
    public String getApplicableProcess()
    {
        return applicableProcess;
    }
    public void setApplicableCalendar(String applicableCalendar)
    {
        this.applicableCalendar = applicableCalendar;
    }
    public String getApplicableCalendar()
    {
        return applicableCalendar;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("description", getDescription())
            .append("duration", getDuration())
            .append("startDate", getStartDate())
            .append("endDate", getEndDate())
            .append("startTime", getStartTime())
            .append("endTime", getEndTime())
            .append("applicableFactory", getApplicableFactory())
            .append("applicableWorkshop", getApplicableWorkshop())
            .append("applicableProcess", getApplicableProcess())
            .append("applicableCalendar", getApplicableCalendar())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsWorkEventMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package com.aps.core.mapper;
import com.aps.core.domain.ApsWorkEvent;
import java.util.List;
/**
 * äº‹ä»¶ç®¡ç†Mapper接口
 *
 * @author hjy
 * @date 2025-04-21
 */
public interface ApsWorkEventMapper
{
    /**
     * æŸ¥è¯¢äº‹ä»¶ç®¡ç†
     *
     * @param id äº‹ä»¶ç®¡ç†ä¸»é”®
     * @return äº‹ä»¶ç®¡ç†
     */
    public ApsWorkEvent selectApsWorkEventById(Long id);
    /**
     * æŸ¥è¯¢äº‹ä»¶ç®¡ç†åˆ—表
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return äº‹ä»¶ç®¡ç†é›†åˆ
     */
    public List<ApsWorkEvent> selectApsWorkEventList(ApsWorkEvent apsWorkEvent);
    /**
     * æ–°å¢žäº‹ä»¶ç®¡ç†
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return ç»“æžœ
     */
    public int insertApsWorkEvent(ApsWorkEvent apsWorkEvent);
    /**
     * ä¿®æ”¹äº‹ä»¶ç®¡ç†
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return ç»“æžœ
     */
    public int updateApsWorkEvent(ApsWorkEvent apsWorkEvent);
    /**
     * åˆ é™¤äº‹ä»¶ç®¡ç†
     *
     * @param id äº‹ä»¶ç®¡ç†ä¸»é”®
     * @return ç»“æžœ
     */
    public int deleteApsWorkEventById(Long id);
    /**
     * æ‰¹é‡åˆ é™¤äº‹ä»¶ç®¡ç†
     *
     * @param ids éœ€è¦åˆ é™¤çš„æ•°æ®ä¸»é”®é›†åˆ
     * @return ç»“æžœ
     */
    public int deleteApsWorkEventByIds(Long[] ids);
}
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsWorkEventService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package com.aps.core.service;
import com.aps.core.domain.ApsWorkEvent;
import java.util.List;
/**
 * äº‹ä»¶ç®¡ç†Service接口
 *
 * @author hjy
 * @date 2025-04-21
 */
public interface IApsWorkEventService
{
    /**
     * æŸ¥è¯¢äº‹ä»¶ç®¡ç†
     *
     * @param id äº‹ä»¶ç®¡ç†ä¸»é”®
     * @return äº‹ä»¶ç®¡ç†
     */
    public ApsWorkEvent selectApsWorkEventById(Long id);
    /**
     * æŸ¥è¯¢äº‹ä»¶ç®¡ç†åˆ—表
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return äº‹ä»¶ç®¡ç†é›†åˆ
     */
    public List<ApsWorkEvent> selectApsWorkEventList(ApsWorkEvent apsWorkEvent);
    /**
     * æ–°å¢žäº‹ä»¶ç®¡ç†
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return ç»“æžœ
     */
    public int insertApsWorkEvent(ApsWorkEvent apsWorkEvent);
    /**
     * ä¿®æ”¹äº‹ä»¶ç®¡ç†
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return ç»“æžœ
     */
    public int updateApsWorkEvent(ApsWorkEvent apsWorkEvent);
    /**
     * æ‰¹é‡åˆ é™¤äº‹ä»¶ç®¡ç†
     *
     * @param ids éœ€è¦åˆ é™¤çš„事件管理主键集合
     * @return ç»“æžœ
     */
    public int deleteApsWorkEventByIds(Long[] ids);
    /**
     * åˆ é™¤äº‹ä»¶ç®¡ç†ä¿¡æ¯
     *
     * @param id äº‹ä»¶ç®¡ç†ä¸»é”®
     * @return ç»“æžœ
     */
    public int deleteApsWorkEventById(Long id);
}
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWorkEventServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,100 @@
package com.aps.core.service.impl;
import com.aps.common.core.utils.DateUtils;
import com.aps.common.security.utils.SecurityUtils;
import com.aps.core.domain.ApsWorkEvent;
import com.aps.core.mapper.ApsWorkEventMapper;
import com.aps.core.service.IApsWorkEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * äº‹ä»¶ç®¡ç†Service业务层处理
 *
 * @author hjy
 * @date 2025-04-21
 */
@Service
public class ApsWorkEventServiceImpl implements IApsWorkEventService
{
    @Autowired
    private ApsWorkEventMapper apsWorkEventMapper;
    /**
     * æŸ¥è¯¢äº‹ä»¶ç®¡ç†
     *
     * @param id äº‹ä»¶ç®¡ç†ä¸»é”®
     * @return äº‹ä»¶ç®¡ç†
     */
    @Override
    public ApsWorkEvent selectApsWorkEventById(Long id)
    {
        return apsWorkEventMapper.selectApsWorkEventById(id);
    }
    /**
     * æŸ¥è¯¢äº‹ä»¶ç®¡ç†åˆ—表
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return äº‹ä»¶ç®¡ç†
     */
    @Override
    public List<ApsWorkEvent> selectApsWorkEventList(ApsWorkEvent apsWorkEvent)
    {
        return apsWorkEventMapper.selectApsWorkEventList(apsWorkEvent);
    }
    /**
     * æ–°å¢žäº‹ä»¶ç®¡ç†
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return ç»“æžœ
     */
    @Override
    public int insertApsWorkEvent(ApsWorkEvent apsWorkEvent)
    {
        apsWorkEvent.setCreateTime(DateUtils.getNowDate());
        apsWorkEvent.setCreateBy(SecurityUtils.getUsername());
        return apsWorkEventMapper.insertApsWorkEvent(apsWorkEvent);
    }
    /**
     * ä¿®æ”¹äº‹ä»¶ç®¡ç†
     *
     * @param apsWorkEvent äº‹ä»¶ç®¡ç†
     * @return ç»“æžœ
     */
    @Override
    public int updateApsWorkEvent(ApsWorkEvent apsWorkEvent)
    {
        apsWorkEvent.setUpdateTime(DateUtils.getNowDate());
        apsWorkEvent.setUpdateBy(SecurityUtils.getUsername());
        return apsWorkEventMapper.updateApsWorkEvent(apsWorkEvent);
    }
    /**
     * æ‰¹é‡åˆ é™¤äº‹ä»¶ç®¡ç†
     *
     * @param ids éœ€è¦åˆ é™¤çš„事件管理主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteApsWorkEventByIds(Long[] ids)
    {
        return apsWorkEventMapper.deleteApsWorkEventByIds(ids);
    }
    /**
     * åˆ é™¤äº‹ä»¶ç®¡ç†ä¿¡æ¯
     *
     * @param id äº‹ä»¶ç®¡ç†ä¸»é”®
     * @return ç»“æžœ
     */
    @Override
    public int deleteApsWorkEventById(Long id)
    {
        return apsWorkEventMapper.deleteApsWorkEventById(id);
    }
}
aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkEventMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,119 @@
<?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.aps.core.mapper.ApsWorkEventMapper">
    <resultMap type="ApsWorkEvent" id="ApsWorkEventResult">
        <result property="id"    column="id"    />
        <result property="description"    column="description"    />
        <result property="duration"    column="duration"    />
        <result property="startDate"    column="start_date"    />
        <result property="endDate"    column="end_date"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="applicableFactory"    column="applicable_factory"    />
        <result property="applicableWorkshop"    column="applicable_workshop"    />
        <result property="applicableProcess"    column="applicable_process"    />
        <result property="applicableCalendar"    column="applicable_calendar"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
    <sql id="selectApsWorkEventVo">
        select id, description, duration, start_date, end_date, start_time, end_time, applicable_factory, applicable_workshop, applicable_process, applicable_calendar, create_by, create_time, update_by, update_time from aps_work_event
    </sql>
    <select id="selectApsWorkEventList" parameterType="ApsWorkEvent" resultMap="ApsWorkEventResult">
        <include refid="selectApsWorkEventVo"/>
        <where>
            <if test="description != null  and description != ''"> and description like concat('%', #{description}, '%')</if>
            <if test="duration != null  and duration != ''"> and duration = #{duration}</if>
            <if test="startDate != null "> and start_date = #{startDate}</if>
            <if test="endDate != null "> and end_date = #{endDate}</if>
            <if test="startTime != null  and startTime != ''"> and start_time = #{startTime}</if>
            <if test="endTime != null  and endTime != ''"> and end_time = #{endTime}</if>
            <if test="applicableFactory != null  and applicableFactory != ''"> and applicable_factory = #{applicableFactory}</if>
            <if test="applicableWorkshop != null  and applicableWorkshop != ''"> and applicable_workshop = #{applicableWorkshop}</if>
            <if test="applicableProcess != null  and applicableProcess != ''"> and applicable_process = #{applicableProcess}</if>
            <if test="applicableCalendar != null  and applicableCalendar != ''"> and applicable_calendar = #{applicableCalendar}</if>
        </where>
    </select>
    <select id="selectApsWorkEventById" parameterType="Long" resultMap="ApsWorkEventResult">
        <include refid="selectApsWorkEventVo"/>
        where id = #{id}
    </select>
    <insert id="insertApsWorkEvent" parameterType="ApsWorkEvent">
        insert into aps_work_event
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="description != null and description != ''">description,</if>
            <if test="duration != null and duration != ''">duration,</if>
            <if test="startDate != null">start_date,</if>
            <if test="endDate != null">end_date,</if>
            <if test="startTime != null and startTime != ''">start_time,</if>
            <if test="endTime != null and endTime != ''">end_time,</if>
            <if test="applicableFactory != null and applicableFactory != ''">applicable_factory,</if>
            <if test="applicableWorkshop != null and applicableWorkshop != ''">applicable_workshop,</if>
            <if test="applicableProcess != null and applicableProcess != ''">applicable_process,</if>
            <if test="applicableCalendar != null and applicableCalendar != ''">applicable_calendar,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="description != null and description != ''">#{description},</if>
            <if test="duration != null and duration != ''">#{duration},</if>
            <if test="startDate != null">#{startDate},</if>
            <if test="endDate != null">#{endDate},</if>
            <if test="startTime != null and startTime != ''">#{startTime},</if>
            <if test="endTime != null and endTime != ''">#{endTime},</if>
            <if test="applicableFactory != null and applicableFactory != ''">#{applicableFactory},</if>
            <if test="applicableWorkshop != null and applicableWorkshop != ''">#{applicableWorkshop},</if>
            <if test="applicableProcess != null and applicableProcess != ''">#{applicableProcess},</if>
            <if test="applicableCalendar != null and applicableCalendar != ''">#{applicableCalendar},</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>
         </trim>
    </insert>
    <update id="updateApsWorkEvent" parameterType="ApsWorkEvent">
        update aps_work_event
        <trim prefix="SET" suffixOverrides=",">
            <if test="description != null and description != ''">description = #{description},</if>
            <if test="duration != null and duration != ''">duration = #{duration},</if>
            <if test="startDate != null">start_date = #{startDate},</if>
            <if test="endDate != null">end_date = #{endDate},</if>
            <if test="startTime != null and startTime != ''">start_time = #{startTime},</if>
            <if test="endTime != null and endTime != ''">end_time = #{endTime},</if>
            <if test="applicableFactory != null and applicableFactory != ''">applicable_factory = #{applicableFactory},</if>
            <if test="applicableWorkshop != null and applicableWorkshop != ''">applicable_workshop = #{applicableWorkshop},</if>
            <if test="applicableProcess != null and applicableProcess != ''">applicable_process = #{applicableProcess},</if>
            <if test="applicableCalendar != null and applicableCalendar != ''">applicable_calendar = #{applicableCalendar},</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>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteApsWorkEventById" parameterType="Long">
        delete from aps_work_event where id = #{id}
    </delete>
    <delete id="deleteApsWorkEventByIds" parameterType="String">
        delete from aps_work_event where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>