对比新文件 |
| | |
| | | package com.gk.firework.Service.ServiceImpl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gk.firework.Domain.DistrictInfo; |
| | | import com.gk.firework.Domain.Utils.StringUtils; |
| | | import com.gk.firework.Mapper.DistrictInfoMapper; |
| | | import com.gk.firework.Service.DistrictService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service("DistrictService") |
| | | public class DistrictServiceImpl extends ServiceImpl<DistrictInfoMapper, DistrictInfo> implements DistrictService { |
| | | |
| | | @Autowired |
| | | DistrictInfoMapper districtInfoMapper; |
| | | |
| | | |
| | | @Override |
| | | public List<DistrictInfo> selectDistrictInfo(String type, String parentcode) { |
| | | return districtInfoMapper.selectDistrictInfo(type, parentcode); |
| | | } |
| | | |
| | | @Override |
| | | public DistrictInfo selectInfoByName(String name, Byte type) { |
| | | DistrictInfo districtInfo = new DistrictInfo(); |
| | | districtInfo.setName(name); |
| | | districtInfo.setType(type); |
| | | QueryWrapper<DistrictInfo> wrapper = new QueryWrapper<> (districtInfo); |
| | | return districtInfoMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public DistrictInfo selectInfoByCode(String code, Byte type) { |
| | | DistrictInfo districtInfo = new DistrictInfo(); |
| | | districtInfo.setCode(code); |
| | | districtInfo.setType(type); |
| | | QueryWrapper<DistrictInfo> wrapper = new QueryWrapper<> (districtInfo); |
| | | return districtInfoMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<DistrictInfo> selectDistrictByName(String type, String parentname, String parenttype) { |
| | | return districtInfoMapper.selectDistrictByName(type, parentname, parenttype); |
| | | } |
| | | |
| | | @Override |
| | | public List<DistrictInfo> selectInfoByParentCode(String s) { |
| | | LambdaQueryWrapper<DistrictInfo> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(DistrictInfo::getParentcode,s); |
| | | return districtInfoMapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<DistrictInfo> selectInfoByParentCodeAndCity(String s, Object city) { |
| | | LambdaQueryWrapper<DistrictInfo> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(DistrictInfo::getParentcode,s); |
| | | if (StringUtils.isNotBlank(city.toString())){ |
| | | wrapper.eq(DistrictInfo::getName,city); |
| | | } |
| | | return districtInfoMapper.selectList(wrapper); |
| | | } |
| | | } |