From db0bd262f7b07e43155db4e0fdf5c52e91610edf Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Tue, 06 Mar 2018 14:11:31 +0800
Subject: [PATCH] 报表优化
---
src/main/java/com/moral/service/impl/OperateUserServiceImpl.java | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/moral/service/impl/OperateUserServiceImpl.java b/src/main/java/com/moral/service/impl/OperateUserServiceImpl.java
index f33c794..9ef3df8 100644
--- a/src/main/java/com/moral/service/impl/OperateUserServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/OperateUserServiceImpl.java
@@ -6,6 +6,7 @@
import javax.annotation.Resource;
+import com.moral.common.util.MyBatisBaseMapUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
@@ -15,6 +16,7 @@
import com.moral.common.bean.PageBean;
import com.moral.common.exception.BusinessException;
import com.moral.common.util.Crypto;
+import com.moral.common.util.ResourceUtil;
import com.moral.common.util.ValidateUtil;
import com.moral.entity.OperateUser;
import com.moral.mapper.OperateUserMapper;
@@ -25,10 +27,15 @@
@Service
public class OperateUserServiceImpl implements OperateUserService {
-
+ private static Class ENTITY_CLASS = OperateUser.class;
@Resource
private OperateUserMapper operateUserMapper;
-
+ @Override
+ public boolean isUniqueProperty(String propertyName, Object value){
+ Example example = new Example(ENTITY_CLASS);
+ example.or().andEqualTo(propertyName,value);
+ return operateUserMapper.selectCountByExample(example)==0;
+ }
@Override
public OperateUser getOperateUserByMobile(String mobile) {
OperateUser operateUser = new OperateUser();
@@ -82,6 +89,7 @@
if (parameters.containsKey("sorter")) {
example.setOrderByClause((String) parameters.get("sorter"));
}
+ criteria.andEqualTo("isDelete", Constants.IS_DELETE_FALSE);
PageHelper.startPage(Integer.valueOf((String) parameters.get("pi")), Integer.valueOf((String) parameters.get("ps")));
List<OperateUser> operateUsers = operateUserMapper.selectByExample(example);
return new PageBean<OperateUser>(operateUsers);
@@ -93,6 +101,7 @@
if (ObjectUtils.isEmpty(operateUser.getId())) {
operateUser.setIsDelete(Constants.IS_DELETE_FALSE);
operateUser.setCreateTime(new Date());
+ operateUser.setPassword(Crypto.md5(ResourceUtil.getValue("password")));
return operateUserMapper.insertSelective(operateUser);
}else {
return operateUserMapper.updateByPrimaryKeySelective(operateUser);
@@ -116,4 +125,9 @@
example.or().andIn("id", ids);
return operateUserMapper.updateByExampleSelective(operateUser, example);
}
+
+ @Override
+ public PageBean queryByPageBean(PageBean pageBean) {
+ return MyBatisBaseMapUtil.queryPage(operateUserMapper,pageBean,ENTITY_CLASS);
+ }
}
--
Gitblit v1.8.0