From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java |   83 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java
index 0291694..5906cca 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/customerservice/CustomerServiceCommonQuestionServiceImpl.java
@@ -2,17 +2,18 @@
 
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.Date;
 import java.util.List;
 
 import javax.annotation.Resource;
 
 import org.springframework.stereotype.Service;
+import org.yeshi.utils.StringUtil;
 
 import com.yeshi.fanli.dao.mybatis.customerservice.CustomerServiceCommonQuestionMapper;
 import com.yeshi.fanli.entity.customerservice.CustomerServiceCommonQuestion;
-import com.yeshi.fanli.exception.CustomerServiceCommonQuestionException;
+import com.yeshi.fanli.exception.user.CustomerServiceCommonQuestionException;
 import com.yeshi.fanli.service.inter.customerservice.CustomerServiceCommonQuestionService;
-import org.yeshi.utils.StringUtil;
 
 @Service
 public class CustomerServiceCommonQuestionServiceImpl implements CustomerServiceCommonQuestionService {
@@ -82,5 +83,83 @@
 	public Long countCustomerServiceCommonQuestion() {
 		return customerServiceCommonQuestionMapper.selectCount();
 	}
+	
+	
+	@Override
+	public List<CustomerServiceCommonQuestion> listQuery(long start, int count, String key, 
+			String type, Integer state, Integer sort){
+		return customerServiceCommonQuestionMapper.listQuery(start, count, key, type, state, sort);
+	}
+	
+	@Override
+	public long countQuery(String key, String type, Integer state) {
+		return customerServiceCommonQuestionMapper.countQuery(key, type, state);
+	}
 
+	@Override
+	public int deleteBatchByPrimaryKey(List<Long> list) {
+		return customerServiceCommonQuestionMapper.deleteBatchByPrimaryKey(list);
+	}
+
+	@Override
+	public int insert(CustomerServiceCommonQuestion record) {
+		return customerServiceCommonQuestionMapper.insert(record);
+	}
+
+	@Override
+	public int insertSelective(CustomerServiceCommonQuestion record) {
+		return customerServiceCommonQuestionMapper.insertSelective(record);
+	}
+
+	@Override
+	public int updateByPrimaryKeySelective(CustomerServiceCommonQuestion record) {
+		return customerServiceCommonQuestionMapper.updateByPrimaryKeySelective(record);
+	}
+
+	@Override
+	public int updateByPrimaryKey(CustomerServiceCommonQuestion record) {
+		return customerServiceCommonQuestionMapper.updateByPrimaryKey(record);
+	}
+
+	@Override
+	public CustomerServiceCommonQuestion selectByPrimaryKey(Long id) {
+		return customerServiceCommonQuestionMapper.selectByPrimaryKey(id);
+	}
+	
+	@Override
+	public void save(CustomerServiceCommonQuestion record) throws Exception, CustomerServiceCommonQuestionException {
+		if (record == null) {
+			throw new  CustomerServiceCommonQuestionException(1, "鍙傛暟涓嶈兘涓虹┖");
+		}
+		
+		String key = record.getKey();
+		String content = record.getContent();
+		String contentType = record.getContentType();
+		if (key == null || key.trim().length() == 0 || content == null || content.trim().length() == 0
+				|| contentType == null || contentType.trim().length() == 0) {
+			throw new  CustomerServiceCommonQuestionException(1, "缂栬緫鍐呭涓嶈兘涓虹┖");
+		}
+		
+		Long id = record.getId();
+		if (id == null) {
+			// 鏂板
+			record.setWeight(0);
+			record.setCreateTime(new Date());
+			record.setUpdateTime(new Date());
+			customerServiceCommonQuestionMapper.insert(record);
+		} else {
+			CustomerServiceCommonQuestion commonQuestion = customerServiceCommonQuestionMapper.selectByPrimaryKey(id);
+			if (commonQuestion == null) {
+				throw new  CustomerServiceCommonQuestionException(1, "鏁版嵁宸蹭笉瀛樺湪");
+			}
+			// 淇敼
+			record.setUpdateTime(new Date());
+			// 淇濆瓨涔嬪墠鐨勭姸鎬�
+			record.setState(commonQuestion.isState());
+			
+			customerServiceCommonQuestionMapper.updateByPrimaryKeySelective(record);
+		}
+		
+	}
+	
 }

--
Gitblit v1.8.0