问题修改

This commit is contained in:
jiang 2026-01-07 13:46:09 +08:00
parent 72b6d2ace7
commit 82e9a203c2
17 changed files with 166 additions and 148 deletions

View File

@ -205,7 +205,7 @@ public class BackChangeServiceImpl implements BackChangeService {
log.error(e.getMessage()); log.error(e.getMessage());
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
return AjaxResult.success("退库申请提交成功,等待审批", AjaxResult.class); return AjaxResult.success("退库申请提交成功,等待审批", csDeviceVo.getDevInfo().getId());
} }

View File

@ -69,7 +69,7 @@ public class BookCarServiceImpl implements BookCarService {
bmFileInfo.setModelId(bookCarDetail.getMaId()); bmFileInfo.setModelId(bookCarDetail.getMaId());
bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE); bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
bmFileInfo.setFileType(0L); bmFileInfo.setFileType(0L);
List<BmFileInfo> mainFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo); List<BmFileInfo> mainFileInfoList = bmFileInfoMapper.selectMaFileInfoList(bookCarDetail.getMaId());
if (!CollectionUtils.isEmpty(mainFileInfoList)) { if (!CollectionUtils.isEmpty(mainFileInfoList)) {
bookCarDetail.setPicUrl(mainFileInfoList.get(0).getFileUrl()); bookCarDetail.setPicUrl(mainFileInfoList.get(0).getFileUrl());
} }

View File

@ -1173,13 +1173,13 @@ public class DevChangeServiceImpl implements DevChangeService {
DevChangeVo entity = mapper.getChange(vo); DevChangeVo entity = mapper.getChange(vo);
vo.setType(entity.getType()); vo.setType(entity.getType());
List<DevChangeVo> list = mapper.getDevDetails(vo); List<DevChangeVo> list = mapper.getDevDetails(vo);
for (DevChangeVo devChangeVo : list) { // for (DevChangeVo devChangeVo : list) {
if (devChangeVo.getWorkingHours() == null) { // if (devChangeVo.getWorkingHours() == null) {
devChangeVo.setWorkingHours(0); // devChangeVo.setWorkingHours(0);
} // }
//
devChangeVo.setRemainingHours(devChangeVo.getMaxWorkingHours() - devChangeVo.getWorkingHours()); // devChangeVo.setRemainingHours(devChangeVo.getMaxWorkingHours() - devChangeVo.getWorkingHours());
} // }
return list; return list;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());

View File

@ -38,9 +38,9 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) { // && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
// o.setCompanyId(deptId); // o.setCompanyId(deptId);
// } // }
if(ADMIN_ID.equals(userId)){ if (ADMIN_ID.equals(userId)) {
o.setCompanyId(1L); o.setCompanyId(1L);
}else{ } else {
o.setCompanyId(deptId); o.setCompanyId(deptId);
} }
List<MaDevInfo> list = mapper.list(o); List<MaDevInfo> list = mapper.list(o);
@ -96,8 +96,8 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
// 兜底净值最低为0避免折旧后为负 // 兜底净值最低为0避免折旧后为负
netValue = netValue.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : netValue; netValue = netValue.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : netValue;
if(item.getValue() == null ||!item.getValue().equals(netValue) ){ if (item.getValue() == null || !item.getValue().equals(netValue)) {
mapper.updatePrice(item.getMaId(),netValue); mapper.updatePrice(item.getMaId(), netValue);
} }
// 填充净值到实体字段 // 填充净值到实体字段
@ -107,7 +107,6 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
}); });
return list; return list;
} }
@ -140,10 +139,9 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
public DeviceCountBean deviceCount(MaDevInfo o) { public DeviceCountBean deviceCount(MaDevInfo o) {
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 o.setCompanyId(1L);
&& !userId.equals(ADMIN_ID) } else {
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
o.setCompanyId(deptId); o.setCompanyId(deptId);
} }
return mapper.deviceCount(o); return mapper.deviceCount(o);
@ -260,7 +258,7 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
// } else { // } else {
// companyId = null; // companyId = null;
// } // }
if(ADMIN_ID.equals(userId)){ if (ADMIN_ID.equals(userId)) {
companyId = 1L; companyId = 1L;
} }
Integer totalCount = mapper.selectTotalDeviceCount(companyId); Integer totalCount = mapper.selectTotalDeviceCount(companyId);

View File

