- 浏览: 16788 次
- 性别:
- 来自: 深圳
-
最新评论
文章列表
<#-- 注释部分 -->
1.输出为空处理
${book.name?if_exists} //用于判断如果存在,就输出这个值
${book.name?default(‘xxx)}//默认值xxx
${book.name!"xxx"}//默认值xxx
2.日期格式化
${lastUpdated?string("yyyy-MM-dd HH:mm:ss")}
输出结果为:2 ...
最近接触到了动态数据库操作,之前没有使用过 GROUP_CONCAT函数,现在用来记录,以免以后忘记,同时分享出来,供参考。其中concat_ws中'//'用来分隔查询结果,即元素;'@'用来分隔不同的查询结果,好了不多说,上代码。
private static final String PRODUCT_SKU_VALUE_SQL = "select GROUP_CONCAT(concat_ws('//',sk.attr_id,sk.attr_value,a.attr_name) SEPARATOR '@') from ap_products.skuattributevalue s ...
private static final String ENQUIRYSHOPPINGCART_INFO_SQL = "select IFNULL((select e.id from ap_products.enquiryshoppingcart e where e.enquiry_order_id=?),0)";
通过id查询为空时,返回0