jimmy 7 years ago
commit 69cd4c88be

@ -56,11 +56,11 @@ public abstract class BaseBean implements Serializable {
@ApiParam(value = "有效性",example = "1")
public Integer isValid; //EnumUtil.isValid;
@Column(name="create_user")
@Column(name="create_user",updatable = false)
@ApiParam(value = "创建用户")
public String createUser;
@Column(name="create_date")
@Column(name="create_date",updatable = false)
@ApiParam(value = "创建日期")
public String createDatetime;
@ -89,11 +89,11 @@ public abstract class BaseBean implements Serializable {
public transient String modifyDateTimeEnd;
@ApiParam(value = "排序属性")
public transient String orderByParam;
public transient String orderByParam = "";
@ApiParam(value = "排序属性",example = "1")
//CommonEnumUtil.ASC_OR_DESC 1 asc,2 desc
public transient int ascOrDesc;
public transient int ascOrDesc = 1;
//排序方式
public String orderBy(){
@ -109,7 +109,4 @@ public abstract class BaseBean implements Serializable {
return result;
}
public String getOrderByParam() {
return this.orderByParam == null ? "" : this.orderByParam;
}
}

@ -43,6 +43,9 @@ public class PagerHelper {
}
private static Pager getPager(int pageSize, int currentPage, int totalRows) {
// TODO 10可用系统参数替换
pageSize = pageSize == 0 ? 10 : pageSize;
Pager pager = new Pager();
pager.setPageSize(pageSize);
pager.setTotalRows(totalRows);

@ -83,6 +83,13 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
public void deleteByIds(Long[] ids);
/**
*
* @param propName
* @param ids
*/
public void deleteByTypeLong(String propName, Long[] ids);
/**
*
* @param conditionName
* @param conditionValue

@ -145,14 +145,19 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
@Override
public void deleteByIds(Long[] ids) {
if(ids != null && ids.length > 0){
String hql = "delete from " + persistentClass.getName() + " model where model.id in(:ids) ";
deleteByTypeLong("id", ids);
}
@Override
public void deleteByTypeLong(String propName, Long[] ids) {
if ((propName != null && propName.length() > 0) && (ids != null && ids.length > 0)) {
String hql = "delete from " + persistentClass.getName() + " model where model."+propName+" in(:ids) ";
Query query = entityManager.createQuery(hql);
query.setParameter("ids", Arrays.asList(ids));
query.executeUpdate();
}else{
throw new IllegalArgumentException("Method deleteByPropertiesIn argument is illegal! ids:" + ids);
throw new IllegalArgumentException("Method deleteByPropertiesIn argument is illegal! "+propName+":" + ids);
}
}

@ -77,6 +77,4 @@ public class SysRole extends BaseBean {
@ApiParam(value ="角色状态枚举1.正常2.状态)" , example ="-1")
private Integer roleStatusId;
}

@ -1,5 +1,6 @@
package cn.estsh.i3plus.pojo.platform.sqlpack;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
import cn.estsh.i3plus.pojo.platform.bean.*;
@ -172,6 +173,10 @@ public class CoreHqlPack {
// hql拼接
HqlPack.getStringLikerPack(sysDictionary.getName(),"name",result);
HqlPack.getStringLikerPack(sysDictionary.getDictionaryCode(),"dictionaryCode",result);
// 默认查询非顶级字典
if(sysDictionary.getParentId() == null || sysDictionary.getParentId() < 1){
HqlPack.getNumNOEqualPack(CommonEnumUtil.PARENT.DEFAULT.getValue(),"parentId",result);
}
HqlPack.getNumEqualPack(sysDictionary.getParentId(),"parentId",result);
return result.toString();
@ -301,4 +306,15 @@ public class CoreHqlPack {
return result.toString();
}
public static String packHqlSysDictionaryCode(SysDictionary sysDictionary){
StringBuffer result = new StringBuffer();
// and
HqlPack.getStringEqualPack(sysDictionary.getDictionaryCode(),"dictionaryCode",result);
// not
HqlPack.getNumNOEqualPack(sysDictionary.getId(),"id",result);
return result.toString();
}
}
Loading…
Cancel
Save