diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/controller/DevChangeController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/controller/DevChangeController.java index 5f8413c..4d86329 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/controller/DevChangeController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/controller/DevChangeController.java @@ -2,9 +2,14 @@ package com.bonus.material.devchange.controller; import cn.hutool.core.convert.Convert; import com.bonus.common.biz.config.ListPagingUtil; +import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.common.log.annotation.SysLog; +import com.bonus.common.log.enums.OperaType; +import com.bonus.material.basic.domain.BmSlideShow; +import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo; import com.bonus.material.devchange.domain.CsDeviceChangeVo; import com.bonus.material.devchange.domain.DevChangeVo; @@ -17,6 +22,7 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import java.util.List; @RestController @@ -67,7 +73,7 @@ public class DevChangeController extends BaseController { - @ApiOperation(value = "新增出库、入库、-退役、维修 ") + @ApiOperation(value = "新增出库") @PostMapping("/addChangeInfo") public AjaxResult addChangeInfo(@RequestBody CsDeviceChangeVo vo) { return service.addChangeInfo(vo); @@ -75,6 +81,32 @@ public class DevChangeController extends BaseController { + @ApiOperation(value = "入库和维修") + @PostMapping("/updateDevChangeInfo") + public AjaxResult updateDevChangeInfo(@RequestBody CsDeviceChangeVo vo) { + return service.updateDevChangeInfo(vo); + } + + @ApiOperation(value = "入库、报废") + @PostMapping("/updateDevChangeInfo2") + public AjaxResult updateDevChangeInfo2(@RequestBody CsDeviceChangeVo vo) { + return service.updateDevChangeInfo2(vo); + } + + @ApiOperation(value = "入库、报废") + @PostMapping("/updateDevChangeInfo3") + public AjaxResult updateDevChangeInfo3(@RequestBody CsDeviceChangeVo vo) { + return service.updateDevChangeInfo3(vo); + } + + + @ApiOperation(value = "导出设备流转台账") + @PostMapping("/export") + public void export(HttpServletResponse response, CsDeviceChangeVo vo) { + List list = service.getDevChangeList(vo); + ExcelUtil util = new ExcelUtil(CsDeviceChangeVo.class); + util.exportExcel(response, list, "设备流转台账"); + } @@ -86,10 +118,19 @@ public class DevChangeController extends BaseController { return getDataTable(list); } + @ApiOperation(value = "导出设备流转台账详情") + @PostMapping("/exportDetails") + public void exportDetails(HttpServletResponse response, CsDeviceChangeDetailsVo vo) { + List list = service.getDevDetails(vo); + ExcelUtil util = new ExcelUtil(DevChangeVo.class); + util.exportExcel(response, list, "导出设备流转台账详情"); + } + + @ApiOperation(value = "出库记录单") @PostMapping("/getDevDetails") public AjaxResult getDevDetails(@RequestBody CsDeviceChangeDetailsVo vo) { - return service.getDevDetails(vo); + return AjaxResult.success(service.getDevDetails(vo)); } } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeDetailsVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeDetailsVo.java index 6ab0483..ffdbf0a 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeDetailsVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeDetailsVo.java @@ -8,6 +8,13 @@ public class CsDeviceChangeDetailsVo { private Integer pageNum; private Integer pageSize; + + private String proId; + + private int num=1; + + private String type; + /** * 主键 */ diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeVo.java index 05e7bc0..305498b 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/CsDeviceChangeVo.java @@ -1,5 +1,6 @@ package com.bonus.material.devchange.domain; +import com.bonus.common.core.annotation.Excel; import lombok.Data; @Data @@ -12,6 +13,14 @@ public class CsDeviceChangeVo { private Integer pageNum; private Integer pageSize; + /** + * 退役原因 + */ + private String reasonId; + /** + * 退役原因 + */ + private String reasonVal; /** * 主键 */ @@ -19,11 +28,18 @@ public class CsDeviceChangeVo { /** * 变更状前状态 */ + @Excel(name = "流转前状态",width = 20,sort = 4) + private String changeStatusName; + private String changeStatus; /** * 类型 * 变更类型 1入库 2出库 3 退役 4 维修 */ + @Excel(name = "操作类型",width = 25 ,sort = 2) + private String typeName; + + private String type; /** * 变更状态 0自用 1共享 @@ -36,6 +52,7 @@ public class CsDeviceChangeVo { /** * 工程名称 */ + @Excel(name = "使用项目",width = 25,sort = 7) private String proName; /** * 工程类型 @@ -44,6 +61,7 @@ public class CsDeviceChangeVo { /** * 设备数量 */ + @Excel(name = "设备数量",width = 25,sort = 9) private String devNum; /** * 电压等级 @@ -52,6 +70,7 @@ public class CsDeviceChangeVo { /** * 使用单位 */ + @Excel(name = "使用单位",width = 25,sort = 6) private String useUint; /** * 省 @@ -68,14 +87,17 @@ public class CsDeviceChangeVo { /** * 详细地址 */ + @Excel(name = "使用地址",width = 25,sort = 8) private String proLocation; /** * 创建时间 */ + @Excel(name = "操作时间",width = 25,sort = 2) private String createTime; /** * 创建人 */ + @Excel(name = "操作人",width = 20,sort = 1) private String createUser; /** * 使用人 diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeDetailsVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeDetailsVo.java new file mode 100644 index 0000000..63de104 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeDetailsVo.java @@ -0,0 +1,28 @@ +package com.bonus.material.devchange.domain; + +import lombok.Data; + +@Data +public class DevChangeDetailsVo { + + private String id; + + private int num=1; + + private String type; + + private String proId; + + private String devId; + + public DevChangeDetailsVo() { + } + + public DevChangeDetailsVo(String devId, String proId, String type, int num) { + this.num = num; + this.type = type; + this.proId = proId; + this.devId = devId; + } + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeVo.java index 94f9833..0d1a717 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/domain/DevChangeVo.java @@ -1,5 +1,6 @@ package com.bonus.material.devchange.domain; +import com.bonus.common.core.annotation.Excel; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import lombok.Data; @@ -42,10 +43,12 @@ public class DevChangeVo { /** * 设备型号 */ + @Excel(name = "设备型号",width = 25 ,sort = 2) private String devModel; /** * 设备名称 */ + @Excel(name = "设备名称",width = 25 ,sort = 1) private String devName; /** * 等级 @@ -66,6 +69,7 @@ public class DevChangeVo { /** * 设备编码 */ + @Excel(name = "设备名称",width = 25 ,sort = 3) private String devCode; /** * 产权单位 diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/mapper/DevChangeMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/mapper/DevChangeMapper.java index dfdbf3e..9cc1770 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/mapper/DevChangeMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/mapper/DevChangeMapper.java @@ -1,10 +1,7 @@ package com.bonus.material.devchange.mapper; import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo; -import com.bonus.material.devchange.domain.CsDeviceChangeVo; -import com.bonus.material.devchange.domain.DevChangeVo; -import com.bonus.material.devchange.domain.JjProjectVo; +import com.bonus.material.devchange.domain.*; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import com.bonus.material.device.domain.vo.DevInfoVo; import org.apache.ibatis.annotations.Mapper; @@ -96,7 +93,7 @@ public interface DevChangeMapper { * @param vo * @return */ - List getDevDetails(CsDeviceChangeDetailsVo vo); + List getDevDetails(CsDeviceChangeDetailsVo vo); /** * 电压等级 @@ -104,4 +101,29 @@ public interface DevChangeMapper { * @return */ List getVoltageLevel(JjProjectVo vo); + + /** + * 修改详情 + * @param deviceChangeDetailsVo + */ + void addDevChangeDetails(DevChangeDetailsVo deviceChangeDetailsVo); + + /** + * 查询数据 + * @param vo + * @return + */ + List getDevChangeDetailsList(DevChangeDetailsVo vo); + + /** + * + * @param voo + */ + void deleteDevChangeDetails(DevChangeDetailsVo voo); + + /** + * 修改数量 + * @param newNum + */ + void updateChangeDetailsNum(DevChangeDetailsVo voo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeService.java index 07d699b..79906be 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeService.java @@ -49,7 +49,7 @@ public interface DevChangeService { * @param vo * @return */ - AjaxResult getDevDetails(CsDeviceChangeDetailsVo vo); + List getDevDetails(CsDeviceChangeDetailsVo vo); /** * 电压等级下拉选 @@ -57,4 +57,10 @@ public interface DevChangeService { * @return */ List getVoltageLevel(JjProjectVo vo); + + AjaxResult updateDevChangeInfo(CsDeviceChangeVo vo); + + AjaxResult updateDevChangeInfo2(CsDeviceChangeVo vo); + + AjaxResult updateDevChangeInfo3(CsDeviceChangeVo vo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java index 971b46b..a1f38ac 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/devchange/service/DevChangeServiceImpl.java @@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSON; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.common.utils.StringUtil; -import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo; -import com.bonus.material.devchange.domain.CsDeviceChangeVo; -import com.bonus.material.devchange.domain.DevChangeVo; -import com.bonus.material.devchange.domain.JjProjectVo; +import com.bonus.material.devchange.domain.*; import com.bonus.material.devchange.mapper.DevChangeMapper; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import com.bonus.material.device.domain.vo.DevInfoVo; @@ -66,6 +63,191 @@ public class DevChangeServiceImpl implements DevChangeService { return new ArrayList<>(); } + /** + * 维修 + * @param vo + * @return + */ + @Override + public AjaxResult updateDevChangeInfo(CsDeviceChangeVo vo) { + try{ + String username = SecurityUtils.getLoginUser().getUsername(); + vo.setCreateUser(username); + String proCode=vo.getProCode(); + if (StringUtils.isBlank(proCode)) { + return AjaxResult.error("请选择工程"); + } + if (StringUtils.isBlank(vo.getType())) { + return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修"); + } + String json=vo.getJsonData(); + if (StringUtils.isBlank(json)) { + return AjaxResult.error("请选择变更的设备"); + } + List list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class); + if(list==null || list.isEmpty()){ + return AjaxResult.error("请选择变更的设备"); + } + + //出库 + if("2".equals(vo.getType())){ + String changeUnit=mapper.getChangeUnit(list.get(0).getDevId()); + vo.setChangeUnit(changeUnit); + } else { + // + String changeUnit=mapper.getChangeUnitById(list.get(0).getDevId()); + vo.setChangeUnit(changeUnit); + } + if("1".equals(vo.getType())){ + //入库厂家 + String changeUnit=mapper.getChangeUnit(list.get(0).getDevId()); + vo.setUseUint(changeUnit); + } + //变更前状态查询 + String changeStatus=mapper.getChangeStatus(list.get(0).getDevId()); + vo.setChangeStatus(changeStatus); + vo.setDevNum(list.size()+""); + int num=mapper.addChangeInfo(vo); + if(num>0){ + for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){ + if("1".equals(vo.getStatus())){ + updateDevDetails(deviceChangeDetailsVo.getDevId(),null,"1",deviceChangeDetailsVo.getNum()); + + }else{ + updateDevDetails(deviceChangeDetailsVo.getDevId(),null,"5",deviceChangeDetailsVo.getNum()); + } + //新增设备列表数据 + deviceChangeDetailsVo.setChangeId(vo.getId()); + //新增设备详情 + int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo); + if(isSuccess>0){ + vo.setDevId(deviceChangeDetailsVo.getDevId()); + vo.setChangeStatus(vo.getStatus()); + vo.setUseUint(null); + vo.setUserName(null); + vo.setUserPhone(null); + vo.setProCode(null); + mapper.updateDevInfo(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + return AjaxResult.success(); + } + + /** + * 报废接口 + * @param vo + * @return + */ + @Override + public AjaxResult updateDevChangeInfo3(CsDeviceChangeVo vo) { + try{ + String username = SecurityUtils.getLoginUser().getUsername(); + vo.setCreateUser(username); + if (StringUtils.isBlank(vo.getType())) { + return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修"); + } + String json=vo.getJsonData(); + if (StringUtils.isBlank(json)) { + return AjaxResult.error("请选择变更的设备"); + } + List list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class); + if(list==null || list.isEmpty()){ + return AjaxResult.error("请选择变更的设备"); + } + //入库厂家 + String usUnit=mapper.getChangeUnit(list.get(0).getDevId()); + vo.setUseUint(usUnit); + vo.setChangeUnit(usUnit); + vo.setChangeStatus("1"); + vo.setDevNum(list.size()+""); + String proId=vo.getProCode(); + int num=mapper.addChangeInfo(vo); + if(num>0){ + for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){ + updateDevDetails(deviceChangeDetailsVo.getDevId(),proId,"4",deviceChangeDetailsVo.getNum()); + //新增设备列表数据 + deviceChangeDetailsVo.setChangeId(vo.getId()); + deviceChangeDetailsVo.setReasonVal(vo.getReasonVal()); + deviceChangeDetailsVo.setReasonId(vo.getReasonId()); + //新增设备详情 + int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo); + if(isSuccess>0){ + vo.setDevId(deviceChangeDetailsVo.getDevId()); + vo.setChangeStatus(vo.getStatus()); + vo.setUseUint(null); + vo.setUserName(null); + vo.setUserPhone(null); + vo.setProCode(null); + mapper.updateDevInfo(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + return AjaxResult.success(); + } + /** + * 维修接口 + * @param vo + * @return + */ + @Override + public AjaxResult updateDevChangeInfo2(CsDeviceChangeVo vo) { + try{ + String username = SecurityUtils.getLoginUser().getUsername(); + vo.setCreateUser(username); + if (StringUtils.isBlank(vo.getType())) { + return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修"); + } + String json=vo.getJsonData(); + if (StringUtils.isBlank(json)) { + return AjaxResult.error("请选择变更的设备"); + } + List list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class); + if(list==null || list.isEmpty()){ + return AjaxResult.error("请选择变更的设备"); + } + //入库厂家 + String usUnit=mapper.getChangeUnit(list.get(0).getDevId()); + vo.setUseUint(usUnit); + vo.setChangeUnit(usUnit); + vo.setChangeStatus("5"); + vo.setDevNum(list.size()+""); + String proId=vo.getProCode(); + int num=mapper.addChangeInfo(vo); + if(num>0){ + for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){ + if("1".equals(vo.getStatus())){ + updateDevDetails2(deviceChangeDetailsVo.getDevId(),proId,"1",deviceChangeDetailsVo.getNum()); + }else{ + updateDevDetails2(deviceChangeDetailsVo.getDevId(),proId,"4",deviceChangeDetailsVo.getNum()); + } + //新增设备列表数据 + deviceChangeDetailsVo.setChangeId(vo.getId()); + //新增设备详情 + int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo); + if(isSuccess>0){ + vo.setDevId(deviceChangeDetailsVo.getDevId()); + vo.setChangeStatus(vo.getStatus()); + vo.setUseUint(null); + vo.setUserName(null); + vo.setUserPhone(null); + vo.setProCode(null); + mapper.updateDevInfo(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + return AjaxResult.success(); + } + /** * 新增设备台账数据 * @param vo @@ -114,6 +296,8 @@ public class DevChangeServiceImpl implements DevChangeService { for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){ //新增设备列表数据 deviceChangeDetailsVo.setChangeId(vo.getId()); + //数据更新 + updateDevDetails(deviceChangeDetailsVo.getDevId(),vo.getProCode(),vo.getType(),deviceChangeDetailsVo.getNum()); //新增设备详情 int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo); if(isSuccess>0){ @@ -138,6 +322,85 @@ public class DevChangeServiceImpl implements DevChangeService { } return AjaxResult.success(); } + public void updateDevDetails2(String devId,String proCode,String type,int num){ + try{ + DevChangeDetailsVo vo=new DevChangeDetailsVo(devId,proCode,type,num); + List list=mapper.getDevChangeDetailsList(vo); + DevChangeDetailsVo devChangeDetailsVo=new DevChangeDetailsVo(devId,proCode,"5",num); + List newList=mapper.getDevChangeDetailsList(devChangeDetailsVo); + for (DevChangeDetailsVo voo:newList){ + if(voo.getNum()==num){ + mapper.deleteDevChangeDetails(voo); + }else if(voo.getNum()>num){ + int newNum=voo.getNum()-num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + //入库--报废 + if("4".equals(type) ){ + if(list==null || list.isEmpty()){ + mapper.addDevChangeDetails(vo); + }else{ + for (DevChangeDetailsVo voo:list){ + int newNum=voo.getNum()+num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + } + /** + * 修改设备 状态 + */ + public void updateDevDetails(String devId,String proCode,String type,int num){ + try{ + DevChangeDetailsVo vo=new DevChangeDetailsVo(devId,proCode,type,num); + List list=mapper.getDevChangeDetailsList(vo); + if( "1".equals(type) || "5".equals(type)){ + DevChangeDetailsVo devChangeDetailsVo=new DevChangeDetailsVo(devId,proCode,"2",num); + List newList=mapper.getDevChangeDetailsList(devChangeDetailsVo); + for (DevChangeDetailsVo voo:newList){ + if(voo.getNum()==num){ + mapper.deleteDevChangeDetails(voo); + }else if(voo.getNum()>num){ + int newNum=voo.getNum()-num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + } + //入库 + if("1".equals(type)){ + //查询 历史数据 进行删除 + for (DevChangeDetailsVo voo:list){ + if(voo.getNum()==num){ + mapper.deleteDevChangeDetails(voo); + }else if(voo.getNum()>num){ + int newNum=voo.getNum()-num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + } else if("2".equals(type) || "3".equals(type) || "4".equals(type) || "5".equals(type)){ + if(list==null || list.isEmpty()){ + mapper.addDevChangeDetails(vo); + }else{ + for (DevChangeDetailsVo voo:list){ + int newNum=voo.getNum()+num; + vo.setNum(newNum); + mapper.updateChangeDetailsNum(vo); + } + } + } + }catch (Exception e){ + log.error(e.getMessage()); + } + + } /** * 查询工程下拉选 @@ -175,14 +438,14 @@ public class DevChangeServiceImpl implements DevChangeService { * @return */ @Override - public AjaxResult getDevDetails(CsDeviceChangeDetailsVo vo) { + public List getDevDetails(CsDeviceChangeDetailsVo vo) { try{ - List list=mapper.getDevDetails(vo); - return AjaxResult.success(list); + List list=mapper.getDevDetails(vo); + return list; }catch (Exception e){ log.error(e.getMessage()); } - return AjaxResult.success(new ArrayList<>()); + return new ArrayList<>(); } @Override diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/devchange/DevChangeMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/devchange/DevChangeMapper.xml index 5849971..7b8ab5e 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/devchange/DevChangeMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/devchange/DevChangeMapper.xml @@ -19,7 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" )values ( #{changeId},#{devId},#{useTime},#{reasonId},#{reasonVal},#{remark},#{repairman},#{repairTime},#{repairContent},0 ) + + + insert into cs_device_detials( + pro_id,dev_id, num, type, create_time, update_time) + values (#{proId},#{devId},#{num},#{type},now(),now()) update ma_dev_info set json_data=#{jsonData} where ma_id=#{devId} @@ -29,6 +34,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" change_status=#{changeStatus} where ma_id=#{devId} + + delete from cs_device_detials where id=#{id} + + + + update cs_device_detials set num=#{num} where id=#{id} + @@ -121,8 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from ma_dev_info where ma_id=#{devId} - + select dev.ma_id devId,dev.device_name devName,dev.code devCode,dev.json_data,DATE(dev.production_date ) productDate ,dev.buy_price buyPrice ,dev.brand , mdq.next_check_time nextDate,mt.typeId, mt.unit_name unit,mt.maintenance_alarm_day , mt.lease_price,mt.proType,mt.level,mt.mainGx,mt.childGx,mt.devCategory ,mt.devSubcategory ,mt.devName, mt.devModel ,bci.company_name compName,bci.operate_address orgName,IFNULL(pro.pro_name,'-') proName, @@ -131,7 +162,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join ma_dev_info dev on dcd.dev_id=dev.ma_id left join bm_company_info bci on bci.company_id=dev.own_co left join ma_type_view mt on mt.typeId=dev.type_id - LEFT JOIN ma_dev_qc mdq on dev.ma_id=mdq.ma_id + LEFT JOIN + (SELECT max( next_check_time) next_check_time,ma_id + from ma_dev_qc + GROUP BY ma_id + ) mdq on dev.ma_id=mdq.ma_id left join jj_sing_project pro on pro.pro_code=dev.on_project where is_active=1 and dcd.change_id=#{id} @@ -139,5 +174,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select distinct voltage from jj_sing_project + + \ No newline at end of file