| package com.xzx.gc.order.service;  | 
|   | 
|   | 
| import cn.hutool.core.convert.Convert;  | 
| import com.xzx.gc.common.constant.Constants;  | 
| import com.xzx.gc.entity.RebateRule;  | 
| import com.xzx.gc.order.mapper.RebateRuleMapper;  | 
| import org.springframework.beans.factory.annotation.Autowired;  | 
| import org.springframework.stereotype.Service;  | 
| import org.springframework.transaction.annotation.Transactional;  | 
| import tk.mybatis.mapper.entity.Example;  | 
|   | 
| import java.util.List;  | 
|   | 
| @Service  | 
| @Transactional  | 
| public class RebateRuleService {  | 
|   | 
|   | 
|     @Autowired  | 
|     private RebateRuleMapper rebateRuleMapper;  | 
|   | 
|   | 
|     /**  | 
|      * 根据规则ID查找  | 
|      * @param ruleId  | 
|      * @return  | 
|      */  | 
|     public List<RebateRule> findByRuleId(Integer ruleId){  | 
|         Example example=new Example(RebateRule.class);  | 
|         Example.Criteria criteria = example.createCriteria();  | 
|         criteria.andEqualTo("ruleId",Convert.toLong(ruleId));  | 
|         criteria.andEqualTo("delFlag",Constants.DEL_NOT_FLAG);  | 
|         example.orderBy("sort").asc();  | 
|         return  rebateRuleMapper.selectByExample(example);  | 
|     }  | 
|   | 
|     public void save(RebateRule rulePrice) {  | 
|         rebateRuleMapper.insertSelective(rulePrice);  | 
|     }  | 
|   | 
| }  |