1、Map的初始化:
Map<String,Object> map = new HashMap<>();
2、Sql的case when方法:
(case 字段
when '字段值' then '替换的值'
when '字段值' then '替换的值'
else '替换的值'
end)
else如果有需求可以有时候不放
3、JSP里的c标签if用法
<c:if text="值的判断句">
……if里要执行的内容……
</c:if>
例如:
<c:if test="${tEFeedbackPage.feedStatus == 1}">
<input value="未回复" />
</c:if>
4、JSP里的c标签forEach遍历List的用法
<c:forEach items="${传来的遍历的List名}" var="循环List的别名">
<input value='${listAns.nickname}' />
<input value='${listAns.time}' />
</c:forEach >
var中可以用这些属性值:
index当前这次迭代从 0 开始的迭代索引
count当前这次迭代从 1 开始的迭代计数
first用来表明当前这轮迭代是否为第一次迭代的标志
last用来表明当前这轮迭代是否为最后一次迭代的标志
begin属性值开始的位置
end属性值结束的位置
step属性值迭代步长
5、MiniDao里的 <#if> 在模糊查询的用法(例如)
SELECT
(select count(1) from t_e_answer t4 where t1.id=t4.question_id) as ansNum,
t1.id,
t2.typecode,
t1.question_title AS questionTitle,
t1.question_status AS questionStatus,
t1.question_time AS questionTime,
t3.nickname,
t1.scan_num AS scanNum
FROM t_e_question t1
INNER JOIN t_s_type t2 ON t1.question_type = t2.typecode
INNER JOIN t_e_person t3 ON t1.person_id = t3.id
WHERE t1.del_flag = 0
<#if tEQuestionEntity.questionTitle ?exists && tEQuestionEntity.questionTitle ?length gt 0>
and t1.question_title like concat('%',:tEQuestionEntity.questionTitle, '%')
</#if>
<#if tEQuestionEntity.questionStatus ?exists && tEQuestionEntity.questionStatus ?length gt 0>
and t1.question_status = :tEQuestionEntity.questionStatus
</#if>
<#if timeGroupDto.questionTime_begin ?exists && timeGroupDto.questionTime_begin ?length gt 0 && timeGroupDto.questionTime_end ?exists && timeGroupDto.questionTime_end ?length gt 0>
and t1.question_time BETWEEN :timeGroupDto.questionTime_begin and :timeGroupDto.questionTime_end
</#if>
<#if nickname ?exists && nickname ?length gt 0>
and t3.nickname like concat('%',:nickname, '%')
</#if>
<#if tEQuestionEntity.scanNum ?exists && tEQuestionEntity.scanNum ?length gt 0>
and t1.scan_num = :tEQuestionEntity.scanNum
</#if>
<#if typecode ?exists && typecode ?length gt 0>
and t2.typecode like concat('%',:typecode, '%')
</#if>
<#if index ?exists && index ?length gt 0 && columns ?exists && index ?length gt 0>
ORDER BY ${columns} ${index}
</#if>
LIMIT :pageIndex,:rows