Merge remote-tracking branch 'frps/master' into frp-master
This commit is contained in:
commit
6262a382c2
|
|
@ -49,4 +49,7 @@ public class TreeNode {
|
||||||
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
private List<TreeNode> children = new ArrayList<>();
|
private List<TreeNode> children = new ArrayList<>();
|
||||||
|
|
||||||
|
@ApiModelProperty("机具类型(1机具,2安全工器具)")
|
||||||
|
private int jiJuType;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,22 @@ public class SelectController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用工程下拉选
|
||||||
|
* @param bmProject
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "领用工程下拉选")
|
||||||
|
@PostMapping("getLeaseProjectList")
|
||||||
|
public AjaxResult getLeaseProjectList(@RequestBody BmProject bmProject) {
|
||||||
|
try {
|
||||||
|
return service.getLeaseProjectList(bmProject);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取数据失败");
|
||||||
|
return AjaxResult.error("获取数据失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "机具类型下拉选")
|
@ApiOperation(value = "机具类型下拉选")
|
||||||
@PostMapping("getMaTypeData")
|
@PostMapping("getMaTypeData")
|
||||||
public AjaxResult getMaTypeData(@RequestBody SelectDto dto){
|
public AjaxResult getMaTypeData(@RequestBody SelectDto dto){
|
||||||
|
|
@ -157,6 +173,11 @@ public class SelectController {
|
||||||
return service.getDeviceTypeTreeTwo(dto);
|
return service.getDeviceTypeTreeTwo(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "设备类型树--编码设备")
|
||||||
|
@PostMapping("getDeviceTypeTreeThree")
|
||||||
|
public AjaxResult getDeviceTypeTreeThree(@RequestBody SelectDto dto){
|
||||||
|
return service.getDeviceTypeTreeThree(dto);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "退料设备类型树")
|
@ApiOperation(value = "退料设备类型树")
|
||||||
@PostMapping("getBackDeviceTypeTree")
|
@PostMapping("getBackDeviceTypeTree")
|
||||||
|
|
|
||||||
|
|
@ -301,4 +301,18 @@ public interface SelectMapper {
|
||||||
List<TypeTreeNode> getBzUseTypeTreeL4(BackApplyInfo bean);
|
List<TypeTreeNode> getBzUseTypeTreeL4(BackApplyInfo bean);
|
||||||
|
|
||||||
List<TreeNode> getDeviceTypeTreeTwo(SelectDto dto);
|
List<TreeNode> getDeviceTypeTreeTwo(SelectDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取工程下拉选
|
||||||
|
* @param bmProject
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ProjectTreeNode> getLeaseProjectList(BmProject bmProject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备类型树3级
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TreeNode> getDeviceTypeTreeThree(SelectDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -259,4 +259,18 @@ public interface SelectService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult getBzUseTypeTree(BackApplyInfo bean);
|
AjaxResult getBzUseTypeTree(BackApplyInfo bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用工程下拉选
|
||||||
|
* @param bmProject
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getLeaseProjectList(BmProject bmProject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型树
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getDeviceTypeTreeThree(SelectDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -415,6 +415,54 @@ public class SelectServiceImpl implements SelectService {
|
||||||
return AjaxResult.success(groupList);
|
return AjaxResult.success(groupList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用工程下拉选
|
||||||
|
* @param bmProject
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getLeaseProjectList(BmProject bmProject) {
|
||||||
|
// 获取登陆用户的组织ID
|
||||||
|
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
|
// 判断是否开启过滤
|
||||||
|
if (Objects.nonNull(bmProject) && Objects.nonNull(bmProject.getEnableFilter()) && bmProject.getEnableFilter()) {
|
||||||
|
bmProject.setDeptId(thisLoginUserDeptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ProjectTreeNode> groupList = new ArrayList<>();
|
||||||
|
List<ProjectTreeNode> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getLeaseProjectList(bmProject);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
// 创建树形结构(数据集合作为参数)
|
||||||
|
ProjectTreeBuild treeBuild = new ProjectTreeBuild(list);
|
||||||
|
// 原查询结果转换树形结构
|
||||||
|
groupList = treeBuild.buildTree();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("工程类型树-查询失败", e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(groupList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getDeviceTypeTreeThree(SelectDto dto) {
|
||||||
|
List<TreeNode> groupList = new ArrayList<>();
|
||||||
|
List<TreeNode> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getDeviceTypeTreeThree(dto);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
// 创建树形结构(数据集合作为参数)
|
||||||
|
TreeBuild treeBuild = new TreeBuild(list);
|
||||||
|
// 原查询结果转换树形结构
|
||||||
|
groupList = treeBuild.buildTree();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("单位树/归属部门/所属上级-查询失败", e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(groupList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getDeviceTypeTree(SelectDto dto) {
|
public AjaxResult getDeviceTypeTree(SelectDto dto) {
|
||||||
List<TreeNode> groupList = new ArrayList<>();
|
List<TreeNode> groupList = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,17 @@ public class MachineController extends BaseController {
|
||||||
return toAjax(machineService.insertMachine(machine));
|
return toAjax(machineService.insertMachine(machine));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增机具设备管理
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增机具设备管理")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@SysLog(title = "机具设备管理", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->新增机具设备管理")
|
||||||
|
@PostMapping(value = "/addMaMachine")
|
||||||
|
public AjaxResult addMaMachine(@RequestBody Machine machine) {
|
||||||
|
return machineService.addMaMachine(machine);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改机具设备管理
|
* 修改机具设备管理
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -249,4 +249,6 @@ public class Type extends BaseEntity {
|
||||||
@ApiModelProperty("机具类型(1机具,2安全工器具)")
|
@ApiModelProperty("机具类型(1机具,2安全工器具)")
|
||||||
private int jiJuType;
|
private int jiJuType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "待出库数量")
|
||||||
|
private BigDecimal pendingOutNum;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,4 +229,11 @@ public interface MachineMapper
|
||||||
List<Machine> getNewByMaCode(Machine machine);
|
List<Machine> getNewByMaCode(Machine machine);
|
||||||
|
|
||||||
List<Machine> findMaMsgById(Machine machine);
|
List<Machine> findMaMsgById(Machine machine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询机具信息
|
||||||
|
* @param machine
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getCountByMaCode(Machine machine);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,4 +146,12 @@ public interface IMachineService
|
||||||
List<Machine> getNewByMaCode(Machine machine);
|
List<Machine> getNewByMaCode(Machine machine);
|
||||||
|
|
||||||
List<Machine> findMaMsgById(Machine machine);
|
List<Machine> findMaMsgById(Machine machine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增机具设备管理
|
||||||
|
*
|
||||||
|
* @param machine 机具设备管理
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
AjaxResult addMaMachine(Machine machine);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -593,6 +593,26 @@ public class MachineServiceImpl implements IMachineService
|
||||||
return machineMapper.findMaMsgById(machine);
|
return machineMapper.findMaMsgById(machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult addMaMachine(Machine machine) {
|
||||||
|
try {
|
||||||
|
//查询类型下编码是否存在
|
||||||
|
int count = machineMapper.getCountByMaCode(machine);
|
||||||
|
if (count > 0) {
|
||||||
|
return AjaxResult.error("该规格类型下此编码已存在");
|
||||||
|
}
|
||||||
|
machine.setMaStatus("1");
|
||||||
|
machine.setMaVender(machine.getSupplierId());
|
||||||
|
int result = machineMapper.insertMachine(machine);
|
||||||
|
if (result > 0) {
|
||||||
|
return AjaxResult.success("入库成功");
|
||||||
|
}
|
||||||
|
return AjaxResult.error("添加盘点入库失败");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("添加盘点入库失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编码铭牌信息
|
* 编码铭牌信息
|
||||||
* @param machine
|
* @param machine
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||||
|
import com.bonus.material.lease.mapper.LeaseTaskMapper;
|
||||||
import com.bonus.material.ma.domain.MaTypeHistory;
|
import com.bonus.material.ma.domain.MaTypeHistory;
|
||||||
import com.bonus.material.ma.domain.TypeKeeper;
|
import com.bonus.material.ma.domain.TypeKeeper;
|
||||||
import com.bonus.material.ma.domain.TypeRepair;
|
import com.bonus.material.ma.domain.TypeRepair;
|
||||||
|
|
@ -49,6 +51,9 @@ public class TypeServiceImpl implements ITypeService {
|
||||||
@Resource
|
@Resource
|
||||||
private TypeMapper typeMapper;
|
private TypeMapper typeMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LeaseTaskMapper leaseTaskMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ITypeKeeperService typeKeeperService;
|
private ITypeKeeperService typeKeeperService;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
UNION
|
UNION
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
concat( 'gs', sd.dept_id ) AS id,
|
concat( 'gs', sd.dept_id ) AS id,
|
||||||
sd.dept_name AS proName,
|
sd.dept_name AS name,
|
||||||
'0' AS parentId,
|
'0' AS parentId,
|
||||||
1 AS level
|
1 AS level
|
||||||
FROM
|
FROM
|
||||||
|
|
@ -925,4 +925,81 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getLeaseProjectList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||||
|
/*根据往来单位id关联协议查询工程*/
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
bmp.pro_id AS id,
|
||||||
|
bmp.pro_name AS name,
|
||||||
|
concat( 'gs', bmp.imp_unit ) AS parentId,
|
||||||
|
2 AS level
|
||||||
|
FROM
|
||||||
|
bm_project bmp
|
||||||
|
LEFT JOIN sys_dept sd ON sd.dept_id = bmp.imp_unit
|
||||||
|
WHERE
|
||||||
|
sd.del_flag = '0'
|
||||||
|
AND sd.`status` = '0'
|
||||||
|
AND bmp.del_flag = '0'
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND bmp.imp_unit = #{deptId}
|
||||||
|
</if>
|
||||||
|
UNION
|
||||||
|
SELECT DISTINCT
|
||||||
|
concat( 'gs', sd.dept_id ) AS id,
|
||||||
|
sd.dept_name AS name,
|
||||||
|
'0' AS parentId,
|
||||||
|
1 AS level
|
||||||
|
FROM
|
||||||
|
sys_dept sd
|
||||||
|
LEFT JOIN bm_project bmp ON sd.dept_id = bmp.imp_unit
|
||||||
|
WHERE
|
||||||
|
bmp.pro_id IS NOT NULL
|
||||||
|
AND sd.del_flag = '0'
|
||||||
|
AND sd.`status` = '0'
|
||||||
|
AND bmp.del_flag = '0'
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND bmp.imp_unit = #{deptId}
|
||||||
|
</if>
|
||||||
|
) a
|
||||||
|
ORDER BY
|
||||||
|
level
|
||||||
|
</select>
|
||||||
|
<select id="getDeviceTypeTreeThree" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||||
|
WITH RECURSIVE type_tree AS (
|
||||||
|
SELECT
|
||||||
|
type_id,
|
||||||
|
type_name,
|
||||||
|
parent_id,
|
||||||
|
level,
|
||||||
|
manage_type,
|
||||||
|
type_id as root_id
|
||||||
|
FROM ma_type
|
||||||
|
WHERE level = 4 AND manage_type = 0
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
mt.type_id,
|
||||||
|
mt.type_name,
|
||||||
|
mt.parent_id,
|
||||||
|
mt.level,
|
||||||
|
mt.manage_type,
|
||||||
|
tt.root_id
|
||||||
|
FROM ma_type mt
|
||||||
|
INNER JOIN type_tree tt ON mt.type_id = tt.parent_id
|
||||||
|
WHERE mt.level BETWEEN 1 AND 3
|
||||||
|
)
|
||||||
|
SELECT DISTINCT
|
||||||
|
type_id as id,
|
||||||
|
type_name as label,
|
||||||
|
parent_id as parentId,
|
||||||
|
level
|
||||||
|
FROM type_tree
|
||||||
|
WHERE level BETWEEN 1 AND 3
|
||||||
|
ORDER BY level, type_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -875,6 +875,7 @@
|
||||||
select workflow_status from sys_workflow_record
|
select workflow_status from sys_workflow_record
|
||||||
where
|
where
|
||||||
task_id = #{taskId}
|
task_id = #{taskId}
|
||||||
|
Limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertWorkOrderPeople">
|
<insert id="insertWorkOrderPeople">
|
||||||
|
|
@ -1164,39 +1165,63 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPendingOutNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
<select id="selectPendingOutNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||||
SELECT
|
SELECT
|
||||||
a.typeId,
|
#{typeId} as typeId,
|
||||||
SUM(a.preNum) as preNum,
|
COALESCE(SUM(combined.pendingOutNum), 0) as pendingOutNum,
|
||||||
SUM(a.alNum) as alNum,
|
CASE mt.manage_type
|
||||||
SUM(a.preNum)-SUM(a.alNum) as pendingOutNum,
|
WHEN 0 THEN
|
||||||
ifnull(mt.storage_num,0) as storageNum
|
IFNULL(subquery0.num, 0)
|
||||||
FROM
|
ELSE
|
||||||
(
|
IFNULL(mt.storage_num, 0)
|
||||||
|
END as storageNum
|
||||||
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
type_id as typeId,
|
lad.type_id as typeId,
|
||||||
SUM(pre_num) as preNum,
|
SUM(pre_num) - SUM(al_num) as pendingOutNum
|
||||||
SUM(al_num) as alNum
|
|
||||||
FROM
|
FROM
|
||||||
lease_apply_details
|
lease_apply_info lai
|
||||||
|
LEFT JOIN lease_apply_details lad ON lad.parent_id = lai.id
|
||||||
|
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
||||||
WHERE
|
WHERE
|
||||||
type_id =#{typeId}
|
tt.task_status = '3'
|
||||||
and new_type is null
|
AND tt.task_type = '2'
|
||||||
GROUP BY type_id
|
AND lad.type_id = #{typeId}
|
||||||
|
GROUP BY lad.type_id
|
||||||
|
|
||||||
UNION
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
new_type as typeId,
|
lpd.new_type as typeId,
|
||||||
SUM(pre_num) as preNum,
|
SUM(lpd.num) - IFNULL(lod.alNum, 0) as pendingOutNum
|
||||||
SUM(al_num) as alNum
|
|
||||||
FROM
|
FROM
|
||||||
lease_apply_details
|
lease_publish_details lpd
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
lod.type_id as typeId,
|
||||||
|
SUM(lod.out_num) as alNum
|
||||||
|
FROM
|
||||||
|
lease_out_details lod
|
||||||
WHERE
|
WHERE
|
||||||
new_type = #{typeId}
|
publish_task is not null
|
||||||
and new_type is not null
|
AND lod.type_id = #{typeId}
|
||||||
GROUP BY new_type
|
GROUP BY lod.type_id
|
||||||
) a
|
) lod ON lpd.new_type = lod.typeId
|
||||||
LEFT JOIN ma_type mt on mt.type_id=a.typeId
|
WHERE
|
||||||
GROUP BY typeId
|
lpd.new_type = #{typeId}
|
||||||
|
GROUP BY lpd.new_type
|
||||||
|
) combined
|
||||||
|
RIGHT JOIN (SELECT #{typeId} as type_id) param ON combined.typeId = param.type_id
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = param.type_id
|
||||||
|
left join (SELECT mt.type_id,
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt.type_name AS typeModelName,
|
||||||
|
count(mm.ma_id) num
|
||||||
|
FROM ma_machine mm
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
WHERE mm.ma_code is not null and mm.ma_status in (1)
|
||||||
|
and mm.type_id=#{typeId}
|
||||||
|
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = param.type_id
|
||||||
|
GROUP BY param.type_id
|
||||||
</select>
|
</select>
|
||||||
<select id="selectLeaseApplyDetailsCountByParentId" resultType="java.lang.Integer">
|
<select id="selectLeaseApplyDetailsCountByParentId" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
parent_id as parentId,
|
parent_id as parentId,
|
||||||
storage_num as storageNum,
|
storage_num as storageNum,
|
||||||
type_code as typeCode,
|
type_code as typeCode,
|
||||||
level as level
|
level as level,
|
||||||
|
jiju_type as jijuType
|
||||||
FROM
|
FROM
|
||||||
ma_type
|
ma_type
|
||||||
WHERE del_flag = '0'
|
WHERE del_flag = '0'
|
||||||
|
|
@ -1053,4 +1054,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ws_ma_info mi
|
ws_ma_info mi
|
||||||
WHERE mi.id =#{maId}
|
WHERE mi.id =#{maId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getCountByMaCode" resultType="java.lang.Integer">
|
||||||
|
SELECT count(1)
|
||||||
|
FROM ma_machine
|
||||||
|
WHERE ma_code = #{maCode}
|
||||||
|
and type_id = #{typeId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ELSE
|
ELSE
|
||||||
IFNULL(m.storage_num, 0)
|
IFNULL(m.storage_num, 0)
|
||||||
END as storage_num,
|
END as storage_num,
|
||||||
m.company_id as companyId
|
m.company_id as companyId,
|
||||||
|
IFNULL(subquery1.pendingOutNum,0) as pendingOutNum
|
||||||
from ma_type m
|
from ma_type m
|
||||||
left join (SELECT mt.type_id,
|
left join (SELECT mt.type_id,
|
||||||
mt2.type_name AS typeName,
|
mt2.type_name AS typeName,
|
||||||
|
|
@ -536,6 +537,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
WHERE mm.ma_code is not null and mm.ma_status in (1)
|
WHERE mm.ma_code is not null and mm.ma_status in (1)
|
||||||
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id
|
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
combined.typeId AS typeId,
|
||||||
|
COALESCE ( SUM( combined.pendingOutNum ), 0 ) AS pendingOutNum
|
||||||
|
FROM
|
||||||
|
(-- 第一个查询
|
||||||
|
SELECT
|
||||||
|
lad.type_id AS typeId,
|
||||||
|
SUM( pre_num ) - SUM( al_num ) AS pendingOutNum
|
||||||
|
FROM
|
||||||
|
lease_apply_info lai
|
||||||
|
LEFT JOIN lease_apply_details lad ON lad.parent_id = lai.id
|
||||||
|
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
||||||
|
WHERE
|
||||||
|
tt.task_status = '3'
|
||||||
|
AND tt.task_type = '2'
|
||||||
|
GROUP BY
|
||||||
|
lad.type_id UNION ALL-- 第二个查询
|
||||||
|
SELECT
|
||||||
|
lpd.new_type AS typeId,
|
||||||
|
SUM( lpd.num ) - IFNULL( lod.alNum, 0 ) AS pendingOutNum
|
||||||
|
FROM
|
||||||
|
lease_publish_details lpd
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
lod.type_id AS typeId,
|
||||||
|
SUM( lod.out_num ) AS alNum
|
||||||
|
FROM
|
||||||
|
lease_out_details lod
|
||||||
|
WHERE
|
||||||
|
publish_task IS NOT NULL
|
||||||
|
GROUP BY
|
||||||
|
lod.type_id
|
||||||
|
) lod ON lpd.new_type = lod.typeId
|
||||||
|
GROUP BY
|
||||||
|
lpd.new_type
|
||||||
|
) combined
|
||||||
|
GROUP BY
|
||||||
|
combined.typeId
|
||||||
|
) subquery1 on subquery1.typeId=m.type_id
|
||||||
<where>
|
<where>
|
||||||
m.del_flag = '0'
|
m.del_flag = '0'
|
||||||
<if test="typeName != null and typeName !=''">
|
<if test="typeName != null and typeName !=''">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue