MyBatis-Plus 动态选择需要查询的列
MyBatis-Plus About 436 wordssqlSelect
Wrapper对象中有sqlSelect方法可以获取MyBatis-Plus组织后的select列。
在xml或@Select等语句中可以使用${ew.sqlSelect}。
@Param(Constants.WRAPPER)是固定参数。
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
@Mapper
public interface TestMapper {
@Select("""
select ${ew.sqlSelect} from test
""")
List<Test> getList(@Param(Constants.WRAPPER) Wrapper<Test> wrapper);
}
Views: 1,113 · Posted: 2024-10-24
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...