ibatis的配置文件中需要注意<![CDATA[ ]]>标记

ibatis中用<![CDATA[  ]]>标记避免sql中与xml规范相冲突的字符对xml映射文件的合法性造成影响.
<![CDATA[  ]]>以"<![CDATA["标记开始,以"]]>"标记结束,指的是不应由xml解析器进行解析的文本数据(Unparsed Character Data), <![CDATA[  ]]>里所有的内容都会被解析器忽略 .
在xml元素中,"<"和"&"是非法的,"<"会产生错误,因为解析器会把该字符解释为新元素的开始."&"也会产生错误,因为解析器会把该字符解释为字符实体的开始.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.qs.birp.jgAudit.JgAuditHeadDao"> <select id="getReqByReqNo" resultType="jg_audit_head" parameterType="String"> select * from jg_audit_head where request_no = #{request_no} limit 1; </select> <select id="showJgAuditHead" resultType="jg_audit_head"> SELECT * FROM jg_audit_head <where> and is_show = "1" <if test='request_no !=null and request_no !=""'>and request_no =#{request_no} </if> <if test='purchase_no !=null and purchase_no !=""'>and purchase_no =#{purchase_no} </if> <if test='project_number !=null and project_number !=""'>and project_number =#{project_number} </if> <if test='project_name !=null and project_name !=""'> and project_name like "%"#{project_name}"%"</if> <if test='company_code !=null and company_code !=""'>and company_code =#{company_code} </if> <if test='sssdwdm !=null and sssdwdm !=""'>and sssdwdm =#{sssdwdm}</if> <if test='ssxdwdm !=null and ssxdwdm !=""'>and ssxdwdm =#{ssxdwdm}</if> <if test='status !=null and status !=""'>and status =#{status}</if> <if test='company_code_values!=null and company_code_values.size()>0'> and company_code in <foreach collection="company_code_values" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </where> limit #{currIndex}, #{pageSize} ; </select> <select id="showJgAuditHeadCount" resultType="Integer"> SELECT count(*) FROM jg_audit_head <where> and is_show = "1" <if test='request_no !=null and request_no !=""'>and request_no =#{request_no} </if> <if test='purchase_no !=null and purchase_no !=""'>and purchase_no =#{purchase_no} </if> <if test='project_number !=null and project_number !=""'>and project_number =#{project_number} </if> <if test='project_name !=null and project_name !=""'> and project_name like "%"#{project_name}"%"</if> <if test='company_code !=null and company_code !=""'>and company_code =#{company_code} </if> <if test='sssdwdm !=null and sssdwdm !=""'>and sssdwdm =#{sssdwdm}</if> <if test='ssxdwdm !=null and ssxdwdm !=""'>and ssxdwdm =#{ssxdwdm}</if> <if test='status !=null and status !=""'>and status =#{status}</if> <if test='company_code_values!=null and company_code_values.size()>0'> and company_code in <foreach collection="company_code_values" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </where> </select> </mapper> 请你帮我分析 什么原因导致服务起不来
最新发布
03-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值