| 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.PageComCvtBusinessAppletsDTO; | 
| import com.panzhihua.common.model.dtos.community.PageComCvtBusinessDTO; | 
| import com.panzhihua.common.model.vos.community.ComCvtBusinessVO; | 
| import com.panzhihua.service_community.model.dos.ComCvtBusinessDO; | 
| import org.apache.ibatis.annotations.Mapper; | 
| import org.apache.ibatis.annotations.Param; | 
| import org.apache.ibatis.annotations.Select; | 
|   | 
| @Mapper | 
| public interface ComCvtBusinessDAO extends BaseMapper<ComCvtBusinessDO> { | 
|   | 
|     @Select("<script> " + | 
|             "SELECT " + | 
|             "a.*,  " + | 
|             "IF(u.type=2,CONCAT('运营平台(',u.account,')'),CONCAT('社区平台(',u.account,')'))  create_by_name " + | 
|             "FROM " + | 
|             "com_cvt_business a  " + | 
|             "LEFT JOIN sys_user u ON a.create_by = u.user_id "+ | 
|             " <where>" + | 
|             "<if test='pageComCvtBusinessDTO.name != null and pageComCvtBusinessDTO.name.trim() != ""'>" + | 
|             " and a.name LIKE concat( #{pageComCvtBusinessDTO.name}, '%' )  " + | 
|             " </if> " + | 
|             "<if test='pageComCvtBusinessDTO.communityId != null and pageComCvtBusinessDTO.communityId != 0'>" + | 
|             " and a.community_id = #{pageComCvtBusinessDTO.communityId} " + | 
|             " </if> " + | 
|             " </where>" + | 
|             " order by a.create_at desc"+ | 
|             "</script>") | 
|     IPage<ComCvtBusinessVO> pageComCvtBusiness(Page page, @Param("pageComCvtBusinessDTO") PageComCvtBusinessDTO pageComCvtBusinessDTO); | 
|   | 
|   | 
|     @Select("<script> " + | 
|             "SELECT " + | 
|             "t.*  " + | 
|             "FROM " + | 
|             "com_cvt_business t  " + | 
|             " <where>" + | 
|             "<if test='comCvtBusinessAppletsDTO.communityId != null and comCvtBusinessAppletsDTO.communityId != 0'>" + | 
|             " t.area_flag = 1 " + | 
|             " OR (" + | 
|             " t.area_flag = 2 " + | 
|             " AND EXISTS ( SELECT * FROM com_cvt_business_area t2 WHERE t2.business_id = t.id AND t2.community_id = #{comCvtBusinessAppletsDTO.communityId} ) \n" + | 
|             " ) " + | 
|             " </if> " + | 
|             " </where>" + | 
|             " order by t.create_at desc"+ | 
|             "</script>") | 
|     IPage<ComCvtBusinessVO> pageComCvtBusinessByServiceArea(Page page, @Param("comCvtBusinessAppletsDTO") PageComCvtBusinessAppletsDTO comCvtBusinessAppletsDTO); | 
|   | 
| } |