地理信息网络态势数据服务接口设计

项目内容:

地理信息网络态势数据服务接口设计。

数据库设计:

三个字典表:

  1. 国家地区:(数字编码、中文编码、中文简称、英文简称、中文全称、英文全称)
  2. 各表中字段的属性字典表:(所属表名、所属表中的字段名、字典值、实际表示的值)
  3. 各种元素的类型编码:(类型编码、类型名称、上级类型编码、类型的深度、优先等级<优先等级越高,值越小,排序越靠前>0表示禁用,1表示可用)

四个基本表:

  1. 网络的基本属性:1编号2名称3类型编码4父节点编号5描述信息6控制程度7所属单位编号
  2. 网络节点基本属性:1编号2名称3目标类型编码4是否为桥接点5父节点编号6重要程度7所属物理平台编号8所属网络编号9节点描述10首报时间11信息更新时间12控守状态13在线状态
  3. 雷达(网络节点扩展表):1.编号2探测距离3旋转周期4雷达体制5雷达半径6雷达朝向7雷达内角
  4. 物理平台基本属性表:(1.编号2.名称3.类型编码4.经度5.纬度6.高深度7所属单位编号8父节点编号9所属国建编号10驻扎单位11综合价值12描述信息13首报时间14信息更新时间15军事部署情况)

(1)其中各种元素的类型编码表采用无极限分类的方式实现   查询:select   where parentId=?and depth=?(实现就是点击功能的时候显示分类情况)

(2)查询每个单表的时候是采用基本表和字典表一起联合查询的方式实现(内连接),优点,反复使用的数据存在了字典表中,节约了基本表的空间,提高了查询的速度。

Select *from A as a ,B as where a.id=b.id.

(3)考虑频繁查询的效率问题,为了给服务器减轻压力,开启了mysql缓存

(4)考虑多线程查询过程中出现的一致性问题,通过在mybatis中采用乐观锁

    <update id="updateUser" >
        update t_user set username=#{username},password=#{password},account=#{account} ,version=version+1 where id=#{id} and version =#{version}
    </update>

springmvc代码:

package com.test.ball.Controller;

import com.test.ball.entity.Country;
import com.test.ball.service.CountryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by nick on 2018/8/8.
 */
@Controller
public class CountryController {
    //请求的路径,方式
    @Autowired
    private CountryService countryService;
    @RequestMapping(value = "/get", method = RequestMethod.GET)
    @ResponseBody
    //查询所有结果
    public List<Country> foo1(HttpServletRequest request) {
        List<Country> list = new ArrayList<Country>();
        list=countryService.getAll();
        return list;
    }
    //查询某一国家
    @RequestMapping(value="/get/{id}",method = RequestMethod.GET)
    @ResponseBody
    public Country getById(@PathVariable(value = "id") String id,HttpServletRequest request)
    {
        Country temp= countryService.getbySZBM(id);
        return temp;
    }
    //增加某一国家
    @RequestMapping(value="/add",method = RequestMethod.POST)
    @ResponseBody
    public String add(HttpServletRequest request){
        String SZBM = request.getParameter("SZBM");
        String ZMBM2 = request.getParameter("ZMBM2");
        String ZMBM3 = request.getParameter("ZMBM3");
        String ZWJC = request.getParameter("ZWJC");
        String YWJC = request.getParameter("YWJC");
        String ZWQC = request.getParameter("ZWQC");
        String YWQC = request.getParameter("YWQC");
        Country temp = new Country(SZBM,ZMBM2,ZMBM3,ZWJC,YWJC,ZWQC,YWQC);
        System.out.println(temp.getSZBM());
        countryService.add(temp);
        return "redirect:/get";
    }
    //删除某一国家,delete请求
    @DeleteMapping(value = "/delete/{id}")
    @ResponseBody
    public String delete(@PathVariable(value = "id")  String id){
        countryService.deletebySZBM(id);
        return "redirect:/get";
    }
    //修改某一国家数据,update
    /**修改课程
     *
     */
    @PutMapping(value = "/update")
    @ResponseBody
    public String update(Country temp){
        countryService.update(temp);
        return "redirect:/get";
    }
}

猜你喜欢

转载自www.cnblogs.com/nickup/p/9767590.html
今日推荐