mybatis comment fuzzy queries in two ways

A construction string

@Select("select * from xxx where  name like #{name} ")

List<xxx> findByName(String name)

When tested, the parameters to be passed to splice  

userDao.findByName("%name%")

 

The second is a placeholder,  $ {value} , $ symbol, attribute value must be, taking the value of the parameter

@Select("select * from xxx where  name like   '%${value}%'  ")

List<xxx> findByName(String name)

When tested, the parameters passed directly

userDao.findByName(name)

Guess you like

Origin www.cnblogs.com/hcl763088301/p/11228878.html