xml在这里插入代码片
<select id="getCount" resultType="com.pisolution.fare.dom.brandfare.model.dto.FareAndRuleCountDto">
SELECT
COUNT(IF(t.release_status != 0,1,null)) AS published,
COUNT(IF(t.release_status = 1,1,null)) AS checkSuccess,
COUNT(IF((t.release_status = 3 or t.release_status = 4),1,null)) AS checkFail,
COUNT(IF(((t.release_status = 3 or t.release_status = 4)and t.status = 1),1,null)) AS failAndProcess,
COUNT(IF(((t.release_status = 3 or t.release_status = 4)and t.status = 0),1,null)) AS failAndNotProcess
FROM
dom_fare_store t
WHERE
1 = 1
<if test="vo != null and vo != ''">
<if test="vo.startTime!= null">
AND t.release_time >= #{vo.startTime}
</if>
<if test="vo.endTime!= null">
AND t.release_time <= #{vo.startTime}
</if>
<if test="vo.userId!= null and vo.userId != ''">
AND t.creator_id = #{vo.userId}
</if>
</if>
</select>
mapper
@Mapper
public interface RuleStoreMapper extends BaseMapper<RuleStore> {
FareAndRuleCountDto getCount(@Param("vo") HomeQueryVo vo);
}
实体
@Data
public class FareAndRuleCountDto {
@ApiModelProperty("已发布")
private int published;
@ApiModelProperty("校验成功")
private int checkSuccess;
@ApiModelProperty("校验失败")
private int checkFail;
@ApiModelProperty("失败已处理")
private int failAndProcess;
@ApiModelProperty("失败未处理")
private int failAndNotProcess;
}