例如:
Condition cnd = Cnd.where("appId", "=", keyid).and("password", "like", searchKey).or("no","like",searchKey).orderBy("id", "desc");
还想加一个条件是模糊查询其他表的name 这个用Cnd怎么实现?
4 回复
SELECT * from
(SELECT
ROW_NUMBER() OVER (ORDER BY mau.id) AS NO,
mau.id AS id,
map.name AS mobilename,
mau.no AS nos,
mau.password AS password,
mau.devices AS devices,
mau.firstlogin AS firstlogin,
mau.uselog AS uselog,
mau.[desc] AS descs,
mau.appid AS appid
FROM
mc_mobileauth mau
LEFT JOIN mc_mobileapp map ON map.id = mau.appid
$condition WHERE mau.no like @searchKey OR mau.password like @searchKey OR map.name like @searchKey
)t
$condition WHERE t.appid=@keyid and t.NO BETWEEN @pageStart AND @pageSize ORDER BY t.NO DESC
就像这个 语句 map.name 可不可以用 cnd写出来 我这个是用自定义sql写的 , 我想要是用cnd的话 估计在实体里是不是得做关联 像sturts那样 我觉得是这样的 不知道我说的对不对
添加回复
请先登陆