mybatis记录

1. 条件查询:

(1)接口:

@Mapper
public interface PlanBrightnessMapper extends BaseMapper<GuideScreenSyncMonitoring> {

List<GuideScreenSyncVo> getPis (Map<String, Object> params);
}

(2)实现:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cars.ict.rbpsems.additional.device.mapper.PlanBrightnessMapper">
<select id="getPis" parameterType="map"
resultType="com.cars.ict.rbpsems.vo.controlpisled.GuideScreenSyncVo">
SELECT
g.device_name AS ledName,
g.ip,
g.station AS stationName,
g.STATUS AS faultStatus,
rd.s_address AS region,
g.modify_time AS modifyTime,
rd.s_id AS deviceId,
rd.s_device_code AS deviceCode,
IF
( camera.camera_id IS NULL, '0', '1' ) AS isCamera,
g.cpu,
g.disk,
g.memory,
c.s_code AS deviceTypeCode
FROM
guide_screen_sync_monitoring g
LEFT JOIN rec_device rd ON rd.s_ip = g.ip
LEFT JOIN camera_config camera ON camera.guid = rd.s_id
LEFT JOIN b_stationinfrelatree srd ON srd.id = rd.s_station_region_id
LEFT JOIN rec_device_category c ON c.s_id = rd.s_device_category_id
<where>
c.s_code IN ( '0203' )
<if test="stationId != null and stationId != ''">
and rd.s_station_id = #{stationId}
</if>
<if test="regionName != null and regionName != ''">
and srd.inf_name = #{regionName}
</if>
<if test="deviceType != null and deviceType != ''">
and rd.s_device_category_id = #{deviceType}
</if>
<if test="deviceName != null and deviceName != ''">
and rd.s_name LIKE CONCAT('%', #{deviceName} ,'%')
</if>
</where>
ORDER BY
modify_time DESC
</select>
</mapper>




posted @   sensen~||^_^|||&  阅读(3)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
历史上的今天:
2021-09-08 idea中配置了SpringBoot的配置文件application.properties后不起作用
2021-09-08 org.springframework.beans.factory.BeanCreationException: Error creating bean XXX ....
点击右上角即可分享
微信分享提示