@@ -0,0 +1,36 @@ | |||
package com.tuoheng.controller; | |||
import com.tuoheng.model.query.AreaQuery; | |||
import com.tuoheng.service.AreaService; | |||
import com.tuoheng.until.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* (Area)表控制层 | |||
* | |||
* @author xiaoying | |||
* @since 2023-03-06 14:59:16 | |||
*/ | |||
@RestController | |||
@RequestMapping("/area") | |||
public class AreaController { | |||
/** | |||
* 服务对象 | |||
*/ | |||
@Autowired | |||
private AreaService areaService; | |||
/** | |||
* 查询区域信息 | |||
* @param query | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult index(AreaQuery query){ | |||
return areaService.index(query); | |||
} | |||
} | |||
@@ -0,0 +1,20 @@ | |||
package com.tuoheng.mapper; | |||
import com.tuoheng.model.entity.Area; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import org.apache.ibatis.annotations.Mapper; | |||
/** | |||
* @author 小影 | |||
* @description 针对表【t_area】的数据库操作Mapper | |||
* @createDate 2023-03-06 14:58:40 | |||
* @Entity com.tuoheng.model.entity.Area | |||
*/ | |||
@Mapper | |||
public interface AreaMapper extends BaseMapper<Area> { | |||
} | |||
@@ -0,0 +1,66 @@ | |||
package com.tuoheng.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
import lombok.Data; | |||
/** | |||
* | |||
* @TableName t_area | |||
*/ | |||
@TableName(value ="t_area") | |||
@Data | |||
public class Area implements Serializable { | |||
/** | |||
* id | |||
*/ | |||
@TableId(type = IdType.AUTO) | |||
private Integer id; | |||
/** | |||
* 创建时间 | |||
*/ | |||
private Date createTime; | |||
/** | |||
* 更新时间 | |||
*/ | |||
private Date updateTime; | |||
/** | |||
* 创建人 | |||
*/ | |||
private Integer createUser; | |||
/** | |||
* 更新人 | |||
*/ | |||
private Integer updateUser; | |||
/** | |||
* 区域名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 省份code(多个用逗号隔开) | |||
*/ | |||
private String cityCode; | |||
/** | |||
* 省份名称(多个用逗号隔开) | |||
*/ | |||
private String cityName; | |||
/** | |||
* 1:可用;0:不可使用 | |||
*/ | |||
private Integer mark; | |||
@TableField(exist = false) | |||
private static final long serialVersionUID = 1L; | |||
} |
@@ -0,0 +1,18 @@ | |||
package com.tuoheng.model.query; | |||
import com.tuoheng.common.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* @Author xiaoying | |||
* @Date 2023/3/6 15:03 | |||
*/ | |||
@Data | |||
public class AreaQuery extends BaseQuery { | |||
/** | |||
* 分区名称 | |||
*/ | |||
private String name; | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.service; | |||
import com.tuoheng.model.entity.Area; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.tuoheng.model.query.AreaQuery; | |||
import com.tuoheng.until.JsonResult; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @author 小影 | |||
* @description 针对表【t_area】的数据库操作Service | |||
* @createDate 2023-03-06 14:58:40 | |||
*/ | |||
public interface AreaService extends IService<Area> { | |||
/** | |||
* 查询区域信息 | |||
* @param query | |||
* @return | |||
*/ | |||
JsonResult index(AreaQuery query); | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.tuoheng.service.impl; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.tuoheng.mapper.AreaMapper; | |||
import com.tuoheng.model.entity.Area; | |||
import com.tuoheng.model.query.AreaQuery; | |||
import com.tuoheng.service.AreaService; | |||
import com.tuoheng.until.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @author 小影 | |||
* @description 针对表【t_area】的数据库操作Service实现 | |||
* @createDate 2023-03-06 14:58:40 | |||
*/ | |||
@Service | |||
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> | |||
implements AreaService{ | |||
@Autowired | |||
private AreaMapper areaMapper; | |||
/** | |||
* 查询区域信息 | |||
* | |||
* @param query | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult index(AreaQuery query) { | |||
//分页参数校验 | |||
query.checkParam(); | |||
//开启分页 | |||
IPage<Area> page = new Page<>(query.getPage(), query.getLimit()); | |||
IPage<Area> areaPage = areaMapper.selectPage(page, Wrappers.<Area>lambdaQuery() | |||
.eq(Area::getMark, 1) | |||
.like(ObjectUtil.isNotEmpty(query.getName()), Area::getName, query.getName())); | |||
//todo 更新人员 users表是加字段还是新表 | |||
return JsonResult.success(areaPage); | |||
} | |||
} | |||
@@ -505,7 +505,6 @@ public class TenantServiceImpl implements TenantService { | |||
//河湖长 | |||
case HhzUrlConstant.HHZ_CLIENT: | |||
url = url + HhzUrlConstant.CREATE_TENANT; | |||
//dto.setClientId(HhzUrlConstant.HHZ_CLIENT_ADMIN); | |||
break; | |||
//机场 | |||
case AirportConstant.AIRPORT_CLIENT: | |||
@@ -514,17 +513,14 @@ public class TenantServiceImpl implements TenantService { | |||
//高速 | |||
case FreeWayConstant.FREEWAY_CLIENT: | |||
url = url + FreeWayConstant.CREATE_TENANT; | |||
//dto.setClientId(FreeWayConstant.FREEWAY_CLIENT_ADMIN + CommonConstant.COMMA + FreeWayConstant.FREEWAY_CLIENT_MP); | |||
break; | |||
//航道 | |||
case WaterWayConstant.WATERWAY_CLIENT: | |||
url = url + WaterWayConstant.CREATE_TENANT; | |||
//dto.setClientId(WaterWayConstant.WATERWAY_CLIENT_ADMIN + CommonConstant.COMMA + WaterWayConstant.WATERWAY_CLIENT_MP); | |||
break; | |||
//飞手 | |||
case PilotConstant.PILOT_CLIENT: | |||
url = url + PilotConstant.CREATE_TENANT; | |||
//dto.setClientId(PilotConstant.PILOT_CLIENT + CommonConstant.COMMA + PilotConstant.PILOT_CLIENT_MP); | |||
break; | |||
default: | |||
break; |
@@ -0,0 +1,24 @@ | |||
<?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.tuoheng.mapper.AreaMapper"> | |||
<resultMap id="BaseResultMap" type="com.tuoheng.model.entity.Area"> | |||
<id property="id" column="id" jdbcType="INTEGER"/> | |||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> | |||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> | |||
<result property="createUser" column="create_user" jdbcType="INTEGER"/> | |||
<result property="updateUser" column="update_user" jdbcType="INTEGER"/> | |||
<result property="name" column="name" jdbcType="VARCHAR"/> | |||
<result property="cityCode" column="city_code" jdbcType="VARCHAR"/> | |||
<result property="cityName" column="city_name" jdbcType="VARCHAR"/> | |||
<result property="mark" column="mark" jdbcType="TINYINT"/> | |||
</resultMap> | |||
<sql id="Base_Column_List"> | |||
id,create_time,update_time, | |||
create_user,update_user,name, | |||
city_code,city_name,mark | |||
</sql> | |||
</mapper> |