注释优化调整
This commit is contained in:
parent
a843c48b07
commit
bfaf3de88e
|
|
@ -542,7 +542,7 @@ public class BackChangeServiceImpl implements BackChangeService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果有需要维修的设备
|
//如果有需要维修的设备
|
||||||
if (toBeRepairList.size() > 0) {
|
if (!toBeRepairList.isEmpty()) {
|
||||||
//创建维修任务
|
//创建维修任务
|
||||||
String userName = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
String userName = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||||
Long changeId = addRepairTask(userName);
|
Long changeId = addRepairTask(userName);
|
||||||
|
|
@ -589,8 +589,8 @@ public class BackChangeServiceImpl implements BackChangeService {
|
||||||
/**
|
/**
|
||||||
* 生成维修任务编号
|
* 生成维修任务编号
|
||||||
*
|
*
|
||||||
* @param thisMonthMaxOrder
|
* @param thisMonthMaxOrder 本月最大序号
|
||||||
* @return
|
* @return String 任务编码
|
||||||
*/
|
*/
|
||||||
private String genderRepairTaskCode(int thisMonthMaxOrder) {
|
private String genderRepairTaskCode(int thisMonthMaxOrder) {
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class ToolLedgerServiceImpl implements ToolLedgerService {
|
||||||
// entity.setCompanyId(deptId);
|
// entity.setCompanyId(deptId);
|
||||||
// }
|
// }
|
||||||
if(ADMIN_ID.equals(userId)){
|
if(ADMIN_ID.equals(userId)){
|
||||||
entity.setCompanyId(1L);
|
entity.setCompanyId(null);
|
||||||
}else{
|
}else{
|
||||||
entity.setCompanyId(deptId);
|
entity.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
|
|
@ -64,15 +64,10 @@ public class ToolLedgerServiceImpl implements ToolLedgerService {
|
||||||
public List<ToolLedgerEntity> listCode(ToolLedgerEntity entity) {
|
public List<ToolLedgerEntity> listCode(ToolLedgerEntity entity) {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
if (ADMIN_ID.equals(userId)) {
|
||||||
// if (userId != null && deptId != null
|
// 管理员可查看所有数据
|
||||||
// && !userId.equals(ADMIN_ID)
|
entity.setCompanyId(null);
|
||||||
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
} else {
|
||||||
// entity.setCompanyId(deptId);
|
|
||||||
// }
|
|
||||||
if(ADMIN_ID.equals(userId)){
|
|
||||||
entity.setCompanyId(1L);
|
|
||||||
}else{
|
|
||||||
entity.setCompanyId(deptId);
|
entity.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
List<ToolLedgerEntity> toolLedgerEntities = mapper.listCode(entity);
|
List<ToolLedgerEntity> toolLedgerEntities = mapper.listCode(entity);
|
||||||
|
|
|
||||||
|
|
@ -167,84 +167,83 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="listCode" resultType="com.bonus.material.toolLedger.domain.ToolLedgerEntity">
|
<select id="listCode" resultType="com.bonus.material.toolLedger.domain.ToolLedgerEntity">
|
||||||
SELECT
|
SELECT
|
||||||
tt.type_name AS typeName,
|
tt.type_name AS typeName,
|
||||||
tt.unit_name AS unitName,
|
tt.unit_name AS unitName,
|
||||||
tt1.type_name AS parentTypeName, -- 1级父节点名称
|
tt1.type_name AS parentTypeName, -- 1级父节点名称
|
||||||
tt2.type_name AS grandparentTypeName, -- 2级父节点名称
|
tt2.type_name AS grandparentTypeName, -- 2级父节点名称
|
||||||
tt3.type_name AS greatGrandparentName, -- 3级父节点名称
|
tt3.type_name AS greatGrandparentName, -- 3级父节点名称
|
||||||
tt4.type_name AS fourthParentName, -- 4级父节点名称
|
tt4.type_name AS fourthParentName, -- 4级父节点名称
|
||||||
tl.id AS id,
|
tl.id AS id,
|
||||||
tl.tool_code AS toolCode,
|
tl.tool_code AS toolCode,
|
||||||
tl.manage_mode AS manageMode,
|
tl.manage_mode AS manageMode,
|
||||||
tl.origin_cost AS originCost,
|
tl.origin_cost AS originCost,
|
||||||
tl.total_num AS totalNum,
|
tl.total_num AS totalNum,
|
||||||
tl.available_num AS availableNum,
|
tl.available_num AS availableNum,
|
||||||
tl.in_num AS inNum,
|
tl.in_num AS inNum,
|
||||||
tl.repair_num AS repairNum,
|
tl.repair_num AS repairNum,
|
||||||
tl.scrap_num AS scrapNum,
|
tl.scrap_num AS scrapNum,
|
||||||
tl.supplier_id AS supplierId,
|
tl.supplier_id AS supplierId,
|
||||||
ms.supplier_name AS supplierName,
|
ms.supplier_name AS supplierName,
|
||||||
tl.identify_code AS identifyCode,
|
tl.identify_code AS identifyCode,
|
||||||
tl.purchase_date AS purchaseDate,
|
tl.purchase_date AS purchaseDate,
|
||||||
tl.production_date AS productionDate,
|
tl.production_date AS productionDate,
|
||||||
tl.last_check_date AS lastCheckDate,
|
tl.last_check_date AS lastCheckDate,
|
||||||
tl.next_check_date AS nextCheckDate,
|
tl.next_check_date AS nextCheckDate,
|
||||||
tl.status AS status,
|
tl.status AS status,
|
||||||
tl.up_down_status AS upDownStatus,
|
tl.up_down_status AS upDownStatus,
|
||||||
sd.dept_abbreviation AS companyName,
|
sd.dept_abbreviation AS companyName,
|
||||||
tl.remark AS remark,
|
tl.remark AS remark,
|
||||||
tl.fileList AS fileList,
|
tl.fileList AS fileList,
|
||||||
tl.create_time AS createTime,
|
tl.create_time AS createTime,
|
||||||
tl.update_time AS updateTime
|
tl.update_time AS updateTime
|
||||||
FROM
|
FROM
|
||||||
tool_type tt
|
tool_type tt
|
||||||
LEFT JOIN tool_ledger tl ON tl.type_id = tt.type_id
|
LEFT JOIN tool_ledger tl ON tl.type_id = tt.type_id
|
||||||
LEFT JOIN sys_dept sd ON sd.dept_id = tl.company_id
|
LEFT JOIN sys_dept sd ON sd.dept_id = tl.company_id
|
||||||
LEFT JOIN ma_supplier ms ON ms.supplier_id = tl.supplier_id
|
LEFT JOIN ma_supplier ms ON ms.supplier_id = tl.supplier_id
|
||||||
-- 关联1级父节点(直接父节点)
|
-- 关联1级父节点(直接父节点)
|
||||||
INNER JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
INNER JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||||
-- 关联2级父节点(祖父节点)
|
-- 关联2级父节点(祖父节点)
|
||||||
INNER JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
INNER JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||||
-- 关联3级父节点(曾祖父节点)
|
-- 关联3级父节点(曾祖父节点)
|
||||||
INNER JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
INNER JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||||
-- 关联4级父节点
|
-- 关联4级父节点
|
||||||
INNER JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
INNER JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||||
WHERE
|
WHERE
|
||||||
tt.del_flag = '0' and tl.tool_code is not null
|
tt.del_flag = '0' and tl.tool_code is not null
|
||||||
AND tt1.del_flag = '0'
|
AND tt1.del_flag = '0'
|
||||||
AND tt2.del_flag = '0'
|
AND tt2.del_flag = '0'
|
||||||
AND tt3.del_flag = '0'
|
AND tt3.del_flag = '0'
|
||||||
AND tt4.del_flag = '0'
|
AND tt4.del_flag = '0'
|
||||||
<if test="fourthParentId != null and fourthParentId != ''">
|
<if test="fourthParentId != null and fourthParentId != ''">
|
||||||
AND tt4.type_id =#{fourthParentId}
|
AND tt4.type_id =#{fourthParentId}
|
||||||
</if>
|
</if>
|
||||||
<if test="greatGrandparentId != null and greatGrandparentId != ''">
|
<if test="greatGrandparentId != null and greatGrandparentId != ''">
|
||||||
AND tt3.type_id = #{greatGrandparentId}
|
AND tt3.type_id = #{greatGrandparentId}
|
||||||
</if>
|
</if>
|
||||||
<if test="grandparentTypeId != null and grandparentTypeId != ''">
|
<if test="grandparentTypeId != null and grandparentTypeId != ''">
|
||||||
AND tt2.type_id = #{grandparentTypeId}
|
AND tt2.type_id = #{grandparentTypeId}
|
||||||
</if>
|
</if>
|
||||||
<if test="parentTypeId != null and parentTypeId != ''">
|
<if test="parentTypeId != null and parentTypeId != ''">
|
||||||
AND tt1.type_id = #{parentTypeId}
|
AND tt1.type_id = #{parentTypeId}
|
||||||
</if>
|
</if>
|
||||||
<if test="typeName != null and typeName != ''">
|
<if test="typeName != null and typeName != ''">
|
||||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="toolCode != null and toolCode != ''">
|
<if test="toolCode != null and toolCode != ''">
|
||||||
AND tl.tool_code LIKE CONCAT('%', #{toolCode}, '%')
|
AND tl.tool_code LIKE CONCAT('%', #{toolCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null and companyId != 1 ">
|
<if test="companyId != null and companyId != 1 ">
|
||||||
<!-- AND (tl.company_id = #{companyId} OR tl.company_id IS NULL)-->
|
and tl.company_id in (
|
||||||
and tl.company_id in (
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
select dept_id from sys_dept where dept_id= #{companyId}
|
union
|
||||||
union
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
select dept_id from sys_dept where parent_id= #{companyId}
|
union
|
||||||
union
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
)
|
||||||
)
|
</if>
|
||||||
</if>
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
tl.create_time DESC
|
tl.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue