排班计划

This commit is contained in:
JinLu.Yin 2022-06-06 22:28:07 +08:00
parent fbab32a428
commit 811aa1573d
6 changed files with 640 additions and 0 deletions

View File

@ -0,0 +1,104 @@
package com.ktg.mes.cal.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.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.cal.domain.CalPlan;
import com.ktg.mes.cal.service.ICalPlanService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 排班计划Controller
*
* @author yinjinlu
* @date 2022-06-06
*/
@RestController
@RequestMapping("/mes/cal/calplan")
public class CalPlanController extends BaseController
{
@Autowired
private ICalPlanService calPlanService;
/**
* 查询排班计划列表
*/
@PreAuthorize("@ss.hasPermi('mes:cal:calplan:list')")
@GetMapping("/list")
public TableDataInfo list(CalPlan calPlan)
{
startPage();
List<CalPlan> list = calPlanService.selectCalPlanList(calPlan);
return getDataTable(list);
}
/**
* 导出排班计划列表
*/
@PreAuthorize("@ss.hasPermi('mes:cal:calplan:export')")
@Log(title = "排班计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CalPlan calPlan)
{
List<CalPlan> list = calPlanService.selectCalPlanList(calPlan);
ExcelUtil<CalPlan> util = new ExcelUtil<CalPlan>(CalPlan.class);
util.exportExcel(response, list, "排班计划数据");
}
/**
* 获取排班计划详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:cal:calplan:query')")
@GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") Long planId)
{
return AjaxResult.success(calPlanService.selectCalPlanByPlanId(planId));
}
/**
* 新增排班计划
*/
@PreAuthorize("@ss.hasPermi('mes:cal:calplan:add')")
@Log(title = "排班计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CalPlan calPlan)
{
return toAjax(calPlanService.insertCalPlan(calPlan));
}
/**
* 修改排班计划
*/
@PreAuthorize("@ss.hasPermi('mes:cal:calplan:edit')")
@Log(title = "排班计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CalPlan calPlan)
{
return toAjax(calPlanService.updateCalPlan(calPlan));
}
/**
* 删除排班计划
*/
@PreAuthorize("@ss.hasPermi('mes:cal:calplan:remove')")
@Log(title = "排班计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable Long[] planIds)
{
return toAjax(calPlanService.deleteCalPlanByPlanIds(planIds));
}
}

View File

@ -0,0 +1,196 @@
package com.ktg.mes.cal.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.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* 排班计划对象 cal_plan
*
* @author yinjinlu
* @date 2022-06-06
*/
public class CalPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 计划ID */
private Long planId;
/** 计划编号 */
@Excel(name = "计划编号")
private String planCode;
/** 计划名称 */
@Excel(name = "计划名称")
private String planName;
/** 开始日期 */
@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 shiftType;
/** 倒班方式 */
@Excel(name = "倒班方式")
private String shiftMethod;
/** 数 */
@Excel(name = "")
private Long shiftCount;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setPlanId(Long planId)
{
this.planId = planId;
}
public Long getPlanId()
{
return planId;
}
public void setPlanCode(String planCode)
{
this.planCode = planCode;
}
public String getPlanCode()
{
return planCode;
}
public void setPlanName(String planName)
{
this.planName = planName;
}
public String getPlanName()
{
return planName;
}
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 setShiftType(String shiftType)
{
this.shiftType = shiftType;
}
public String getShiftType()
{
return shiftType;
}
public void setShiftMethod(String shiftMethod)
{
this.shiftMethod = shiftMethod;
}
public String getShiftMethod()
{
return shiftMethod;
}
public void setShiftCount(Long shiftCount)
{
this.shiftCount = shiftCount;
}
public Long getShiftCount()
{
return shiftCount;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(Long attr3)
{
this.attr3 = attr3;
}
public Long getAttr3()
{
return attr3;
}
public void setAttr4(Long attr4)
{
this.attr4 = attr4;
}
public Long getAttr4()
{
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("planId", getPlanId())
.append("planCode", getPlanCode())
.append("planName", getPlanName())
.append("startDate", getStartDate())
.append("endDate", getEndDate())
.append("shiftType", getShiftType())
.append("shiftMethod", getShiftMethod())
.append("shiftCount", getShiftCount())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.cal.mapper;
import java.util.List;
import com.ktg.mes.cal.domain.CalPlan;
/**
* 排班计划Mapper接口
*
* @author yinjinlu
* @date 2022-06-06
*/
public interface CalPlanMapper
{
/**
* 查询排班计划
*
* @param planId 排班计划主键
* @return 排班计划
*/
public CalPlan selectCalPlanByPlanId(Long planId);
/**
* 查询排班计划列表
*
* @param calPlan 排班计划
* @return 排班计划集合
*/
public List<CalPlan> selectCalPlanList(CalPlan calPlan);
/**
* 新增排班计划
*
* @param calPlan 排班计划
* @return 结果
*/
public int insertCalPlan(CalPlan calPlan);
/**
* 修改排班计划
*
* @param calPlan 排班计划
* @return 结果
*/
public int updateCalPlan(CalPlan calPlan);
/**
* 删除排班计划
*
* @param planId 排班计划主键
* @return 结果
*/
public int deleteCalPlanByPlanId(Long planId);
/**
* 批量删除排班计划
*
* @param planIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCalPlanByPlanIds(Long[] planIds);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.cal.service;
import java.util.List;
import com.ktg.mes.cal.domain.CalPlan;
/**
* 排班计划Service接口
*
* @author yinjinlu
* @date 2022-06-06
*/
public interface ICalPlanService
{
/**
* 查询排班计划
*
* @param planId 排班计划主键
* @return 排班计划
*/
public CalPlan selectCalPlanByPlanId(Long planId);
/**
* 查询排班计划列表
*
* @param calPlan 排班计划
* @return 排班计划集合
*/
public List<CalPlan> selectCalPlanList(CalPlan calPlan);
/**
* 新增排班计划
*
* @param calPlan 排班计划
* @return 结果
*/
public int insertCalPlan(CalPlan calPlan);
/**
* 修改排班计划
*
* @param calPlan 排班计划
* @return 结果
*/
public int updateCalPlan(CalPlan calPlan);
/**
* 批量删除排班计划
*
* @param planIds 需要删除的排班计划主键集合
* @return 结果
*/
public int deleteCalPlanByPlanIds(Long[] planIds);
/**
* 删除排班计划信息
*
* @param planId 排班计划主键
* @return 结果
*/
public int deleteCalPlanByPlanId(Long planId);
}

View File

@ -0,0 +1,96 @@
package com.ktg.mes.cal.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.cal.mapper.CalPlanMapper;
import com.ktg.mes.cal.domain.CalPlan;
import com.ktg.mes.cal.service.ICalPlanService;
/**
* 排班计划Service业务层处理
*
* @author yinjinlu
* @date 2022-06-06
*/
@Service
public class CalPlanServiceImpl implements ICalPlanService
{
@Autowired
private CalPlanMapper calPlanMapper;
/**
* 查询排班计划
*
* @param planId 排班计划主键
* @return 排班计划
*/
@Override
public CalPlan selectCalPlanByPlanId(Long planId)
{
return calPlanMapper.selectCalPlanByPlanId(planId);
}
/**
* 查询排班计划列表
*
* @param calPlan 排班计划
* @return 排班计划
*/
@Override
public List<CalPlan> selectCalPlanList(CalPlan calPlan)
{
return calPlanMapper.selectCalPlanList(calPlan);
}
/**
* 新增排班计划
*
* @param calPlan 排班计划
* @return 结果
*/
@Override
public int insertCalPlan(CalPlan calPlan)
{
calPlan.setCreateTime(DateUtils.getNowDate());
return calPlanMapper.insertCalPlan(calPlan);
}
/**
* 修改排班计划
*
* @param calPlan 排班计划
* @return 结果
*/
@Override
public int updateCalPlan(CalPlan calPlan)
{
calPlan.setUpdateTime(DateUtils.getNowDate());
return calPlanMapper.updateCalPlan(calPlan);
}
/**
* 批量删除排班计划
*
* @param planIds 需要删除的排班计划主键
* @return 结果
*/
@Override
public int deleteCalPlanByPlanIds(Long[] planIds)
{
return calPlanMapper.deleteCalPlanByPlanIds(planIds);
}
/**
* 删除排班计划信息
*
* @param planId 排班计划主键
* @return 结果
*/
@Override
public int deleteCalPlanByPlanId(Long planId)
{
return calPlanMapper.deleteCalPlanByPlanId(planId);
}
}

View File

@ -0,0 +1,122 @@
<?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.ktg.mes.cal.mapper.CalPlanMapper">
<resultMap type="CalPlan" id="CalPlanResult">
<result property="planId" column="plan_id" />
<result property="planCode" column="plan_code" />
<result property="planName" column="plan_name" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="shiftType" column="shift_type" />
<result property="shiftMethod" column="shift_method" />
<result property="shiftCount" column="shift_count" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<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="selectCalPlanVo">
select plan_id, plan_code, plan_name, start_date, end_date, shift_type, shift_method, shift_count, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from cal_plan
</sql>
<select id="selectCalPlanList" parameterType="CalPlan" resultMap="CalPlanResult">
<include refid="selectCalPlanVo"/>
<where>
<if test="planCode != null "> and plan_code like concat('%', #{planCode}, '%')</if>
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="shiftType != null and shiftType != ''"> and shift_type = #{shiftType}</if>
<if test="shiftMethod != null and shiftMethod != ''"> and shift_method = #{shiftMethod}</if>
<if test="shiftCount != null "> and shift_count = #{shiftCount}</if>
</where>
</select>
<select id="selectCalPlanByPlanId" parameterType="Long" resultMap="CalPlanResult">
<include refid="selectCalPlanVo"/>
where plan_id = #{planId}
</select>
<insert id="insertCalPlan" parameterType="CalPlan" useGeneratedKeys="true" keyProperty="planId">
insert into cal_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planCode != null">plan_code,</if>
<if test="planName != null and planName != ''">plan_name,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="shiftType != null">shift_type,</if>
<if test="shiftMethod != null">shift_method,</if>
<if test="shiftCount != null">shift_count,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</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="planCode != null">#{planCode},</if>
<if test="planName != null and planName != ''">#{planName},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="shiftType != null">#{shiftType},</if>
<if test="shiftMethod != null">#{shiftMethod},</if>
<if test="shiftCount != null">#{shiftCount},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</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="updateCalPlan" parameterType="CalPlan">
update cal_plan
<trim prefix="SET" suffixOverrides=",">
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="planName != null and planName != ''">plan_name = #{planName},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="shiftType != null">shift_type = #{shiftType},</if>
<if test="shiftMethod != null">shift_method = #{shiftMethod},</if>
<if test="shiftCount != null">shift_count = #{shiftCount},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</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 plan_id = #{planId}
</update>
<delete id="deleteCalPlanByPlanId" parameterType="Long">
delete from cal_plan where plan_id = #{planId}
</delete>
<delete id="deleteCalPlanByPlanIds" parameterType="String">
delete from cal_plan where plan_id in
<foreach item="planId" collection="array" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
</mapper>