<?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.ruoyi.system.mapper.stamp.CarExamineExtMapper">

  <select id="listCarExamineByParam" resultType="com.ruoyi.system.domain.stamp.CarExamine">
    select * from car_examine where 1=1
    <if test="title != null and title != ''">
      and title like concat('%',#{title},'%')
    </if>
    <if test="status != null and status != ''">
      and status = #{status}
    </if>
    <if test="userId != null and userId != ''">
      and(create_user = #{userId} or id in(select bus_id from car_dinner_examine_user where user_id = #{userId} and type='CAR'))
    </if>
    order by create_time desc
  </select>
  <select id="listDinnerExamineByParam" resultType="com.ruoyi.system.domain.stamp.DinnerExamine">
    select * from dinner_examine where 1=1
    <if test="title != null and title != ''">
      and title like concat('%',#{title},'%')
    </if>
    <if test="status != null and status != ''">
      and status = #{status}
    </if>
    <if test="userId != null and userId != ''">
      and(create_user = #{userId} or id in(select bus_id from car_dinner_examine_user where user_id = #{userId} and type='DINNER'))
    </if>
    order by create_time desc
  </select>
</mapper>