Commit 1f3e7511 authored by lisong's avatar lisong

添加焊机查询接口

parent 200bbdda
package com.yeejoin.amos.boot.module.ugp.api.mapper; package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto; import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment; import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -22,4 +23,8 @@ public interface EquipmentMapper extends BaseMapper<Equipment> { ...@@ -22,4 +23,8 @@ public interface EquipmentMapper extends BaseMapper<Equipment> {
IPage<EquipmentDto> queryEquipmentPage(IPage<EquipmentDto> page, Equipment equipment, Set<String> companyIds); IPage<EquipmentDto> queryEquipmentPage(IPage<EquipmentDto> page, Equipment equipment, Set<String> companyIds);
List<Map<String, Long>> informationStatistics(@Param("companyIds") Set<String> companyIds); List<Map<String, Long>> informationStatistics(@Param("companyIds") Set<String> companyIds);
Page<EquipmentDto> boundWelder(@Param("page" )IPage<EquipmentDto> page, @Param("projectId") String projectId, @Param("companyId") Long companyId, @Param("name") String name);
Page<EquipmentDto> allBoundWelder(@Param("page" )IPage<EquipmentDto> page, @Param("projectId") String projectId, @Param("companyId") Long companyId, @Param("name") String name);
} }
...@@ -37,5 +37,37 @@ ...@@ -37,5 +37,37 @@
</where> </where>
GROUP BY type GROUP BY type
</select> </select>
<select id="boundWelder" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto">
SELECT
ue.*
FROM
tz_ugp_equipment ue
LEFT JOIN tz_ugp_project_resource upr ON ue.sequence_nbr = upr.resource_id
<where>
upr.type = 'equipment' AND upr.project_id = #{projectId}
AND ue.company_id = #{companyId}
<if test="name != null and name != ''">
and ue.name like concat('%', #{name}, '%')
</if>
</where>
</select>
<select id="allBoundWelder" resultType="com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto">
SELECT
ue.*
FROM
tz_ugp_equipment ue
LEFT JOIN tz_ugp_project_resource upr ON ue.sequence_nbr = upr.resource_id
<where>
( (upr.project_id = #{projectId} and upr.type = 'equipment' ) or upr.resource_id is null)
AND ue.company_id = #{companyId}
<if test="name != null and name != ''">
and ue.name like concat('%', #{name}, '%')
</if>
</where>
</select>
</mapper> </mapper>
...@@ -285,4 +285,30 @@ public class EquipmentController extends BaseController { ...@@ -285,4 +285,30 @@ public class EquipmentController extends BaseController {
public ResponseModel<List<Map<String,Long>>> informationStatistics() { public ResponseModel<List<Map<String,Long>>> informationStatistics() {
return ResponseHelper.buildResponse(equipmentServiceImpl.informationStatistics()); return ResponseHelper.buildResponse(equipmentServiceImpl.informationStatistics());
} }
/**
* 查询已绑定焊机信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/boundWelder")
@ApiOperation(httpMethod = "GET", value = "查询已绑定焊机信息", notes = "查询已绑定焊机信息")
public ResponseModel<Object> boundWelder(@RequestParam(value = "projectId") String projectId,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "name", required = false) String name) {
return ResponseHelper.buildResponse(equipmentServiceImpl.boundWelder(projectId, current, size, name, null));
}
/**
* 查询已绑定焊机信息以及空闲设备
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/allBoundWelder")
@ApiOperation(httpMethod = "GET", value = "查询已绑定焊机信息", notes = "查询已绑定焊机信息")
public ResponseModel<Object> allBoundWelder(@RequestParam(value = "projectId") String projectId,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "name", required = false) String name) {
return ResponseHelper.buildResponse(equipmentServiceImpl.boundWelder(projectId, current, size, name, "all"));
}
} }
...@@ -20,12 +20,14 @@ import com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService; ...@@ -20,12 +20,14 @@ import com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto; import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify; import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 设备信息表服务实现类 * 设备信息表服务实现类
...@@ -285,4 +287,19 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E ...@@ -285,4 +287,19 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
return equipmentMapper.informationStatistics(companyIds); return equipmentMapper.informationStatistics(companyIds);
} }
@BusinessIdentify
public Page<EquipmentDto> boundWelder(String projectId, int current, int size, String name, String type) {
ReginParams reginParams = orgService.getReginParams();
Long companySequenceNbr = reginParams.getBusinessInfo().getCompanySequenceNbr();
Page<EquipmentDto> page = new Page<>(current, size);
Page<EquipmentDto> result;
if (!ObjectUtils.isEmpty(type) && "all".equals(type)) {
result = equipmentMapper.boundWelder(page, projectId, companySequenceNbr, name);
} else {
result = equipmentMapper.allBoundWelder(page, projectId, companySequenceNbr, name);
}
return result;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment