物资装备SQL修改

This commit is contained in:
syruan 2024-11-26 09:48:08 +08:00
parent 0928f68f6a
commit 8002f8143f
3 changed files with 53 additions and 24 deletions

View File

@ -47,7 +47,6 @@ public class DevInfoController extends BaseController {
@ApiOperation(value = "装备列表")
@PostMapping("/list")
public AjaxResult list(@RequestBody DevInfoVo devInfo) {
devInfo.setLevel("4");
List<DevInfoVo> list = devInfoService.selectDevInfoList(devInfo);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
@ -67,10 +66,10 @@ public class DevInfoController extends BaseController {
}
/**
* 查询商品列表--包含附件查询
* 查询商品列表--分页
*/
//@RequiresPermissions("equip:info:list")
@ApiOperation(value = "查询商品列表--附件列表")
@ApiOperation(value = "查询装备列表--分页")
@PostMapping("/devList")
public TableDataInfo devList(@RequestBody DevInfoVo devInfo) {
startPage();

View File

@ -286,6 +286,12 @@ public class DevInfoServiceImpl implements DevInfoService {
return AjaxResult.success("装备草稿保存成功");
}
/**
* 物资设备文件处理并上传
* @param devInfo 设备附件对象
* @param userId 用户ID
* @return 无异常返回null 报错返回AjaxResult
*/
private AjaxResult uploadFiles(DevInfo devInfo, Long userId) {
if (userId == null) {
return AjaxResult.error("用户信息获取失败,请刷新后重试");
@ -422,13 +428,7 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) {
List<DevInfoVo> list = devInfoMapper.selectDevInfoLists(devInfo);
//获取设备的附件
for (DevInfoVo devInfoVo : list) {
List<BmFileInfo> fileInfoList = bmFileInfoMapper.selectBmFileInfoById(devInfoVo.getMaId());
devInfoVo.setBmFileInfoList(fileInfoList);
}
return list;
return devInfoMapper.selectDevInfoLists(devInfo);
}
/**

View File

@ -470,20 +470,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
select
d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,t.group_name as type_name,t.p_id as group_id,t.group_id as company_id
from ma_dev_info d
left join (select
t.*, p.type_name as parent_name, p.type_id as p_id,mt.type_name as group_name, mt.type_id as group_id
d.*,c.company_name as companyName,c.operate_address as operateAddress,
mt4.type_name as typeName,mt4.unit_name as unitName,
mt3.type_id as thirdId,mt3.type_name as thirdName,
mt2.type_id as secondId,mt2.type_name as secondName,
mt1.type_id as firstId,mt1.type_name as firstName
from
ma_type t
left join
ma_type p on t.parent_id=p.type_id
left join
ma_type mt on p.parent_id = mt.type_id
) t on d.type_id = t.type_id
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 ORDER BY d.create_time desc
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 mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
left join ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0'
left join ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
<where>
<if test="maId != null "> and d.ma_id = #{maId}</if>
<if test="code != null and code != ''"> and d.code = #{code}</if>
<if test="deviceName != null and deviceName != ''">
and d.device_name like concat('%',#{deviceName},'%')
</if>
<if test="typeId != null">
and d.type_id = #{typeId}
</if>
<if test="maStatus != null"> and d.ma_status = #{maStatus}</if>
<if test="leaseScope != null "> and d.lease_scope = #{leaseScope}</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="modelName != null and modelName != ''"> and d.model_name like concat('%', #{modelName}, '%')</if>
<if test="companyId != null "> and d.own_co = #{companyId}</if>
<if test="startTime != null and endTime != null">
and d.update_time between #{startTime} and #{endTime}
</if>
<if test="keyWord != null and keyWord != ''">
and (
locate(#{keyWord},c.company_name) > 0
or locate(#{keyWord},d.ma_id) > 0
or locate(#{keyWord},d.model_name) > 0
or locate(#{keyWord},d.specification) > 0
or locate(#{keyWord},d.serial_number) > 0
or locate(#{keyWord},d.description) > 0
)
</if>
and d.is_active = '1'
</where>
ORDER BY d.create_time desc
</select>
<select id="selectCompanyList" resultType="com.bonus.common.biz.domain.BmCompanyInfo">