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