提交 9e9ec885 authored 作者: 董吉利's avatar 董吉利

Merge branch 'dev' of http://39.96.70.20:8080/A7/aroad into dev

-- MySQL Script generated by MySQL Workbench
-- Thu Apr 11 09:57:40 2019
-- Mon Apr 15 09:33:45 2019
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
......@@ -18,7 +18,7 @@ CREATE SCHEMA IF NOT EXISTS `aroad` DEFAULT CHARACTER SET utf8 ;
USE `aroad` ;
-- -----------------------------------------------------
-- Table `aroad`.`attendance_template`
-- Table `aroad`.`attendance_templates`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `aroad`.`attendance_templates` ;
......@@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `aroad`.`attendance` (
`attendance_id` INT NOT NULL AUTO_INCREMENT COMMENT '排班id',
`shift_id` INT NOT NULL COMMENT '班次表主键',
PRIMARY KEY (`attendance_id`),
INDEX `shift_id_index` (`shift_id` ASC))
INDEX `shift_id_index` (`shift_id` ASC) VISIBLE)
ENGINE = InnoDB
COMMENT = '排班表';
......@@ -61,18 +61,33 @@ CREATE TABLE IF NOT EXISTS `aroad`.`attendance_members` (
`attendance_id` INT NOT NULL,
`name` VARCHAR(10) NOT NULL COMMENT '值班人员姓名',
PRIMARY KEY (`id`),
INDEX `attendance_id_index` (`attendance_id` ASC))
INDEX `attendance_id_index` (`attendance_id` ASC) INVISIBLE)
ENGINE = InnoDB
COMMENT = '值班人员表';
-- -----------------------------------------------------
-- Table `aroad`.`attendance_records`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `aroad`.`attendance_records` ;
CREATE TABLE IF NOT EXISTS `aroad`.`attendance_records` (
`record_id` INT NOT NULL AUTO_INCREMENT COMMENT '通讯录id',
`unit` VARCHAR(30) NOT NULL,
`department` VARCHAR(30) NOT NULL COMMENT '部门id',
`position` VARCHAR(30) NULL,
`name` VARCHAR(10) NOT NULL,
`telphone` VARCHAR(15) NULL,
`remark` VARCHAR(100) NULL,
PRIMARY KEY (`record_id`))
ENGINE = InnoDB
COMMENT = '值班通讯录';
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-- 菜单SQL
INSERT INTO `sys_menu` (
`parent_id`,
`component`,
......@@ -164,3 +179,25 @@ VALUES
'2018-07-29 13:38:19',
'班次管理'
);
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
values ( '8200', null, 'attendancetemplates_add', '1', null, '1', '8201', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '新增');
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
values ( '8200', null, 'attendancetemplates_edit', '1', null, '1', '8202', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '修改');
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
values ( '8200', null, 'attendancetemplates_del', '1', null, '1', '8203', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '删除');
-- 菜单SQL
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
values ( '8000', 'views/attendance/attendancerecords/index_manage', '', '0', '/recordsmanage', 'icon-bangzhushouji', '8400', '0', '2018-01-20 13:17:19', '8', '2018-07-29 13:38:19', '通讯录管理');
-- 菜单对应按钮SQL
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
values ( '8400', null, 'attendancerecords_add', '1', null, '1', '8401', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '新增');
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
values ( '8400', null, 'attendancerecords_edit', '1', null, '1', '8402', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '修改');
insert into `sys_menu` ( `parent_id`, `component`, `permission`, `type`, `path`, `icon`, `menu_id`, `del_flag`, `create_time`, `sort`, `update_time`, `name`)
values ( '8400', null, 'attendancerecords_del', '1', null, '1', '8403', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '删除');
package com.elephant.framework.galaxy.aroad.module.attendance.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.elephant.framework.galaxy.aroad.response.R;
import com.elephant.framework.galaxy.aroad.module.common.annotation.SysLog;
import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceRecords;
import com.elephant.framework.galaxy.aroad.module.attendance.service.AttendanceRecordsService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.elephant.framework.galaxy.aroad.module.common.controller.BaseController;
/**
* 值班通讯录表
*
* @author songwenjie
* @date 2019-04-15 09:34:54
*/
@RestController
@AllArgsConstructor
@RequestMapping("/attendancerecords")
public class AttendanceRecordsController extends BaseController {
private final AttendanceRecordsService attendanceRecordsService;
/**
* 分页查询
* @param page 分页对象
* @param attendanceRecords 值班通讯录表
* @return
*/
@GetMapping("/page")
public R getAttendanceRecordsPage(Page page, AttendanceRecords attendanceRecords) {
return new R<>(attendanceRecordsService.page(page,Wrappers.query(attendanceRecords)));
}
/**
* 通过id查询值班通讯录表
* @param recordId id
* @return R
*/
@GetMapping("/{recordId}")
public R getById(@PathVariable("recordId") Integer recordId){
return new R<>(attendanceRecordsService.getById(recordId));
}
/**
* 新增值班通讯录表
* @param attendanceRecords 值班通讯录表
* @return R
*/
@SysLog("新增值班通讯录表")
@PostMapping
public R save(@RequestBody AttendanceRecords attendanceRecords){
return new R<>(attendanceRecordsService.save(attendanceRecords));
}
/**
* 修改值班通讯录表
* @param attendanceRecords 值班通讯录表
* @return R
*/
@SysLog("修改值班通讯录表")
@PutMapping
public R updateById(@RequestBody AttendanceRecords attendanceRecords){
return new R<>(attendanceRecordsService.updateById(attendanceRecords));
}
/**
* 通过id删除值班通讯录表
* @param recordId id
* @return R
*/
@SysLog("删除值班通讯录表")
@DeleteMapping("/{recordId}")
public R removeById(@PathVariable Integer recordId){
return new R<>(attendanceRecordsService.removeById(recordId));
}
}
package com.elephant.framework.galaxy.aroad.module.attendance.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 值班通讯录表
*
* @author songwenjie
* @date 2019-04-15 09:34:54
*/
@Data
@TableName("attendance_records")
@EqualsAndHashCode(callSuper = true)
public class AttendanceRecords extends Model<AttendanceRecords> {
private static final long serialVersionUID = 1L;
/**
* 通讯录id
*/
@TableId
private Integer recordId;
/**
*
*/
private String unit;
/**
* 部门id
*/
private String department;
/**
*
*/
private String position;
/**
*
*/
private String name;
/**
*
*/
private String telphone;
/**
*
*/
private String remark;
}
package com.elephant.framework.galaxy.aroad.module.attendance.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
......@@ -24,7 +28,7 @@ public class AttendanceTemplates extends Model<AttendanceTemplates> {
/**
* 班次id
*/
@TableId
@TableId(type = IdType.AUTO)
private Integer shiftId;
/**
* 模板名称
......@@ -33,10 +37,12 @@ public class AttendanceTemplates extends Model<AttendanceTemplates> {
/**
* 开始时间
*/
@JsonFormat(pattern = "yyyy/MM/dd HH:mm",timezone="GMT+8")
private Date startTime;
/**
* 结束时间
*/
@JsonFormat(pattern = "yyyy/MM/dd HH:mm",timezone="GMT+8")
private Date endTime;
/**
* 班次类型:白班/夜班/全天/领导带班
......
package com.elephant.framework.galaxy.aroad.module.attendance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceRecords;
/**
* 值班通讯录表
*
* @author songwenjie
* @date 2019-04-15 09:34:54
*/
public interface AttendanceRecordsMapper extends BaseMapper<AttendanceRecords> {
}
package com.elephant.framework.galaxy.aroad.module.attendance.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceRecords;
/**
* 值班通讯录表
*
* @author songwenjie
* @date 2019-04-15 09:34:54
*/
public interface AttendanceRecordsService extends IService<AttendanceRecords> {
}
package com.elephant.framework.galaxy.aroad.module.attendance.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceRecords;
import com.elephant.framework.galaxy.aroad.module.attendance.mapper.AttendanceRecordsMapper;
import com.elephant.framework.galaxy.aroad.module.attendance.service.AttendanceRecordsService;
import org.springframework.stereotype.Service;
/**
* 值班通讯录表
*
* @author songwenjie
* @date 2019-04-15 09:34:54
*/
@Service
public class AttendanceRecordsServiceImpl extends ServiceImpl<AttendanceRecordsMapper, AttendanceRecords> implements AttendanceRecordsService {
}
......@@ -13,7 +13,7 @@ import java.util.List;
public class TreeNode {
protected int id;
protected int parentId;
protected List<TreeNode> children = new ArrayList<TreeNode>();
protected List<TreeNode> children;
public void add(TreeNode node) {
children.add(node);
......
......@@ -39,10 +39,15 @@ public class ZhtjGllmqkController extends BaseController {
* 获取总体情况柱状图统计信息
*/
@GetMapping("/barzt")
public R getBarZtData(@RequestParam String type){
return new R <>(zhtjGllmqkService.getBarZtData(type));
public R getBarZtData(@RequestParam("type") String type,@RequestParam("year") String year){
return new R <>(zhtjGllmqkService.getBarZtData(type,year));
}
@GetMapping("/ordinary")
public R getOrdinary(@RequestParam("type") String type,@RequestParam("year")String year,@RequestParam("area")String area){
return new R <>(zhtjGllmqkService.getOrdinary(type,year,area));
}
/**
* 通过id查询综合统计_公路路面情况
* @param id id
......
......@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
* @date 2019-03-12 08:37:12
*/
@Data
@TableName("T_ZHTJ_GLJSDJQK")
@TableName("t_zhtj_gljsdjqk")
@EqualsAndHashCode(callSuper = true)
public class ZhtjGljsdjqk extends Model<ZhtjGljsdjqk> {
private static final long serialVersionUID = 1L;
......
......@@ -16,5 +16,6 @@ import java.util.Map;
* @date 2019-03-11 17:24:55
*/
public interface ZhtjGljsdjqkMapper extends BaseMapper<ZhtjGljsdjqk> {
//查詢普通公路覆蓋情況
List<ZhtjGljsdjqk> selectZhtjGljsdjqk(String area,String type);
}
......@@ -2,6 +2,8 @@ package com.elephant.framework.galaxy.aroad.module.zhtj.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.elephant.framework.galaxy.aroad.module.zhtj.entity.ZhtjGllmqk;
import java.util.List;
import java.util.Map;
/**
* 综合统计_公路路面情况
......@@ -10,5 +12,8 @@ import com.elephant.framework.galaxy.aroad.module.zhtj.entity.ZhtjGllmqk;
* @date 2019-03-12 11:04:15
*/
public interface ZhtjGllmqkMapper extends BaseMapper<ZhtjGllmqk> {
// 根据年份、类型查询各地市路面情况
List<ZhtjGllmqk> electZhtjGllmqks(String year, String type,String area);
Map<String, Object> selectOrdinary(String type, String year, String area);
}
......@@ -3,7 +3,6 @@ package com.elephant.framework.galaxy.aroad.module.zhtj.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.elephant.framework.galaxy.aroad.module.system.vo.echarts.BarEchartsVo;
import com.elephant.framework.galaxy.aroad.module.zhtj.entity.ZhtjGllmqk;
import java.util.Map;
/**
......@@ -14,9 +13,10 @@ import java.util.Map;
*/
public interface ZhtjGllmqkService extends IService<ZhtjGllmqk> {
// 获取总体情况柱状图统计信息
BarEchartsVo getBarZtData(String type);
BarEchartsVo getBarZtData(String type,String year);
/**
* 公路覆蓋情況統計
*/
Map<String,Object> getGlfgqktj();
Map<String, Object> getOrdinary(String type, String year, String area);
}
......@@ -25,11 +25,11 @@ import java.util.*;
@AllArgsConstructor
public class ZhtjGllmqkServiceImpl extends ServiceImpl<ZhtjGllmqkMapper, ZhtjGllmqk> implements ZhtjGllmqkService {
private final ZhtjGljsdjqkMapper zhtjGljsdjqkMapper;
private final ZhtjGllmqkMapper zhtjGllmqkMapper;
@Override
public BarEchartsVo getBarZtData(String type) {
public BarEchartsVo getBarZtData(String type,String year) {
BarEchartsVo barEchartsVo = new BarEchartsVo();
List<ZhtjGllmqk> zhtjGllmqkList = super.list(Wrappers.<ZhtjGllmqk>query().lambda().eq(ZhtjGllmqk::getType ,type));
List<ZhtjGllmqk> zhtjGllmqkList = zhtjGllmqkMapper.electZhtjGllmqks(year,type,null);
List<String> legends = new ArrayList<>(Arrays.asList("沥青混凝土","水泥混凝土","简易铺装路面","未铺装路面"));
barEchartsVo.setLegendData(legends);
List<String> yAxisData = new ArrayList<>();
......@@ -80,7 +80,7 @@ public class ZhtjGllmqkServiceImpl extends ServiceImpl<ZhtjGllmqkMapper, ZhtjGll
}
@Override
public Map<String, Object> getGlfgqktj() {
public Map<String,Object> getGlfgqktj() {
Map<String,Object> resultMap = new HashMap<>();
String[] indicator = new String[]{"二级公路","等级公路","沥青公路"};
/**
......@@ -88,7 +88,7 @@ public class ZhtjGllmqkServiceImpl extends ServiceImpl<ZhtjGllmqkMapper, ZhtjGll
* 普通公路不计算高速
*/
ZhtjGllmqk ptglZhtjGllmqk = super.getOne(Wrappers.<ZhtjGllmqk>query().lambda().eq(ZhtjGllmqk::getArea,"合计").eq(ZhtjGllmqk::getType,"总计"));
ZhtjGljsdjqk zhtjGljsdjqk = zhtjGljsdjqkMapper.selectOne(Wrappers.<ZhtjGljsdjqk>query().lambda().eq(ZhtjGljsdjqk::getArea,"合计").eq(ZhtjGljsdjqk::getType,"总计"));
ZhtjGljsdjqk zhtjGljsdjqk = zhtjGljsdjqkMapper.selectZhtjGljsdjqk("合计","'总计'").get(0);
resultMap.put("ptgl",new HashMap<String,Object>(){{
put("serieData",new ArrayList<Object>(){{
add(zhtjGljsdjqk.getSecondRoad());
......@@ -102,7 +102,7 @@ public class ZhtjGllmqkServiceImpl extends ServiceImpl<ZhtjGllmqkMapper, ZhtjGll
* 国省道包含高速公路
*/
ZhtjGllmqk gsdZhtjGllmqk = super.getOne(Wrappers.<ZhtjGllmqk>query().lambda().eq(ZhtjGllmqk::getArea,"合计").eq(ZhtjGllmqk::getType,"国省道合计"));
ZhtjGljsdjqk gsdGljsdjqk = zhtjGljsdjqkMapper.selectOne(Wrappers.<ZhtjGljsdjqk>query().lambda().eq(ZhtjGljsdjqk::getArea,"合计").eq(ZhtjGljsdjqk::getType,"国省道合计"));
ZhtjGljsdjqk gsdGljsdjqk = zhtjGljsdjqkMapper.selectZhtjGljsdjqk("合计","'国省道合计'").get(0);
resultMap.put("gsd",new HashMap<String,Object>(){{
put("serieData",new ArrayList<Object>(){{
add(gsdGljsdjqk.getSecondRoad());
......@@ -127,7 +127,7 @@ public class ZhtjGllmqkServiceImpl extends ServiceImpl<ZhtjGllmqkMapper, ZhtjGll
* 查询农村公路覆盖情况
*/
List<ZhtjGllmqk> ncglZhtjGllmqks = super.list(Wrappers.<ZhtjGllmqk>query().lambda().eq(ZhtjGllmqk::getArea,"合计").in(ZhtjGllmqk::getType,"县道","乡道","专用公路","村道"));
List<ZhtjGljsdjqk> ncglGljsdjqks = zhtjGljsdjqkMapper.selectList(Wrappers.<ZhtjGljsdjqk>query().lambda().eq(ZhtjGljsdjqk::getArea,"合计").in(ZhtjGljsdjqk::getType,"县道","乡道","专用公路","村道"));
List<ZhtjGljsdjqk> ncglGljsdjqks = zhtjGljsdjqkMapper.selectZhtjGljsdjqk("合计","'县道','乡道','专用公路','村道'");
Double secondRoad = 0.0,total=0.0,ypzlmLqhnt=0.0;
for(ZhtjGllmqk zhtjGllmqk : ncglZhtjGllmqks){
ypzlmLqhnt+=zhtjGllmqk.getYpzlmLqhnt();
......@@ -149,4 +149,10 @@ public class ZhtjGllmqkServiceImpl extends ServiceImpl<ZhtjGllmqkMapper, ZhtjGll
}});
return resultMap;
}
@Override
public Map<String, Object> getOrdinary(String type, String year, String area) {
Map<String, Object> mapOrdinary = zhtjGllmqkMapper.selectOrdinary(type,year,area);
return mapOrdinary;
}
}
......@@ -5,7 +5,7 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/aroad?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root
password: 123456
password: root
cache:
type: redis
redis:
......
<?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.elephant.framework.galaxy.aroad.module.attendance.mapper.AttendanceRecordsMapper">
<resultMap id="attendanceRecordsMap" type="com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceRecords">
<id property="recordId" column="record_id"/>
<result property="unit" column="unit"/>
<result property="department" column="department"/>
<result property="position" column="position"/>
<result property="name" column="name"/>
<result property="telphone" column="telphone"/>
<result property="remark" column="remark"/>
</resultMap>
</mapper>
......@@ -27,4 +27,10 @@
<result property="delFlag" column="del_flag"/>
<result property="remarks" column="remarks"/>
</resultMap>
<select id="selectZhtjGljsdjqk" resultMap="zhtjGljsdjqkMap">
SELECT * FROM `t_zhtj_gljsdjqk` as tsd where area=#{area} and type in (${type}) and year = (
select max(year) maxyear from `t_zhtj_gljsdjqk`
)
</select>
</mapper>
......@@ -25,4 +25,32 @@
<result property="delFlag" column="del_flag"/>
<result property="remarks" column="remarks"/>
</resultMap>
<select id="electZhtjGllmqks" resultMap="zhtjGllmqkMap">
SELECT * FROM `t_zhtj_gllmqk` where type = #{type}
<if test="year==null or year==''">
and year=(
select max(year) maxyear from `t_zhtj_gllmqk`
)
</if>
<if test="year!=null and year!=''">
and year=#{year}
</if>
<if test="area!=null and area!=''">
and area=#{area}
</if>
</select>
<select id="selectOrdinary" resultType="Map">
SELECT sum(ypzlm_lqhnt) as ypzlm_lqhnt,sum(ypzlm_snhnt) as ypzlm_snhnt,sum(jypzlm) as jypzlm,sum(wpzlm) as wpzlm FROM `t_zhtj_gllmqk` where type in (${type})
<if test="year==null or year==''">
and year=(
select max(year) maxyear from `t_zhtj_gllmqk`
)
</if>
<if test="year!=null and year!=''">
and year=#{year}
</if>
<if test="area!=null and area!=''">
and area=#{area}
</if>
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论