设备列表同公司数据隔离

This commit is contained in:
liang.chao 2024-12-06 18:55:00 +08:00
parent 33b7aa480d
commit 3851cfc92b
2 changed files with 9 additions and 10 deletions

View File

@ -363,7 +363,7 @@ public class DevInfoServiceImpl implements DevInfoService {
for (int i = 0; i < devInfo.getExaminationPdfs().size(); i++) { for (int i = 0; i < devInfo.getExaminationPdfs().size(); i++) {
String code = getString(); String code = getString();
devInfo.setCode(code); devInfo.setCode(code);
devInfo.setDeviceCount(1); devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
int insertedDraft = devInfoMapper.insertDraft(devInfo); int insertedDraft = devInfoMapper.insertDraft(devInfo);
if (insertedDraft == 0) { if (insertedDraft == 0) {
return AjaxResult.error("装备草稿保存失败,请修改后重试"); return AjaxResult.error("装备草稿保存失败,请修改后重试");
@ -530,7 +530,7 @@ public class DevInfoServiceImpl implements DevInfoService {
*/ */
@Override @Override
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) { public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) {
devInfo.setOwnId(SecurityUtils.getLoginUser().getUserid()); devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
return devInfoMapper.selectDevInfoLists(devInfo); return devInfoMapper.selectDevInfoLists(devInfo);
} }

View File

@ -477,14 +477,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo"> <select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
select select
d.*,c.company_name as companyName,c.operate_address as operateAddress, d.*,
mt4.type_name as typeName,mt4.unit_name as unitName, mt4.type_name as typeName,mt4.unit_name as unitName,
mt3.type_id as thirdId,mt3.type_name as thirdName, mt3.type_id as thirdId,mt3.type_name as thirdName,
mt2.type_id as secondId,mt2.type_name as secondName, mt2.type_id as secondId,mt2.type_name as secondName,
mt1.type_id as firstId,mt1.type_name as firstName mt1.type_id as firstId,mt1.type_name as firstName
from from
ma_dev_info d ma_dev_info d
left join bm_company_info c on d.own_co = c.company_id
left join ma_up_off u on d.ma_id = u.ma_id left join ma_up_off u on d.ma_id = u.ma_id
left join ma_type mt4 ON mt4.type_id = d.type_id and mt4.del_flag = '0' left join ma_type mt4 ON mt4.type_id = d.type_id and mt4.del_flag = '0'
left join ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0' left join ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
@ -504,7 +503,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaId != null and areaId != ''"> and d.area_id = #{areaId}</if> <if test="areaId != null and areaId != ''"> and d.area_id = #{areaId}</if>
<if test="brand != null and brand != ''"> and d.brand = #{brand}</if> <if test="brand != null and brand != ''"> and d.brand = #{brand}</if>
<if test="modelName != null and modelName != ''"> and d.model_name like concat('%', #{modelName}, '%')</if> <if test="modelName != null and modelName != ''"> and d.model_name like concat('%', #{modelName}, '%')</if>
<if test="companyId != null "> and d.own_co = #{companyId}</if> <if test="companyId != null and companyId !=''"> and d.own_co = #{companyId}</if>
<if test="startTime != null and endTime != null"> <if test="startTime != null and endTime != null">
and d.update_time between #{startTime} and #{endTime} and d.update_time between #{startTime} and #{endTime}
</if> </if>
@ -518,7 +517,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or locate(#{keyWord},d.description) > 0 or locate(#{keyWord},d.description) > 0
) )
</if> </if>
and d.own_id = #{ownId} and d.own_co = #{companyId}
and d.is_active = '1' and d.is_active = '1'
</where> </where>
ORDER BY d.create_time desc ORDER BY d.create_time desc
@ -570,7 +569,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaId != null and areaId != ''">area_id,</if> <if test="areaId != null and areaId != ''">area_id,</if>
<if test="brand != null and brand != ''">brand,</if> <if test="brand != null and brand != ''">brand,</if>
<if test="modelName != null and modelName != ''">model_name,</if> <if test="modelName != null and modelName != ''">model_name,</if>
<if test="productionDate != null and productionDate != ''">production_date,</if> <if test="productionDate != null">production_date,</if>
<if test="workingHours != null and workingHours != ''">working_hours,</if> <if test="workingHours != null and workingHours != ''">working_hours,</if>
<if test="serialNumber != null and serialNumber != ''">serial_number,</if> <if test="serialNumber != null and serialNumber != ''">serial_number,</if>
<if test="picUrl != null and picUrl != ''">pic_url,</if> <if test="picUrl != null and picUrl != ''">pic_url,</if>
@ -578,7 +577,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jsDayPrice != null and jsDayPrice != ''">js_day_price,</if> <if test="jsDayPrice != null and jsDayPrice != ''">js_day_price,</if>
<if test="description != null and description != ''">`description`,</if> <if test="description != null and description != ''">`description`,</if>
<if test="gpsCode != null and gpsCode != ''">gps_code,</if> <if test="gpsCode != null and gpsCode != ''">gps_code,</if>
<if test="companyId != null">own_co,</if> <if test="companyId != null and companyId != ''" >own_co,</if>
<if test="person != null and person != ''">person,</if> <if test="person != null and person != ''">person,</if>
<if test="personPhone != null and personPhone != ''">person_phone,</if> <if test="personPhone != null and personPhone != ''">person_phone,</if>
create_time, create_time,
@ -606,7 +605,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaId != null and areaId != ''">#{areaId},</if> <if test="areaId != null and areaId != ''">#{areaId},</if>
<if test="brand != null and brand != ''">#{brand},</if> <if test="brand != null and brand != ''">#{brand},</if>
<if test="modelName != null and modelName != ''">#{modelName},</if> <if test="modelName != null and modelName != ''">#{modelName},</if>
<if test="productionDate != null and productionDate != ''">#{productionDate},</if> <if test="productionDate != null">#{productionDate},</if>
<if test="workingHours != null and workingHours != ''">#{workingHours},</if> <if test="workingHours != null and workingHours != ''">#{workingHours},</if>
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if> <if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
<if test="picUrl != null and picUrl != ''">#{picUrl},</if> <if test="picUrl != null and picUrl != ''">#{picUrl},</if>
@ -614,7 +613,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jsDayPrice != null and jsDayPrice != ''">#{jsDayPrice},</if> <if test="jsDayPrice != null and jsDayPrice != ''">#{jsDayPrice},</if>
<if test="description != null and description != ''">#{description},</if> <if test="description != null and description != ''">#{description},</if>
<if test="gpsCode != null and gpsCode != ''">#{gpsCode},</if> <if test="gpsCode != null and gpsCode != ''">#{gpsCode},</if>
<if test="companyId != null">#{companyId},</if> <if test="companyId != null and companyId != ''">#{companyId},</if>
<if test="person != null and person != ''">#{person},</if> <if test="person != null and person != ''">#{person},</if>
<if test="personPhone != null and personPhone != ''">#{personPhone},</if> <if test="personPhone != null and personPhone != ''">#{personPhone},</if>
now(), now(),