批量查询数据的sql语句

包括根据数字转成汉字、日期计算

<select id="queryFinaByIds" parameterType="cn.git.dgmsfund.api.entity.bo.finance.finaExcelBO" resultType="cn.git.dgmsfund.api.entity.bo.finance.finaExcelBO">
select  FINANCIAL_INSTITUTION   AS financialInstitution,
        ACCOUNT_NO              AS accountNo,
        case
            when fina.FINA_PROD_TYPE=01 then
            '结构性存款'
            when fina.FINA_PROD_TYPE=02 then
            '大额存单'
            when fina.FINA_PROD_TYPE=03 then
            '七天通知存款单'
        end finaProdType,//根据数字转成汉字
        DATEDIFF(END_DATE, DATE_FORMAT(NOW(),'%Y-%m-%d'))   AS dueDay//日期计算
from t09_zj_fina_prod_info fina
WHERE fina.FINA_ID in
<foreach collection="finaIds" item="item" index="index" open="(" separator="," close=")">
    #{item}//替身ids
</foreach>
</select>

更多推荐

批量查询数据的sql语句