WzUserServiceImpl.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package com.example.service.impl;
  2. import com.example.dao.WzUserDao;
  3. import com.example.entity.OtnAreaEntity;
  4. import com.example.entity.WzUserEntity;
  5. import com.example.service.WzOtnAreaService;
  6. import com.example.service.WzUserService;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Service;
  9. import java.util.List;
  10. import java.util.Map;
  11. @Service
  12. public class WzUserServiceImpl implements WzUserService {
  13. @Autowired
  14. private WzUserDao wzUserDao;
  15. @Autowired
  16. private WzOtnAreaService otnAreaService;
  17. @Override
  18. public List<WzUserEntity> queryList(Map<String, Object> map) {
  19. if(map.get("city")!=null&&!map.get("city").toString().equals("全省")&&!map.get("city").toString().equals("")){
  20. OtnAreaEntity city = otnAreaService.queryObjectById(map.get("city").toString());
  21. map.put("city",city.getName());
  22. }
  23. if(map.get("city")!=null&&map.get("city").toString().equals("全省")){
  24. map.remove("city");
  25. }
  26. if(map.get("city")!=null&&map.get("city").toString().equals("")){
  27. map.remove("city");
  28. }
  29. if(map.get("county")!=null&&!map.get("county").toString().equals("区县")&&!map.get("county").toString().equals("")){
  30. OtnAreaEntity city = otnAreaService.queryObjectById(map.get("county").toString());
  31. map.put("county",city.getName());
  32. }
  33. if(map.get("county")!=null&&map.get("county").toString().equals("区县")){
  34. map.remove("county");
  35. }
  36. if(map.get("county")!=null&&map.get("county").toString().equals("")){
  37. map.remove("county");
  38. }
  39. return wzUserDao.queryList(map);
  40. }
  41. @Override
  42. public int queryTotal(Map<String, Object> map) {
  43. if(map.get("city")!=null&&!map.get("city").toString().equals("全省")&&!map.get("city").toString().equals("")){
  44. OtnAreaEntity city = otnAreaService.queryObjectById(map.get("city").toString());
  45. map.put("city",city.getName());
  46. }
  47. if(map.get("city")!=null&&map.get("city").toString().equals("全省")){
  48. map.remove("city");
  49. }
  50. if(map.get("city")!=null&&map.get("city").toString().equals("")){
  51. map.remove("city");
  52. }
  53. if(map.get("county")!=null&&!map.get("county").toString().equals("区县")&&!map.get("county").toString().equals("")){
  54. OtnAreaEntity city = otnAreaService.queryObjectById(map.get("county").toString());
  55. map.put("county",city.getName());
  56. }
  57. if(map.get("county")!=null&&map.get("county").toString().equals("区县")){
  58. map.remove("county");
  59. }
  60. if(map.get("county")!=null&&map.get("county").toString().equals("")){
  61. map.remove("county");
  62. }
  63. return wzUserDao.queryTotal(map);
  64. }
  65. @Override
  66. public int save(WzUserEntity userEntity) {
  67. if(userEntity.getCity()!=null&&!userEntity.getCity().equals("全省")&&!userEntity.getCity().equals("")){
  68. OtnAreaEntity city = otnAreaService.queryObjectById(userEntity.getCity());
  69. userEntity.setCity(city.getName());
  70. }
  71. if(userEntity.getCounty()!=null&&!userEntity.getCounty().equals("区县")&&!userEntity.getCounty().equals("")){
  72. OtnAreaEntity city = otnAreaService.queryObjectById(userEntity.getCounty());
  73. userEntity.setCounty(city.getName());
  74. }
  75. return wzUserDao.save(userEntity);
  76. }
  77. }