1 常见传入参数strTime 格式问题 2018-08-09 而数据库要求的是20180809 数据库中数据类型有可能是int
2 DefraudingEffect et = new DefraudingEffect();
displayList.add(et); list中只存的是对对象的引用,
displayList.add(et);
displayList.get(4).setTelno("15220092297");
displayList.get(4).setEventTime("2018-08-13 20:03:00");
displayList.get(4).setMeasureType("电话外呼");
displayList.get(3).setTelno("15220092342");
displayList.get(3).setEventTime("2018-08-13 20:03:00");
displayList.get(3).setMeasureType("电话外呼11111111");
最后加入list的值是最后设置的数据,之前的数据会被覆盖
3 Exception in thread “main” java.lang.UnsupportedClassVersionError: javaee/appTest : Unsupported major.minor version 52.0
原因分析:高版本编译器编译后不能在低版本的JVM上运行,而本机上安装了多个跨版本的JDK
解决方案:将IDE编译器与JVM虚拟机版本改为相同。
4 mybatis中的return类型 ,sql,参数为一个的时候<if test="_parameter !=null">
当有序列的时候: 要使用 nextval('序列名称')
<select id="selectSeq" resultType="java.lang.Long">
select nextval('gis2_msg_info_id_seq') as seqid
</select>
<select id="selectTotalInfo" parameterType="map" resultType="com.asiainfo.idsp.gaj.orm.MsgCountInfo">
<!-- 批量新增短信标签 -->
<insert id="batchInsert" parameterType="java.util.ArrayList">
insert into
gis2_msg_info_ext(msg_id, tag_name, tag_value)
values
<foreach item="sms" collection="list" separator="," >
(#{sms.msgId,jdbcType=BIGINT}, #{sms.tagName,jdbcType=VARCHAR}, #{sms.tagValue,jdbcType=VARCHAR})
</foreach>
</insert>
5 select
a.custtitle,
(select count(*) from gis2_sms_response msgrep
where msgrep.taskid=a.id) as replayCount // 嵌套查询
from
gis2_msg_info a
left JOIN channel_info b
on a.channel_id=CAST(b.id as varchar) // 强制转换成字符
left join system_user c
on a.edit_user_id=c.user_id
where
<if test="editDate!=null and editDate!=''">
and to_date(to_char(a.edit_time, 'YYYY-MM-DD'),'YYYY-MM-DD') = to_date(#{editDate},'YYYY-MM-DD')
</if>
<if test="startDate!=null and startDate!=''">
and a.edit_time >=to_date(#{startDate},'YYYY-MM-DD HH24:MI:SS')
</if>
<if test="endDate!=null and endDate!=''">
and a.edit_time <= to_date(#{endDate},'YYYY-MM-DD HH24:MI:SS') // 转换时间
</if>
<if test="msgContent!=null and msgContent!=''">
and a.msg_content like CONCAT(CONCAT('%', #{msgContent}), '%') // 字符拼接
</if>
<if test="countyId!=null and countyId!=0 ">
and county_id = #{countyId}::numeric // 将countyId转换成数字
</if>
<if test="status!=null and status.size>0">
and a.status in
<foreach collection="status" index="index" item="state" separator="," open="(" close=")">
#{state}
</foreach>
</if>
order by a.id desc
limit #{pageSize} offset #{pageNo}
select (
select
sum(CAST(sendcount as numeric(16))) as todayCount
from
gis2_msg_info
where start_time like CONCAT(CONCAT(#{strTime}), '%')
) as todayCount
,
(
select count(*) from gis2_sms_response where taskid in
(
select id
from gis2_msg_info
where start_time like CONCAT(CONCAT(#{strTime}), '%')
)
) as todayReply
6 serviceimpl中需要标注注解
@Service("oaApproveServiceImpl")
7