CameraRepository.java 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. package com.xiaoan.dao.backend;
  2. import com.xiaoan.domain.backend.CameraEntity;
  3. import com.xiaoan.domain.dto.response.CameraResponse;
  4. import org.apache.ibatis.annotations.Mapper;
  5. import org.apache.ibatis.annotations.Select;
  6. import org.springframework.stereotype.Component;
  7. import java.util.List;
  8. /**
  9. * Created by Hb_zzZ on 2020/2/27.
  10. */
  11. @Mapper
  12. @Component
  13. public interface CameraRepository extends IBaseMapper<CameraEntity, Long> {
  14. @Select(value = "select * from t_camera where wifi_name = #{code} and rec_status = 'A' ")
  15. CameraEntity findByWifiName(String code);
  16. @Select(value = "select z.id, z.sn_code, z.child_name, z.wifi_name, z.create_time, z.update_time, d.type from" +
  17. " t_camera z left join t_camera_detail d on z.id = d.camera_id where z.rec_status = 'A' " +
  18. " and ( z.wifi_name like #{searchKey} or #{searchKey} is null)" +
  19. " and (d.user_id = #{userId} or #{userId} is null) " +
  20. " order by z.create_time desc")
  21. List<CameraResponse> findAllBySearchKey(String searchKey, Long userId);
  22. }