/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.ifish.mapper; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.annotations.Param; /** * * @author Administrator */ public class Tbl_Version_MapperSql { /** * 查询版本数据 * * @param phoneType * @param context * @param start * @param length * @return */ public String getVersionListData(@Param("type") String phoneType, String context, Integer start, Integer length) { StringBuilder sb = new StringBuilder(); sb.append("SELECT version_id versionId,version_code versionCode,is_must_update isMustUpdate,app_address appAddress,upload_content uploadContent,create_time createTime,phone_type phoneType "); sb.append(" from tbl_version WHERE 1=1 "); if (StringUtils.isNotBlank(phoneType)) { sb.append(" AND phone_type = #{type}"); } if (StringUtils.isNotBlank(context)) { sb.append(" AND upload_content like '%").append(context).append("%'"); } sb.append(" ORDER BY version_id DESC LIMIT ").append(start).append(",").append(length); return sb.toString(); } /** * 查询版本数据数量 * * @param phoneType * @param context * @return */ public String getVeriosnListDataCountBySelect(@Param("type") String phoneType, String context) { StringBuilder sb = new StringBuilder(); sb.append("SELECT count(1) "); sb.append(" from tbl_version WHERE 1=1 "); if (StringUtils.isNotBlank(phoneType)) { sb.append(" AND phone_type = #{type}"); } if (StringUtils.isNotBlank(context)) { sb.append(" AND upload_content like '%").append(context).append("%'"); } return sb.toString(); } }