|
|
@ -1,9 +1,19 @@ |
|
|
|
package com.kms.yxgh.df.mapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.kms.yxgh.df.domain.DfAnimalRecord; |
|
|
|
import com.kms.yxgh.df.dto.DfAnimalRecordDto; |
|
|
|
import com.kms.yxgh.df.dto.DfYhPlanDto; |
|
|
|
import com.shuili.common.utils.StringUtils; |
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.apache.ibatis.annotations.SelectProvider; |
|
|
|
import org.apache.ibatis.jdbc.SQL; |
|
|
|
import org.springframework.stereotype.Repository; |
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* 害堤动物防治计划执行记录Mapper接口 |
|
|
|
* |
|
|
@ -13,4 +23,30 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
|
|
@Repository |
|
|
|
public interface DfAnimalRecordMapper extends BaseMapper<DfAnimalRecord> { |
|
|
|
|
|
|
|
@SelectProvider(type = DfAnimalRecordSqlProvider.class, method = "selectPage") |
|
|
|
IPage<DfAnimalRecordDto> selectPage(Page<DfAnimalRecordDto> page, @Param("dto") DfAnimalRecordDto dto); |
|
|
|
|
|
|
|
class DfAnimalRecordSqlProvider { |
|
|
|
|
|
|
|
public String selectPage(final Map<String, Object> param) { |
|
|
|
return new SQL(){{ |
|
|
|
SELECT("t.id, t.dike_code, t.plan_id, t.plan_name, t.location, t.construction_status, t.pest, t.status"); |
|
|
|
FROM("bs_sgc_df_hdjl t"); |
|
|
|
WHERE("1 = 1"); |
|
|
|
|
|
|
|
DfAnimalRecordDto dto = (DfAnimalRecordDto) param.get("dto"); |
|
|
|
if (dto != null) { |
|
|
|
if (StringUtils.isNotBlank(dto.getDikeCode())) { |
|
|
|
WHERE("t.dike_code = #{dto.dikeCode}"); |
|
|
|
} |
|
|
|
if (dto.getLocation() != null) { |
|
|
|
WHERE("t.location LIKE CONCAT('%', #{dto.location}, '%')"); |
|
|
|
} |
|
|
|
if (dto.getStatus() != null) { |
|
|
|
WHERE("t.status = #{dto.status}"); |
|
|
|
} |
|
|
|
} |
|
|
|
}}.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|