<select id="findCompayByName" resultType="com.doctor.cloud.recruit.biz.dto.CompanyDO">select * from r_company where 1 = 1
<if test="startTime!=null and startTime!=''">
and c1.create_time >=#{startTime}</if><if test="endTime!=null and endTime!=''">
and c1.create_time <=#{endTime}</if></select>
<select id="findCompayByName" resultType="com.doctor.cloud.recruit.biz.dto.CompanyDO">select * from r_company where 1 = 1
<if test="startTime!=null and startTime!=''">
and c1.create_time >= concat(#{startTime},' 00:00:00')</if><if test="endTime!=null and endTime!=''">
and c1.create_time <= concat(#{endTime},' 23:59:59')</if></select>
3.解决方法2:使用时间戳
<select id="findCompayByName" resultType="com.doctor.cloud.recruit.biz.dto.CompanyDO">select * from r_company where 1 = 1
<if test="startTime!=null and startTime!=''">
and c1.create_time >=#{startTime,jdbcType=TIMESTAMP}</if><if test="endTime!=null and endTime!=''">
and c1.create_time <=#{endTime,jdbcType=TIMESTAMP}</if></select>