| @@ -0,0 +1,46 @@ | |||||
| package com.iformall.controller.market; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.FengNiaoMapConfig; | |||||
| import com.iformall.service.FengNiaoMapService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("fengniaomap") | |||||
| @Api(description = "蜂鸟地图") | |||||
| public class FengNiaoMapController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private FengNiaoMapService fengNiaoMapService; | |||||
| @ApiOperation("查询地图配置") | |||||
| @GetMapping("/getConfig") | |||||
| public ResultData getConfig() { | |||||
| String tenantId = ifParentUpdateTenantInfo().getTenantId(); | |||||
| if (!StringUtils.isBlank(tenantId)) { | |||||
| try { | |||||
| FengNiaoMapConfig config = fengNiaoMapService.getConfigByTenantId(tenantId); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", config); | |||||
| }catch(Exception e) { | |||||
| logger.error("fengniaomap getConfig error.",e); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", null); | |||||
| } | |||||
| }else { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", null); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,10 @@ | |||||
| CREATE TABLE `fengniao_map_config` ( | |||||
| `id` bigint(20) NOT NULL, | |||||
| `tenant_id` varchar(5) NOT NULL, | |||||
| `app_key` varchar(40) NOT NULL COMMENT '蜂鸟地图-我的应用,key值', | |||||
| `app_name` varchar(100) DEFAULT NULL COMMENT '蜂鸟地图-我的应用,名称', | |||||
| `map_id` varchar(40) DEFAULT NULL COMMENT '蜂鸟地图-制图,地图编号', | |||||
| `shop_type_id` text COMMENT '判定为门店的类型的编号。根据地图类型来配置', | |||||
| `remark` text COMMENT '说明', | |||||
| PRIMARY KEY (`id`) | |||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | |||||
| @@ -0,0 +1,30 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| @TableName(value = "fengniao_map_config") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class FengNiaoMapConfig extends BaseEntity { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long id; | |||||
| private String tenantId; | |||||
| private String appKey; | |||||
| private String appName; | |||||
| private String mapId; | |||||
| private String shopTypeId; | |||||
| private String remark; | |||||
| } | |||||
| @@ -0,0 +1,10 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.FengNiaoMapConfig; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| public interface FengNiaoMapConfigMapper extends CommonMapper<FengNiaoMapConfig, Long> { | |||||
| FengNiaoMapConfig findByTenantId(@Param("tenantId")String tenantId); | |||||
| } | |||||
| @@ -0,0 +1,8 @@ | |||||
| package com.iformall.service; | |||||
| import com.iformall.domain.po.FengNiaoMapConfig; | |||||
| public interface FengNiaoMapService { | |||||
| FengNiaoMapConfig getConfigByTenantId(String tenantId); | |||||
| } | |||||
| @@ -0,0 +1,22 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.iformall.domain.po.FengNiaoMapConfig; | |||||
| import com.iformall.mapper.FengNiaoMapConfigMapper; | |||||
| import com.iformall.service.FengNiaoMapService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| @Service | |||||
| public class FengNiaoMapServiceImpl implements FengNiaoMapService { | |||||
| @Autowired | |||||
| private FengNiaoMapConfigMapper fengNiaoMapConfigMapper; | |||||
| @Override | |||||
| public FengNiaoMapConfig getConfigByTenantId(String tenantId) { | |||||
| return fengNiaoMapConfigMapper.findByTenantId(tenantId); | |||||
| } | |||||
| } | |||||
| @@ -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.iformall.mapper.FengNiaoMapConfigMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.FengNiaoMapConfig"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="app_key" jdbcType="VARCHAR" property="appKey"/> | |||||
| <result column="app_name" jdbcType="VARCHAR" property="appName"/> | |||||
| <result column="map_id" jdbcType="VARCHAR" property="mapId"/> | |||||
| <result column="shop_type_id" jdbcType="VARCHAR" property="shopTypeId"/> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`app_key`,`app_name`,`map_id`,`shop_type_id`,`remark` | |||||
| </sql> | |||||
| <select id="findByTenantId" parameterType="String" resultMap="BaseResultMap" > | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from fengniao_map_config and `tenant_id` = #{tenantId} | |||||
| </select> | |||||
| </mapper> | |||||