huanghongfa
2021-09-02 177249c76aeea0b4bf8d8816d4994e3b445b45ce
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngCarDAO.java
@@ -1,22 +1,20 @@
package com.panzhihua.service_community.dao;
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.community.ExportComMngCarExcelDTO;
import com.panzhihua.common.model.dtos.community.ExportRealCompanyExcelDTO;
import com.panzhihua.common.model.dtos.community.PageComMngCarDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngCarExcelVO;
import com.panzhihua.common.model.vos.community.ComMngCarVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationCarVO;
import com.panzhihua.common.model.vos.community.ComMngRealCompanyExcelVO;
import com.panzhihua.service_community.model.dos.ComMngCarDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
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.community.ExportComMngCarExcelDTO;
import com.panzhihua.common.model.dtos.community.PageComMngCarDTO;
import com.panzhihua.common.model.vos.community.ComMngCarExcelVO;
import com.panzhihua.common.model.vos.community.ComMngCarVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationCarVO;
import com.panzhihua.service_community.model.dos.ComMngCarDO;
/**
 * @description: 车辆管理
@@ -26,78 +24,41 @@
@Mapper
public interface ComMngCarDAO extends BaseMapper<ComMngCarDO> {
    @Select("<script> " +
            " SELECT " +
            " t.id, " +
            " t.community_id AS communityId, " +
            " t1.`name` AS communityName, " +
            " t.card_no AS cardNo, " +
            " t.area_id AS areaId, " +
            " t.area_name AS areaName, " +
            " t.user_id userId, " +
            " t.user_name AS userName, " +
            " t.address, " +
            " t.mobile, " +
            " t.plate_num AS plateNum, " +
            " t.brand, " +
            " t.color, " +
            " t.create_at AS createAt, " +
            " t3.`name` AS createBy  " +
            "FROM " +
            " com_mng_car t " +
            " LEFT JOIN com_act t1 ON t.community_id = t1.community_id " +
            " LEFT JOIN sys_user t3 ON t.create_by = t3.user_id " +
            " WHERE 1=1" +
            "<if test='pageComMngCarDTO.name != null and pageComMngCarDTO.name != &quot;&quot;'>" +
            " and t.user_name LIKE concat( '%',#{pageComMngCarDTO.name}, '%' )  " +
            " </if> " +
            "<if test='pageComMngCarDTO.villageId != null and pageComMngCarDTO.villageId != &quot;&quot;'>" +
            " and t.area_id = #{pageComMngCarDTO.villageId} " +
            " </if> " +
            "<if test='pageComMngCarDTO.communityId != null and pageComMngCarDTO.communityId != 0'>" +
            " and t.community_id = #{pageComMngCarDTO.communityId} " +
            " </if> " +
            "<if test='pageComMngCarDTO.areaName != null and pageComMngCarDTO.areaName != &quot;&quot;'>" +
            " and t2.area_name LIKE concat( '%',#{pageComMngCarDTO.areaName}, '%' )  " +
            " </if> " +
            " order by t.create_at desc" +
            "</script>")
    IPage<ComMngCarVO> pageQueryComMngCar(Page page, @Param(value = "pageComMngCarDTO") PageComMngCarDTO pageComMngCarDTO);
    @Select("<script> " + " SELECT " + " t.id, " + " t.community_id AS communityId, " + " t1.`name` AS communityName, "
        + " t.card_no AS cardNo, " + " t.area_id AS areaId, " + " t.area_name AS areaName, " + " t.user_id userId, "
        + " t.user_name AS userName, " + " t.address, " + " t.mobile, " + " t.plate_num AS plateNum, " + " t.brand, "
        + " t.color, " + " t.create_at AS createAt, " + " t3.`name` AS createBy  " + "FROM " + " com_mng_car t "
        + " LEFT JOIN com_act t1 ON t.community_id = t1.community_id "
        + " LEFT JOIN sys_user t3 ON t.create_by = t3.user_id " + " WHERE 1=1"
        + "<if test='pageComMngCarDTO.name != null and pageComMngCarDTO.name != &quot;&quot;'>"
        + " and t.user_name LIKE concat( '%',#{pageComMngCarDTO.name}, '%' )  " + " </if> "
        + "<if test='pageComMngCarDTO.villageId != null and pageComMngCarDTO.villageId != &quot;&quot;'>"
        + " and t.area_id = #{pageComMngCarDTO.villageId} " + " </if> "
        + "<if test='pageComMngCarDTO.communityId != null and pageComMngCarDTO.communityId != 0'>"
        + " and t.community_id = #{pageComMngCarDTO.communityId} " + " </if> "
        + "<if test='pageComMngCarDTO.areaName != null and pageComMngCarDTO.areaName != &quot;&quot;'>"
        + " and t2.area_name LIKE concat( '%',#{pageComMngCarDTO.areaName}, '%' )  " + " </if> "
        + " order by t.create_at desc" + "</script>")
    IPage<ComMngCarVO> pageQueryComMngCar(Page page,
        @Param(value = "pageComMngCarDTO") PageComMngCarDTO pageComMngCarDTO);
    @Select("select cmc.id,cmc.plate_num,cmc.color,cmc.brand from com_mng_car as cmc " +
            " left join sys_user as su on su.user_id = cmc.user_id " +
            " where su.id_card = #{idCard}")
    @Select("select cmc.id,cmc.plate_num,cmc.color,cmc.brand from com_mng_car as cmc "
        + " left join sys_user as su on su.user_id = cmc.user_id " + " where su.id_card = #{idCard}")
    List<ComMngPopulationCarVO> getPopulationCarListByIdCard(@Param(value = "idCard") String idCard);
    @Select("<script> " +
            " SELECT  " +
            "  t.area_name AS areaName,  " +
            "  t.user_name AS userName,  " +
            "  t.card_no AS cardNo,  " +
            "  t.brand,  " +
            "  t.plate_num AS plateNum,  " +
            "  t.color,  " +
            "  t.mobile,  " +
            "  t.address " +
            "FROM  " +
            "  com_mng_car t where 1=1 " +
            "<if test='exportComMngCarExcelDTO.areaName != null and exportComMngCarExcelDTO.areaName.trim() != &quot;&quot;'>" +
            " and t.area_name LIKE concat( #{exportComMngCarExcelDTO.areaName}, '%' )  " +
            " </if> " +
            "<if test='exportComMngCarExcelDTO.communityId != null and exportComMngCarExcelDTO.communityId != &quot;&quot;'>" +
            " and t.community_id = #{exportComMngCarExcelDTO.communityId} " +
            " </if> " +
            "<if test='exportComMngCarExcelDTO.villageId != null and exportComMngCarExcelDTO.villageId != &quot;&quot;'>" +
            " and t.area_id = #{exportComMngCarExcelDTO.villageId} " +
            " </if> " +
            "<if test='exportComMngCarExcelDTO.userName != null and exportComMngCarExcelDTO.userName.trim() != &quot;&quot;'>" +
            " and t.user_name LIKE concat( #{exportComMngCarExcelDTO.userName}, '%' )  " +
            " </if> " +
            " order by t.create_at desc" +
            "</script>")
    List<ComMngCarExcelVO> exportRealCar(@Param(value = "exportComMngCarExcelDTO") ExportComMngCarExcelDTO exportComMngCarExcelDTO);
    @Select("<script> " + " SELECT  " + "  t.area_name AS areaName,  " + "  t.user_name AS userName,  "
        + "  t.card_no AS cardNo,  " + "  t.brand,  " + "  t.plate_num AS plateNum,  " + "  t.color,  "
        + "  t.mobile,  " + "  t.address " + "FROM  " + "  com_mng_car t where 1=1 "
        + "<if test='exportComMngCarExcelDTO.areaName != null and exportComMngCarExcelDTO.areaName.trim() != &quot;&quot;'>"
        + " and t.area_name LIKE concat( #{exportComMngCarExcelDTO.areaName}, '%' )  " + " </if> "
        + "<if test='exportComMngCarExcelDTO.communityId != null and exportComMngCarExcelDTO.communityId != &quot;&quot;'>"
        + " and t.community_id = #{exportComMngCarExcelDTO.communityId} " + " </if> "
        + "<if test='exportComMngCarExcelDTO.villageId != null and exportComMngCarExcelDTO.villageId != &quot;&quot;'>"
        + " and t.area_id = #{exportComMngCarExcelDTO.villageId} " + " </if> "
        + "<if test='exportComMngCarExcelDTO.userName != null and exportComMngCarExcelDTO.userName.trim() != &quot;&quot;'>"
        + " and t.user_name LIKE concat( #{exportComMngCarExcelDTO.userName}, '%' )  " + " </if> "
        + " order by t.create_at desc" + "</script>")
    List<ComMngCarExcelVO>
        exportRealCar(@Param(value = "exportComMngCarExcelDTO") ExportComMngCarExcelDTO exportComMngCarExcelDTO);
}