update - add生产日历

master
yinq 12 months ago
parent c305a2783e
commit 12570a5997

@ -0,0 +1,115 @@
package com.aucma.production.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.aucma.common.utils.DateUtils;
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.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.production.domain.CalendarInfo;
import com.aucma.production.service.ICalendarInfoService;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2023-11-23
*/
@RestController
@RequestMapping("/production/calendarInfo" )
public class CalendarInfoController extends BaseController {
@Autowired
private ICalendarInfoService calendarInfoService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('production:calendarInfo:list')" )
@GetMapping("/list" )
public TableDataInfo list(CalendarInfo calendarInfo) {
startPage();
List<CalendarInfo> list = calendarInfoService.selectCalendarInfoList(calendarInfo);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('production:calendarInfo:export')" )
@Log(title = "生产日历" , businessType = BusinessType.EXPORT)
@PostMapping("/export" )
public void export(HttpServletResponse response, CalendarInfo calendarInfo) {
List<CalendarInfo> list = calendarInfoService.selectCalendarInfoList(calendarInfo);
ExcelUtil<CalendarInfo> util = new ExcelUtil<CalendarInfo>(CalendarInfo. class);
util.exportExcel(response, list, "生产日历数据" );
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('production:calendarInfo:query')" )
@GetMapping(value = "/{objId}" )
public AjaxResult getInfo(@PathVariable("objId" ) Long objId) {
return success(calendarInfoService.selectCalendarInfoByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('production:calendarInfo:add')" )
@Log(title = "生产日历" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CalendarInfo calendarInfo) {
calendarInfo.setCreatedBy(getUsername());
calendarInfo.setCreatedTime(DateUtils.getNowDate());
return toAjax(calendarInfoService.insertCalendarInfo(calendarInfo));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('production:calendarInfo:edit')" )
@Log(title = "生产日历" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CalendarInfo calendarInfo) {
calendarInfo.setUpdatedBy(getUsername());
calendarInfo.setUpdatedTime(DateUtils.getNowDate());
return toAjax(calendarInfoService.updateCalendarInfo(calendarInfo));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('production:calendarInfo:remove')" )
@Log(title = "生产日历" , businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}" )
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(calendarInfoService.deleteCalendarInfoByObjIds(objIds));
}
/**
*
* @param calendarInfo
* @return
*/
@Log(title = "生产日历" , businessType = BusinessType.INSERT)
@PostMapping("/addSAPCalendar")
public AjaxResult addSAPCalendar(@RequestBody CalendarInfo calendarInfo) {
return toAjax(calendarInfoService.addSAPCalendar(calendarInfo));
}
}

@ -0,0 +1,255 @@
package com.aucma.production.domain;
import java.math.BigDecimal;
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.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
/**
* product_calendar_info
*
* @author Yinq
* @date 2023-11-23
*/
public class CalendarInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
* SAP
*/
@Excel(name = "SAP计划编号")
private String sapPlanCode;
/**
*
*/
@Excel(name = "物料编号")
private String materialCode;
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planStartDate;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planEndDate;
/**
*
*/
@Excel(name = "计划数量")
private BigDecimal planAmount;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划排产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date schedulingDate;
/**
* 0-1
*/
@Excel(name = "是否已排产", readConverterExp = "0=是,1=否")
private Long isScheduling;
/**
*
*/
@Excel(name = "排产班组")
private String schedulingTeam;
/**
*
*/
@Excel(name = "是否标识")
private Long isFlag;
/**
*
*/
@Excel(name = "创建人")
private String createdBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/**
*
*/
@Excel(name = "更新人")
private String updatedBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setSapPlanCode(String sapPlanCode) {
this.sapPlanCode = sapPlanCode;
}
public String getSapPlanCode() {
return sapPlanCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialName() {
return materialName;
}
public void setPlanStartDate(Date planStartDate) {
this.planStartDate = planStartDate;
}
public Date getPlanStartDate() {
return planStartDate;
}
public void setPlanEndDate(Date planEndDate) {
this.planEndDate = planEndDate;
}
public Date getPlanEndDate() {
return planEndDate;
}
public void setPlanAmount(BigDecimal planAmount) {
this.planAmount = planAmount;
}
public BigDecimal getPlanAmount() {
return planAmount;
}
public void setSchedulingDate(Date schedulingDate) {
this.schedulingDate = schedulingDate;
}
public Date getSchedulingDate() {
return schedulingDate;
}
public void setIsScheduling(Long isScheduling) {
this.isScheduling = isScheduling;
}
public Long getIsScheduling() {
return isScheduling;
}
public void setSchedulingTeam(String schedulingTeam) {
this.schedulingTeam = schedulingTeam;
}
public String getSchedulingTeam() {
return schedulingTeam;
}
public void setIsFlag(Long isFlag) {
this.isFlag = isFlag;
}
public Long getIsFlag() {
return isFlag;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getCreatedTime() {
return createdTime;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("sapPlanCode", getSapPlanCode())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("planStartDate", getPlanStartDate())
.append("planEndDate", getPlanEndDate())
.append("planAmount", getPlanAmount())
.append("schedulingDate", getSchedulingDate())
.append("isScheduling", getIsScheduling())
.append("schedulingTeam", getSchedulingTeam())
.append("isFlag", getIsFlag())
.append("createdBy", getCreatedBy())
.append("createdTime", getCreatedTime())
.append("updatedBy", getUpdatedBy())
.append("updatedTime", getUpdatedTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.aucma.production.mapper;
import java.util.List;
import com.aucma.production.domain.CalendarInfo;
/**
* Mapper
*
* @author Yinq
* @date 2023-11-23
*/
public interface CalendarInfoMapper
{
/**
*
*
* @param objId
* @return
*/
public CalendarInfo selectCalendarInfoByObjId(Long objId);
/**
*
*
* @param calendarInfo
* @return
*/
public List<CalendarInfo> selectCalendarInfoList(CalendarInfo calendarInfo);
/**
*
*
* @param calendarInfo
* @return
*/
public int insertCalendarInfo(CalendarInfo calendarInfo);
/**
*
*
* @param calendarInfo
* @return
*/
public int updateCalendarInfo(CalendarInfo calendarInfo);
/**
*
*
* @param objId
* @return
*/
public int deleteCalendarInfoByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteCalendarInfoByObjIds(Long[] objIds);
}

@ -0,0 +1,69 @@
package com.aucma.production.service;
import java.util.List;
import com.aucma.production.domain.CalendarInfo;
/**
* Service
*
* @author Yinq
* @date 2023-11-23
*/
public interface ICalendarInfoService
{
/**
*
*
* @param objId
* @return
*/
public CalendarInfo selectCalendarInfoByObjId(Long objId);
/**
*
*
* @param calendarInfo
* @return
*/
public List<CalendarInfo> selectCalendarInfoList(CalendarInfo calendarInfo);
/**
*
*
* @param calendarInfo
* @return
*/
public int insertCalendarInfo(CalendarInfo calendarInfo);
/**
*
*
* @param calendarInfo
* @return
*/
public int updateCalendarInfo(CalendarInfo calendarInfo);
/**
*
*
* @param objIds
* @return
*/
public int deleteCalendarInfoByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteCalendarInfoByObjId(Long objId);
/**
* SAP
*
* @param calendarInfo
* @return
*/
public int addSAPCalendar(CalendarInfo calendarInfo);
}

@ -0,0 +1,110 @@
package com.aucma.production.service.impl;
import java.util.List;
import com.aucma.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.production.mapper.CalendarInfoMapper;
import com.aucma.production.domain.CalendarInfo;
import com.aucma.production.service.ICalendarInfoService;
import static com.aucma.common.utils.SecurityUtils.getUsername;
/**
* Service
*
* @author Yinq
* @date 2023-11-23
*/
@Service
public class CalendarInfoServiceImpl implements ICalendarInfoService
{
@Autowired
private CalendarInfoMapper calendarInfoMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public CalendarInfo selectCalendarInfoByObjId(Long objId)
{
return calendarInfoMapper.selectCalendarInfoByObjId(objId);
}
/**
*
*
* @param calendarInfo
* @return
*/
@Override
public List<CalendarInfo> selectCalendarInfoList(CalendarInfo calendarInfo)
{
return calendarInfoMapper.selectCalendarInfoList(calendarInfo);
}
/**
*
*
* @param calendarInfo
* @return
*/
@Override
public int insertCalendarInfo(CalendarInfo calendarInfo)
{
return calendarInfoMapper.insertCalendarInfo(calendarInfo);
}
/**
*
*
* @param calendarInfo
* @return
*/
@Override
public int updateCalendarInfo(CalendarInfo calendarInfo)
{
return calendarInfoMapper.updateCalendarInfo(calendarInfo);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteCalendarInfoByObjIds(Long[] objIds)
{
return calendarInfoMapper.deleteCalendarInfoByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteCalendarInfoByObjId(Long objId)
{
return calendarInfoMapper.deleteCalendarInfoByObjId(objId);
}
/**
* SAP
* @param calendarInfo
* @return
*/
@Override
public int addSAPCalendar(CalendarInfo calendarInfo) {
return 1;
}
}

@ -0,0 +1,126 @@
<?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.aucma.production.mapper.CalendarInfoMapper">
<resultMap type="CalendarInfo" id="CalendarInfoResult">
<result property="objId" column="obj_id" />
<result property="sapPlanCode" column="sap_plan_code" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="planStartDate" column="plan_start_date" />
<result property="planEndDate" column="plan_end_date" />
<result property="planAmount" column="plan_amount" />
<result property="schedulingDate" column="scheduling_date" />
<result property="isScheduling" column="is_scheduling" />
<result property="schedulingTeam" column="scheduling_team" />
<result property="isFlag" column="is_flag" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectCalendarInfoVo">
select obj_id, sap_plan_code, material_code, material_name, plan_start_date, plan_end_date, plan_amount, scheduling_date, is_scheduling, scheduling_team, is_flag, created_by, created_time, updated_by, updated_time from product_calendar_info
</sql>
<select id="selectCalendarInfoList" parameterType="CalendarInfo" resultMap="CalendarInfoResult">
<include refid="selectCalendarInfoVo"/>
<where>
<if test="sapPlanCode != null and sapPlanCode != ''"> and sap_plan_code = #{sapPlanCode}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat(concat('%', #{materialName}), '%')</if>
<if test="params.beginPlanStartDate != null and params.beginPlanStartDate != '' and params.endPlanStartDate != null and params.endPlanStartDate != ''"> and plan_start_date between to_date(#{params.beginPlanStartDate}, 'yyyy-mm-dd hh24:mi:ss') and to_date(#{params.endPlanStartDate}, 'yyyy-mm-dd hh24:mi:ss')</if>
<if test="planEndDate != null "> and plan_end_date = #{planEndDate}</if>
<if test="planAmount != null "> and plan_amount = #{planAmount}</if>
<if test="params.beginSchedulingDate != null and params.beginSchedulingDate != '' and params.endSchedulingDate != null and params.endSchedulingDate != ''"> and scheduling_date between to_date(#{params.beginSchedulingDate}, 'yyyy-mm-dd hh24:mi:ss') and to_date(#{params.endSchedulingDate}, 'yyyy-mm-dd hh24:mi:ss')</if>
<if test="isScheduling != null "> and is_scheduling = #{isScheduling}</if>
<if test="schedulingTeam != null and schedulingTeam != ''"> and scheduling_team = #{schedulingTeam}</if>
<if test="isFlag != null "> and is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectCalendarInfoByObjId" parameterType="Long" resultMap="CalendarInfoResult">
<include refid="selectCalendarInfoVo"/>
where obj_id = #{objId}
</select>
<insert id="insertCalendarInfo" parameterType="CalendarInfo">
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
SELECT seq_product_calendar_info.NEXTVAL as objId FROM DUAL
</selectKey>
insert into product_calendar_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">obj_id,</if>
<if test="sapPlanCode != null">sap_plan_code,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="planStartDate != null">plan_start_date,</if>
<if test="planEndDate != null">plan_end_date,</if>
<if test="planAmount != null">plan_amount,</if>
<if test="schedulingDate != null">scheduling_date,</if>
<if test="isScheduling != null">is_scheduling,</if>
<if test="schedulingTeam != null">scheduling_team,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
<if test="sapPlanCode != null">#{sapPlanCode},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="planStartDate != null">#{planStartDate},</if>
<if test="planEndDate != null">#{planEndDate},</if>
<if test="planAmount != null">#{planAmount},</if>
<if test="schedulingDate != null">#{schedulingDate},</if>
<if test="isScheduling != null">#{isScheduling},</if>
<if test="schedulingTeam != null">#{schedulingTeam},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateCalendarInfo" parameterType="CalendarInfo">
update product_calendar_info
<trim prefix="SET" suffixOverrides=",">
<if test="sapPlanCode != null">sap_plan_code = #{sapPlanCode},</if>
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="planStartDate != null">plan_start_date = #{planStartDate},</if>
<if test="planEndDate != null">plan_end_date = #{planEndDate},</if>
<if test="planAmount != null">plan_amount = #{planAmount},</if>
<if test="schedulingDate != null">scheduling_date = #{schedulingDate},</if>
<if test="isScheduling != null">is_scheduling = #{isScheduling},</if>
<if test="schedulingTeam != null">scheduling_team = #{schedulingTeam},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteCalendarInfoByObjId" parameterType="Long">
delete from product_calendar_info where obj_id = #{objId}
</delete>
<delete id="deleteCalendarInfoByObjIds" parameterType="String">
delete from product_calendar_info where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save