huanghongfa
2021-05-20 db151c2d4b332a320be7813ea3eb0e0cfe9e1f11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.panzhihua.service_community.dao;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.common.model.vos.vaccines.VaccinesUserInoculationByAppVO;
import com.panzhihua.service_community.model.dos.ComMngVaccinesInoculationRecordDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
 
/**
 * @auther lyq
 * @create 2021-05-19 14:17:59
 * @describe 疫苗接种记录表mapper类
 */
@Mapper
public interface ComMngVaccinesInoculationRecordDAO extends BaseMapper<ComMngVaccinesInoculationRecordDO> {
 
    @Select("<script> " +
            "select id,vaccines,name,inoculation_at,vaccines_code,medical_institution,dosage from com_mng_vaccines_inoculation_record " +
            " where 1=1 and " +
            "<if test='ids != null and ids.size>0'>" +
            "(user_type = 2 and user_id in  "+
            "<foreach item=\"item\" collection=\"ids\" separator=\",\" open=\"(\" close=\")\" index=\"\"> " +
            "#{item} " +
            "</foreach>" +
            " ) or  " +
            " </if> " +
 
            " (user_type = 1 and user_id = #{userId}) " +
            " order by inoculation_at desc " +
            " </script>")
    List<VaccinesUserInoculationByAppVO> getUserInoculationListByApp(@Param("ids") List<Long> ids, @Param("userId") Long userId);
 
}