Browse Source

水位计搜索

platform-api
yx 2 years ago
parent
commit
8a8a9a8362
  1. 7
      ruoyi-code/src/main/java/com/ruoyi/code/camera/mapper/CameraMapper.java
  2. 6
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraServiceImpl.java
  3. 13
      ruoyi-code/src/main/resources/mapper/camera/CameraMapper.xml

7
ruoyi-code/src/main/java/com/ruoyi/code/camera/mapper/CameraMapper.java

@ -1,10 +1,15 @@ @@ -1,10 +1,15 @@
package com.ruoyi.code.camera.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Mapper接口
@ -19,4 +24,6 @@ public interface CameraMapper extends BaseMapper<Camera> @@ -19,4 +24,6 @@ public interface CameraMapper extends BaseMapper<Camera>
List<Camera> queryCameraList();
Camera queryCameraBYSid(Long sid);
IPage<Camera> queryPage(Page page,@Param("params") Map<String, Object> params);
}

6
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraServiceImpl.java

@ -3,6 +3,7 @@ package com.ruoyi.code.camera.service.impl; @@ -3,6 +3,7 @@ package com.ruoyi.code.camera.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import com.ruoyi.code.camera.domain.Camera;
@ -29,9 +30,10 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme @@ -29,9 +30,10 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<Camera> page = this.page(
IPage<Camera> page = baseMapper.queryPage(
new Query<Camera>().getPage(params),
new QueryWrapper<Camera>()
params
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());

13
ruoyi-code/src/main/resources/mapper/camera/CameraMapper.xml

@ -20,4 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -20,4 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.devsn = s.camera_sn
and s.id = #{sid}
</select>
<select id="queryPage" resultType="com.ruoyi.code.camera.domain.Camera">
select * from camera
<where>
<if test="params.devsn!= null and params.devsn != ''">
and devsn like concat('%',#{params.devsn},'%')
</if>
<if test="params.name != null and params.name != ''">
and name like concat('%',#{params.name},'%')
</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save