代码提交
This commit is contained in:
parent
e1b6e08dd8
commit
2c8b5f0a51
|
@ -45,6 +45,7 @@ spring:
|
||||||
primary: master
|
primary: master
|
||||||
# 严格模式 匹配不到数据源则报错
|
# 严格模式 匹配不到数据源则报错
|
||||||
strict: true
|
strict: true
|
||||||
|
strict: true
|
||||||
datasource:
|
datasource:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
|
@ -52,15 +53,15 @@ spring:
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
url: jdbc:mysql://101.37.69.204:8001/demo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: Mz!@#123
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
lazy: true
|
lazy: true
|
||||||
type: ${spring.datasource.type}
|
type: ${spring.datasource.type}
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
url: jdbc:mysql://101.37.69.204:8001/demo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||||
username:
|
username:
|
||||||
password:
|
password:
|
||||||
# oracle:
|
# oracle:
|
||||||
|
|
|
@ -31,6 +31,10 @@ public class MesPlanDetail extends TreeEntity<MesPlanDetail> {
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id")
|
@TableId(value = "id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
private String ancestors;
|
||||||
/**
|
/**
|
||||||
* 主表id
|
* 主表id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,6 +31,11 @@ public class MesPlanDetailBo extends TreeEntity<MesPlanDetailBo> {
|
||||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主表id
|
* 主表id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.ruoyi.mts.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AncestorsVO {
|
||||||
|
private Long id;
|
||||||
|
private String ancestors;
|
||||||
|
private Integer len;
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.apache.http.ssl.PrivateKeyStrategy;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -38,6 +39,11 @@ public class MesPlanDetailVo implements Serializable {
|
||||||
@ExcelProperty(value = "父id")
|
@ExcelProperty(value = "父id")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主表id
|
* 主表id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,9 +2,11 @@ package com.ruoyi.mts.mapper;
|
||||||
|
|
||||||
import com.ruoyi.mts.domain.MesPlanDetail;
|
import com.ruoyi.mts.domain.MesPlanDetail;
|
||||||
import com.ruoyi.mts.domain.bo.MesPlanDetailBo;
|
import com.ruoyi.mts.domain.bo.MesPlanDetailBo;
|
||||||
|
import com.ruoyi.mts.domain.vo.AncestorsVO;
|
||||||
import com.ruoyi.mts.domain.vo.GanttVO;
|
import com.ruoyi.mts.domain.vo.GanttVO;
|
||||||
import com.ruoyi.mts.domain.vo.MesPlanDetailVo;
|
import com.ruoyi.mts.domain.vo.MesPlanDetailVo;
|
||||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -14,7 +16,10 @@ import java.util.List;
|
||||||
* @author jiangzhe
|
* @author jiangzhe
|
||||||
* @date 2024-02-19
|
* @date 2024-02-19
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface MesPlanDetailMapper extends BaseMapperPlus<MesPlanDetailMapper, MesPlanDetail, MesPlanDetailVo> {
|
public interface MesPlanDetailMapper extends BaseMapperPlus<MesPlanDetailMapper, MesPlanDetail, MesPlanDetailVo> {
|
||||||
|
|
||||||
List<GanttVO> queryGanttList(MesPlanDetailBo bo);
|
List<GanttVO> queryGanttList(MesPlanDetailBo bo);
|
||||||
|
|
||||||
|
AncestorsVO findMaxAncestors();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package com.ruoyi.mts.service.impl;
|
package com.ruoyi.mts.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.ruoyi.mts.domain.vo.AncestorsVO;
|
||||||
import com.ruoyi.mts.domain.vo.GanttVO;
|
import com.ruoyi.mts.domain.vo.GanttVO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -13,9 +17,7 @@ import com.ruoyi.mts.domain.MesPlanDetail;
|
||||||
import com.ruoyi.mts.mapper.MesPlanDetailMapper;
|
import com.ruoyi.mts.mapper.MesPlanDetailMapper;
|
||||||
import com.ruoyi.mts.service.IMesPlanDetailService;
|
import com.ruoyi.mts.service.IMesPlanDetailService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产计划明细Service业务层处理
|
* 生产计划明细Service业务层处理
|
||||||
|
@ -29,6 +31,8 @@ public class MesPlanDetailServiceImpl implements IMesPlanDetailService {
|
||||||
|
|
||||||
private final MesPlanDetailMapper baseMapper;
|
private final MesPlanDetailMapper baseMapper;
|
||||||
|
|
||||||
|
public static final String TAB_PREFIX = " ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询生产计划明细
|
* 查询生产计划明细
|
||||||
*/
|
*/
|
||||||
|
@ -43,8 +47,22 @@ public class MesPlanDetailServiceImpl implements IMesPlanDetailService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MesPlanDetailVo> queryList(MesPlanDetailBo bo) {
|
public List<MesPlanDetailVo> queryList(MesPlanDetailBo bo) {
|
||||||
|
bo.setParentId(0L);
|
||||||
LambdaQueryWrapper<MesPlanDetail> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<MesPlanDetail> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
List<MesPlanDetailVo> list = baseMapper.selectVoList(lqw);
|
||||||
|
|
||||||
|
LinkedList<MesPlanDetailVo> res = new LinkedList<>();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
MesPlanDetailVo vo = list.get(i);
|
||||||
|
res.add(vo);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<MesPlanDetail> voLqw = Wrappers.lambdaQuery(MesPlanDetail.class).eq(TreeEntity::getParentId, vo.getId()).orderByAsc(MesPlanDetail::getId);
|
||||||
|
List<MesPlanDetailVo> children = baseMapper.selectVoList(voLqw);
|
||||||
|
if (CollUtil.isNotEmpty(children)) {
|
||||||
|
res.addAll(i + 1, children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,6 +81,7 @@ public class MesPlanDetailServiceImpl implements IMesPlanDetailService {
|
||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<MesPlanDetail> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<MesPlanDetail> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(bo.getParentId() != null, MesPlanDetail::getParentId, bo.getParentId());
|
lqw.eq(bo.getParentId() != null, MesPlanDetail::getParentId, bo.getParentId());
|
||||||
|
lqw.eq(bo.getAncestors() != null, MesPlanDetail::getAncestors, bo.getAncestors());
|
||||||
lqw.eq(bo.getMainId() != null, MesPlanDetail::getMainId, bo.getMainId());
|
lqw.eq(bo.getMainId() != null, MesPlanDetail::getMainId, bo.getMainId());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getName()), MesPlanDetail::getName, bo.getName());
|
lqw.like(StringUtils.isNotBlank(bo.getName()), MesPlanDetail::getName, bo.getName());
|
||||||
lqw.eq(bo.getPlanStartDate() != null, MesPlanDetail::getPlanStartDate, bo.getPlanStartDate());
|
lqw.eq(bo.getPlanStartDate() != null, MesPlanDetail::getPlanStartDate, bo.getPlanStartDate());
|
||||||
|
|
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<resultMap type="com.ruoyi.mts.domain.MesPlanDetail" id="MesPlanDetailResult">
|
<resultMap type="com.ruoyi.mts.domain.MesPlanDetail" id="MesPlanDetailResult">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="parentId" column="parent_id"/>
|
<result property="parentId" column="parent_id"/>
|
||||||
|
<result property="ancestors" column="ancestors"/>
|
||||||
<result property="mainId" column="main_id"/>
|
<result property="mainId" column="main_id"/>
|
||||||
<result property="name" column="name"/>
|
<result property="name" column="name"/>
|
||||||
<result property="planStartDate" column="plan_start_date"/>
|
<result property="planStartDate" column="plan_start_date"/>
|
||||||
|
@ -27,5 +28,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
FROM mes_plan_detail t WHERE t.main_id=#{mainId}
|
FROM mes_plan_detail t WHERE t.main_id=#{mainId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findMaxAncestors" resultType="com.ruoyi.mts.domain.vo.AncestorsVO">
|
||||||
|
SELECT t.id,t.ancestors, LENGTH(t.ancestors) len
|
||||||
|
FROM mes_plan_detail t
|
||||||
|
ORDER BY len DESC
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -30,11 +30,14 @@
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-if="refreshTable" v-loading="loading" :data="planDetailList" row-key="id" height="700"
|
<el-table v-if="refreshTable" v-loading="loading" :data="planDetailList" row-key="id" height="800"
|
||||||
:default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
:default-expand-all="isExpandAll" :span-method="objectSpanMethod" :cell-style="handleChangeCellStyle">
|
||||||
:cell-style="handleChangeCellStyle">
|
|
||||||
<el-table-column fixed="left" label="名称" align="left" prop="name" width="180">
|
<el-table-column fixed="left" label="名称" align="left" prop="name" width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<span v-html="handleName(scope.row)"></span>
|
||||||
|
{{ scope.row.name }}
|
||||||
|
</template>
|
||||||
|
<!-- <template #default="scope">
|
||||||
<el-dropdown>
|
<el-dropdown>
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
{{ scope.row.name }}
|
{{ scope.row.name }}
|
||||||
|
@ -53,6 +56,11 @@
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
</template> -->
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划/实际" align="center" prop="flag" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ scope.rowIndex % 2 === 0 ? '实际' : '计划' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column label="计划时间" align="center" prop="planDate" width="180">
|
<!-- <el-table-column label="计划时间" align="center" prop="planDate" width="180">
|
||||||
|
@ -258,11 +266,45 @@ function handleChangeCellStyle({ row, column, rowIndex, columnIndex }) {
|
||||||
return cellStyle
|
return cellStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nbsp = " "
|
||||||
|
function handleName(row) {
|
||||||
|
let res = ''
|
||||||
|
let arr = row.ancestors.split(',')
|
||||||
|
if (arr.length > 1) {
|
||||||
|
for (let i = 1; i < arr.length; i++) {
|
||||||
|
res = res + nbsp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
const objectSpanMethod = ({
|
||||||
|
row,
|
||||||
|
column,
|
||||||
|
rowIndex,
|
||||||
|
columnIndex,
|
||||||
|
}) => {
|
||||||
|
if (columnIndex === 0) {
|
||||||
|
if (rowIndex % 2 === 0) {
|
||||||
|
return {
|
||||||
|
rowspan: 2,
|
||||||
|
colspan: 1,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 查询生产计划明细列表 */
|
/** 查询生产计划明细列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listPlanDetail(queryParams.value).then(response => {
|
listPlanDetail(queryParams.value).then(response => {
|
||||||
planDetailList.value = proxy.handleTree(response.data, "id", "parentId");
|
// planDetailList.value = proxy.handleTree(response.data, "id", "parentId");
|
||||||
|
planDetailList.value = response.data
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue