src/com/dream/service/impl/ProductServiceImpl.java
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.dream.service.impl;
import java.util.LinkedHashMap;
import java.util.List;
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.Product;
import com.dream.dao.DaoSupport;
import com.dream.page.QueryResult;
import com.dream.service.ProductService;
@Service
@Transactional
public class ProductServiceImpl extends DaoSupport implements ProductService {
public void deleteProduct(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 Product 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 boolean isexitscode(String code) {
Query query = em.createQuery("select count(o) from Product o where o.code=?1");
query.setParameter(1, code);
Long count = (Long)query.getSingleResult();
if(count>=1){
return true;
}
return false;
}
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public boolean isexitsname(String name) {
Query query = em.createQuery("select count(o) from Product o where o.name=?1");
query.setParameter(1, name);
Long count = (Long)query.getSingleResult();
if(count>=1){
return true;
}
return false;
}
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public List<Product> getAllPro(){
Query query = em.createQuery("select o from Product o");
return query.getResultList();
}
后面还有 19 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。