|
|
@ -2,7 +2,6 @@ package cn.estsh.i3plus.pojo.base.jpa.daoimpl;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.SnowflakeIdMaker;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.SnowflakeIdMaker;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
@ -14,6 +13,7 @@ import javax.persistence.Id;
|
|
|
|
import javax.persistence.Query;
|
|
|
|
import javax.persistence.Query;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -33,11 +33,13 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
private final EntityManager entityManager;
|
|
|
|
private final EntityManager entityManager;
|
|
|
|
|
|
|
|
|
|
|
|
private Class<T> persistentClass;
|
|
|
|
private Class<T> persistentClass;
|
|
|
|
|
|
|
|
private SnowflakeIdMaker snowflakeIdMaker;
|
|
|
|
|
|
|
|
|
|
|
|
public BaseRepositoryImpl(Class<T> clz, EntityManager em) {
|
|
|
|
public BaseRepositoryImpl(Class<T> clz, EntityManager em) {
|
|
|
|
super(clz, em);
|
|
|
|
super(clz, em);
|
|
|
|
this.entityManager = em;
|
|
|
|
this.entityManager = em;
|
|
|
|
this.persistentClass = clz;
|
|
|
|
this.persistentClass = clz;
|
|
|
|
|
|
|
|
this.snowflakeIdMaker = new SnowflakeIdMaker();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setParameter(Query query, String[] propName, Object[] propValue) {
|
|
|
|
private void setParameter(Query query, String[] propName, Object[] propValue) {
|
|
|
@ -146,7 +148,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
return query.executeUpdate();
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
throw new IllegalArgumentException("Method deleteByProperties argument is illegal!propName:" + propName + ",propValue:" + propValue);
|
|
|
|
throw new IllegalArgumentException("删除错误!propName:" + propName + ",propValue:" + propValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -169,112 +171,6 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int deleteWeaklyById(ID id) {
|
|
|
|
|
|
|
|
return deleteWeaklyByProperty("id", id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyByIds(Long[] ids) {
|
|
|
|
|
|
|
|
return deleteWeaklyByPropertyIn("id", ids);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyByProperty(String propName, Object propValue) {
|
|
|
|
|
|
|
|
return deleteWeaklyByProperties(new String[] { propName }, new Object[] { propValue });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量弱删除
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyByPropertyIn(String propName, Object[] propValues) {
|
|
|
|
|
|
|
|
if(propValues != null && propValues.length > 0){
|
|
|
|
|
|
|
|
String hql = "update " + persistentClass.getName() + " model set model.isValid = :isValid where model."+propName+" in(:"+propName+") ";
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(hql);
|
|
|
|
|
|
|
|
query.setParameter("isValid",CommonEnumUtil.IS_VAILD.INVAILD.getValue());
|
|
|
|
|
|
|
|
query.setParameter(propName, Arrays.asList(propValues));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValues);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量弱删除
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyByProperties(String[] propName, Object[] propValue) {
|
|
|
|
|
|
|
|
if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) {
|
|
|
|
|
|
|
|
StringBuffer sb = new StringBuffer("update " + persistentClass.getName() + " model set model.isValid = :isValid where 1=1 ");
|
|
|
|
|
|
|
|
appendQL(sb,propName,propValue);
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(sb.toString());
|
|
|
|
|
|
|
|
query.setParameter("isValid",CommonEnumUtil.IS_VAILD.INVAILD.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setParameter(query,propName,propValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusById(ID id,int status) {
|
|
|
|
|
|
|
|
return updateValidStatusByProperty("id", id,status);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusByIds(Long[] ids,int status) {
|
|
|
|
|
|
|
|
return updateValidStatusByPropertyIn("id", ids,status);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusByProperty(String propName, Object propValue,int status) {
|
|
|
|
|
|
|
|
return updateValidStatusByProperties(new String[] { propName }, new Object[] { propValue },status);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量弱删除
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusByPropertyIn(String propName, Object[] propValues,int status) {
|
|
|
|
|
|
|
|
if(propValues != null && propValues.length > 0){
|
|
|
|
|
|
|
|
String hql = "update " + persistentClass.getName() + " model set model.isValid = :isValid where model."+propName+" in(:"+propName+") ";
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(hql);
|
|
|
|
|
|
|
|
query.setParameter("isValid",status);
|
|
|
|
|
|
|
|
query.setParameter(propName, Arrays.asList(propValues));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValues);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量弱删除
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusByProperties(String[] propName, Object[] propValue,int status) {
|
|
|
|
|
|
|
|
if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) {
|
|
|
|
|
|
|
|
StringBuffer sb = new StringBuffer("update " + persistentClass.getName() + " model set model.isValid = :isValid where 1=1 ");
|
|
|
|
|
|
|
|
appendQL(sb,propName,propValue);
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(sb.toString());
|
|
|
|
|
|
|
|
query.setParameter("isValid",status);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setParameter(query,propName,propValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateByProperties(String conditionName, Object conditionValue, String propertyName, Object propertyValue) {
|
|
|
|
public int updateByProperties(String conditionName, Object conditionValue, String propertyName, Object propertyValue) {
|
|
|
|
return updateByProperties(new String[] { conditionName }, new Object[] { conditionValue }, new String[] { propertyName }, new Object[] { propertyValue });
|
|
|
|
return updateByProperties(new String[] { conditionName }, new Object[] { conditionValue }, new String[] { propertyName }, new Object[] { propertyValue });
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -312,7 +208,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
setParameter(query, conditionName, conditionValue);
|
|
|
|
setParameter(query, conditionName, conditionValue);
|
|
|
|
return query.executeUpdate();
|
|
|
|
return query.executeUpdate();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw new IllegalArgumentException("Method updateByProperties argument is illegal!conditionName:" + conditionName
|
|
|
|
throw new IllegalArgumentException("参数值错误!conditionName:" + conditionName
|
|
|
|
+ ",conditionValue:" + conditionValue + ",propertyName:" + propertyName + ",propertyValue:" + propertyValue);
|
|
|
|
+ ",conditionValue:" + conditionValue + ",propertyName:" + propertyName + ",propertyValue:" + propertyValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -343,7 +239,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
return query.executeUpdate();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw new IllegalArgumentException("Method updateByProperties argument is illegal! propertyName:" + propertyName + ",propertyValue:" + propertyValue);
|
|
|
|
throw new IllegalArgumentException("参数值错误! propertyName:" + propertyName + ",propertyValue:" + propertyValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -925,7 +821,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
Object val = idField.get(item);
|
|
|
|
Object val = idField.get(item);
|
|
|
|
if((type == long.class || type == Long.class) && (val == null || Long.parseLong(val.toString()) == 0)){
|
|
|
|
if((type == long.class || type == Long.class) && (val == null || Long.parseLong(val.toString()) == 0)){
|
|
|
|
// long类型主键,以snowflake为主键
|
|
|
|
// long类型主键,以snowflake为主键
|
|
|
|
idField.set(item, new SnowflakeIdMaker().nextId());
|
|
|
|
idField.set(item, snowflakeIdMaker.nextId());
|
|
|
|
} else if(type == String.class && (val==null || "".equals(val))){
|
|
|
|
} else if(type == String.class && (val==null || "".equals(val))){
|
|
|
|
// String类型主键,以UUID为主键
|
|
|
|
// String类型主键,以UUID为主键
|
|
|
|
idField.set(item, UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
|
|
|
idField.set(item, UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
|
|
@ -944,4 +840,140 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************** 部分业务 *************/
|
|
|
|
|
|
|
|
private String getNowTime(boolean needSecond) {
|
|
|
|
|
|
|
|
return needSecond ? getNowTime("yyyy-MM-dd HH:mm:ss") : getNowTime("yyyy-MM-dd HH:mm");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getNowTime(String format) {
|
|
|
|
|
|
|
|
String dateTime;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
dateTime = (new SimpleDateFormat(format)).format(new Date());
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
dateTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return dateTime;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyById(ID id,String username) {
|
|
|
|
|
|
|
|
return deleteWeaklyByProperty("id", id,username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyByIds(Long[] ids,String username) {
|
|
|
|
|
|
|
|
return deleteWeaklyByPropertyIn("id", ids,username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyByProperty(String propName, Object propValue,String username) {
|
|
|
|
|
|
|
|
return deleteWeaklyByProperties(new String[] { propName }, new Object[] { propValue },username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量弱删除
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyByPropertyIn(String propName, Object[] propValues,String username) {
|
|
|
|
|
|
|
|
if(propValues != null && propValues.length > 0){
|
|
|
|
|
|
|
|
String hql = "update " + persistentClass.getName()
|
|
|
|
|
|
|
|
+ " model set model.isValid = :isValid,model.modifyUser= :modifyUser,model.modifyDatetime=:modifyDatetime where model."
|
|
|
|
|
|
|
|
+ propName + " in(:"+propName+") ";
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(hql);
|
|
|
|
|
|
|
|
query.setParameter("isValid",CommonEnumUtil.IS_VAILD.INVAILD.getValue());
|
|
|
|
|
|
|
|
query.setParameter("modifyUser",username);
|
|
|
|
|
|
|
|
query.setParameter("modifyDatetime",getNowTime(true));
|
|
|
|
|
|
|
|
query.setParameter(propName, Arrays.asList(propValues));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValues);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量弱删除
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int deleteWeaklyByProperties(String[] propName, Object[] propValue,String username) {
|
|
|
|
|
|
|
|
if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) {
|
|
|
|
|
|
|
|
StringBuffer sb = new StringBuffer("update " + persistentClass.getName()
|
|
|
|
|
|
|
|
+ " model set model.isValid = :isValid,model.modifyUser= :modifyUser,model.modifyDatetime=:modifyDatetime where 1=1 ");
|
|
|
|
|
|
|
|
appendQL(sb,propName,propValue);
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(sb.toString());
|
|
|
|
|
|
|
|
query.setParameter("modifyUser",username);
|
|
|
|
|
|
|
|
query.setParameter("modifyDatetime",getNowTime(true));
|
|
|
|
|
|
|
|
query.setParameter("isValid",CommonEnumUtil.IS_VAILD.INVAILD.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setParameter(query,propName,propValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("弱删除失败:"+propName+":" + propValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusById(ID id,int status,String username) {
|
|
|
|
|
|
|
|
return updateValidStatusByProperty("id", id,status,username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusByIds(Long[] ids,int status,String username) {
|
|
|
|
|
|
|
|
return updateValidStatusByPropertyIn("id", ids,status,username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusByProperty(String propName, Object propValue,int status,String username) {
|
|
|
|
|
|
|
|
return updateValidStatusByProperties(new String[] { propName }, new Object[] { propValue },status,username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量弱删除
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusByPropertyIn(String propName, Object[] propValues,int status,String username) {
|
|
|
|
|
|
|
|
if(propValues != null && propValues.length > 0){
|
|
|
|
|
|
|
|
String hql = "update " + persistentClass.getName()
|
|
|
|
|
|
|
|
+ " model set model.isValid = :isValid ,model.modifyUser= :modifyUser,model.modifyDatetime=:modifyDatetime where model."
|
|
|
|
|
|
|
|
+ propName + " in(:"+propName+") ";
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(hql);
|
|
|
|
|
|
|
|
query.setParameter("modifyUser",username);
|
|
|
|
|
|
|
|
query.setParameter("modifyDatetime",getNowTime(true));
|
|
|
|
|
|
|
|
query.setParameter("isValid",status);
|
|
|
|
|
|
|
|
query.setParameter(propName, Arrays.asList(propValues));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("修改状态失败:"+propName+":" + propValues);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量弱删除
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int updateValidStatusByProperties(String[] propName, Object[] propValue,int status,String username) {
|
|
|
|
|
|
|
|
if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) {
|
|
|
|
|
|
|
|
StringBuffer sb = new StringBuffer("update " + persistentClass.getName()
|
|
|
|
|
|
|
|
+ " model set model.isValid = :isValid,model.modifyUser= :modifyUser,model.modifyDatetime=:modifyDatetime where 1=1 ");
|
|
|
|
|
|
|
|
appendQL(sb,propName,propValue);
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(sb.toString());
|
|
|
|
|
|
|
|
query.setParameter("modifyUser",username);
|
|
|
|
|
|
|
|
query.setParameter("modifyDatetime",getNowTime(true));
|
|
|
|
|
|
|
|
query.setParameter("isValid",status);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setParameter(query,propName,propValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return query.executeUpdate();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("修改状态失败:"+propName+":" + propValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|