1,弱删除bug

yun-zuoyi
alwaysfrin 7 years ago
parent e2124a843e
commit 58d4c25ccc

@ -881,7 +881,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
public int deleteWeaklyByPropertyIn(String propName, Object[] propValues,String username) { public int deleteWeaklyByPropertyIn(String propName, Object[] propValues,String username) {
if(propValues != null && propValues.length > 0){ if(propValues != null && propValues.length > 0){
String hql = "update " + persistentClass.getName() String hql = "update " + persistentClass.getName()
+ " model set model.isValid = :isValid,model.modifyUser= :modifyUser,model.modifyDatetime=:modifyDatetime where model." + " model set model.isDeleted = :isDeleted,model.modifyUser= :modifyUser,model.modifyDatetime=:modifyDatetime where model."
+ propName + " in(:"+propName+") "; + propName + " in(:"+propName+") ";
Query query = entityManager.createQuery(hql); Query query = entityManager.createQuery(hql);
query.setParameter("isDeleted",CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); query.setParameter("isDeleted",CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
@ -903,7 +903,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
public int deleteWeaklyByProperties(String[] propName, Object[] propValue,String username) { public int deleteWeaklyByProperties(String[] propName, Object[] propValue,String username) {
if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) { if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) {
StringBuffer sb = new StringBuffer("update " + persistentClass.getName() StringBuffer sb = new StringBuffer("update " + persistentClass.getName()
+ " model set model.isValid = :isValid,model.modifyUser= :modifyUser,model.modifyDatetime=:modifyDatetime where 1=1 "); + " model set model.isDeleted = :isDeleted,model.modifyUser= :modifyUser,model.modifyDatetime=:modifyDatetime where 1=1 ");
appendQL(sb,propName,propValue); appendQL(sb,propName,propValue);
Query query = entityManager.createQuery(sb.toString()); Query query = entityManager.createQuery(sb.toString());
query.setParameter("modifyUser",username); query.setParameter("modifyUser",username);

Loading…
Cancel
Save