This commit is contained in:
JinLu.Yin 2022-06-06 22:33:50 +08:00
parent bc010616b9
commit 8aa26b6707
5 changed files with 490 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.CalShift;
import com.ktg.mes.cal.service.ICalShiftService;
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/shift")
public class CalShiftController extends BaseController
{
@Autowired
private ICalShiftService calShiftService;
/**
* 查询计划班次列表
*/
@PreAuthorize("@ss.hasPermi('mes:cal:shift:list')")
@GetMapping("/list")
public TableDataInfo list(CalShift calShift)
{
startPage();
List<CalShift> list = calShiftService.selectCalShiftList(calShift);
return getDataTable(list);
}
/**
* 导出计划班次列表
*/
@PreAuthorize("@ss.hasPermi('mes:cal:shift:export')")
@Log(title = "计划班次", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CalShift calShift)
{
List<CalShift> list = calShiftService.selectCalShiftList(calShift);
ExcelUtil<CalShift> util = new ExcelUtil<CalShift>(CalShift.class);
util.exportExcel(response, list, "计划班次数据");
}
/**
* 获取计划班次详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:cal:shift:query')")
@GetMapping(value = "/{shiftId}")
public AjaxResult getInfo(@PathVariable("shiftId") Long shiftId)
{
return AjaxResult.success(calShiftService.selectCalShiftByShiftId(shiftId));
}
/**
* 新增计划班次
*/
@PreAuthorize("@ss.hasPermi('mes:cal:shift:add')")
@Log(title = "计划班次", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CalShift calShift)
{
return toAjax(calShiftService.insertCalShift(calShift));
}
/**
* 修改计划班次
*/
@PreAuthorize("@ss.hasPermi('mes:cal:shift:edit')")
@Log(title = "计划班次", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CalShift calShift)
{
return toAjax(calShiftService.updateCalShift(calShift));
}
/**
* 删除计划班次
*/
@PreAuthorize("@ss.hasPermi('mes:cal:shift:remove')")
@Log(title = "计划班次", businessType = BusinessType.DELETE)
@DeleteMapping("/{shiftIds}")
public AjaxResult remove(@PathVariable Long[] shiftIds)
{
return toAjax(calShiftService.deleteCalShiftByShiftIds(shiftIds));
}
}

View File

@ -0,0 +1,168 @@
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_shift
*
* @author yinjinlu
* @date 2022-06-06
*/
public class CalShift extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 班次ID */
private Long shiftId;
/** 计划ID */
@Excel(name = "计划ID")
private Long planId;
/** 序号 */
@Excel(name = "序号")
private Integer orderNum;
/** 班次名称 */
@Excel(name = "班次名称")
private String shiftName;
/** 开始时间 */
@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;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setShiftId(Long shiftId)
{
this.shiftId = shiftId;
}
public Long getShiftId()
{
return shiftId;
}
public void setPlanId(Long planId)
{
this.planId = planId;
}
public Long getPlanId()
{
return planId;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
public Integer getOrderNum()
{
return orderNum;
}
public void setShiftName(String shiftName)
{
this.shiftName = shiftName;
}
public String getShiftName()
{
return shiftName;
}
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 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("shiftId", getShiftId())
.append("planId", getPlanId())
.append("orderNum", getOrderNum())
.append("shiftName", getShiftName())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.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.CalShift;
/**
* 计划班次Mapper接口
*
* @author yinjinlu
* @date 2022-06-06
*/
public interface CalShiftMapper
{
/**
* 查询计划班次
*
* @param shiftId 计划班次主键
* @return 计划班次
*/
public CalShift selectCalShiftByShiftId(Long shiftId);
/**
* 查询计划班次列表
*
* @param calShift 计划班次
* @return 计划班次集合
*/
public List<CalShift> selectCalShiftList(CalShift calShift);
/**
* 新增计划班次
*
* @param calShift 计划班次
* @return 结果
*/
public int insertCalShift(CalShift calShift);
/**
* 修改计划班次
*
* @param calShift 计划班次
* @return 结果
*/
public int updateCalShift(CalShift calShift);
/**
* 删除计划班次
*
* @param shiftId 计划班次主键
* @return 结果
*/
public int deleteCalShiftByShiftId(Long shiftId);
/**
* 批量删除计划班次
*
* @param shiftIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCalShiftByShiftIds(Long[] shiftIds);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.cal.service;
import java.util.List;
import com.ktg.mes.cal.domain.CalShift;
/**
* 计划班次Service接口
*
* @author yinjinlu
* @date 2022-06-06
*/
public interface ICalShiftService
{
/**
* 查询计划班次
*
* @param shiftId 计划班次主键
* @return 计划班次
*/
public CalShift selectCalShiftByShiftId(Long shiftId);
/**
* 查询计划班次列表
*
* @param calShift 计划班次
* @return 计划班次集合
*/
public List<CalShift> selectCalShiftList(CalShift calShift);
/**
* 新增计划班次
*
* @param calShift 计划班次
* @return 结果
*/
public int insertCalShift(CalShift calShift);
/**
* 修改计划班次
*
* @param calShift 计划班次
* @return 结果
*/
public int updateCalShift(CalShift calShift);
/**
* 批量删除计划班次
*
* @param shiftIds 需要删除的计划班次主键集合
* @return 结果
*/
public int deleteCalShiftByShiftIds(Long[] shiftIds);
/**
* 删除计划班次信息
*
* @param shiftId 计划班次主键
* @return 结果
*/
public int deleteCalShiftByShiftId(Long shiftId);
}

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.CalShiftMapper;
import com.ktg.mes.cal.domain.CalShift;
import com.ktg.mes.cal.service.ICalShiftService;
/**
* 计划班次Service业务层处理
*
* @author yinjinlu
* @date 2022-06-06
*/
@Service
public class CalShiftServiceImpl implements ICalShiftService
{
@Autowired
private CalShiftMapper calShiftMapper;
/**
* 查询计划班次
*
* @param shiftId 计划班次主键
* @return 计划班次
*/
@Override
public CalShift selectCalShiftByShiftId(Long shiftId)
{
return calShiftMapper.selectCalShiftByShiftId(shiftId);
}
/**
* 查询计划班次列表
*
* @param calShift 计划班次
* @return 计划班次
*/
@Override
public List<CalShift> selectCalShiftList(CalShift calShift)
{
return calShiftMapper.selectCalShiftList(calShift);
}
/**
* 新增计划班次
*
* @param calShift 计划班次
* @return 结果
*/
@Override
public int insertCalShift(CalShift calShift)
{
calShift.setCreateTime(DateUtils.getNowDate());
return calShiftMapper.insertCalShift(calShift);
}
/**
* 修改计划班次
*
* @param calShift 计划班次
* @return 结果
*/
@Override
public int updateCalShift(CalShift calShift)
{
calShift.setUpdateTime(DateUtils.getNowDate());
return calShiftMapper.updateCalShift(calShift);
}
/**
* 批量删除计划班次
*
* @param shiftIds 需要删除的计划班次主键
* @return 结果
*/
@Override
public int deleteCalShiftByShiftIds(Long[] shiftIds)
{
return calShiftMapper.deleteCalShiftByShiftIds(shiftIds);
}
/**
* 删除计划班次信息
*
* @param shiftId 计划班次主键
* @return 结果
*/
@Override
public int deleteCalShiftByShiftId(Long shiftId)
{
return calShiftMapper.deleteCalShiftByShiftId(shiftId);
}
}