update - add生产日历
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,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…
Reference in New Issue