(方法一)以需要推送的模块作为主数据联查
(方法二)通过推送的模块新增数据到本页面
1.分别再其需要推送的模块相关impl层新增
表结构:关联id(物资盘点id/机械盘点id),类型(机械盘点/.物资盘点)
机械盘点impl层,物资盘点推送数据同机械
//竣工内业管理
if("竣工盘点".equals(pmMechanicalCheck.getCheckType())){ //判断盘点类型为竣工盘点可推
PmBeCompletedManage manage = new PmBeCompletedManage();
manage.setManageId(randomStr(32));
manage.setCheckId(pmMechanicalCheck.getCheckId());
manage.setProjectId(pmMechanicalCheck.getItemCode());
manage.setType("机械盘点");
manage.setCreateTime(DateUtils.getNowDate());
pmBeCompletedManageMapper.insertPmBeCompletedManage(manage);
}
2.编辑页数据来源两个及以上模块
(1)分别再需要推送的模块,机械盘点,物资盘点模块写mapper,然后调查询sql(物资盘点同机械)
机械盘点
/**
* 查询机械设备盘点明细
*
* @param checkId 机械盘点id
* @return
*/
List<PmMechanicalCheckItem> selectByCheckId(String 明细id);
<select id="selectByCheckId" parameterType="String" resultMap="PmMechanicalCheckItemResult">
select
pmc.check_id_item,
pmc.check_id,
pmc.check_num,
pmc.reason,
pmc.create_by,
pmc.update_by,
pmc.create_time,
pmc.update_time,
pmc.del_flag,
pmc.check_type,
pmc.input_item_id,
pmc.mechanical_name,
pmc.mechanical_spec,
pmc.mechanical_model,
pmc.amount,
pmc.item_code,
pmc.item_name,
pmt.tran_apply_id,
pmt.into_project_name,
pmt.into_company_name,
pmm.tran_time,
pmm.tran_people
from
pm_mechanical_check_item pmc
left join pm_mechanical_tran_apply_item pmt on pmt.input_item_id = pmc.input_item_id
left join pm_mechanical_tran_apply pmm on pmm.tran_apply_id = pmt.tran_apply_id
where check_id = #{checkId}
(2)编辑详情查询调mapper
//查询机械盘点,物资盘点明细
if("机械盘点".equals(manage.getType())){
List<PmMechanicalCheckItem> pmMechanicalCheckItems = pmMechanicalCheckItemMapper.selectByCheckId(manage.getCheckId());
manage.setBuildAllotList(pmMechanicalCheckItems);
}else{
List<PmStockInventoryItem> pmStockInventoryItems = pmStockInventoryItemMapper.selectByCheckId(manage.getCheckId());
manage.setMaterialAllotList(pmStockInventoryItems);
}
3.sql,查询条件同一个字段并列,用in 或者or
(1)where item_code = #{itemCode} and bui_type in ('3', '4')
(2)where item_code = #{itemCode} and bui_type ='3' or bui_type = '4'
2. 魔法值,及短信发送
eg: xxx.setFromStatus("0");
提取魔法值:代码中不允许出现魔法值
```java
常量信息中提取定义魔法值
/** 表单状态formStatus(0草稿 1已完成) */
public final static String FROM_STATUS_TWO = "1";
if(UserConstants.FROM_STATUS_TWO.equals(pmBeCompletedBack.getFormStatus())){}
//短信内容可提取出来,以方便维护
private final static String MSG_CONTENT = "您有履约保证金待回收,请在“要求返还日期”之前回收完毕";
//提交 *** 作-发送短信
if(UserConstants.FROM_STATUS_TWO.equals(pmBeCompletedBack.getFormStatus())){
//TODO 项目id暂时无法带出项目经理手机号 chengminqi
List<String> userNumbers = new ArrayList<>();
userNumbers.add("13468569865");
try{
//发送短信
iMmSmsHttpSendService.sendSmsByPost(MSG_CONTENT,userNumbers, MessageType.MESSAGE, new Date(), PassageMode.LOOSE);
}catch (RequiredArgsNotFoundException ex){
ex.printStackTrace();
}
}
3. 多列表,并且每个列表字段都一样,即可把多列表进行融合到一张子表里,用类型进行区分
(1)实体中分别封装列表
//施工方案及预制加工方案-电气列表
private List<PmBuildProcessPlan> buildProcessPlanList;
//施工方案及预制加工方案-管道
private List<PmBuildProcessPlan> pipeList;
//施工方案及预制加工方案-通风
private List<PmBuildProcessPlan> ventilateList;
(2)impl
新增
//施工方案及预制加工方案
List<PmBuildProcessPlan> buildProcessPlanList = pmTechnologyPlan.getBuildProcessPlanList(); //电气
buildProcessPlanList.addAll(pmTechnologyPlan.getPipeList()); //管道
buildProcessPlanList.addAll(pmTechnologyPlan.getVentilateList()); //通风
if(buildProcessPlanList !=null){
for(PmBuildProcessPlan detail : buildProcessPlanList){
detail.setTechnologyPlanId(pmTechnologyPlan.getTechnologyPlanId());
pmBuildProcessPlanMapper.insertPmBuildProcessPlan(detail);
}
}
修改
//施工方案及预制加工方案
List<PmBuildProcessPlan> buildProcessPlanList = pmTechnologyPlan.getBuildProcessPlanList(); //电气
buildProcessPlanList.addAll(pmTechnologyPlan.getPipeList()); //管道
buildProcessPlanList.addAll(pmTechnologyPlan.getVentilateList()); //通风
//先删除
pmBuildProcessPlanMapper.deleteTechnologyPlanById(pmTechnologyPlan.getTechnologyPlanId());
for(PmBuildProcessPlan detail : buildProcessPlanList){
detail.setTechnologyPlanId(pmTechnologyPlan.getTechnologyPlanId());
pmBuildProcessPlanMapper.insertPmBuildProcessPlan(detail);
}
修改查询
//查询技术方案
PmTechnologyPlan pmTechnologyPlan = pmTechnologyPlanMapper.selectPmTechnologyPlanById(technologyPlanId);
//施工方案及预制加工方案
PmBuildProcessPlan pmBuildProcessPlan = new PmBuildProcessPlan();
pmBuildProcessPlan.setTechnologyPlanId(technologyPlanId);
List<PmBuildProcessPlan> list = pmBuildProcessPlanMapper.selectPmBuildProcessPlanList(pmBuildProcessPlan);
List<PmBuildProcessPlan> buildProcessPlanList = new ArrayList<>(); //电气
List<PmBuildProcessPlan> pipeList = new ArrayList<>(); //管道
List<PmBuildProcessPlan> ventilateList = new ArrayList<>(); //通风
for(PmBuildProcessPlan detail: list){
String tableType = detail.getTableType();
switch (tableType){
case "电气": buildProcessPlanList.add(detail); break;
case "管道": pipeList.add(detail); break;
case "通风": ventilateList.add(detail); break;
}
}
pmTechnologyPlan.setBuildProcessPlanList(buildProcessPlanList);
pmTechnologyPlan.setPipeList(pipeList);
pmTechnologyPlan.setVentilateList(ventilateList);
return pmTechnologyPlan;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)