aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessShopStatController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,74 @@ package com.aps.core.controller.mainPlan; 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.ApsPlateProcessShopStat; import com.aps.core.service.IApsPlateProcessShopStatService; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * é£é车é´ç»è®¡Controller * * @author zhl * @date 2025-04-23 */ @RestController @RequestMapping("/ApsPlateProcessShopStat") public class ApsPlateProcessShopStatController extends BaseController { @Autowired private IApsPlateProcessShopStatService apsPlateProcessShopStatService; /** * 导åºé£é车é´ç»è®¡å表 */ @RequiresPermissions("ApsPlateProcessShopStat:ApsPlateProcessShopStat:export") @Log(title = "é£é车é´ç»è®¡", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ApsPlateProcessShopStat apsPlateProcessShopStat) { List<ApsPlateProcessShopStat> list = apsPlateProcessShopStatService.selectApsPlateProcessShopStatList(apsPlateProcessShopStat); ExcelUtil<ApsPlateProcessShopStat> util = new ExcelUtil<ApsPlateProcessShopStat>(ApsPlateProcessShopStat.class); util.exportExcel(response, list, "é£é车é´ç»è®¡æ°æ®"); } /** * ä¿®æ¹é£é车é´ç»è®¡ */ @Log(title = "é£é车é´ç»è®¡", businessType = BusinessType.UPDATE) @PostMapping("/update") public AjaxResult update(@RequestBody ApsPlateProcessShopStat apsPlateProcessShopStat) { apsPlateProcessShopStatService.saveShopStat(); return toAjax(true); } /** * æ¥è¯¢é£é车é´ç»è®¡å表 */ @GetMapping("/list") public AjaxResult list(ApsPlateProcessShopStat apsPlateProcessShopStat) { return apsPlateProcessShopStatService.getShopPlanStat(); } } aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopPlanStat.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,68 @@ package com.aps.core.domain; import com.aps.common.core.annotation.Excel; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; import java.io.Serializable; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @Data public class ApsPlateProcessShopPlanStat implements Serializable { @Serial private static final long serialVersionUID = 1L; /** 主é®id */ private String id; /** 主件æå· */ @Excel(name = "主件æå·") private String mainPartNumber; /** ä¸å¡ç±»å */ @Excel(name = "ä¸å¡ç±»å") private String businessType; /** åæ®å· */ @Excel(name = "åæ®å·") private String documentNumber; /** éæ±åç±» */ @Excel(name = "éæ±åç±»") private String requirementType; /** åæ®ç¶æ */ @Excel(name = "åæ®ç¶æ") private String documentStatus; /** å½åå·¥åº */ @Excel(name = "å½åå·¥åº") private String workCenter; /** æå· */ @Excel(name = "æå·") private String itemNumber; /** å¾å· */ @Excel(name = "å¾å·") private String drawingNo; /** çæ¬å· */ @Excel(name = "çæ¬å·") private String versionNumber; /** ç产æ°é */ @Excel(name = "ç产æ°é") private BigDecimal productionQuantity; /** 计åå®å·¥æ¥ */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "计åå®å·¥æ¥", width = 30, dateFormat = "yyyy-MM-dd") private Date planEndDay; private List<ApsPlateProcessShopStat> deptPlans=new ArrayList<>(); } aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopStat.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,140 @@ package com.aps.core.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.aps.common.core.annotation.Excel; //import io.swagger.annotations.ApiModel; //import io.swagger.annotations.ApiModelProperty; import com.aps.common.core.web.domain.BaseEntity; /** * é£é车é´ç»è®¡å¯¹è±¡ aps_plate_process_shop_stat * * @author zhl * @date 2025-04-23 */ //@ApiModel("é£é车é´ç»è®¡å®ä½ç±»") public class ApsPlateProcessShopStat extends BaseEntity { private static final long serialVersionUID = 1L; /** $column.columnComment */ //@ApiModelProperty("$column.columnComment") private Long id; /** åæ®å· */ @Excel(name = "åæ®å·") ///@ApiModelProperty("åæ®å·") private String docNo; /** 车é´ç¼ç */ @Excel(name = "车é´ç¼ç ") //@ApiModelProperty("车é´ç¼ç ") private String shopCode; /** 车é´åç§° */ @Excel(name = "车é´åç§°") //@ApiModelProperty("车é´åç§°") private String shopName; /** 计åå¼å§æ¶é´ */ @Excel(name = "计åå¼å§æ¶é´") //@ApiModelProperty("计åå¼å§æ¶é´") private String planStartDate; /** 计åç»ææ¥æ */ @Excel(name = "计åç»ææ¥æ") //@ApiModelProperty("计åç»ææ¥æ") private String planEndDate; /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ //@ApiModelProperty("å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼") private String delFlag; public void setId(Long id) { this.id = id; } public Long getId() { return id; } public void setDocNo(String docNo) { this.docNo = docNo; } public String getDocNo() { return docNo; } public void setShopCode(String shopCode) { this.shopCode = shopCode; } public String getShopCode() { return shopCode; } public void setShopName(String shopName) { this.shopName = shopName; } public String getShopName() { return shopName; } public void setPlanStartDate(String planStartDate) { this.planStartDate = planStartDate; } public String getPlanStartDate() { return planStartDate; } public void setPlanEndDate(String planEndDate) { this.planEndDate = planEndDate; } public String getPlanEndDate() { return planEndDate; } public void setDelFlag(String delFlag) { this.delFlag = delFlag; } public String getDelFlag() { return delFlag; } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) .append("docNo", getDocNo()) .append("shopCode", getShopCode()) .append("shopName", getShopName()) .append("planStartDate", getPlanStartDate()) .append("planEndDate", getPlanEndDate()) .append("delFlag", getDelFlag()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .toString(); } } aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,67 @@ package com.aps.core.mapper; import java.util.List; import com.aps.core.domain.ApsPlateProcessShopStat; import org.apache.ibatis.annotations.Mapper; /** * é£é车é´ç»è®¡Mapperæ¥å£ * * @author zhl * @date 2025-04-23 */ @Mapper public interface ApsPlateProcessShopStatMapper { /** * æ¥è¯¢é£é车é´ç»è®¡ * * @param id é£é车é´ç»è®¡ä¸»é® * @return é£é车é´ç»è®¡ */ public ApsPlateProcessShopStat selectApsPlateProcessShopStatById(Long id); /** * æ¥è¯¢é£é车é´ç»è®¡å表 * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return é£é车é´ç»è®¡éå */ public List<ApsPlateProcessShopStat> selectApsPlateProcessShopStatList(ApsPlateProcessShopStat apsPlateProcessShopStat); /** * æ°å¢é£é车é´ç»è®¡ * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return ç»æ */ public int insertApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat); /** * ä¿®æ¹é£é车é´ç»è®¡ * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return ç»æ */ public int updateApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat); /** * å é¤é£é车é´ç»è®¡ * * @param id é£é车é´ç»è®¡ä¸»é® * @return ç»æ */ public int deleteApsPlateProcessShopStatById(Long id); /** * æ¹éå é¤é£é车é´ç»è®¡ * * @param ids éè¦å é¤çæ°æ®ä¸»é®éå * @return ç»æ */ public int deleteApsPlateProcessShopStatByIds(Long[] ids); int deleteAll(); void batchInsert(List<ApsPlateProcessShopStat> stats); } aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessShopStatService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,67 @@ package com.aps.core.service; import java.util.List; import com.aps.common.core.web.domain.AjaxResult; import com.aps.core.domain.ApsPlateProcessShopStat; /** * é£é车é´ç»è®¡Serviceæ¥å£ * * @author zhl * @date 2025-04-23 */ public interface IApsPlateProcessShopStatService { /** * æ¥è¯¢é£é车é´ç»è®¡ * * @param id é£é车é´ç»è®¡ä¸»é® * @return é£é车é´ç»è®¡ */ public ApsPlateProcessShopStat selectApsPlateProcessShopStatById(Long id); /** * æ¥è¯¢é£é车é´ç»è®¡å表 * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return é£é车é´ç»è®¡éå */ public List<ApsPlateProcessShopStat> selectApsPlateProcessShopStatList(ApsPlateProcessShopStat apsPlateProcessShopStat); /** * æ°å¢é£é车é´ç»è®¡ * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return ç»æ */ public int insertApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat); /** * ä¿®æ¹é£é车é´ç»è®¡ * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return ç»æ */ public int updateApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat); /** * æ¹éå é¤é£é车é´ç»è®¡ * * @param ids éè¦å é¤çé£é车é´ç»è®¡ä¸»é®éå * @return ç»æ */ public int deleteApsPlateProcessShopStatByIds(Long[] ids); /** * å é¤é£é车é´ç»è®¡ä¿¡æ¯ * * @param id é£é车é´ç»è®¡ä¸»é® * @return ç»æ */ public int deleteApsPlateProcessShopStatById(Long id); void saveShopStat(); AjaxResult getShopPlanStat(); } aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java
@@ -183,4 +183,7 @@ return Strings.EMPTY; } } } aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessShopStatServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,283 @@ package com.aps.core.service.impl; import java.util.*; import java.util.stream.Collectors; import com.alibaba.fastjson.JSONObject; import com.aps.common.core.utils.DateUtils; import com.aps.common.core.utils.bean.BeanUtils; import com.aps.common.core.web.domain.AjaxResult; import com.aps.common.security.utils.SecurityUtils; import com.aps.core.domain.*; import com.aps.core.mapper.*; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.aps.core.service.IApsPlateProcessShopStatService; import org.springframework.transaction.annotation.Transactional; /** * é£é车é´ç»è®¡Serviceä¸å¡å±å¤ç * * @author zhl * @date 2025-04-23 */ @Slf4j @Service public class ApsPlateProcessShopStatServiceImpl implements IApsPlateProcessShopStatService { @Autowired private ApsPlateProcessShopStatMapper apsPlateProcessShopStatMapper; @Resource private ApsPlateProcessStatMapper apsPlateProcessStatMapper; @Resource private ApsShopMapper shopMapper; @Resource private ApsStandardProcessMapper standardProcessMapper; @Resource private ApsPlatePlanMapper apsPlatePlanMapper; /** * æ¥è¯¢é£é车é´ç»è®¡ * * @param id é£é车é´ç»è®¡ä¸»é® * @return é£é车é´ç»è®¡ */ @Override public ApsPlateProcessShopStat selectApsPlateProcessShopStatById(Long id) { return apsPlateProcessShopStatMapper.selectApsPlateProcessShopStatById(id); } /** * æ¥è¯¢é£é车é´ç»è®¡å表 * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return é£é车é´ç»è®¡ */ @Override public List<ApsPlateProcessShopStat> selectApsPlateProcessShopStatList(ApsPlateProcessShopStat apsPlateProcessShopStat) { return apsPlateProcessShopStatMapper.selectApsPlateProcessShopStatList(apsPlateProcessShopStat); } /** * æ°å¢é£é车é´ç»è®¡ * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return ç»æ */ @Override public int insertApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat) { apsPlateProcessShopStat.setCreateTime(DateUtils.getNowDate()); return apsPlateProcessShopStatMapper.insertApsPlateProcessShopStat(apsPlateProcessShopStat); } /** * ä¿®æ¹é£é车é´ç»è®¡ * * @param apsPlateProcessShopStat é£é车é´ç»è®¡ * @return ç»æ */ @Override public int updateApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat) { apsPlateProcessShopStat.setUpdateTime(DateUtils.getNowDate()); return apsPlateProcessShopStatMapper.updateApsPlateProcessShopStat(apsPlateProcessShopStat); } /** * æ¹éå é¤é£é车é´ç»è®¡ * * @param ids éè¦å é¤çé£é车é´ç»è®¡ä¸»é® * @return ç»æ */ @Override public int deleteApsPlateProcessShopStatByIds(Long[] ids) { return apsPlateProcessShopStatMapper.deleteApsPlateProcessShopStatByIds(ids); } /** * å é¤é£é车é´ç»è®¡ä¿¡æ¯ * * @param id é£é车é´ç»è®¡ä¸»é® * @return ç»æ */ @Override public int deleteApsPlateProcessShopStatById(Long id) { return apsPlateProcessShopStatMapper.deleteApsPlateProcessShopStatById(id); } /** * ä¿åé£é车é´ç»è®¡ */ @Transactional @Override public void saveShopStat() { try { // å¼å§ä¹åå å 餿æå岿°æ® apsPlateProcessShopStatMapper.deleteAll(); // å®ä¹è¯¥åè½ä½¿ç¨æ°æ®æºä¸ºåéçå·¥å final String plant = "FORTUNA"; // æ¥è¯¢ç¸å ³æ°æ® ApsPlatePlan platePlan = new ApsPlatePlan(); platePlan.setPlant(plant); List<ApsPlatePlan> planList = apsPlatePlanMapper.selectApsPlatePlanList(platePlan); List<ApsPlateProcessStat> statList = apsPlateProcessStatMapper.selectApsPlateProcessStatList(new ApsPlateProcessStat()); ApsShop apsShop = new ApsShop(); apsShop.setPlantCode(plant); List<ApsShop> shopList = shopMapper.selectApsShopList(apsShop); ApsStandardProcess process = new ApsStandardProcess(); process.setPlant(plant); List<ApsStandardProcess> shopProcesses = standardProcessMapper.selectApsStandardProcessList(process); if (planList.isEmpty() || shopList.isEmpty() || shopProcesses.isEmpty()) { log.warn("计åå表ã车é´å表æå·¥åºåè¡¨ä¸ºç©ºï¼æ æ³çæç»è®¡ä¿¡æ¯"); return; } // æå»ºè½¦é´åç§°å°å·¥åºåç§°çæ å° Map<String, List<String>> shopToProcessNames = shopProcesses.stream() .collect(Collectors.groupingBy(ApsStandardProcess::getWorkShop, Collectors.mapping(ApsStandardProcess::getProcessName, Collectors.toList()) )); // æ¹éæå ¥ç»è®¡æ°æ® List<ApsPlateProcessShopStat> statsToInsert = new ArrayList<>(); for (ApsPlatePlan plan : planList) { for (ApsShop shop : shopList) { ApsPlateProcessShopStat stat = createShopStat(plan, shop, shopToProcessNames, statList); statsToInsert.add(stat); } } // æ¹éæå ¥ä»¥æé«æ§è½ if (!statsToInsert.isEmpty()) { int batchSize = 1000; for (int i = 0; i < statsToInsert.size(); i += batchSize) { int end = Math.min(i + batchSize, statsToInsert.size()); List<ApsPlateProcessShopStat> batch = statsToInsert.subList(i, end); apsPlateProcessShopStatMapper.batchInsert(batch); } } } catch (Exception e) { log.error("ä¿åé£é车é´ç»è®¡æ¶åçå¼å¸¸", e); throw new RuntimeException("ä¿åé£é车é´ç»è®¡å¤±è´¥", e); } } /** * å建å个车é´ç»è®¡å¯¹è±¡ */ private ApsPlateProcessShopStat createShopStat(ApsPlatePlan plan, ApsShop shop, Map<String, List<String>> shopToProcessNames, List<ApsPlateProcessStat> statList) { String shopName = shop.getShopName(); ApsPlateProcessShopStat stat = new ApsPlateProcessShopStat(); stat.setDocNo(plan.getDocumentNumber()); stat.setShopCode(shop.getShopCode()); stat.setShopName(shopName); stat.setDelFlag("0"); stat.setCreateBy(SecurityUtils.getUsername()); stat.setCreateTime(DateUtils.getNowDate()); try { List<String> processNames = shopToProcessNames.getOrDefault(shopName, Collections.emptyList()); if (!processNames.isEmpty()) { // æ ¹æ®å·¥åºåç§°ï¼æ¥è¯¢è¯¥å·¥å䏿æçå·¥åºä¿¡æ¯ List<ApsPlateProcessStat> processStats = statList.stream() .filter(x -> processNames.contains(x.getProcessName()) && x.getWorkOrderNo().equals(plan.getDocumentNumber())) .toList(); if (!processStats.isEmpty()) { // ååºå·¥åä¸å·¥åºçæå°å¼å§æ¶é´åæå¤§ç»ææ¶é´ List<Date> startDayList = processStats.stream().map(ApsPlateProcessStat::getProcessPlanStartDay).filter(Objects::nonNull).toList(); if (!startDayList.isEmpty()) { if (startDayList.size() == 1) { stat.setPlanStartDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", startDayList.get(0))); } else { Optional<Date> minStartDay = processStats.stream() .map(ApsPlateProcessStat::getProcessPlanStartDay) .min(Comparator.naturalOrder()); Date date = minStartDay.get(); stat.setPlanStartDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", date)); } } List<Date> endDayList = processStats.stream().map(ApsPlateProcessStat::getProcessPlanEndDay).filter(Objects::nonNull).toList(); if (!endDayList.isEmpty()) { if (endDayList.size() == 1) { stat.setPlanEndDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", endDayList.get(0))); } else { Optional<Date> maxEndDay = processStats.stream() .map(ApsPlateProcessStat::getProcessPlanEndDay) .max(Comparator.naturalOrder()); Date date = maxEndDay.get(); stat.setPlanEndDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", date)); } } } } } catch (Exception e) { log.error("computer error:"+ JSONObject.toJSONString(stat)); } return stat; } @Override public AjaxResult getShopPlanStat() { // æå硬ç¼ç å¼ä¸ºå¸¸é final String PLANT_CODE = "FORTUNA"; // åå§å对象 ApsPlatePlan platePlan = new ApsPlatePlan(); platePlan.setPlant(PLANT_CODE); ApsShop apsShop = new ApsShop(); apsShop.setPlantCode(PLANT_CODE); // è·å车é´å表并å¤çç©ºå¼ List<String> shopList = Optional.ofNullable(shopMapper.selectApsShopList(apsShop)) .orElse(Collections.emptyList()) .stream() .map(ApsShop::getShopName) .toList(); // è·å计åå表åç¶æå表 List<ApsPlatePlan> planList = Optional.ofNullable(apsPlatePlanMapper.selectApsPlatePlanList(platePlan)) .orElse(Collections.emptyList()); List<ApsPlateProcessShopStat> shopStates = Optional.ofNullable(apsPlateProcessShopStatMapper.selectApsPlateProcessShopStatList(new ApsPlateProcessShopStat())) .orElse(Collections.emptyList()); // æå对 shopStates æ docNo åç»ï¼åå°é夿µæä½ Map<String, List<ApsPlateProcessShopStat>> shopStatesByDocNo = shopStates.stream() .collect(Collectors.groupingBy(ApsPlateProcessShopStat::getDocNo)); // æå»ºç»æå表 List<ApsPlateProcessShopPlanStat> shopPlanStats = planList.stream() .map(plan -> { ApsPlateProcessShopPlanStat shopPlanStat = new ApsPlateProcessShopPlanStat(); BeanUtils.copyProperties(plan, shopPlanStat); // ç¡®ä¿ç®æ 对象æ¯åæ³çå个对象å®ä¾ // æ ¹æ® docNo è·å对åºç shopStatList List<ApsPlateProcessShopStat> shopStatList = shopStatesByDocNo.getOrDefault(plan.getDocumentNumber(), Collections.emptyList()); shopPlanStat.setDeptPlans(shopStatList); return shopPlanStat; }) .toList(); // æå»ºè¿åç»æ AjaxResult success = AjaxResult.success(shopPlanStats); success.put("shopNames", shopList); return success; } } aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml
@@ -49,40 +49,41 @@ <select id="selectApsPlatePlanList" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult"> <include refid="selectApsPlatePlanVo"/> <where> <if test="masterPlanner != null and masterPlanner != ''"> and master_planner like concat('%', #{masterPlanner}, '%')</if> <if test="masterPlanner != null and masterPlanner != ''"> and master_planner like '%'|| #{masterPlanner}|| '%'</if> <if test="weekDay != null "> and week_day = #{weekDay}</if> <if test="weekCycle != null and weekCycle != ''"> and week_cycle like concat('%', #{weekCycle}, '%')</if> <if test="mainPartNumber != null and mainPartNumber != ''"> and main_part_number like concat('%', #{mainPartNumber}, '%')</if> <if test="mainPartDrawingNumber != null and mainPartDrawingNumber != ''"> and main_part_drawing_number like concat('%', #{mainPartDrawingNumber}, '%')</if> <if test="weekCycle != null and weekCycle != ''"> and week_cycle like '%'|| #{weekCycle}|| '%' </if> <if test="mainPartNumber != null and mainPartNumber != ''"> and main_part_number like '%'|| #{mainPartNumber} ||'%' </if> <if test="mainPartDrawingNumber != null and mainPartDrawingNumber != ''"> and main_part_drawing_number like '%'|| #{mainPartDrawingNumber}|| '%'</if> <if test="customer != null and customer != ''"> and customer like '%' || #{customer} || '%'</if> <if test="businessType != null and businessType != ''"> and business_type = #{businessType}</if> <if test="documentNumber != null and documentNumber != ''"> and document_number like '%'|| #{documentNumber}|| '%'</if> <if test="requirementType != null and requirementType != ''"> and requirement_type like concat('%', #{requirementType}, '%')</if> <if test="requirementType != null and requirementType != ''"> and requirement_type like '%'|| #{requirementType}||'%' </if> <if test="documentStatus != null and documentStatus != ''"> and document_status = #{documentStatus}</if> <if test="itemNumber != null and itemNumber != ''"> and item_number like concat('%', #{itemNumber}, '%')</if> <if test="drawingNo != null and drawingNo != ''"> and drawing_no like concat('%', #{drawingNo}, '%')</if> <if test="versionNumber != null and versionNumber != ''"> and version_number like concat('%', #{versionNumber}, '%')</if> <if test="itemNumber != null and itemNumber != ''"> and item_number like '%'|| #{itemNumber}|| '%'</if> <if test="drawingNo != null and drawingNo != ''"> and drawing_no like '%'|| #{drawingNo}|| '%'</if> <if test="versionNumber != null and versionNumber != ''"> and version_number like '%'|| #{versionNumber}|| '%'</if> <if test="productionQuantity != null "> and production_quantity = #{productionQuantity}</if> <if test="goodProductsQuantity != null "> and good_products_quantity = #{goodProductsQuantity}</if> <if test="processNumber != null and processNumber != ''"> and process_number like concat('%', #{processNumber}, '%')</if> <if test="workCenter != null and workCenter != ''"> and work_center like concat('%', #{workCenter}, '%')</if> <if test="department != null and department != ''"> and department like concat('%', #{department}, '%')</if> <if test="processNumber != null and processNumber != ''"> and process_number like '%'|| #{processNumber}||'%'</if> <if test="workCenter != null and workCenter != ''"> and work_center like '%'|| #{workCenter}||'%'</if> <if test="department != null and department != ''"> and department like '%'|| #{department}||'%'</if> <if test="params.beginPlanStartDay != null and params.beginPlanStartDay != '' and params.endPlanStartDay != null and params.endPlanStartDay != ''"> and plan_start_day between #{params.beginPlanStartDay} and #{params.endPlanStartDay}</if> <if test="params.beginPlanEndDay != null and params.beginPlanEndDay != '' and params.endPlanEndDay != null and params.endPlanEndDay != ''"> and plan_end_day between #{params.beginPlanEndDay} and #{params.endPlanEndDay}</if> <if test="standbyNumber != null and standbyNumber != ''"> and standby_number like concat('%', #{standbyNumber}, '%')</if> <if test="standbyName != null and standbyName != ''"> and standby_name like concat('%', #{standbyName}, '%')</if> <if test="standbyNumber != null and standbyNumber != ''"> and standby_number like '%'|| #{standbyNumber}|| '%'</if> <if test="standbyName != null and standbyName != ''"> and standby_name like '%'|| #{standbyName}||'%'</if> <if test="standbyStock != null "> and standby_stock = #{standbyStock}</if> <if test="nextProcessDeparment != null and nextProcessDeparment != ''"> and next_process_deparment like concat('%', #{nextProcessDeparment}, '%')</if> <if test="nextProcessDeparment != null and nextProcessDeparment != ''"> and next_process_deparment like '%'|| #{nextProcessDeparment}|| '%'</if> <if test="isSuspended != null "> and is_suspended = #{isSuspended}</if> <if test="isOutsourcing != null and isOutsourcing != ''"> and is_outsourcing like concat('%', #{isOutsourcing}, '%')</if> <if test="account != null and account != ''"> and account like concat('%', #{account}, '%')</if> <if test="advancedMaterials != null and advancedMaterials != ''"> and advanced_materials like concat('%', #{advancedMaterials}, '%')</if> <if test="advancedDocumentNumber != null and advancedDocumentNumber != ''"> and advanced_document_number like concat('%', #{advancedDocumentNumber}, '%')</if> <if test="isOutsourcing != null and isOutsourcing != ''"> and is_outsourcing like '%'|| #{isOutsourcing}||'%'</if> <if test="account != null and account != ''"> and account like '%'|| #{account}|| '%'</if> <if test="advancedMaterials != null and advancedMaterials != ''"> and advanced_materials like '%'|| #{advancedMaterials}|| '%'</if> <if test="advancedDocumentNumber != null and advancedDocumentNumber != ''"> and advanced_document_number '%'|| #{advancedDocumentNumber}|| '%'</if> <if test="params.beginAdvancedRequirementDay != null and params.beginAdvancedRequirementDay != '' and params.endAdvancedRequirementDay != null and params.endAdvancedRequirementDay != ''"> and advanced_requirement_day between #{params.beginAdvancedRequirementDay} and #{params.endAdvancedRequirementDay}</if> <if test="isPlanComplete != null "> and is_plan_complete = #{isPlanComplete}</if> <if test="isStockComplete != null "> and is_stock_complete = #{isStockComplete}</if> <if test="hasTurnback != null "> and has_turnback = #{hasTurnback}</if> <if test="hasRisk != null "> and has_risk = #{hasRisk}</if> <if test="plant != null "> and plant = #{plant}</if> and del_flag='0' </where> </select> aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessShopStatMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,118 @@ <?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.ApsPlateProcessShopStatMapper"> <resultMap type="ApsPlateProcessShopStat" id="ApsPlateProcessShopStatResult"> <result property="id" column="id" /> <result property="docNo" column="doc_no" /> <result property="shopCode" column="shop_code" /> <result property="shopName" column="shop_name" /> <result property="planStartDate" column="plan_start_date" /> <result property="planEndDate" column="plan_end_date" /> <result property="delFlag" column="del_flag" /> <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="selectApsPlateProcessShopStatVo"> select id, doc_no, shop_code, shop_name, plan_start_date, plan_end_date, del_flag, create_by, create_time, update_by, update_time from aps_plate_process_shop_stat </sql> <select id="selectApsPlateProcessShopStatList" parameterType="ApsPlateProcessShopStat" resultMap="ApsPlateProcessShopStatResult"> <include refid="selectApsPlateProcessShopStatVo"/> <where> <if test="docNo != null and docNo != ''"> and doc_no = #{docNo}</if> <if test="shopCode != null and shopCode != ''"> and shop_code = #{shopCode}</if> <if test="shopName != null and shopName != ''"> and shop_name = #{shopName}</if> <if test="planStartDate != null and planStartDate != ''"> and plan_start_date = #{planStartDate}</if> <if test="planEndDate != null and planEndDate != ''"> and plan_end_date = #{planEndDate}</if> and del_flag='0' </where> </select> <select id="selectApsPlateProcessShopStatById" parameterType="Long" resultMap="ApsPlateProcessShopStatResult"> <include refid="selectApsPlateProcessShopStatVo"/> where id = #{id} </select> <insert id="insertApsPlateProcessShopStat" parameterType="ApsPlateProcessShopStat" useGeneratedKeys="true" keyProperty="id"> insert into aps_plate_process_shop_stat <trim prefix="(" suffix=")" suffixOverrides=","> <if test="docNo != null">doc_no,</if> <if test="shopCode != null">shop_code,</if> <if test="shopName != null">shop_name,</if> <if test="planStartDate != null">plan_start_date,</if> <if test="planEndDate != null">plan_end_date,</if> <if test="delFlag != null">del_flag,</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="docNo != null">#{docNo},</if> <if test="shopCode != null">#{shopCode},</if> <if test="shopName != null">#{shopName},</if> <if test="planStartDate != null">#{planStartDate},</if> <if test="planEndDate != null">#{planEndDate},</if> <if test="delFlag != null">#{delFlag},</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="updateApsPlateProcessShopStat" parameterType="ApsPlateProcessShopStat"> update aps_plate_process_shop_stat <trim prefix="SET" suffixOverrides=","> <if test="docNo != null">doc_no = #{docNo},</if> <if test="shopCode != null">shop_code = #{shopCode},</if> <if test="shopName != null">shop_name = #{shopName},</if> <if test="planStartDate != null">plan_start_date = #{planStartDate},</if> <if test="planEndDate != null">plan_end_date = #{planEndDate},</if> <if test="delFlag != null">del_flag = #{delFlag},</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="deleteApsPlateProcessShopStatById" parameterType="Long"> delete from aps_plate_process_shop_stat where id = #{id} </delete> <delete id="deleteApsPlateProcessShopStatByIds" parameterType="String"> delete from aps_plate_process_shop_stat where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> <delete id="deleteAll" > delete from aps_plate_process_shop_stat where del_flag in ('0','1') </delete> <insert id="batchInsert" parameterType="java.util.List"> insert into aps_plate_process_shop_stat (doc_no, shop_code, shop_name, plan_start_date, plan_end_date, del_flag, create_by, create_time) values <foreach collection="list" item="item" separator=","> ( #{item.docNo}, #{item.shopCode}, #{item.shopName}, #{item.planStartDate}, #{item.planEndDate}, #{item.delFlag}, #{item.createBy}, #{item.createTime} ) </foreach> </insert> </mapper> aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml
@@ -27,6 +27,7 @@ <if test="shopCode != null and shopCode != ''"> and shop_code = #{shopCode}</if> <if test="plantCode != null and plantCode != ''"> and plant_code = #{plantCode}</if> <if test="status != null and status != ''"> and status = #{status}</if> and status='1' </where> </select>