package com.huimv.face.repo;

import com.huimv.face.domain.FaceUserImgs;
import com.huimv.face.domain.XtHkbjgzxx;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
 * @Project : huimv.shiwan
 * @Package : com.huimv.face.repo
 * @Description : TODO
 * @Author : yuxuexuan
 * @Create : 2020/12/30 0030 18:26
 **/
public interface FaceUserImgRepository extends JpaRepository<FaceUserImgs, Integer> {
    @Query(nativeQuery = true,value = "SELECT * FROM  face_user_img  where user_id= ?1")
    FaceUserImgs findAllByUserId(String userId);


    @Query(nativeQuery = true,value = "  SELECT gzxx.*, gydm.dmmc gzxx, zsda.zsmc zsmc, mcda.mcmc mcmc, zsda.zsqy zsqy\n" +
            "      FROM da_jqda jqda, da_zsda zsda, da_mcda mcda, xt_hkbj_gzxx gzxx \n" +
            "      LEFT JOIN xt_gydm gydm \n" +
            "      ON gydm.zfbz = 0 \n" +
            "      AND gydm.lbid = 32\n" +
            "       AND gydm.dmid = gzxx.gzlx\n" +
            "    WHERE jqda.zfbz = 0\n" +
            "     AND zsda.zfbz = 0 \n" +
            "     AND mcda.zfbz = 0 \n" +
            "     AND zsda.id = jqda.zsid \n" +
            "     AND jqda.jqid = gzxx.jqid\n" +
            "      AND mcda.id = zsda.mcid      AND mcda.id = 39        \n" +
            "     AND gzxx.jssj IS NULL \n" +
            "  \n" +
            "     AND gzxx.gzlx IN (1, 2, 3, 4, 5) AND fssj > DATE_ADD(NOW(),INTERVAL -10 DAY) AND zsda.ssqy != '5'  GROUP BY jqid,gzlx ")

            //之后改成牧场id
            public   List<Object[]>   findAlarm();



}
