18 files added
11 files modified
| | |
| | | @Log4j |
| | | public class MyBatisBaseMapUtil { |
| | | public static PageBean queryPage(BaseMapper baseMapper, PageBean pageBean,Class clazz){ |
| | | List page = null; |
| | | PageBean page = null; |
| | | try { |
| | | Example example = ExampleUtil.generateExample(clazz,pageBean); |
| | | PageHelper.startPage(pageBean.getPageIndex(),pageBean.getPageSize()); |
| | | page = baseMapper.selectByExample(example); |
| | | page = queryPage(baseMapper,pageBean,example); |
| | | |
| | | }catch (Exception ex){ |
| | | log.error(ex.getMessage()); |
| | | ex.printStackTrace(); |
| | | } |
| | | return page; |
| | | } |
| | | public static PageBean queryPage(BaseMapper baseMapper,PageBean pageBean, Example example){ |
| | | PageHelper.startPage(pageBean.getPageIndex(),pageBean.getPageSize()); |
| | | List page = baseMapper.selectByExample(example); |
| | | return new PageBean(page); |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.controller; |
| | | |
| | | import com.moral.common.bean.Constants; |
| | | import com.moral.common.bean.ResultBean; |
| | | import com.moral.entity.Area; |
| | | import com.moral.entity.City; |
| | | import com.moral.entity.Province; |
| | | import com.moral.service.AreaService; |
| | | import org.springframework.web.bind.annotation.CrossOrigin; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("area") |
| | | @CrossOrigin(origins = "*", maxAge = 3600) |
| | | public class AreaController { |
| | | @Resource |
| | | AreaService areaService; |
| | | |
| | | @GetMapping("get-provinces") |
| | | public ResultBean<List<Province>> getProvinces(){ |
| | | ResultBean<List<Province>> resultBean = new ResultBean<>(); |
| | | List<Province> provinceList = areaService.getProvinces(); |
| | | resultBean.setData(provinceList); |
| | | resultBean.setCode(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | @GetMapping("get-cities") |
| | | public ResultBean<List<City>> getCities(int provinceCode){ |
| | | ResultBean<List<City>> resultBean = new ResultBean<>(); |
| | | List<City> cityList = areaService.getCities(provinceCode); |
| | | resultBean.setData(cityList); |
| | | resultBean.setCode(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | @GetMapping("get-areas") |
| | | public ResultBean<List<Area>> getAreas(int cityCode){ |
| | | ResultBean<List<Area>> resultBean = new ResultBean<>(); |
| | | List<Area> areaList = areaService.getAreas(cityCode); |
| | | resultBean.setData(areaList); |
| | | resultBean.setCode(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.controller; |
| | | |
| | | import com.moral.common.bean.PageBean; |
| | | import com.moral.common.bean.ResultBean; |
| | | import com.moral.entity.Organization; |
| | | import com.moral.service.OrganizationService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | @RestController |
| | | @RequestMapping("organization") |
| | | public class OrganizationController { |
| | | @Resource |
| | | OrganizationService organizationService; |
| | | |
| | | @GetMapping("page-list") |
| | | public PageBean pageList(PageBean pageBean) { |
| | | return organizationService.queryByPageBean(pageBean); |
| | | } |
| | | @PostMapping("delete-by-ids") |
| | | public ResultBean deleteByIds(@RequestBody Integer [] ids){ |
| | | organizationService.deleteByIds(ids); |
| | | ResultBean resultBean = new ResultBean(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | @PostMapping("add-or-modify") |
| | | public ResultBean addOrModify(@RequestBody Organization organization){ |
| | | organizationService.addOrModify(organization); |
| | | ResultBean resultBean = new ResultBean(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.entity; |
| | | |
| | | public class Area { |
| | | private Integer areaCode; |
| | | |
| | | private String areaName; |
| | | |
| | | private Integer cityCode; |
| | | |
| | | public Integer getAreaCode() { |
| | | return areaCode; |
| | | } |
| | | |
| | | public void setAreaCode(Integer areaCode) { |
| | | this.areaCode = areaCode; |
| | | } |
| | | |
| | | public String getAreaName() { |
| | | return areaName; |
| | | } |
| | | |
| | | public void setAreaName(String areaName) { |
| | | this.areaName = areaName == null ? null : areaName.trim(); |
| | | } |
| | | |
| | | public Integer getCityCode() { |
| | | return cityCode; |
| | | } |
| | | |
| | | public void setCityCode(Integer cityCode) { |
| | | this.cityCode = cityCode; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.entity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class AreaExample { |
| | | protected String orderByClause; |
| | | |
| | | protected boolean distinct; |
| | | |
| | | protected List<Criteria> oredCriteria; |
| | | |
| | | public AreaExample() { |
| | | oredCriteria = new ArrayList<Criteria>(); |
| | | } |
| | | |
| | | public void setOrderByClause(String orderByClause) { |
| | | this.orderByClause = orderByClause; |
| | | } |
| | | |
| | | public String getOrderByClause() { |
| | | return orderByClause; |
| | | } |
| | | |
| | | public void setDistinct(boolean distinct) { |
| | | this.distinct = distinct; |
| | | } |
| | | |
| | | public boolean isDistinct() { |
| | | return distinct; |
| | | } |
| | | |
| | | public List<Criteria> getOredCriteria() { |
| | | return oredCriteria; |
| | | } |
| | | |
| | | public void or(Criteria criteria) { |
| | | oredCriteria.add(criteria); |
| | | } |
| | | |
| | | public Criteria or() { |
| | | Criteria criteria = createCriteriaInternal(); |
| | | oredCriteria.add(criteria); |
| | | return criteria; |
| | | } |
| | | |
| | | public Criteria createCriteria() { |
| | | Criteria criteria = createCriteriaInternal(); |
| | | if (oredCriteria.size() == 0) { |
| | | oredCriteria.add(criteria); |
| | | } |
| | | return criteria; |
| | | } |
| | | |
| | | protected Criteria createCriteriaInternal() { |
| | | Criteria criteria = new Criteria(); |
| | | return criteria; |
| | | } |
| | | |
| | | public void clear() { |
| | | oredCriteria.clear(); |
| | | orderByClause = null; |
| | | distinct = false; |
| | | } |
| | | |
| | | protected abstract static class GeneratedCriteria { |
| | | protected List<Criterion> criteria; |
| | | |
| | | protected GeneratedCriteria() { |
| | | super(); |
| | | criteria = new ArrayList<Criterion>(); |
| | | } |
| | | |
| | | public boolean isValid() { |
| | | return criteria.size() > 0; |
| | | } |
| | | |
| | | public List<Criterion> getAllCriteria() { |
| | | return criteria; |
| | | } |
| | | |
| | | public List<Criterion> getCriteria() { |
| | | return criteria; |
| | | } |
| | | |
| | | protected void addCriterion(String condition) { |
| | | if (condition == null) { |
| | | throw new RuntimeException("Value for condition cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition)); |
| | | } |
| | | |
| | | protected void addCriterion(String condition, Object value, String property) { |
| | | if (value == null) { |
| | | throw new RuntimeException("Value for " + property + " cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition, value)); |
| | | } |
| | | |
| | | protected void addCriterion(String condition, Object value1, Object value2, String property) { |
| | | if (value1 == null || value2 == null) { |
| | | throw new RuntimeException("Between values for " + property + " cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition, value1, value2)); |
| | | } |
| | | |
| | | public Criteria andAreaCodeIsNull() { |
| | | addCriterion("area_code is null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeIsNotNull() { |
| | | addCriterion("area_code is not null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeEqualTo(Integer value) { |
| | | addCriterion("area_code =", value, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeNotEqualTo(Integer value) { |
| | | addCriterion("area_code <>", value, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeGreaterThan(Integer value) { |
| | | addCriterion("area_code >", value, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeGreaterThanOrEqualTo(Integer value) { |
| | | addCriterion("area_code >=", value, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeLessThan(Integer value) { |
| | | addCriterion("area_code <", value, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeLessThanOrEqualTo(Integer value) { |
| | | addCriterion("area_code <=", value, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeIn(List<Integer> values) { |
| | | addCriterion("area_code in", values, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeNotIn(List<Integer> values) { |
| | | addCriterion("area_code not in", values, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeBetween(Integer value1, Integer value2) { |
| | | addCriterion("area_code between", value1, value2, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaCodeNotBetween(Integer value1, Integer value2) { |
| | | addCriterion("area_code not between", value1, value2, "areaCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameIsNull() { |
| | | addCriterion("area_name is null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameIsNotNull() { |
| | | addCriterion("area_name is not null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameEqualTo(String value) { |
| | | addCriterion("area_name =", value, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameNotEqualTo(String value) { |
| | | addCriterion("area_name <>", value, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameGreaterThan(String value) { |
| | | addCriterion("area_name >", value, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameGreaterThanOrEqualTo(String value) { |
| | | addCriterion("area_name >=", value, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameLessThan(String value) { |
| | | addCriterion("area_name <", value, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameLessThanOrEqualTo(String value) { |
| | | addCriterion("area_name <=", value, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameLike(String value) { |
| | | addCriterion("area_name like", value, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameNotLike(String value) { |
| | | addCriterion("area_name not like", value, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameIn(List<String> values) { |
| | | addCriterion("area_name in", values, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameNotIn(List<String> values) { |
| | | addCriterion("area_name not in", values, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameBetween(String value1, String value2) { |
| | | addCriterion("area_name between", value1, value2, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andAreaNameNotBetween(String value1, String value2) { |
| | | addCriterion("area_name not between", value1, value2, "areaName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeIsNull() { |
| | | addCriterion("city_code is null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeIsNotNull() { |
| | | addCriterion("city_code is not null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeEqualTo(Integer value) { |
| | | addCriterion("city_code =", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeNotEqualTo(Integer value) { |
| | | addCriterion("city_code <>", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeGreaterThan(Integer value) { |
| | | addCriterion("city_code >", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeGreaterThanOrEqualTo(Integer value) { |
| | | addCriterion("city_code >=", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeLessThan(Integer value) { |
| | | addCriterion("city_code <", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeLessThanOrEqualTo(Integer value) { |
| | | addCriterion("city_code <=", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeIn(List<Integer> values) { |
| | | addCriterion("city_code in", values, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeNotIn(List<Integer> values) { |
| | | addCriterion("city_code not in", values, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeBetween(Integer value1, Integer value2) { |
| | | addCriterion("city_code between", value1, value2, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeNotBetween(Integer value1, Integer value2) { |
| | | addCriterion("city_code not between", value1, value2, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | } |
| | | |
| | | public static class Criteria extends GeneratedCriteria { |
| | | |
| | | protected Criteria() { |
| | | super(); |
| | | } |
| | | } |
| | | |
| | | public static class Criterion { |
| | | private String condition; |
| | | |
| | | private Object value; |
| | | |
| | | private Object secondValue; |
| | | |
| | | private boolean noValue; |
| | | |
| | | private boolean singleValue; |
| | | |
| | | private boolean betweenValue; |
| | | |
| | | private boolean listValue; |
| | | |
| | | private String typeHandler; |
| | | |
| | | public String getCondition() { |
| | | return condition; |
| | | } |
| | | |
| | | public Object getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public Object getSecondValue() { |
| | | return secondValue; |
| | | } |
| | | |
| | | public boolean isNoValue() { |
| | | return noValue; |
| | | } |
| | | |
| | | public boolean isSingleValue() { |
| | | return singleValue; |
| | | } |
| | | |
| | | public boolean isBetweenValue() { |
| | | return betweenValue; |
| | | } |
| | | |
| | | public boolean isListValue() { |
| | | return listValue; |
| | | } |
| | | |
| | | public String getTypeHandler() { |
| | | return typeHandler; |
| | | } |
| | | |
| | | protected Criterion(String condition) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.typeHandler = null; |
| | | this.noValue = true; |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, String typeHandler) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.value = value; |
| | | this.typeHandler = typeHandler; |
| | | if (value instanceof List<?>) { |
| | | this.listValue = true; |
| | | } else { |
| | | this.singleValue = true; |
| | | } |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value) { |
| | | this(condition, value, null); |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.value = value; |
| | | this.secondValue = secondValue; |
| | | this.typeHandler = typeHandler; |
| | | this.betweenValue = true; |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, Object secondValue) { |
| | | this(condition, value, secondValue, null); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AreaNames { |
| | | private String provinceName; |
| | | private String cityName; |
| | | private String areaName; |
| | | } |
New file |
| | |
| | | package com.moral.entity; |
| | | |
| | | public class City { |
| | | private Integer cityCode; |
| | | |
| | | private String cityName; |
| | | |
| | | private Integer provinceCode; |
| | | |
| | | public Integer getCityCode() { |
| | | return cityCode; |
| | | } |
| | | |
| | | public void setCityCode(Integer cityCode) { |
| | | this.cityCode = cityCode; |
| | | } |
| | | |
| | | public String getCityName() { |
| | | return cityName; |
| | | } |
| | | |
| | | public void setCityName(String cityName) { |
| | | this.cityName = cityName == null ? null : cityName.trim(); |
| | | } |
| | | |
| | | public Integer getProvinceCode() { |
| | | return provinceCode; |
| | | } |
| | | |
| | | public void setProvinceCode(Integer provinceCode) { |
| | | this.provinceCode = provinceCode; |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.entity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class CityExample { |
| | | protected String orderByClause; |
| | | |
| | | protected boolean distinct; |
| | | |
| | | protected List<Criteria> oredCriteria; |
| | | |
| | | public CityExample() { |
| | | oredCriteria = new ArrayList<Criteria>(); |
| | | } |
| | | |
| | | public void setOrderByClause(String orderByClause) { |
| | | this.orderByClause = orderByClause; |
| | | } |
| | | |
| | | public String getOrderByClause() { |
| | | return orderByClause; |
| | | } |
| | | |
| | | public void setDistinct(boolean distinct) { |
| | | this.distinct = distinct; |
| | | } |
| | | |
| | | public boolean isDistinct() { |
| | | return distinct; |
| | | } |
| | | |
| | | public List<Criteria> getOredCriteria() { |
| | | return oredCriteria; |
| | | } |
| | | |
| | | public void or(Criteria criteria) { |
| | | oredCriteria.add(criteria); |
| | | } |
| | | |
| | | public Criteria or() { |
| | | Criteria criteria = createCriteriaInternal(); |
| | | oredCriteria.add(criteria); |
| | | return criteria; |
| | | } |
| | | |
| | | public Criteria createCriteria() { |
| | | Criteria criteria = createCriteriaInternal(); |
| | | if (oredCriteria.size() == 0) { |
| | | oredCriteria.add(criteria); |
| | | } |
| | | return criteria; |
| | | } |
| | | |
| | | protected Criteria createCriteriaInternal() { |
| | | Criteria criteria = new Criteria(); |
| | | return criteria; |
| | | } |
| | | |
| | | public void clear() { |
| | | oredCriteria.clear(); |
| | | orderByClause = null; |
| | | distinct = false; |
| | | } |
| | | |
| | | protected abstract static class GeneratedCriteria { |
| | | protected List<Criterion> criteria; |
| | | |
| | | protected GeneratedCriteria() { |
| | | super(); |
| | | criteria = new ArrayList<Criterion>(); |
| | | } |
| | | |
| | | public boolean isValid() { |
| | | return criteria.size() > 0; |
| | | } |
| | | |
| | | public List<Criterion> getAllCriteria() { |
| | | return criteria; |
| | | } |
| | | |
| | | public List<Criterion> getCriteria() { |
| | | return criteria; |
| | | } |
| | | |
| | | protected void addCriterion(String condition) { |
| | | if (condition == null) { |
| | | throw new RuntimeException("Value for condition cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition)); |
| | | } |
| | | |
| | | protected void addCriterion(String condition, Object value, String property) { |
| | | if (value == null) { |
| | | throw new RuntimeException("Value for " + property + " cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition, value)); |
| | | } |
| | | |
| | | protected void addCriterion(String condition, Object value1, Object value2, String property) { |
| | | if (value1 == null || value2 == null) { |
| | | throw new RuntimeException("Between values for " + property + " cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition, value1, value2)); |
| | | } |
| | | |
| | | public Criteria andCityCodeIsNull() { |
| | | addCriterion("city_code is null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeIsNotNull() { |
| | | addCriterion("city_code is not null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeEqualTo(Integer value) { |
| | | addCriterion("city_code =", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeNotEqualTo(Integer value) { |
| | | addCriterion("city_code <>", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeGreaterThan(Integer value) { |
| | | addCriterion("city_code >", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeGreaterThanOrEqualTo(Integer value) { |
| | | addCriterion("city_code >=", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeLessThan(Integer value) { |
| | | addCriterion("city_code <", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeLessThanOrEqualTo(Integer value) { |
| | | addCriterion("city_code <=", value, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeIn(List<Integer> values) { |
| | | addCriterion("city_code in", values, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeNotIn(List<Integer> values) { |
| | | addCriterion("city_code not in", values, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeBetween(Integer value1, Integer value2) { |
| | | addCriterion("city_code between", value1, value2, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityCodeNotBetween(Integer value1, Integer value2) { |
| | | addCriterion("city_code not between", value1, value2, "cityCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameIsNull() { |
| | | addCriterion("city_name is null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameIsNotNull() { |
| | | addCriterion("city_name is not null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameEqualTo(String value) { |
| | | addCriterion("city_name =", value, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameNotEqualTo(String value) { |
| | | addCriterion("city_name <>", value, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameGreaterThan(String value) { |
| | | addCriterion("city_name >", value, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameGreaterThanOrEqualTo(String value) { |
| | | addCriterion("city_name >=", value, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameLessThan(String value) { |
| | | addCriterion("city_name <", value, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameLessThanOrEqualTo(String value) { |
| | | addCriterion("city_name <=", value, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameLike(String value) { |
| | | addCriterion("city_name like", value, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameNotLike(String value) { |
| | | addCriterion("city_name not like", value, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameIn(List<String> values) { |
| | | addCriterion("city_name in", values, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameNotIn(List<String> values) { |
| | | addCriterion("city_name not in", values, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameBetween(String value1, String value2) { |
| | | addCriterion("city_name between", value1, value2, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andCityNameNotBetween(String value1, String value2) { |
| | | addCriterion("city_name not between", value1, value2, "cityName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeIsNull() { |
| | | addCriterion("province_code is null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeIsNotNull() { |
| | | addCriterion("province_code is not null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeEqualTo(Integer value) { |
| | | addCriterion("province_code =", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeNotEqualTo(Integer value) { |
| | | addCriterion("province_code <>", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeGreaterThan(Integer value) { |
| | | addCriterion("province_code >", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeGreaterThanOrEqualTo(Integer value) { |
| | | addCriterion("province_code >=", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeLessThan(Integer value) { |
| | | addCriterion("province_code <", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeLessThanOrEqualTo(Integer value) { |
| | | addCriterion("province_code <=", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeIn(List<Integer> values) { |
| | | addCriterion("province_code in", values, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeNotIn(List<Integer> values) { |
| | | addCriterion("province_code not in", values, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeBetween(Integer value1, Integer value2) { |
| | | addCriterion("province_code between", value1, value2, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeNotBetween(Integer value1, Integer value2) { |
| | | addCriterion("province_code not between", value1, value2, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | } |
| | | |
| | | public static class Criteria extends GeneratedCriteria { |
| | | |
| | | protected Criteria() { |
| | | super(); |
| | | } |
| | | } |
| | | |
| | | public static class Criterion { |
| | | private String condition; |
| | | |
| | | private Object value; |
| | | |
| | | private Object secondValue; |
| | | |
| | | private boolean noValue; |
| | | |
| | | private boolean singleValue; |
| | | |
| | | private boolean betweenValue; |
| | | |
| | | private boolean listValue; |
| | | |
| | | private String typeHandler; |
| | | |
| | | public String getCondition() { |
| | | return condition; |
| | | } |
| | | |
| | | public Object getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public Object getSecondValue() { |
| | | return secondValue; |
| | | } |
| | | |
| | | public boolean isNoValue() { |
| | | return noValue; |
| | | } |
| | | |
| | | public boolean isSingleValue() { |
| | | return singleValue; |
| | | } |
| | | |
| | | public boolean isBetweenValue() { |
| | | return betweenValue; |
| | | } |
| | | |
| | | public boolean isListValue() { |
| | | return listValue; |
| | | } |
| | | |
| | | public String getTypeHandler() { |
| | | return typeHandler; |
| | | } |
| | | |
| | | protected Criterion(String condition) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.typeHandler = null; |
| | | this.noValue = true; |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, String typeHandler) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.value = value; |
| | | this.typeHandler = typeHandler; |
| | | if (value instanceof List<?>) { |
| | | this.listValue = true; |
| | | } else { |
| | | this.singleValue = true; |
| | | } |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value) { |
| | | this(condition, value, null); |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.value = value; |
| | | this.secondValue = secondValue; |
| | | this.typeHandler = typeHandler; |
| | | this.betweenValue = true; |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, Object secondValue) { |
| | | this(condition, value, secondValue, null); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.moral.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.persistence.Id; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class DeviceVersion { |
| | | @Id |
| | | private Integer id; |
| | | |
| | | private String name; |
| | |
| | | private Date createTime; |
| | | |
| | | private String description; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name == null ? null : name.trim(); |
| | | } |
| | | |
| | | public Integer getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(Integer version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description == null ? null : description.trim(); |
| | | } |
| | | } |
| | |
| | | package com.moral.entity;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.persistence.Id;
|
| | |
|
New file |
| | |
| | | package com.moral.entity; |
| | | |
| | | public class Province { |
| | | private Integer provinceCode; |
| | | |
| | | private String provinceName; |
| | | |
| | | public Integer getProvinceCode() { |
| | | return provinceCode; |
| | | } |
| | | |
| | | public void setProvinceCode(Integer provinceCode) { |
| | | this.provinceCode = provinceCode; |
| | | } |
| | | |
| | | public String getProvinceName() { |
| | | return provinceName; |
| | | } |
| | | |
| | | public void setProvinceName(String provinceName) { |
| | | this.provinceName = provinceName == null ? null : provinceName.trim(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.entity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class ProvinceExample { |
| | | protected String orderByClause; |
| | | |
| | | protected boolean distinct; |
| | | |
| | | protected List<Criteria> oredCriteria; |
| | | |
| | | public ProvinceExample() { |
| | | oredCriteria = new ArrayList<Criteria>(); |
| | | } |
| | | |
| | | public void setOrderByClause(String orderByClause) { |
| | | this.orderByClause = orderByClause; |
| | | } |
| | | |
| | | public String getOrderByClause() { |
| | | return orderByClause; |
| | | } |
| | | |
| | | public void setDistinct(boolean distinct) { |
| | | this.distinct = distinct; |
| | | } |
| | | |
| | | public boolean isDistinct() { |
| | | return distinct; |
| | | } |
| | | |
| | | public List<Criteria> getOredCriteria() { |
| | | return oredCriteria; |
| | | } |
| | | |
| | | public void or(Criteria criteria) { |
| | | oredCriteria.add(criteria); |
| | | } |
| | | |
| | | public Criteria or() { |
| | | Criteria criteria = createCriteriaInternal(); |
| | | oredCriteria.add(criteria); |
| | | return criteria; |
| | | } |
| | | |
| | | public Criteria createCriteria() { |
| | | Criteria criteria = createCriteriaInternal(); |
| | | if (oredCriteria.size() == 0) { |
| | | oredCriteria.add(criteria); |
| | | } |
| | | return criteria; |
| | | } |
| | | |
| | | protected Criteria createCriteriaInternal() { |
| | | Criteria criteria = new Criteria(); |
| | | return criteria; |
| | | } |
| | | |
| | | public void clear() { |
| | | oredCriteria.clear(); |
| | | orderByClause = null; |
| | | distinct = false; |
| | | } |
| | | |
| | | protected abstract static class GeneratedCriteria { |
| | | protected List<Criterion> criteria; |
| | | |
| | | protected GeneratedCriteria() { |
| | | super(); |
| | | criteria = new ArrayList<Criterion>(); |
| | | } |
| | | |
| | | public boolean isValid() { |
| | | return criteria.size() > 0; |
| | | } |
| | | |
| | | public List<Criterion> getAllCriteria() { |
| | | return criteria; |
| | | } |
| | | |
| | | public List<Criterion> getCriteria() { |
| | | return criteria; |
| | | } |
| | | |
| | | protected void addCriterion(String condition) { |
| | | if (condition == null) { |
| | | throw new RuntimeException("Value for condition cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition)); |
| | | } |
| | | |
| | | protected void addCriterion(String condition, Object value, String property) { |
| | | if (value == null) { |
| | | throw new RuntimeException("Value for " + property + " cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition, value)); |
| | | } |
| | | |
| | | protected void addCriterion(String condition, Object value1, Object value2, String property) { |
| | | if (value1 == null || value2 == null) { |
| | | throw new RuntimeException("Between values for " + property + " cannot be null"); |
| | | } |
| | | criteria.add(new Criterion(condition, value1, value2)); |
| | | } |
| | | |
| | | public Criteria andProvinceCodeIsNull() { |
| | | addCriterion("province_code is null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeIsNotNull() { |
| | | addCriterion("province_code is not null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeEqualTo(Integer value) { |
| | | addCriterion("province_code =", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeNotEqualTo(Integer value) { |
| | | addCriterion("province_code <>", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeGreaterThan(Integer value) { |
| | | addCriterion("province_code >", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeGreaterThanOrEqualTo(Integer value) { |
| | | addCriterion("province_code >=", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeLessThan(Integer value) { |
| | | addCriterion("province_code <", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeLessThanOrEqualTo(Integer value) { |
| | | addCriterion("province_code <=", value, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeIn(List<Integer> values) { |
| | | addCriterion("province_code in", values, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeNotIn(List<Integer> values) { |
| | | addCriterion("province_code not in", values, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeBetween(Integer value1, Integer value2) { |
| | | addCriterion("province_code between", value1, value2, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceCodeNotBetween(Integer value1, Integer value2) { |
| | | addCriterion("province_code not between", value1, value2, "provinceCode"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameIsNull() { |
| | | addCriterion("province_name is null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameIsNotNull() { |
| | | addCriterion("province_name is not null"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameEqualTo(String value) { |
| | | addCriterion("province_name =", value, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameNotEqualTo(String value) { |
| | | addCriterion("province_name <>", value, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameGreaterThan(String value) { |
| | | addCriterion("province_name >", value, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameGreaterThanOrEqualTo(String value) { |
| | | addCriterion("province_name >=", value, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameLessThan(String value) { |
| | | addCriterion("province_name <", value, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameLessThanOrEqualTo(String value) { |
| | | addCriterion("province_name <=", value, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameLike(String value) { |
| | | addCriterion("province_name like", value, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameNotLike(String value) { |
| | | addCriterion("province_name not like", value, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameIn(List<String> values) { |
| | | addCriterion("province_name in", values, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameNotIn(List<String> values) { |
| | | addCriterion("province_name not in", values, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameBetween(String value1, String value2) { |
| | | addCriterion("province_name between", value1, value2, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | |
| | | public Criteria andProvinceNameNotBetween(String value1, String value2) { |
| | | addCriterion("province_name not between", value1, value2, "provinceName"); |
| | | return (Criteria) this; |
| | | } |
| | | } |
| | | |
| | | public static class Criteria extends GeneratedCriteria { |
| | | |
| | | protected Criteria() { |
| | | super(); |
| | | } |
| | | } |
| | | |
| | | public static class Criterion { |
| | | private String condition; |
| | | |
| | | private Object value; |
| | | |
| | | private Object secondValue; |
| | | |
| | | private boolean noValue; |
| | | |
| | | private boolean singleValue; |
| | | |
| | | private boolean betweenValue; |
| | | |
| | | private boolean listValue; |
| | | |
| | | private String typeHandler; |
| | | |
| | | public String getCondition() { |
| | | return condition; |
| | | } |
| | | |
| | | public Object getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public Object getSecondValue() { |
| | | return secondValue; |
| | | } |
| | | |
| | | public boolean isNoValue() { |
| | | return noValue; |
| | | } |
| | | |
| | | public boolean isSingleValue() { |
| | | return singleValue; |
| | | } |
| | | |
| | | public boolean isBetweenValue() { |
| | | return betweenValue; |
| | | } |
| | | |
| | | public boolean isListValue() { |
| | | return listValue; |
| | | } |
| | | |
| | | public String getTypeHandler() { |
| | | return typeHandler; |
| | | } |
| | | |
| | | protected Criterion(String condition) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.typeHandler = null; |
| | | this.noValue = true; |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, String typeHandler) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.value = value; |
| | | this.typeHandler = typeHandler; |
| | | if (value instanceof List<?>) { |
| | | this.listValue = true; |
| | | } else { |
| | | this.singleValue = true; |
| | | } |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value) { |
| | | this(condition, value, null); |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { |
| | | super(); |
| | | this.condition = condition; |
| | | this.value = value; |
| | | this.secondValue = secondValue; |
| | | this.typeHandler = typeHandler; |
| | | this.betweenValue = true; |
| | | } |
| | | |
| | | protected Criterion(String condition, Object value, Object secondValue) { |
| | | this(condition, value, secondValue, null); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.entity.exp; |
| | | |
| | | import com.moral.entity.AreaNames; |
| | | import com.moral.entity.Organization; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class OrganizationExp extends Organization { |
| | | private AreaNames areaNames; |
| | | } |
New file |
| | |
| | | package com.moral.mapper; |
| | | |
| | | import com.moral.common.mapper.BaseMapper; |
| | | import com.moral.entity.Area; |
| | | import com.moral.entity.AreaExample; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface AreaMapper extends BaseMapper<Area> { |
| | | } |
New file |
| | |
| | | package com.moral.mapper; |
| | | |
| | | import com.moral.common.mapper.BaseMapper; |
| | | import com.moral.entity.City; |
| | | import com.moral.entity.CityExample; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface CityMapper extends BaseMapper<City> { |
| | | } |
| | |
| | |
|
| | | import com.moral.common.mapper.BaseMapper;
|
| | | import com.moral.entity.Organization;
|
| | | import com.moral.entity.exp.OrganizationExp;
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | public interface OrganizationMapper extends BaseMapper<Organization> {
|
| | |
|
| | | List<OrganizationExp> selectWithAreaNameByExample(Example example);
|
| | | List<Organization> getOrganizationsByAreaName(Map<String, Object> parameters);
|
| | | } |
New file |
| | |
| | | package com.moral.mapper; |
| | | |
| | | import com.moral.common.mapper.BaseMapper; |
| | | import com.moral.entity.Province; |
| | | import com.moral.entity.ProvinceExample; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface ProvinceMapper extends BaseMapper<Province> { |
| | | } |
New file |
| | |
| | | package com.moral.service; |
| | | |
| | | import com.moral.entity.Area; |
| | | import com.moral.entity.City; |
| | | import com.moral.entity.Province; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface AreaService { |
| | | List<Province> getProvinces(); |
| | | List<City> getCities(int provinceCode); |
| | | List<Area> getAreas(int cityCode); |
| | | } |
| | |
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | | import com.moral.common.bean.PageBean;
|
| | | import com.moral.entity.DeviceVersion;
|
| | | import com.moral.entity.Organization;
|
| | |
|
| | | public interface OrganizationService {
|
| | |
|
| | | Set<Integer> getChildOrganizationIds(Integer orgId);
|
| | |
|
| | | List<Organization> getOrganizationsByAreaName(Map<String, Object> parameters);
|
| | |
|
| | | public PageBean queryByPageBean(PageBean pageBean);
|
| | |
|
| | | public void addOrModify(Organization organization);
|
| | |
|
| | | public void deleteByIds(Integer... ids);
|
| | | }
|
New file |
| | |
| | | package com.moral.service.impl; |
| | | |
| | | import com.moral.entity.Area; |
| | | import com.moral.entity.City; |
| | | import com.moral.entity.Province; |
| | | import com.moral.mapper.AreaMapper; |
| | | import com.moral.mapper.CityMapper; |
| | | import com.moral.mapper.ProvinceMapper; |
| | | import com.moral.service.AreaService; |
| | | import org.springframework.stereotype.Service; |
| | | import tk.mybatis.mapper.entity.Example; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class AreaServiceImpl implements AreaService{ |
| | | @Resource |
| | | ProvinceMapper provinceMapper; |
| | | @Resource |
| | | CityMapper cityMapper; |
| | | @Resource |
| | | AreaMapper areaMapper; |
| | | |
| | | @Override |
| | | public List<Province> getProvinces() { |
| | | return provinceMapper.selectAll(); |
| | | } |
| | | |
| | | @Override |
| | | public List<City> getCities(int provinceCode) { |
| | | Example example = new Example(City.class); |
| | | example.or().andEqualTo("provinceCode",provinceCode); |
| | | return cityMapper.selectByExample(example); |
| | | } |
| | | |
| | | @Override |
| | | public List<Area> getAreas(int cityCode) { |
| | | Example example = new Example(Area.class); |
| | | example.or().andEqualTo("cityCode",cityCode); |
| | | return areaMapper.selectByExample(example); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.moral.entity.auth.AuthRole; |
| | | import com.moral.entity.auth.AuthUser; |
| | | import com.moral.service.UserService; |
| | | //import com.moral.service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | |
| | | @Service |
| | | public class AuthUserServiceImpl implements UserDetailsService { |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | // @Autowired |
| | | // private UserService userService; |
| | | |
| | | @Override |
| | | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
| | | AuthUser user = userService.findByUsername(username); |
| | | |
| | | // AuthUser user = userService.findByUsername(username); |
| | | AuthUser user = null; |
| | | if(user == null){ |
| | | throw new UsernameNotFoundException("用户名:"+ username + "不存在!"); |
| | | } |
| | |
| | | package com.moral.service.impl;
|
| | |
|
| | | import static com.moral.common.bean.Constants.IS_DELETE_FALSE;
|
| | |
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.github.pagehelper.PageHelper;
|
| | | import com.moral.common.bean.PageBean;
|
| | | import com.moral.common.util.ExampleUtil;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.entity.Organization;
|
| | | import com.moral.entity.exp.OrganizationExp;
|
| | | import com.moral.entity.OrganizationRelation;
|
| | | import com.moral.mapper.OrganizationMapper;
|
| | | import com.moral.mapper.OrganizationRelationMapper;
|
| | | import com.moral.service.OrganizationService;
|
| | | import org.springframework.stereotype.Service;
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import java.util.*;
|
| | |
|
| | | import static com.moral.common.bean.Constants.IS_DELETE_FALSE;
|
| | |
|
| | | @Service
|
| | | public class OrganizationServiceImpl implements OrganizationService {
|
| | |
| | |
|
| | | @Resource
|
| | | private OrganizationRelationMapper organizationRelationMapper;
|
| | |
|
| | | private static Class ENTITY_CLASS = Organization.class;
|
| | |
|
| | | @Override
|
| | | public Set<Integer> getChildOrganizationIds(Integer orgId){
|
| | |
| | | return organizations;
|
| | | }
|
| | |
|
| | | public PageBean queryByPageBean(PageBean pageBean){
|
| | | Example example = ExampleUtil.generateExample(ENTITY_CLASS,pageBean);
|
| | | List<Example.Criteria> criteriaList = example.getOredCriteria();
|
| | | if(criteriaList!=null&&criteriaList.size()>0){
|
| | | for(Example.Criteria cri : criteriaList){
|
| | | cri.andNotEqualTo("isDelete","1");
|
| | | }
|
| | | }else {
|
| | | example.or().andNotEqualTo("isDelete","1");
|
| | | }
|
| | | PageHelper.startPage(pageBean.getPageIndex(),pageBean.getPageSize());
|
| | | List<OrganizationExp> organizationExpandList = organizationMapper.selectWithAreaNameByExample(example);
|
| | | return new PageBean(organizationExpandList);
|
| | | }
|
| | | public void addOrModify(Organization organization){
|
| | | try{
|
| | | if(organization.getId()==null){
|
| | | //新建数据,默认为未删除状态
|
| | | organization.setIsDelete("0");
|
| | | organizationMapper.insertSelective(organization);
|
| | | }else{
|
| | | organizationMapper.updateByPrimaryKeySelective(organization);
|
| | | }
|
| | | }
|
| | | catch (Exception ex){
|
| | | throw ex;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteByIds(Integer... ids) {
|
| | | Organization organization = new Organization();
|
| | | organization.setIsDelete("1");
|
| | | if(ids!=null&&ids.length>0){
|
| | | if(ids.length==1){
|
| | | organization.setId(ids[0]);
|
| | | organizationMapper.updateByPrimaryKeySelective(organization);
|
| | | }else{
|
| | | Example example = new Example(ENTITY_CLASS);
|
| | | example.or().andIn("id", Arrays.asList(ids));
|
| | | organizationMapper.updateByExampleSelective(organization,example);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | |
| | | mybatis: |
| | | mapper-locations: classpath*:/mapper/*Mapper.xml |
| | | type-aliases-package: com.moral.entity |
| | | type-aliases-packageS: com.moral.entity |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | | <mapper namespace="com.moral.mapper.AccountMapper"> |
| | | <select id="getRoleNameByAccountId" resultType="map"> |
| | | <select id="getRoleNameByAccountId" resultType="java.util.Map"> |
| | | SELECT |
| | | r.role_name |
| | | FROM |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.moral.mapper.AreaMapper" > |
| | | <resultMap id="BaseResultMap" type="com.moral.entity.Area" > |
| | | <id column="area_code" property="areaCode" jdbcType="INTEGER" /> |
| | | <result column="area_name" property="areaName" jdbcType="VARCHAR" /> |
| | | <result column="city_code" property="cityCode" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.moral.mapper.CityMapper" > |
| | | <resultMap id="BaseResultMap" type="com.moral.entity.City" > |
| | | <id column="city_code" property="cityCode" jdbcType="INTEGER" /> |
| | | <result column="city_name" property="cityName" jdbcType="VARCHAR" /> |
| | | <result column="province_code" property="provinceCode" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moral.mapper.DeviceVersionMapper"> |
| | | <resultMap id="BaseResultMap" type="com.moral.entity.DeviceVersion"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="version" jdbcType="INTEGER" property="version" /> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| | | <result column="description" jdbcType="VARCHAR" property="description" /> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | | <mapper namespace="com.moral.mapper.OrganizationMapper"> |
| | | <resultMap id="BaseResultMap" type="com.moral.entity.exp.OrganizationExp"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="rank" jdbcType="INTEGER" property="rank" /> |
| | | <result column="province_code" jdbcType="INTEGER" property="provinceCode" /> |
| | | <result column="city_code" jdbcType="INTEGER" property="cityCode" /> |
| | | <result column="area_code" jdbcType="INTEGER" property="areaCode" /> |
| | | <result column="address" jdbcType="VARCHAR" property="address" /> |
| | | <result column="telephone" jdbcType="VARCHAR" property="telephone" /> |
| | | <result column="email" jdbcType="VARCHAR" property="email" /> |
| | | <result column="is_delete" jdbcType="CHAR" property="isDelete" /> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| | | <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" /> |
| | | <result column="description" jdbcType="VARCHAR" property="description" /> |
| | | <!-- 与省市县一对一的关系 --> |
| | | <association property="areaNames" javaType="com.moral.entity.AreaNames"> |
| | | <result column="province_name" property="provinceName" jdbcType="VARCHAR" /> |
| | | <result column="city_name" property="cityName" jdbcType="VARCHAR" /> |
| | | <result column="area_name" property="areaName" jdbcType="VARCHAR" /> |
| | | </association> |
| | | </resultMap> |
| | | <sql id="Example_Where_Clause"> |
| | | <where> |
| | | <foreach collection="oredCriteria" item="criteria" separator="or"> |
| | | <if test="criteria.valid"> |
| | | <trim prefix="(" prefixOverrides="and" suffix=")"> |
| | | <foreach collection="criteria.criteria" item="criterion"> |
| | | <choose> |
| | | <when test="criterion.noValue"> |
| | | and ${criterion.condition} |
| | | </when> |
| | | <when test="criterion.singleValue"> |
| | | and ${criterion.condition} #{criterion.value} |
| | | </when> |
| | | <when test="criterion.betweenValue"> |
| | | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
| | | </when> |
| | | <when test="criterion.listValue"> |
| | | and ${criterion.condition} |
| | | <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
| | | #{listItem} |
| | | </foreach> |
| | | </when> |
| | | </choose> |
| | | </foreach> |
| | | </trim> |
| | | </if> |
| | | </foreach> |
| | | </where> |
| | | </sql> |
| | | <sql id="Base_Column_List"> |
| | | id, name, rank, province_code, city_code, area_code, address, telephone, email, is_delete, |
| | | create_time, expire_time, description |
| | | </sql> |
| | | <sql id="Relation_Province_City_Area_List"> |
| | | are.area_name, cti.city_name, pro.province_name |
| | | </sql> |
| | | <select id="selectWithAreaNameByExample" parameterType="tk.mybatis.mapper.entity.Example" resultMap="BaseResultMap"> |
| | | select |
| | | <if test="distinct"> |
| | | distinct |
| | | </if> |
| | | organization.* |
| | | , |
| | | <include refid="Relation_Province_City_Area_List" /> |
| | | from organization |
| | | left join area are on organization.area_code = are.area_code |
| | | left join city cti on organization.city_code = cti.city_code |
| | | left join province pro on organization.province_code = pro.province_code |
| | | <if test="_parameter != null"> |
| | | <include refid="Example_Where_Clause" /> |
| | | </if> |
| | | <if test="orderByClause != null"> |
| | | order by ${orderByClause} |
| | | </if> |
| | | </select> |
| | | <select id="getOrganizationsByAreaName" resultType="com.moral.entity.Organization"> |
| | | SELECT |
| | | o.* |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.moral.mapper.ProvinceMapper" > |
| | | <resultMap id="BaseResultMap" type="com.moral.entity.Province" > |
| | | <id column="province_code" property="provinceCode" jdbcType="INTEGER" /> |
| | | <result column="province_name" property="provinceName" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | </mapper> |