省市区以及前端优化

main
王宇航 2024-04-25 14:47:56 +08:00
parent 8debf3f15e
commit 5f5ab46b05
24 changed files with 1470 additions and 11 deletions

View File

@ -24,6 +24,181 @@ public interface RemoteLogService
* *
* @param sysOperLog * @param sysOperLog
* @param source * @param source
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* @return * @return
*/ */
@PostMapping("/operlog") @PostMapping("/operlog")

View File

@ -92,6 +92,11 @@
<groupId>com.aliyun</groupId> <groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId> <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
<dependency> <dependency>
<groupId>com.github.xiaoymin</groupId> <groupId>com.github.xiaoymin</groupId>
@ -106,11 +111,7 @@
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
</dependencies> </dependencies>

View File

@ -0,0 +1,95 @@
package com.ruoyi.app.controller;
import com.ruoyi.app.service.IAppCityService;
import com.ruoyi.app.service.IAppProvinceService;
import com.ruoyi.app.service.IAppTownService;
import com.ruoyi.app.service.impl.AppProvinceServiceImpl;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/area")
@Api(tags = "省市区接口" , description = "省市区接口")
public class AppAreaController extends BaseController {
@Autowired
private IAppProvinceService appProvinceService;
@Autowired
private IAppCityService appCityService;
@Autowired
private IAppTownService appTownService;
/**
*
* @return
*/
@GetMapping("/getAllProvince")
@ApiOperation(value = "所有省级数据", notes = "所有省级数据", httpMethod = "GET")
public AjaxResult getAllProvince() {
return AjaxResult.success(appProvinceService.selectAppProvinceList(null));
}
/**
*
* @return
*/
@GetMapping("/getAllCity")
@ApiOperation(value = "所有市级数据", notes = "所有市级数据", httpMethod = "GET")
public AjaxResult getAllCity() {
return AjaxResult.success(appCityService.selectAppCityList(null));
}
/**
*
* @return
*/
@GetMapping("/getAllTown")
@ApiOperation(value = "所有县级数据", notes = "所有县级数据", httpMethod = "GET")
public AjaxResult getAllTown() {
return AjaxResult.success(appTownService.selectAppTownList(null));
}
/**
*
*/
@GetMapping("/getCityByProvinceId")
@ApiOperation(value = "根据省级id查询城市", notes = "根据省级id查询城市", httpMethod = "GET")
public AjaxResult getCityByProvinceId(@RequestParam("provinceId") Integer provinceId) {
return AjaxResult.success(appCityService.selectAppCityListByProvinceId(provinceId));
}
/**
*
*/
@GetMapping("/getTownByCityId")
@ApiOperation(value = "根据省级id查询城市", notes = "根据省级id查询城市", httpMethod = "GET")
public AjaxResult getTownByCityId(@RequestParam("cityId") Integer cityId) {
return AjaxResult.success(appTownService.getTownByCityId(cityId));
}
/**
*
*/
@GetMapping("/getAreaTree")
@ApiOperation(value = "省市区树状结构", notes = "省市区树状结构", httpMethod = "GET")
public AjaxResult getAreaTree() {
return AjaxResult.success(appProvinceService.selectAppProvinceTree());
}
}

View File

@ -8,6 +8,7 @@ import com.ruoyi.app.form.RegisterForm;
import com.ruoyi.app.service.IAppRegisterService; import com.ruoyi.app.service.IAppRegisterService;
import com.ruoyi.app.service.IAppUserService; import com.ruoyi.app.service.IAppUserService;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.ip.IpUtils; import com.ruoyi.common.core.utils.ip.IpUtils;
import com.ruoyi.common.core.utils.uuid.IdUtils; import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.redis.service.RedisService;
@ -49,6 +50,9 @@ public class AppLoginController {
AppUser appUser = appUserService.selectAppUserByPhone(registerForm.getPhoneNumber()); AppUser appUser = appUserService.selectAppUserByPhone(registerForm.getPhoneNumber());
Assert.notNull(registerForm.getSchoolId(), "学校id不能为空"); Assert.notNull(registerForm.getSchoolId(), "学校id不能为空");
Assert.isNull(appUser, "手机号已注册"); Assert.isNull(appUser, "手机号已注册");
if (StringUtils.isNotEmpty(registerForm.getEmail())) {
}
AppRegister appRegister = setAppRegister(registerForm); AppRegister appRegister = setAppRegister(registerForm);
appRegister.setInvitationCode(registerForm.getInvitationCode()); appRegister.setInvitationCode(registerForm.getInvitationCode());
int i = appRegisterService.insertAppRegister(appRegister); int i = appRegisterService.insertAppRegister(appRegister);

View File

@ -0,0 +1,65 @@
package com.ruoyi.app.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* app_city
*
* @author wyh
* @date 2024-04-24
*/
public class AppCity extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 城市id */
private Integer id;
/** 城市名称 */
@Excel(name = "城市名称")
private String name;
/** 所属城市编号 */
@Excel(name = "所属城市编号")
private Long provinceId;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setProvinceId(Long provinceId)
{
this.provinceId = provinceId;
}
public Long getProvinceId()
{
return provinceId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("provinceId", getProvinceId())
.toString();
}
}

