1.mapper.xml,>,< <select id="getAllByPage" resultType="com.chint.entity.ExceptionHandling"> select a.* from exception_handling a <where> <if test="deliveryNoteNo != null and deliveryNoteNo != ''"> and a.delivery_note_no like concat('%', #{deliveryNoteNo}, '%') </if> <if test="deliveryShipNo != null and deliveryShipNo != ''"> and a.delivery_ship_no =#{deliveryShipNo} </if> <if test="startTime != null and startTime != '' "> and DATE_FORMAT(alarm_time,'%Y-%m-%d') >= DATE_FORMAT(#{startTime},'%Y-%m-%d') </if> <if test="endTime != null and endTime != '' "> and DATE_FORMAT(alarm_time,'%Y-%m-%d') <= DATE_FORMAT(#{endTime},'%Y-%m-%d') </if> </where> limit #{pageNum} , #{pageSize}
2.mapper
@Repository public interface ExceptionHandlingMapper extends BaseMapper<ExceptionHandling> { List<ExceptionHandling> getAllByPage(ExceptionHandlingDto exceptionHandlingDto);}
3.入参实体
@Getter @Setter public class ExceptionHandlingDto implements Serializable { @ApiModelProperty("发货清单号") private String deliveryShipNo; @ApiModelProperty("交货单号") private String deliveryNoteNo; @ApiModelProperty("开始时间") private String startTime; @ApiModelProperty("结束时间") private String endTime; private int pageNum; private int pageSize; }