@ -30,6 +30,8 @@ public interface BmFileInfoMapper {
*/ */
List<BmFileInfo> selectBmFileInfoList(BmFileInfo bmFileInfo); List<BmFileInfo> selectBmFileInfoList(BmFileInfo bmFileInfo);
List<BmFileInfo> selectMaFileInfoList(Long maId);
List<BmFileInfo> selectBmFileInfo(BmFileInfo bmFileInfo); List<BmFileInfo> selectBmFileInfo(BmFileInfo bmFileInfo);
/** /**

View File

@ -72,16 +72,16 @@ import static com.bonus.common.biz.enums.MaStatusEnum.*;
@Slf4j @Slf4j
public class DevInfoServiceImpl implements DevInfoService { public class DevInfoServiceImpl implements DevInfoService {
// 装备主展示图片字典 // 装备主展示图片字典
private final Integer MAIN_IMAGES_DICT_VALUE = 0; private final Integer MAIN_IMAGES_DICT_VALUE = 1;
// 装备详情展示图片字典 // 装备详情展示图片字典
private final Integer DETAILS_IMAGES_DICT_VALUE = 1; private final Integer DETAILS_IMAGES_DICT_VALUE = 2;
// 检测证明PDF附件字典 // 检测证明PDF附件字典
private final Integer EXAMINATION_PDF = 2; private final Integer EXAMINATION_PDF = 3;
// 合格证PDF附件字典 // 合格证PDF附件字典
private final Integer INSURANCE_PDF = 3; private final Integer INSURANCE_PDF = 4;
@Resource @Resource
private DevInfoMapper devInfoMapper; private DevInfoMapper devInfoMapper;
@ -123,7 +123,7 @@ public class DevInfoServiceImpl implements DevInfoService {
System.err.println("更新设备搜索量失败,不影响主业务流程"); System.err.println("更新设备搜索量失败,不影响主业务流程");
} }
BmFileInfo bmFileInfo = new BmFileInfo().setModelId(devInfoVo.getMaId()).setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE); BmFileInfo bmFileInfo = new BmFileInfo().setModelId(devInfoVo.getMaId()).setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
List<BmFileInfo> fileList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo); List<BmFileInfo> fileList = bmFileInfoMapper.selectMaFileInfoList(maId);
ArrayList<Table> tableList = new ArrayList<>(); ArrayList<Table> tableList = new ArrayList<>();
if (!CollectionUtils.isEmpty(fileList)) { if (!CollectionUtils.isEmpty(fileList)) {
fileList.removeIf(Objects::isNull); fileList.removeIf(Objects::isNull);
@ -424,34 +424,34 @@ public class DevInfoServiceImpl implements DevInfoService {
} }
}*/ }*/
String code = ""; String code = "";
/* for (int i = 0; i < devInfo.getTableList().size(); i++) {*/ /* for (int i = 0; i < devInfo.getTableList().size(); i++) {*/
//获取用户信息 //获取用户信息
Long userId = SecurityUtils.getLoginUser().getUserid(); Long userId = SecurityUtils.getLoginUser().getUserid();
//保存用户信息 //保存用户信息
devInfo.setCreator(userId) devInfo.setCreator(userId)
/*.setMaStatus(ON_HIRE.getCode())*/ /*.setMaStatus(ON_HIRE.getCode())*/
.setOwnId(userId); .setOwnId(userId);
if (org.apache.commons.lang3.StringUtils.isBlank(code)) { if (org.apache.commons.lang3.StringUtils.isBlank(code)) {
code = getString(); code = getString();
} }
devInfo.setCode(code); devInfo.setCode(code);
//devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString()); //devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
devInfo.setDeviceCount(devInfo.getDeviceCount()); devInfo.setDeviceCount(devInfo.getDeviceCount());
//devInfo.setIdentifyCode(devInfo.getTableList().get(i).getIdentifyCode()); //devInfo.setIdentifyCode(devInfo.getTableList().get(i).getIdentifyCode());
//0914 添加字段 //0914 添加字段
devInfo.setChangeStatus("1"); devInfo.setChangeStatus("1");
devInfo.setUpDownStatus("0"); devInfo.setUpDownStatus("0");
int num = devInfoMapper.insertDevInfo(devInfo); int num = devInfoMapper.insertDevInfo(devInfo);
if (num == 0) { if (num == 0) {
return AjaxResult.error("设备信息SQL保存失败请修改后重试"); return AjaxResult.error("设备信息SQL保存失败请修改后重试");
} }
//devInfoMapper.updateTypeLeasePrice(devInfo); //devInfoMapper.updateTypeLeasePrice(devInfo);
code = ""; code = "";
//保存自定义属性值 //保存自定义属性值
/*if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) { /*if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) {
devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties()); devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties());
}*/ }*/
//把文件保存到附件中 //把文件保存到附件中
/* Table table = devInfo.getTableList().get(i); /* Table table = devInfo.getTableList().get(i);
AjaxResult error = uploadFiles(table, devInfo, userId, i); AjaxResult error = uploadFiles(table, devInfo, userId, i);
if (error != null) { if (error != null) {
@ -1066,13 +1066,13 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override @Override
public Integer updateCheckStatus(String ids, String status) { public Integer updateCheckStatus(String ids, String status) {
String[] split = ids.split(","); String[] split = ids.split(",");
if(split.length>0){ if (split.length > 0) {
List<MapBean> list = new ArrayList<>(); List<MapBean> list = new ArrayList<>();
for (String s : split) { for (String s : split) {
list.add(new MapBean(s,status)); list.add(new MapBean(s, status));
} }
return devInfoMapper.updateCheckStatus(list); return devInfoMapper.updateCheckStatus(list);
}else { } else {
return 0; return 0;
} }
} }

View File

@ -171,29 +171,7 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
} }
// 如果是编辑操作那么就直接把之前的任务删掉重新建立
if (Objects.equals("edit", bean.getOperationType())) {
scrapMapper.deleteChangeInfo(bean.getId());
}
String username = SecurityUtils.getLoginUser().getSysUser().getNickName();
//1创建退役任务单号
int thisMonthMaxOrder = scrapMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TypeEnums.TM_TASK_RETIRE.getTaskTypeId());
String code = genderTaskCode(thisMonthMaxOrder);
CsDeviceInfo deviceInfo = new CsDeviceInfo();
deviceInfo.setType(String.valueOf(TypeEnums.TM_TASK_RETIRE.getTaskTypeId()));
deviceInfo.setCode(code);
deviceInfo.setReviewStatus("0"); // 待审批状态
deviceInfo.setCreateUser(username);
deviceInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
// 添加任务
int num = scrapMapper.addDeviceChangeApply(deviceInfo);
if (num < 1) {
throw new ServiceException("添加任务失败");
}
Long changeId = deviceInfo.getId();
// 保存任务明细
for (ToBeScrap toBeScrap : bean.getToBeScrapList()) { for (ToBeScrap toBeScrap : bean.getToBeScrapList()) {
BigDecimal onWayNum = Optional.ofNullable(scrapMapper.getDetailsNum(toBeScrap)).orElse(BigDecimal.ZERO); BigDecimal onWayNum = Optional.ofNullable(scrapMapper.getDetailsNum(toBeScrap)).orElse(BigDecimal.ZERO);
// 获取已使用数量可能为null转0 // 获取已使用数量可能为null转0
BigDecimal usedNum = Optional.ofNullable(toBeScrap.getInStockNum()).orElse(BigDecimal.ZERO); BigDecimal usedNum = Optional.ofNullable(toBeScrap.getInStockNum()).orElse(BigDecimal.ZERO);
@ -222,12 +200,35 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
// 返回错误结果 // 返回错误结果
return AjaxResult.error(errorMsg, AjaxResult.class); return AjaxResult.error(errorMsg, AjaxResult.class);
} }
}
// 如果是编辑操作那么就直接把之前的任务删掉重新建立
if (Objects.equals("edit", bean.getOperationType())) {
scrapMapper.deleteChangeInfo(bean.getId());
}
String username = SecurityUtils.getLoginUser().getSysUser().getNickName();
//1创建退役任务单号
int thisMonthMaxOrder = scrapMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TypeEnums.TM_TASK_RETIRE.getTaskTypeId());
String code = genderTaskCode(thisMonthMaxOrder);
CsDeviceInfo deviceInfo = new CsDeviceInfo();
deviceInfo.setType(String.valueOf(TypeEnums.TM_TASK_RETIRE.getTaskTypeId()));
deviceInfo.setCode(code);
deviceInfo.setReviewStatus("0"); // 待审批状态
deviceInfo.setCreateUser(username);
deviceInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
// 添加任务
int num = scrapMapper.addDeviceChangeApply(deviceInfo);
if (num < 1) {
throw new ServiceException("添加任务失败");
}
Long changeId = deviceInfo.getId();
// 保存任务明细
for (ToBeScrap toBeScrap : bean.getToBeScrapList()) {
toBeScrap.setChangeId(changeId); toBeScrap.setChangeId(changeId);
toBeScrap.setCreateUser(username); toBeScrap.setCreateUser(username);
if (CollectionUtils.isNotEmpty(toBeScrap.getBmFileInfos())) { if (CollectionUtils.isNotEmpty(toBeScrap.getBmFileInfos())) {
toBeScrap.setScrapUrl(toBeScrap.getBmFileInfos().get(0).getFileUrl()); toBeScrap.setScrapUrl(toBeScrap.getBmFileInfos().get(0).getFileUrl());
} }

View File

@ -195,7 +195,7 @@
</if> </if>
</where> </where>
GROUP BY mdi.code GROUP BY mdi.code,cd.order_id
HAVING useNum &gt; 0 and useNum is not null HAVING useNum &gt; 0 and useNum is not null
UNION ALL UNION ALL
@ -289,7 +289,6 @@
AND cd.pro_code = #{proCode} AND cd.pro_code = #{proCode}
</if> </if>
</where> </where>
GROUP BY tl.id GROUP BY tl.id
HAVING useNum &gt; 0 and useNum is not null HAVING useNum &gt; 0 and useNum is not null
UNION ALL UNION ALL
@ -346,7 +345,7 @@
</if> </if>
</where> </where>
GROUP BY mdi.code GROUP BY mdi.code,cd.order_id
HAVING useNum &gt; 0 and useNum is not null HAVING useNum &gt; 0 and useNum is not null
UNION ALL UNION ALL

View File

@ -160,7 +160,7 @@
cs_device_change cds cs_device_change cds
LEFT JOIN cs_device_change_details dcd ON dcd.change_id = cds.id LEFT JOIN cs_device_change_details dcd ON dcd.change_id = cds.id
WHERE WHERE
cds.del_flag = 0 cds.del_flag = 0 AND cds.review_status = 2
<if test="keyWord!=null and keyWord!=''"> <if test="keyWord!=null and keyWord!=''">
and ( and (
cds.pro_name like concat('%',#{keyWord},'%') or cds.pro_name like concat('%',#{keyWord},'%') or
@ -183,7 +183,7 @@
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' "> <if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
and cds.create_time between #{startTime} and #{endTime} and cds.create_time between #{startTime} and #{endTime}
</if> </if>
<if test="companyId !=null and companyId !=1" > <if test="companyId !=null and companyId !=1">
and cds.company_id and cds.company_id
in ( in (
select dept_id from sys_dept where dept_id= #{companyId} select dept_id from sys_dept where dept_id= #{companyId}

View File

@ -264,17 +264,18 @@
count(distinct if(mdi.change_status = '3', mdi.ma_id, null)) as share, count(distinct if(mdi.change_status = '3', mdi.ma_id, null)) as share,
count(distinct if(mdi.change_status = '5', mdi.ma_id, null)) as underRepair count(distinct if(mdi.change_status = '5', mdi.ma_id, null)) as underRepair
FROM ma_dev_info mdi FROM ma_dev_info mdi
INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN (SELECT max(next_check_time) next_check_time, ma_id from ma_dev_qc GROUP BY ma_id) mdq on
mdi.ma_id = mdq.ma_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
<where> <where>
mdi.is_active = '1' and mdi.entry_status = '1' mdi.is_active = '1' and mdi.entry_status = '1'
<if test="companyId != null"> <if test="companyId !=null and companyId != 1">
AND mdi.on_company = #{companyId} AND mdi.on_company
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> </if>
</where> </where>
</select> </select>
@ -347,8 +348,18 @@
mdi.unit AS unit, mdi.unit AS unit,
mdq.next_check_time AS nextMaintenanceDate, mdq.next_check_time AS nextMaintenanceDate,
mdi.max_working_hours AS maxServiceLifeYears, mdi.max_working_hours AS maxServiceLifeYears,
0 AS repairCount, (SELECT
0 AS usageCount, COUNT(1)
FROM
cs_device_change_details cdcd
LEFT JOIN cs_device_change cdc ON cdc.id = cdcd.change_id
WHERE cdc.type= 4 and cdc.review_status = 2 AND cdcd.dev_code = mdi.code) AS repairCount,
(SELECT
COUNT(1)
FROM
cs_device_change_details cdcd
LEFT JOIN cs_device_change cdc ON cdc.id = cdcd.change_id
WHERE cdc.type= 1 and cdc.review_status = 2 and cdcd.dev_code = mdi.code) AS usageCount,
sc.name AS province sc.name AS province
from ma_dev_info mdi from ma_dev_info mdi
INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
@ -367,7 +378,8 @@
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>
<if test="typeId != null and typeId != 0 "> <if test="typeId != null and typeId != 0 ">
@ -525,23 +537,17 @@
<select id="selectTotalDeviceCount" resultType="java.lang.Integer"> <select id="selectTotalDeviceCount" resultType="java.lang.Integer">
SELECT COUNT(1) SELECT COUNT(1)
from ma_dev_info mdi from ma_dev_info mdi
INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN (SELECT max(next_check_time) next_check_time, ma_id from ma_dev_qc GROUP BY ma_id) mdq on
mdi.ma_id = mdq.ma_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
<where> <where>
mdi.is_active = '1' and mdi.entry_status = '1' mdi.is_active = '1' and mdi.entry_status = '1'
<if test="companyId != nul and companyId != 1"> <if test="companyId != null and companyId != 1 ">
AND mdi.on_company AND mdi.on_company
in ( 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>
</where> </where>

View File

@ -73,6 +73,15 @@
and task_type = 17 and task_type = 17
and file_type = 4 and file_type = 4
</select> </select>
<select id="selectMaFileInfoList" resultType="com.bonus.common.biz.domain.BmFileInfo">
select id,
file_name fileName,
file_url fileUrl,
file_type AS fileType,
create_time
from ma_dev_file
WHERE ma_id = #{maId}
</select>
<insert id="insertBmFileInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertBmFileInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo" useGeneratedKeys="true" keyProperty="id">
insert into bm_file_info insert into bm_file_info

View File

@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-- 第一个子查询:设备表数据 -- 第一个子查询:设备表数据
( (
SELECT SELECT
IFNULL(mdf.file_url, bfi.url) AS picUrl, mdf.file_url AS picUrl,
mtv.proType, mtv.proType,
mtv.mainGx, mtv.mainGx,
mtv.childGx, mtv.childGx,
@ -127,7 +127,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
INNER JOIN ma_type_view mtv ON mtv.typeId = d.type_id INNER JOIN ma_type_view mtv ON mtv.typeId = d.type_id
LEFT JOIN bm_file_info bfi ON d.ma_id = bfi.model_id AND bfi.file_type = '0' AND bfi.task_type = '17' LEFT JOIN bm_file_info bfi ON d.ma_id = bfi.model_id AND bfi.file_type = '0' AND bfi.task_type = '17'
LEFT JOIN ma_dev_file mdf ON d.ma_id = mdf.ma_id AND mdf.file_type = '1' AND mdf.is_active = '1' LEFT JOIN (
SELECT mdf.ma_id, mdf.file_url
FROM ma_dev_file mdf
WHERE mdf.file_type = '1' AND mdf.is_active = '1'
GROUP BY mdf.ma_id
) mdf ON mdf.ma_id = d.ma_id
WHERE WHERE
d.is_active = '1' AND d.ma_status='1' d.is_active = '1' AND d.ma_status='1'
AND d.up_down_status = '1' AND d.up_down_status = '1'
@ -360,8 +365,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.brand as brand, d.brand as brand,
d.production_date as productionDate, d.production_date as productionDate,
d.max_working_hours as workingHours, d.max_working_hours as workingHours,
sd.leader as person, sd.leader as person,
sd.phone as personPhone, sd.phone as personPhone,
d.on_company as companyId, d.on_company as companyId,
sd.dept_name as companyName, sd.dept_name as companyName,
c.operate_address as operateAddress, c.operate_address as operateAddress,

View File

@ -94,9 +94,7 @@
INSERT INTO ma_dev_info ( INSERT INTO ma_dev_info (
<!-- 必选字段若业务要求必须传值可去掉if判断 --> <!-- 必选字段若业务要求必须传值可去掉if判断 -->
device_name, device_name,
device_count,
item_type_model, item_type_model,
manage_type,
code, code,
ma_status, ma_status,
province_id, province_id,
@ -118,9 +116,7 @@
) )
VALUES ( VALUES (
#{name}, #{name},
#{count},
#{specificationModel}, #{specificationModel},
#{manageType},
#{code}, #{code},
'0', '0',
#{province}, #{province},
@ -258,41 +254,42 @@
<update id="updateDeviceByMaId"> <update id="updateDeviceByMaId">
UPDATE ma_dev_info UPDATE ma_dev_info
SET <!-- 用 <set> 标签替代直接写 SET 关键字,自动处理逗号问题 -->
device_name = #{name}, <set>
device_count = #{count}, device_name = #{name},
item_type_model = #{specificationModel}, device_count = #{count},
manage_type = #{manageType}, item_type_model = #{specificationModel},
<!-- 非必填字段:有值才更新 --> manage_type = #{manageType},
<if test="originalCode != null and originalCode != ''"> <!-- 非必填字段:有值才更新,前无需加逗号(加了也不影响,<set> 会自动处理) -->
identify_code = #{originalCode}, <if test="originalCode != null and originalCode != ''">
</if> identify_code = #{originalCode},
<if test="typeId != null"> </if>
type_id = #{typeId}, <if test="typeId != null">
</if> type_id = #{typeId},
<if test="manufacturerId != null and manufacturerId != ''"> </if>
supplier_id = #{manufacturerId}, <if test="manufacturerId != null and manufacturerId != ''">
</if> supplier_id = #{manufacturerId},
<if test="productionDate != null"> </if>
production_date = #{productionDate}, <if test="productionDate != null">
</if> production_date = #{productionDate},
<if test="maxServiceLifeYears != null"> </if>
max_working_hours = #{maxServiceLifeYears}, <if test="maxServiceLifeYears != null">
</if> max_working_hours = #{maxServiceLifeYears},
<if test="expirationTime != null"> </if>
expiration_time = #{expirationTime}, <if test="expirationTime != null">
</if> expiration_time = #{expirationTime},
<if test="originalValue != null"> </if>
buy_price = #{originalValue}, <if test="originalValue != null">
</if> buy_price = #{originalValue},
<if test="purchaseDate != null"> </if>
purchase_date = #{purchaseDate}, <if test="purchaseDate != null">
</if> purchase_date = #{purchaseDate},
<if test="unit != null"> </if>
unit = #{unit} <if test="unit != null">
</if> unit = #{unit} <!-- 最后一个字段可以不加逗号,也可以加,<set> 都会兼容 -->
</if>
</set>
WHERE WHERE
<!-- 注意:此处需要替换为实际的主键字段,例如 id -->
ma_id = #{maId} ma_id = #{maId}
</update> </update>

View File

@ -147,7 +147,8 @@
</update> </update>
<update id="updateDevStatus"> <update id="updateDevStatus">
update ma_dev_info update ma_dev_info
set ma_status ='5' set ma_status ='5',
change_status ='5'
where type_id = #{typeId} where type_id = #{typeId}
and `code` = #{code} and `code` = #{code}
</update> </update>

View File

@ -436,8 +436,8 @@
FROM cs_device_change_details cdcd FROM cs_device_change_details cdcd
LEFT JOIN cs_device_change cdc ON cdc.id = cdcd.change_id LEFT JOIN cs_device_change cdc ON cdc.id = cdcd.change_id
WHERE cdcd.dev_type_id = #{typeId} WHERE cdcd.dev_type_id = #{typeId}
AND cdc.review_status in ('1','0','5') AND cdc.type ='3' AND cdc.review_status in ('1','0','5') AND cdc.type ='3' AND cdc.del_flag = '0'
and cdcd.del_flag ='0' and cdcd.del_flag ='0'
<if test="devCode!=null and devCode!=&quot;/&quot;"> <if test="devCode!=null and devCode!=&quot;/&quot;">
AND cdcd.dev_code = #{devCode} AND cdcd.dev_code = #{devCode}
</if> </if>

View File

@ -234,7 +234,7 @@
<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 = #{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}

View File

@ -198,7 +198,7 @@
<if test="subProcess != null and subProcess != ''"> <if test="subProcess != null and subProcess != ''">
and mtv.childGx like concat('%', #{subProcess}, '%') and mtv.childGx like concat('%', #{subProcess}, '%')
</if> </if>
<if test="companyId != null and companyId != 1"> <if test="companyId != null and companyId != 1 ">
and mdi.on_company and mdi.on_company
in ( in (
select dept_id from sys_dept where dept_id= #{companyId} select dept_id from sys_dept where dept_id= #{companyId}