mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.panzhihua.service_community.dao;
 
import java.util.List;
 
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.vaccines.VaccinesEnrollByAdminDTO;
import com.panzhihua.common.model.vos.vaccines.ComMngVaccinesEnrollExcelVo;
import com.panzhihua.common.model.vos.vaccines.VaccinesEnrollByAdminVO;
import com.panzhihua.common.model.vos.vaccines.VaccinesEnrollUserByAppVO;
import com.panzhihua.service_community.model.dos.ComMngVaccinesEnrollRecordDO;
 
/**
 * @auther lyq
 * @create 2021-05-19 14:17:53
 * @describe 疫苗报名记录表mapper类
 */
@Mapper
public interface ComMngVaccinesEnrollRecordDAO extends BaseMapper<ComMngVaccinesEnrollRecordDO> {
 
    @Select("select cmfi.id as userId,cmfi.name,cmfi.age,cmfi.job,cmfi.phone,cmfi.id_card,cmfi.create_at from com_mng_family_info as cmfi where user_id = #{userId}")
    List<VaccinesEnrollUserByAppVO> getFamilyUserList(@Param("userId") Long userId);
 
    @Select("select su.user_id,su.name,su.nick_name,su.job,su.phone,su.id_card,su.birthday,su.sex,su.create_at from sys_user as su where user_id = #{userId}")
    VaccinesEnrollUserByAppVO getSysUser(@Param("userId") Long userId);
 
    @Select("select cmfi.name,cmfi.age,cmfi.phone,cmfi.id_card from com_mng_family_info as cmfi where id = #{userId}")
    VaccinesEnrollUserByAppVO getFamilyUser(@Param("userId") Long userId);
 
    @Select("<script> "
        + "select cmver.id,cmver.name,cmver.sex,cmver.age,cmver.phone,cmver.id_card,cmver.create_at,cmv.name as vaccines from com_mng_vaccines_enroll_record as cmver "
        + " left join com_mng_vaccines as cmv on cmv.id = cmver.type " + " <where>"
        + "<if test='vaccinesByAdminDTO.communityId != null'>"
        + " and cmver.community_id = ${vaccinesByAdminDTO.communityId} " + " </if> "
        + "<if test='vaccinesByAdminDTO.vaccines != null and vaccinesByAdminDTO.vaccines != &quot;&quot;'>"
        + " and cmv.name = #{vaccinesByAdminDTO.vaccines} " + " </if> "
        + "<if test='vaccinesByAdminDTO.name != null and vaccinesByAdminDTO.name != &quot;&quot;'>"
        + " and cmver.name like concat('%',#{vaccinesByAdminDTO.name},'%') " + " </if> "
        + "<if test='vaccinesByAdminDTO.idCard != null and vaccinesByAdminDTO.idCard != &quot;&quot;'>"
        + " and cmver.id_card = #{vaccinesByAdminDTO.idCard} " + " </if> "
        + "<if test='vaccinesByAdminDTO.phone != null and vaccinesByAdminDTO.phone != &quot;&quot;'>"
        + " and cmver.phone = #{vaccinesByAdminDTO.phone} " + " </if> "
        + "<if test='vaccinesByAdminDTO.startTime != null and vaccinesByAdminDTO.startTime != &quot;&quot;  '>\n"
        + " AND cmver.create_at <![CDATA[>=]]> #{vaccinesByAdminDTO.startTime}  \n" + "</if>"
        + "<if test='vaccinesByAdminDTO.endTime != null and vaccinesByAdminDTO.endTime != &quot;&quot;  '>\n"
        + " AND cmver.create_at <![CDATA[<=]]> #{vaccinesByAdminDTO.endTime}  " + " </if> \n" + " </where>"
        + " order by cmver.create_at desc" + " </script>")
    IPage<VaccinesEnrollByAdminVO> getVaccinesEnrollListByAdmin(Page page,
        @Param("vaccinesByAdminDTO") VaccinesEnrollByAdminDTO vaccinesByAdminDTO);
 
    @Select("<script> "
        + "select cmver.name,cmver.sex,cmver.age,cmver.phone,cmver.id_card,cmver.create_at,cmv.name as vaccines from com_mng_vaccines_enroll_record as cmver "
        + " left join com_mng_vaccines as cmv on cmv.id = cmver.type " + " <where>"
        + "<if test='vaccinesByAdminDTO.communityId != null'>"
        + " and cmver.community_id = ${vaccinesByAdminDTO.communityId} " + " </if> "
        + "<if test='vaccinesByAdminDTO.ids != null and vaccinesByAdminDTO.ids.size > 0'>" + " and cmver.id in "
        + "<foreach item=\"item\" collection=\"vaccinesByAdminDTO.ids\" separator=\",\" open=\"(\" close=\")\" index=\"\"> \n"
        + "#{item}" + "</foreach>" + " </if> "
        + "<if test='vaccinesByAdminDTO.vaccines != null and vaccinesByAdminDTO.vaccines != &quot;&quot;'>"
        + " and cmv.name = #{vaccinesByAdminDTO.vaccines} " + " </if> "
        + "<if test='vaccinesByAdminDTO.name != null and vaccinesByAdminDTO.name != &quot;&quot;'>"
        + " and cmver.name like concat('%',#{vaccinesByAdminDTO.name},'%') " + " </if> "
        + "<if test='vaccinesByAdminDTO.idCard != null and vaccinesByAdminDTO.idCard != &quot;&quot;'>"
        + " and cmver.id_card = #{vaccinesByAdminDTO.idCard} " + " </if> "
        + "<if test='vaccinesByAdminDTO.phone != null and vaccinesByAdminDTO.phone != &quot;&quot;'>"
        + " and cmver.phone = #{vaccinesByAdminDTO.phone} " + " </if> "
        + "<if test='vaccinesByAdminDTO.startTime != null and vaccinesByAdminDTO.startTime != &quot;&quot; '>\n"
        + " AND cmver.create_at <![CDATA[>=]]> #{vaccinesByAdminDTO.startTime}  \n" + "</if>"
        + "<if test='vaccinesByAdminDTO.endTime != null and vaccinesByAdminDTO.endTime != &quot;&quot; '>\n"
        + " AND cmver.create_at <![CDATA[<=]]> #{vaccinesByAdminDTO.endTime}  " + " </if> \n" + " </where>"
        + " order by cmver.create_at desc" + " </script>")
    List<ComMngVaccinesEnrollExcelVo>
        exportVaccinesEnrollListByAdmin(@Param("vaccinesByAdminDTO") VaccinesEnrollByAdminDTO vaccinesByAdminDTO);
}