修正根据租电套餐查询电池信息的接口问题
This commit is contained in:
@ -24,4 +24,11 @@ public interface RentBatteyRuleMapper extends BaseMapper<RentBatteyRulePO> {
|
||||
*/
|
||||
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(@Param("carRuleId") Integer carRuleId);
|
||||
|
||||
/**
|
||||
* 根据 id 查询 租电套餐计费规则
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
RentBatteyRuleDTO getRentBatteyRuleById(@Param("id") Integer id);
|
||||
|
||||
}
|
||||
|
||||
@ -16,4 +16,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface RentBatteyRuleRepo extends IService<RentBatteyRulePO> {
|
||||
List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId);
|
||||
RentBatteyRuleDTO getRentBatteyRuleById(Integer id);
|
||||
}
|
||||
|
||||
@ -24,4 +24,9 @@ public class RentBatteyRuleRepoImpl extends ServiceImpl<RentBatteyRuleMapper, Re
|
||||
public List<RentBatteyRuleDTO> queryRentBatteyRuleByCarRuleId(Integer carRuleId) {
|
||||
return this.getBaseMapper().queryRentBatteyRuleByCarRuleId(carRuleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RentBatteyRuleDTO getRentBatteyRuleById(Integer id) {
|
||||
return this.getBaseMapper().getRentBatteyRuleById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,9 +6,6 @@ import com.sczx.car.service.RentBatteyRuleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -18,12 +15,7 @@ public class RentBatteyRuleServiceImpl implements RentBatteyRuleService {
|
||||
private RentBatteyRuleRepo rentBatteyRuleRepo;
|
||||
|
||||
@Override
|
||||
public RentBatteyRuleDTO getRentBatteyRuleByBatteyRuleId(Long carRuleId) {
|
||||
// RentBatteyRulePO rentBatteyRulePO = rentBatteyRuleRepo.getById(carRuleId);
|
||||
List<RentBatteyRuleDTO> rentBatteyRuleList = rentBatteyRuleRepo.queryRentBatteyRuleByCarRuleId(carRuleId.intValue());
|
||||
if(CollectionUtils.isEmpty(rentBatteyRuleList)){
|
||||
return null;
|
||||
}
|
||||
return rentBatteyRuleList.get(0);
|
||||
public RentBatteyRuleDTO getRentBatteyRuleByBatteyRuleId(Long batteyRuleId) {
|
||||
return rentBatteyRuleRepo.getRentBatteyRuleById(batteyRuleId.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,4 +15,16 @@
|
||||
rcb.car_rule_id = #{carRuleId}
|
||||
AND b.is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="getRentBatteyRuleById" resultType="com.sczx.car.dto.RentBatteyRuleDTO">
|
||||
SELECT
|
||||
b.*,c.category_name
|
||||
FROM
|
||||
zc_rent_battey_rule b
|
||||
JOIN
|
||||
zc_battery_category c ON b.category_id = c.id
|
||||
WHERE
|
||||
b.id = #{id}
|
||||
AND b.is_delete = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user