change(hwmom-mes):交接班信息增加连表查询

- 在 ProdShiftChange 模型中添加 teamName、machineName 和 shiftName 字段
- 在 ProdShiftChangeServiceImpl 中实现连表查询逻辑
- 在 ProdShiftChangeVo 中添加相应的 Excel属性注解
master
zch 3 weeks ago
parent 35f3ca9860
commit 23e71a79de

@ -1,6 +1,7 @@
package org.dromara.mes.domain; package org.dromara.mes.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -65,5 +66,17 @@ public class ProdShiftChange extends TenantEntity {
*/ */
private String remark; private String remark;
/** 班组名称 */
@TableField(exist = false)
private String teamName;//JOIN连表查询
/** 机台名称 */
@TableField(exist = false)
private String machineName;//JOIN连表查询
/** 班次名称 */
@TableField(exist = false)
private String shiftName;//JOIN连表查询
} }

@ -74,5 +74,16 @@ public class ProdShiftChangeVo implements Serializable {
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String remark; private String remark;
/** 班组名称 */
@ExcelProperty(value = "班组名称")
private String teamName;//JOIN连表查询
/** 机台名称 */
@ExcelProperty(value = "机台名称")
private String machineName;//JOIN连表查询
/** 班次名称 */
@ExcelProperty(value = "班次名称")
private String shiftName;//JOIN连表查询
} }

@ -8,6 +8,9 @@ import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.mes.domain.BaseClassTeamInfo;
import org.dromara.mes.domain.BaseShiftInfo;
import org.dromara.mes.domain.ProdBaseMachineInfo;
import org.dromara.mes.domain.ProdShiftChange; import org.dromara.mes.domain.ProdShiftChange;
import org.dromara.mes.domain.bo.ProdShiftChangeBo; import org.dromara.mes.domain.bo.ProdShiftChangeBo;
import org.dromara.mes.domain.vo.ProdShiftChangeVo; import org.dromara.mes.domain.vo.ProdShiftChangeVo;
@ -76,6 +79,21 @@ public class ProdShiftChangeServiceImpl implements IProdShiftChangeService {
Map<String, Object> params = bo.getParams(); Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ProdShiftChange> lqw = JoinWrappers.lambda(ProdShiftChange.class) MPJLambdaWrapper<ProdShiftChange> lqw = JoinWrappers.lambda(ProdShiftChange.class)
.selectAll(ProdShiftChange.class) .selectAll(ProdShiftChange.class)
//连表查询班组名称
.select(BaseClassTeamInfo::getTeamName)
.leftJoin(BaseClassTeamInfo.class,BaseClassTeamInfo::getClassTeamId,ProdShiftChange::getClassTeamId)
//连表查询班次名称
.select(BaseShiftInfo::getShiftName)
.leftJoin(BaseShiftInfo.class,BaseShiftInfo::getShiftId,ProdShiftChange::getShiftId)
//连表查询机台名称
.select(ProdBaseMachineInfo::getMachineName)
.leftJoin(ProdBaseMachineInfo.class,ProdBaseMachineInfo::getMachineId,ProdShiftChange::getMachineId)
.eq(bo.getShiftChangeId() != null, ProdShiftChange::getShiftChangeId, bo.getShiftChangeId()) .eq(bo.getShiftChangeId() != null, ProdShiftChange::getShiftChangeId, bo.getShiftChangeId())
.eq(bo.getShiftChangeTime() != null, ProdShiftChange::getShiftChangeTime, bo.getShiftChangeTime()) .eq(bo.getShiftChangeTime() != null, ProdShiftChange::getShiftChangeTime, bo.getShiftChangeTime())
.eq(bo.getMachineId() != null, ProdShiftChange::getMachineId, bo.getMachineId()) .eq(bo.getMachineId() != null, ProdShiftChange::getMachineId, bo.getMachineId())

Loading…
Cancel
Save