src/com/dream/service/impl/ProvideServiceImpl.java
(完整代码) 1KBpackage com.dream.service.impl;
import javax.persistence.Query;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.dream.bean.Provide;
import com.dream.dao.DaoSupport;
import com.dream.service.ProvideService;
@Service
@Transactional
public class ProvideServiceImpl extends DaoSupport implements ProvideService {
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public boolean isexits(String name){
Query query = em.createQuery("select count(o) from Provide o where o.name=?1");
query.setParameter(1, name);
Long count = (Long)query.getSingleResult();
if(count>=1){
return true;
}
return false;
}
public void deleteProvide(Long[] ids){
if(ids!=null&&ids.length>0){
StringBuffer jpql = new StringBuffer();
for(int i=0;i<ids.length;i++){
jpql.append("?").append(i+1).append(",");
}
jpql.deleteCharAt(jpql.length()-1);
Query query = em.createQuery("delete from Provide o where o.id in("+jpql.toString()+")");
for(int i=0;i<ids.length;i++){
query.setParameter(i+1, ids[i]);
}
query.executeUpdate();
}
}
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public Provide findByName(String name){
Query query = em.createQuery("select o from Provide o where o.name=?1");
query.setParameter(1, name);
return (Provide)query.getSingleResult();
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。