@Update("<script>"
+ "update product set pname=#{pname},market_price=#{market_price},shop_price=#{shop_price}"
+ "<if test='pimage != null'>,pimage=#{pimage}</if>"
+ ",pdate=#{pdate},is_hot=#{is_hot},pdesc=#{pdesc},cid=#{category.cid} where pid=#{pid}"
+ "</script>")
test中取值不需要#号,直接写属性名
如果test中出现字符串,不能使用单引号,使用双引号转义
如果出现大于号小于号 ,转义使用
不要忘记加<script>标签