123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- package com.example.service.impl;
- import com.example.dao.WzUserDao;
- import com.example.entity.OtnAreaEntity;
- import com.example.entity.WzUserEntity;
- import com.example.service.WzOtnAreaService;
- import com.example.service.WzUserService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.List;
- import java.util.Map;
- @Service
- public class WzUserServiceImpl implements WzUserService {
- @Autowired
- private WzUserDao wzUserDao;
- @Autowired
- private WzOtnAreaService otnAreaService;
- @Override
- public List<WzUserEntity> queryList(Map<String, Object> map) {
- if(map.get("city")!=null&&!map.get("city").toString().equals("全省")&&!map.get("city").toString().equals("")){
- OtnAreaEntity city = otnAreaService.queryObjectById(map.get("city").toString());
- map.put("city",city.getName());
- }
- if(map.get("city")!=null&&map.get("city").toString().equals("全省")){
- map.remove("city");
- }
- if(map.get("city")!=null&&map.get("city").toString().equals("")){
- map.remove("city");
- }
- if(map.get("county")!=null&&!map.get("county").toString().equals("区县")&&!map.get("county").toString().equals("")){
- OtnAreaEntity city = otnAreaService.queryObjectById(map.get("county").toString());
- map.put("county",city.getName());
- }
- if(map.get("county")!=null&&map.get("county").toString().equals("区县")){
- map.remove("county");
- }
- if(map.get("county")!=null&&map.get("county").toString().equals("")){
- map.remove("county");
- }
- return wzUserDao.queryList(map);
- }
- @Override
- public int queryTotal(Map<String, Object> map) {
- if(map.get("city")!=null&&!map.get("city").toString().equals("全省")&&!map.get("city").toString().equals("")){
- OtnAreaEntity city = otnAreaService.queryObjectById(map.get("city").toString());
- map.put("city",city.getName());
- }
- if(map.get("city")!=null&&map.get("city").toString().equals("全省")){
- map.remove("city");
- }
- if(map.get("city")!=null&&map.get("city").toString().equals("")){
- map.remove("city");
- }
- if(map.get("county")!=null&&!map.get("county").toString().equals("区县")&&!map.get("county").toString().equals("")){
- OtnAreaEntity city = otnAreaService.queryObjectById(map.get("county").toString());
- map.put("county",city.getName());
- }
- if(map.get("county")!=null&&map.get("county").toString().equals("区县")){
- map.remove("county");
- }
- if(map.get("county")!=null&&map.get("county").toString().equals("")){
- map.remove("county");
- }
- return wzUserDao.queryTotal(map);
- }
- @Override
- public int save(WzUserEntity userEntity) {
- if(userEntity.getCity()!=null&&!userEntity.getCity().equals("全省")&&!userEntity.getCity().equals("")){
- OtnAreaEntity city = otnAreaService.queryObjectById(userEntity.getCity());
- userEntity.setCity(city.getName());
- }
- if(userEntity.getCounty()!=null&&!userEntity.getCounty().equals("区县")&&!userEntity.getCounty().equals("")){
- OtnAreaEntity city = otnAreaService.queryObjectById(userEntity.getCounty());
- userEntity.setCounty(city.getName());
- }
- return wzUserDao.save(userEntity);
- }
- }
|