Skip to content

Commit

Permalink
add the city service and it's implemention
Browse files Browse the repository at this point in the history
  • Loading branch information
leedarKen committed Feb 19, 2016
1 parent 41c3c98 commit 2ff6c3f
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/main/java/com/zmsport/iyuesai/service/CityService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.zmsport.iyuesai.service;

import com.zmsport.iyuesai.mapper.Admin;
import com.zmsport.iyuesai.mapper.City;

import java.util.List;

/**
* 城市管理相关服务
* @author bilei
*
*/
public interface CityService {
/**
* 查询城市
* @param cityName
* @return
*/
public City findCityByName(String cityName);

/**
* 分页获取城市列表
* @param page
* @param pageSize
* @return
*/
public List<City> getCitys(int page, int pageSize);

/**
* 获取城市总数
* @return
*/
public int getTotalNum();

/**
* 插入
* @param city
*/
public void insert(City city);

/**
* 修改
* @param city
*/
public void update(City city);

/**
* 查找城市
* @param id
* @return
*/
public City findCityById(long id);

/**
* 删除城市
* @param ids
*/
public void delete(String ids);

}
47 changes: 47 additions & 0 deletions src/main/java/com/zmsport/iyuesai/service/CityServiceImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.zmsport.iyuesai.service;

import com.zmsport.iyuesai.mapper.Admin;
import com.zmsport.iyuesai.mapper.City;
import com.zmsport.iyuesai.mapper.CityMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Arrays;
import java.util.List;

/**
* Created by ken.kang on 2016/2/19.
*/
public class CityServiceImpl implements CityService {

@Autowired
private CityMapper mapper;

public City findCityByName(String cityName) {
return mapper.findCityByName(cityName) ;
}

public List<City> getCitys(int page, int pageSize) {
return mapper.getCitys(page, pageSize);
}

public int getTotalNum() {
return mapper.getTotalNum();
}

public void insert(City city) {
mapper.insert(city);
}

public void update(City city) {
mapper.update(city);
}

public City findCityById(long id) {
return mapper.findCityById(id);
}


public void delete(String ids) {
mapper.delete(Arrays.asList(ids.split(",")));
}
}

0 comments on commit 2ff6c3f

Please sign in to comment.