View File

@ -0,0 +1,65 @@
package com.ruoyi.app.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* app_province
*
* @author wyh
* @date 2024-04-24
*/
public class AppProvince extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 省级id */
private Integer id;
/** 省名 */
@Excel(name = "省名")
private String name;
/** 所属地区 */
@Excel(name = "所属地区")
private String area;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setArea(String area)
{
this.area = area;
}
public String getArea()
{
return area;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("area", getArea())
.toString();
}
}

View File

@ -0,0 +1,65 @@
package com.ruoyi.app.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* app_town
*
* @author wyh
* @date 2024-04-24
*/
public class AppTown extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 区id */
private Integer id;
/** 区名称 */
@Excel(name = "区名称")
private String name;
/** 所属城市编号 */
@Excel(name = "所属城市编号")
private Long cityId;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setCityId(Long cityId)
{
this.cityId = cityId;
}
public Long getCityId()
{
return cityId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("cityId", getCityId())
.toString();
}
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.app.domain.vo;
import lombok.Data;
import java.util.List;
@Data
public class AreaVo {
private Integer id;
private String name;
private String parentId;
private Integer level;
private Boolean isLeaf;
private List<AreaVo> children;
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppCity;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author wyh
* @date 2024-04-24
*/
public interface AppCityMapper
{
/**
*
*
* @param id
* @return
*/
public AppCity selectAppCityById(Long id);
/**
*
*
* @param appCity
* @return
*/
public List<AppCity> selectAppCityList(AppCity appCity);
/**
*
*
* @param appCity
* @return
*/
public int insertAppCity(AppCity appCity);
/**
*
*
* @param appCity
* @return
*/
public int updateAppCity(AppCity appCity);
/**
*
*
* @param id
* @return
*/
public int deleteAppCityById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAppCityByIds(Long[] ids);
List<AppCity> selectAppCityListByProvinceId(@Param("provinceId") Integer provinceId);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppProvince;
/**
* Mapper
*
* @author wyh
* @date 2024-04-24
*/
public interface AppProvinceMapper
{
/**
*
*
* @param id
* @return
*/
public AppProvince selectAppProvinceById(Integer id);
/**
*
*
* @param appProvince
* @return
*/
public List<AppProvince> selectAppProvinceList(AppProvince appProvince);
/**
*
*
* @param appProvince
* @return
*/
public int insertAppProvince(AppProvince appProvince);
/**
*
*
* @param appProvince
* @return
*/
public int updateAppProvince(AppProvince appProvince);
/**
*
*
* @param id
* @return
*/
public int deleteAppProvinceById(Integer id);
/**
*
*
* @param ids
* @return
*/
public int deleteAppProvinceByIds(Integer[] ids);
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppTown;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author wyh
* @date 2024-04-24
*/
public interface AppTownMapper
{
/**
*
*
* @param id
* @return
*/
public AppTown selectAppTownById(Long id);
/**
*
*
* @param appTown
* @return
*/
public List<AppTown> selectAppTownList(AppTown appTown);
/**
*
*
* @param appTown
* @return
*/
public int insertAppTown(AppTown appTown);
/**
*
*
* @param appTown
* @return
*/
public int updateAppTown(AppTown appTown);
/**
*
*
* @param id
* @return
*/
public int deleteAppTownById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAppTownByIds(Long[] ids);
List<AppTown> getTownByCityId(@Param("cityId") Integer cityId);
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppCity;
/**
* Service
*
* @author wyh
* @date 2024-04-24
*/
public interface IAppCityService
{
/**
*
*
* @param id
* @return
*/
public AppCity selectAppCityById(Long id);
/**
*
*
* @param appCity
* @return
*/
public List<AppCity> selectAppCityList(AppCity appCity);
/**
*
*
* @param appCity
* @return
*/
public int insertAppCity(AppCity appCity);
/**
*
*
* @param appCity
* @return
*/
public int updateAppCity(AppCity appCity);
/**
*
*
* @param ids
* @return
*/
public int deleteAppCityByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAppCityById(Long id);
List<AppCity> selectAppCityListByProvinceId(Integer provinceId);
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppProvince;
import com.ruoyi.app.domain.vo.AreaVo;
/**
* Service
*
* @author wyh
* @date 2024-04-24
*/
public interface IAppProvinceService
{
/**
*
*
* @param id
* @return
*/
public AppProvince selectAppProvinceById(Integer id);
/**
*
*
* @param appProvince
* @return
*/
public List<AppProvince> selectAppProvinceList(AppProvince appProvince);
/**
*
*
* @param appProvince
* @return
*/
public int insertAppProvince(AppProvince appProvince);
/**
*
*
* @param appProvince
* @return
*/
public int updateAppProvince(AppProvince appProvince);
/**
*
*
* @param ids
* @return
*/
public int deleteAppProvinceByIds(Integer[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAppProvinceById(Integer id);
List<AreaVo> selectAppProvinceTree();
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppTown;
/**
* Service
*
* @author wyh
* @date 2024-04-24
*/
public interface IAppTownService
{
/**
*
*
* @param id
* @return
*/
public AppTown selectAppTownById(Long id);
/**
*
*
* @param appTown
* @return
*/
public List<AppTown> selectAppTownList(AppTown appTown);
/**
*
*
* @param appTown
* @return
*/
public int insertAppTown(AppTown appTown);
/**
*
*
* @param appTown
* @return
*/
public int updateAppTown(AppTown appTown);
/**
*
*
* @param ids
* @return
*/
public int deleteAppTownByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAppTownById(Long id);
List<AppTown> getTownByCityId(Integer cityId);
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.app.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppCityMapper;
import com.ruoyi.app.domain.AppCity;
import com.ruoyi.app.service.IAppCityService;
/**
* Service
*
* @author wyh
* @date 2024-04-24
*/
@Service
public class AppCityServiceImpl implements IAppCityService
{
@Autowired
private AppCityMapper appCityMapper;
/**
*
*
* @param id
* @return
*/
@Override
public AppCity selectAppCityById(Long id)
{
return appCityMapper.selectAppCityById(id);
}
/**
*
*
* @param appCity
* @return
*/
@Override
public List<AppCity> selectAppCityList(AppCity appCity)
{
return appCityMapper.selectAppCityList(appCity);
}
/**
*
*
* @param appCity
* @return
*/
@Override
public int insertAppCity(AppCity appCity)
{
return appCityMapper.insertAppCity(appCity);
}
/**
*
*
* @param appCity
* @return
*/
@Override
public int updateAppCity(AppCity appCity)
{
return appCityMapper.updateAppCity(appCity);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAppCityByIds(Long[] ids)
{
return appCityMapper.deleteAppCityByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAppCityById(Long id)
{
return appCityMapper.deleteAppCityById(id);
}
@Override
public List<AppCity> selectAppCityListByProvinceId(Integer provinceId) {
return appCityMapper.selectAppCityListByProvinceId(provinceId);
}
}

View File

@ -0,0 +1,156 @@
package com.ruoyi.app.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.ruoyi.app.domain.AppCity;
import com.ruoyi.app.domain.AppTown;
import com.ruoyi.app.domain.vo.AreaVo;
import com.ruoyi.app.mapper.AppCityMapper;
import com.ruoyi.app.mapper.AppTownMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppProvinceMapper;
import com.ruoyi.app.domain.AppProvince;
import com.ruoyi.app.service.IAppProvinceService;
/**
* Service
*
* @author wyh
* @date 2024-04-24
*/
@Service
public class AppProvinceServiceImpl implements IAppProvinceService {
@Autowired
private AppProvinceMapper appProvinceMapper;
@Autowired
private AppCityMapper appCityMapper;
@Autowired
private AppTownMapper appTownMapper;
/**
*
*
* @param id
* @return
*/
@Override
public AppProvince selectAppProvinceById(Integer id) {
return appProvinceMapper.selectAppProvinceById(id);
}
/**
*
*
* @param appProvince
* @return
*/
@Override
public List<AppProvince> selectAppProvinceList(AppProvince appProvince) {
return appProvinceMapper.selectAppProvinceList(appProvince);
}
/**
*
*
* @param appProvince
* @return
*/
@Override
public int insertAppProvince(AppProvince appProvince) {
return appProvinceMapper.insertAppProvince(appProvince);
}
/**
*
*
* @param appProvince
* @return
*/
@Override
public int updateAppProvince(AppProvince appProvince) {
return appProvinceMapper.updateAppProvince(appProvince);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAppProvinceByIds(Integer[] ids) {
return appProvinceMapper.deleteAppProvinceByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAppProvinceById(Integer id) {
return appProvinceMapper.deleteAppProvinceById(id);
}
@Override
public List<AreaVo> selectAppProvinceTree() {
// 查询所有省级列表
List<AppProvince> appProvinces = appProvinceMapper.selectAppProvinceList(null);
return appProvinces.stream()
.map(appProvince -> {
AreaVo areaVo = new AreaVo();
areaVo.setId(appProvince.getId());
areaVo.setName(appProvince.getName());
areaVo.setLevel(1);
areaVo.setIsLeaf(false);
List<AppCity> appCities = appCityMapper.selectAppCityListByProvinceId(appProvince.getId());
if (appCities == null || appCities.isEmpty()) {
return areaVo;
}
List<AreaVo> children = appCities.stream()
.map(appCity -> {
AreaVo child = new AreaVo();
child.setId(appCity.getId());
child.setName(appCity.getName());
child.setLevel(2);
child.setIsLeaf(false);
List<AppTown> appTowns = appTownMapper.getTownByCityId(appCity.getId());
if (appTowns == null || appTowns.isEmpty()) {
return child;
}
List<AreaVo> townChildren = appTowns.stream()
.map(appTown -> {
AreaVo townChild = new AreaVo();
townChild.setId(appTown.getId());
townChild.setName(appTown.getName());
townChild.setLevel(3);
townChild.setIsLeaf(true);
return townChild;
})
.collect(Collectors.toList());
child.setChildren(townChildren);
return child;
})
.collect(Collectors.toList());
areaVo.setChildren(children);
return areaVo;
})
.collect(Collectors.toList());
}
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.app.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppTownMapper;
import com.ruoyi.app.domain.AppTown;
import com.ruoyi.app.service.IAppTownService;
/**
* Service
*
* @author wyh
* @date 2024-04-24
*/
@Service
public class AppTownServiceImpl implements IAppTownService
{
@Autowired
private AppTownMapper appTownMapper;
/**
*
*
* @param id
* @return
*/
@Override
public AppTown selectAppTownById(Long id)
{
return appTownMapper.selectAppTownById(id);
}
/**
*
*
* @param appTown
* @return
*/
@Override
public List<AppTown> selectAppTownList(AppTown appTown)
{
return appTownMapper.selectAppTownList(appTown);
}
/**
*
*
* @param appTown
* @return
*/
@Override
public int insertAppTown(AppTown appTown)
{
return appTownMapper.insertAppTown(appTown);
}
/**
*
*
* @param appTown
* @return
*/
@Override
public int updateAppTown(AppTown appTown)
{
return appTownMapper.updateAppTown(appTown);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAppTownByIds(Long[] ids)
{
return appTownMapper.deleteAppTownByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAppTownById(Long id)
{
return appTownMapper.deleteAppTownById(id);
}
@Override
public List<AppTown> getTownByCityId(Integer cityId) {
return appTownMapper.getTownByCityId(cityId);
}
}

View File

@ -124,4 +124,14 @@ public class SendNoteUtil {
} }
/**
*
*
*
*/
// public void sendEmail() {
// SingleSendMailRequest request = new SingleSendMailRequest();
// }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false"> <configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="logs/ruoyi-system" /> <property name="log.path" value="logs/ruoyi-app" />
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

View File

@ -0,0 +1,66 @@
<?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.ruoyi.app.mapper.AppCityMapper">
<resultMap type="AppCity" id="AppCityResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="provinceId" column="province_id" />
</resultMap>
<sql id="selectAppCityVo">
select id, name, province_id from app_city
</sql>
<select id="selectAppCityList" parameterType="AppCity" resultMap="AppCityResult">
<include refid="selectAppCityVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="provinceId != null "> and province_id = #{provinceId}</if>
</where>
</select>
<select id="selectAppCityById" parameterType="Long" resultMap="AppCityResult">
<include refid="selectAppCityVo"/>
where id = #{id}
</select>
<insert id="insertAppCity" parameterType="AppCity" useGeneratedKeys="true" keyProperty="id">
insert into app_city
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="provinceId != null">province_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="provinceId != null">#{provinceId},</if>
</trim>
</insert>
<update id="updateAppCity" parameterType="AppCity">
update app_city
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="provinceId != null">province_id = #{provinceId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppCityById" parameterType="Long">
delete from app_city where id = #{id}
</delete>
<delete id="deleteAppCityByIds" parameterType="String">
delete from app_city where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectAppCityListByProvinceId" resultType="com.ruoyi.app.domain.AppCity">
<include refid="selectAppCityVo"/> where province_id = #{provinceId}
</select>
</mapper>

View File

@ -0,0 +1,61 @@
<?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.ruoyi.app.mapper.AppProvinceMapper">
<resultMap type="AppProvince" id="AppProvinceResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="area" column="area" />
</resultMap>
<sql id="selectAppProvinceVo">
select id, name, area from app_province
</sql>
<select id="selectAppProvinceList" parameterType="AppProvince" resultMap="AppProvinceResult">
<include refid="selectAppProvinceVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="area != null and area != ''"> and area = #{area}</if>
</where>
</select>
<select id="selectAppProvinceById" parameterType="Integer" resultMap="AppProvinceResult">
<include refid="selectAppProvinceVo"/>
where id = #{id}
</select>
<insert id="insertAppProvince" parameterType="AppProvince" useGeneratedKeys="true" keyProperty="id">
insert into app_province
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="area != null">area,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="area != null">#{area},</if>
</trim>
</insert>
<update id="updateAppProvince" parameterType="AppProvince">
update app_province
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="area != null">area = #{area},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppProvinceById" parameterType="Integer">
delete from app_province where id = #{id}
</delete>
<delete id="deleteAppProvinceByIds" parameterType="String">
delete from app_province where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,66 @@
<?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.ruoyi.app.mapper.AppTownMapper">
<resultMap type="AppTown" id="AppTownResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="cityId" column="city_id" />
</resultMap>
<sql id="selectAppTownVo">
select id, name, city_id from app_town
</sql>
<select id="selectAppTownList" parameterType="AppTown" resultMap="AppTownResult">
<include refid="selectAppTownVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="cityId != null "> and city_id = #{cityId}</if>
</where>
</select>
<select id="selectAppTownById" parameterType="Long" resultMap="AppTownResult">
<include refid="selectAppTownVo"/>
where id = #{id}
</select>
<insert id="insertAppTown" parameterType="AppTown">
insert into app_town
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null">name,</if>
<if test="cityId != null">city_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="cityId != null">#{cityId},</if>
</trim>
</insert>
<update id="updateAppTown" parameterType="AppTown">
update app_town
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="cityId != null">city_id = #{cityId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppTownById" parameterType="Long">
delete from app_town where id = #{id}
</delete>
<delete id="deleteAppTownByIds" parameterType="String">
delete from app_town where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getTownByCityId" resultType="com.ruoyi.app.domain.AppTown">
<include refid="selectAppTownVo"/> where city_id = #{cityId} </select>
</mapper>

View File

@ -3,6 +3,8 @@ package ${packageName}.controller;
import java.util.List; import java.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -33,6 +35,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("/${businessName}") @RequestMapping("/${businessName}")
@Api(tags = "${functionName}" , description = "${functionName}")
public class ${ClassName}Controller extends BaseController public class ${ClassName}Controller extends BaseController
{ {
@Autowired @Autowired
@ -43,6 +46,7 @@ public class ${ClassName}Controller extends BaseController
*/ */
@RequiresPermissions("${permissionPrefix}:list") @RequiresPermissions("${permissionPrefix}:list")
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询${functionName}", notes = "查询${functionName}", httpMethod = "GET")
#if($table.crud || $table.sub) #if($table.crud || $table.sub)
public TableDataInfo list(${ClassName} ${className}) public TableDataInfo list(${ClassName} ${className})
{ {
@ -76,6 +80,7 @@ public class ${ClassName}Controller extends BaseController
*/ */
@RequiresPermissions("${permissionPrefix}:query") @RequiresPermissions("${permissionPrefix}:query")
@GetMapping(value = "/{${pkColumn.javaField}}") @GetMapping(value = "/{${pkColumn.javaField}}")
@ApiOperation(value = "获取${functionName}详细信息", notes = "获取${functionName}详细信息", httpMethod = "GET")
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
{ {
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
@ -85,8 +90,9 @@ public class ${ClassName}Controller extends BaseController
* 新增${functionName} * 新增${functionName}
*/ */
@RequiresPermissions("${permissionPrefix}:add") @RequiresPermissions("${permissionPrefix}:add")
@ApiOperation(value = "新增${functionName}", notes = "新增${functionName}", httpMethod = "POST")
@Log(title = "${functionName}", businessType = BusinessType.INSERT) @Log(title = "${functionName}", businessType = BusinessType.INSERT)
@PostMapping @PostMapping("/add")
public AjaxResult add(@RequestBody ${ClassName} ${className}) public AjaxResult add(@RequestBody ${ClassName} ${className})
{ {
return toAjax(${className}Service.insert${ClassName}(${className})); return toAjax(${className}Service.insert${ClassName}(${className}));
@ -96,8 +102,9 @@ public class ${ClassName}Controller extends BaseController
* 修改${functionName} * 修改${functionName}
*/ */
@RequiresPermissions("${permissionPrefix}:edit") @RequiresPermissions("${permissionPrefix}:edit")
@ApiOperation(value = "修改${functionName}", notes = "修改${functionName}", httpMethod = "PUT")
@Log(title = "${functionName}", businessType = BusinessType.UPDATE) @Log(title = "${functionName}", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping("/edit")
public AjaxResult edit(@RequestBody ${ClassName} ${className}) public AjaxResult edit(@RequestBody ${ClassName} ${className})
{ {
return toAjax(${className}Service.update${ClassName}(${className})); return toAjax(${className}Service.update${ClassName}(${className}));
@ -109,7 +116,7 @@ public class ${ClassName}Controller extends BaseController
@RequiresPermissions("${permissionPrefix}:remove") @RequiresPermissions("${permissionPrefix}:remove")
@Log(title = "${functionName}", businessType = BusinessType.DELETE) @Log(title = "${functionName}", businessType = BusinessType.DELETE)
@DeleteMapping("/{${pkColumn.javaField}s}") @DeleteMapping("/{${pkColumn.javaField}s}")
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) public R remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
{ {
return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s)); return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
} }

View File

@ -123,7 +123,36 @@
<el-table-column label="手机号" align="center" prop="phone" /> <el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="用户名" align="center" prop="username" /> <el-table-column label="用户名" align="center" prop="username" />
<el-table-column label="学校证明" align="center" prop="prove" /> <el-table-column label="学校证明" align="center" prop="prove" />
<el-table-column label="头像" align="center" prop="avatarUrl" /> <el-table-column
align="center"
width="200px"
label="学校证明"
>
<template slot-scope="{ row }">
<el-image
:preview-src-list="[row.prove]"
:src="row.prove"
fit="cover"
@click=""
/>
</template>
</el-table-column>
<el-table-column
prop="avatarUrl"
header-align="center"
previce-srcList:
align="center"
label="头像"
>
<template slot-scope="scope" class="demo-image__preview">
<img
:src="scope.row.avatarUrl"
width="40"
height="40"
class="head_pic"
/>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="sex"> <el-table-column label="性别" align="center" prop="sex">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.sex == 0 ? '男' : scope.row.sex == 1 ? '女' : '' }} {{ scope.row.sex == 0 ? '男' : scope.row.sex == 1 ? '女' : '' }}
@ -239,7 +268,8 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
} },
logicImageList: []
}; };
}, },
created() { created() {