springboot 使用jpa动态拼接sql ,参数传递的方法
@Component
public class RoomManageDao {
@PersistenceContext
private EntityManager entityManager;
public List<RoomOrderBean> roomMessageSearch(String address) {
StringBuffer strSql = new StringBuffer();
strSql.append("SELECT");
strSql.append(" T1.roomid");
strSql.append(" ,T1.address");
strSql.append(" , T1.roomName");
strSql.append(" , T1.effct");
strSql.append(" , T2.userName");
strSql.append(" , T1.chairs");
strSql.append(" , T1.useFlsg");
strSql.append(" , T1.remark");
strSql.append(" FROM meetingRoomMessage T1 ,userTable T2");
strSql.append(" WHERE");
strSql.append(" T1.address like :address ");
s