@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>標籤