Commit 6aad5a32 authored by srx's avatar srx

设备模糊筛选

parent 5f5e4daa
package com.yeejoin.amos.boot.module.ugp.api.mapper; package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.yeejoin.amos.boot.module.ugp.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
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;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 设备信息表 Mapper 接口 * 设备信息表 Mapper 接口
* *
...@@ -12,5 +17,6 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,5 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface EquipmentMapper extends BaseMapper<Equipment> { public interface EquipmentMapper extends BaseMapper<Equipment> {
List<EquipmentDto> queryEquipmentPage(Equipment equipmentParam);
} }
...@@ -4,6 +4,7 @@ package com.yeejoin.amos.boot.module.ugp.api.service; ...@@ -4,6 +4,7 @@ package com.yeejoin.amos.boot.module.ugp.api.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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 org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -14,9 +15,11 @@ import java.util.List; ...@@ -14,9 +15,11 @@ import java.util.List;
* @author system_generator * @author system_generator
* @date 2022-09-22 * @date 2022-09-22
*/ */
public interface IEquipmentService { public interface IEquipmentService {
//添加设备+附件 //添加设备+附件
EquipmentDto saveEI(JSONObject object); EquipmentDto saveEI(JSONObject object);
Page<EquipmentDto> queryEquipmentPage(int current, int size, Equipment equipment);
} }
...@@ -2,4 +2,19 @@ ...@@ -2,4 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper"> <mapper namespace="com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper">
<select id="queryEquipmentPage" resultType="com.yeejoin.amos.boot.module.ugp.api.entity.Equipment">
select * from tz_ugp_equipment
<where>
<if test="name != '' and name != null">
and `name` like concat('%',#{name},'%')
</if>
<if test="code != '' and code != null">
and `code` like concat('%',#{code},'%')
</if>
<if test="verifyStatus != '' and verifyStatus != null">
and `verifyStatus` like concat('%',#{verifyStatus},'%')
</if>
</where>
</select>
</mapper> </mapper>
...@@ -4,8 +4,12 @@ import com.alibaba.fastjson.JSON; ...@@ -4,8 +4,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment; import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment; import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
...@@ -20,6 +24,8 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -20,6 +24,8 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.EquipmentServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.EquipmentServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -46,6 +52,7 @@ public class EquipmentController extends BaseController { ...@@ -46,6 +52,7 @@ public class EquipmentController extends BaseController {
@Autowired @Autowired
EquipmentServiceImpl equipmentServiceImpl; EquipmentServiceImpl equipmentServiceImpl;
@Autowired @Autowired
EquipmentMapper equipmentMapper; EquipmentMapper equipmentMapper;
...@@ -111,29 +118,46 @@ public class EquipmentController extends BaseController { ...@@ -111,29 +118,46 @@ public class EquipmentController extends BaseController {
return ResponseHelper.buildResponse(equipmentServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(equipmentServiceImpl.queryBySeq(sequenceNbr));
} }
// /**
// * 列表分页查询
// *
// * @param current 当前页
// * @param current 每页大小
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @GetMapping(value = "/page")
// @ApiOperation(httpMethod = "GET",value = "设备信息表分页查询", notes = "设备信息表分页查询")
// public ResponseModel<Page<EquipmentDto>> queryForPage(
// @RequestParam(value = "current") int current,
// @RequestParam(value = "size") int size,
// @RequestParam(value = "name",required = false) String name,
// @RequestParam(value = "code",required = false) String code,
// @RequestParam(value = "verifyStatus",required = false)String verifyStatus) {
// Page<EquipmentDto> page = new Page<EquipmentDto>();
// page.setCurrent(current);
// page.setSize(size);
//
// return ResponseHelper.buildResponse(equipmentServiceImpl.queryForEquipmentPage(page,name,code,verifyStatus));
// }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "设备信息表分页查询", notes = "设备信息表分页查询") @ApiOperation(httpMethod = "GET",value = "设备信息表分页查询", notes = "设备信息表分页查询")
public ResponseModel<Page<EquipmentDto>> queryForPage( public ResponseModel<Page<EquipmentDto>> queryForPage(
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, @RequestParam(value = "size") int size, Equipment equipment) {
@RequestParam(value = "name",required = false) String name, return ResponseHelper.buildResponse(equipmentServiceImpl.queryEquipmentPage(current,size,equipment));
@RequestParam(value = "code",required = false) String code,
@RequestParam(value = "verifyStatus",required = false)String verifyStatus) {
Page<EquipmentDto> page = new Page<EquipmentDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentServiceImpl.queryForEquipmentPage(page,name,code,verifyStatus));
} }
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
......
...@@ -7,7 +7,10 @@ import com.alibaba.fastjson.JSON; ...@@ -7,7 +7,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment; import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment; import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project; import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper;
...@@ -22,6 +25,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -22,6 +25,7 @@ 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 org.typroject.tyboot.core.restful.utils.ResponseHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -172,6 +176,24 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E ...@@ -172,6 +176,24 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
// BeanUtils.copyProperties(attachmentDto,attachment); // BeanUtils.copyProperties(attachmentDto,attachment);
} }
public Page<EquipmentDto> queryEquipmentPage(int current, int size, Equipment equipment) {
Page<EquipmentDto> page = new Page<>();
page.setSize(size);
page.setCurrent(current);
this.list();
List<EquipmentDto> equipments = equipmentMapper.queryEquipmentPage(equipment);
// List<CompanyDto> companyDtos = new ArrayList<>();
// BeanUtils.copyProperties(companies,companyDtos);
page.setRecords(equipments);
// if (companyDto.getName() != null) {
// List<CompanyDto> collect = page1.getRecords().stream().filter(a -> a.getName().equals(companyDto.getName())).collect(Collectors.toList());
// page1.setRecords(collect);
// }
return page;
}
} }
\ 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