| | |
| | |
|
| | | 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 {
|
| | |
| | | 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);
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | }
|