| | |
| | | return new Response().setII(1,"添加成功"); |
| | | } |
| | | |
| | | @GetMapping("findByCategoryId") |
| | | @ApiOperation(value = "在线监测-查询拓扑图状态的显示/查询控制信息") |
| | | public Response findByCategoryId(@RequestParam int categoryId){ |
| | | return service.findByCategoryId(categoryId); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.factory; |
| | | |
| | | import com.whyc.pojo.PageParam; |
| | | |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | | public class TableInitFactory { |
| | | //获取PageParam默认数据集合 |
| | | public static List getPageParamInit(){ |
| | | LinkedList<PageParam> pageParams = new LinkedList<>(); |
| | | pageParams.add(new PageParam(1,"设备工作状态", 1, 1)); |
| | | pageParams.add(new PageParam(2,"设备通讯", 1, 1)); |
| | | pageParams.add(new PageParam(3,"设备温度", 1, 1)); |
| | | pageParams.add(new PageParam(4,"干接点", 1, 1)); |
| | | pageParams.add(new PageParam(5,"核容终止原因", 1, 1)); |
| | | pageParams.add(new PageParam(6,"操作失败原因", 1, 1)); |
| | | pageParams.add(new PageParam(7,"剩余天数", 1, 1)); |
| | | pageParams.add(new PageParam(8,"工作模式", 1, 1)); |
| | | pageParams.add(new PageParam(9,"组端电压", 1, 1)); |
| | | pageParams.add(new PageParam(10,"峰值电压", 1, 1)); |
| | | pageParams.add(new PageParam(11,"启动核容测试", 1, 2)); |
| | | pageParams.add(new PageParam(12,"停止测试", 1, 2)); |
| | | pageParams.add(new PageParam(13,"系统参数设置", 1, 2)); |
| | | pageParams.add(new PageParam(14,"清除告警", 1, 2)); |
| | | pageParams.add(new PageParam(15,"启动养护/除硫", 1, 2)); |
| | | pageParams.add(new PageParam(16,"停止养护/除硫", 1, 2)); |
| | | pageParams.add(new PageParam(17,"启动离线养护", 1, 2)); |
| | | pageParams.add(new PageParam(18,"停止离线养护", 1, 2)); |
| | | pageParams.add(new PageParam(19,"定期启动设备", 1, 2)); |
| | | pageParams.add(new PageParam(20,"重启设备", 1, 2)); |
| | | |
| | | pageParams.add(new PageParam(31,"蓄电池后台监控管理平台", 1, 5)); |
| | | |
| | | pageParams.add(new PageParam(32,"V1.0.5", 1, 6)); |
| | | |
| | | pageParams.add(new PageParam(33,"平台logo", 1, 7)); |
| | | pageParams.add(new PageParam(34,"uKey", 1, 7)); |
| | | pageParams.add(new PageParam(35,"人脸识别", 1, 7)); |
| | | pageParams.add(new PageParam(36,"签名", 1, 7)); |
| | | pageParams.add(new PageParam(37,"远程修改ip", 1, 7)); |
| | | pageParams.add(new PageParam(38,"启动放电添加人脸识别", 1, 7)); |
| | | |
| | | pageParams.add(new PageParam(39,"账号扫描策略", 1, 8)); |
| | | pageParams.add(new PageParam(40,"账号登录失败限制次数", 6, 9)); |
| | | pageParams.add(new PageParam(41,"账号登录失败锁定解锁策略", 1, 9)); |
| | | return pageParams; |
| | | } |
| | | } |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.PageParam; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PageParamMapper extends CustomMapper<PageParam>{ |
| | | void updateList(List<PageParam> pageParamList, int operationFlag); |
| | | |
| | | //判断tb_page_param表是否存在 |
| | | boolean exist(); |
| | | //查询tb_page_param表中数据总数 |
| | | int getCount(); |
| | | //创建表 |
| | | boolean createTable(); |
| | | //初始化表中数据 |
| | | boolean init(List<PageParam> list); |
| | | //根据 |
| | | List findByCategoryId(@Param("categoryId") int categoryId); |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private String fBSDeviceName; |
| | | |
| | | @TableField(value = "dev_version",exist = false) |
| | | private String devVersion; |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.apache.ibatis.type.Alias; |
| | | |
| | | /** |
| | |
| | | |
| | | @TableName(schema = "db_app_sys",value = "tb_page_param") |
| | | @Alias("PageParam") |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class PageParam { |
| | | |
| | | @TableId |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.factory.TableInitFactory; |
| | | import com.whyc.mapper.PageParamMapper; |
| | | import com.whyc.pojo.PageParam; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | public void addList(List<PageParam> pageParamList) { |
| | | mapper.insertBatchSomeColumn(pageParamList); |
| | | } |
| | | |
| | | //在线监测-查询拓扑图状态的显示/查询控制信息 |
| | | public Response findByCategoryId(int categoryId) { |
| | | boolean res=mapper.exist(); |
| | | List<PageParam> listparam=TableInitFactory.getPageParamInit(); |
| | | if(!res) { //表不存在,新建表,同时初始化参数 |
| | | mapper.createTable(); |
| | | mapper.init(listparam); |
| | | }else { |
| | | int count=mapper.getCount(); |
| | | if(count==0){ |
| | | boolean inited = mapper.init(listparam); |
| | | } |
| | | } |
| | | List list=mapper.findByCategoryId(categoryId); |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().set(1,pageInfo); |
| | | } |
| | | } |
| | |
| | | </choose> |
| | | |
| | | </update> |
| | | <select id="exist" resultType="java.lang.Boolean"> |
| | | select count(*) num from information_schema.TABLES t where t.TABLE_SCHEMA ='db_app_sys' and t.TABLE_NAME ='tb_page_param' |
| | | </select> |
| | | <select id="getCount" resultType="java.lang.Integer"> |
| | | select count(*) num from db_app_sys.tb_page_param |
| | | </select> |
| | | <update id="createTable" > |
| | | CREATE TABLE db_app_sys.tb_page_param ( |
| | | id int(11) NOT NULL AUTO_INCREMENT, |
| | | param varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '具体参数', |
| | | status int(1) DEFAULT NULL COMMENT '参数是否页面显示', |
| | | categoryId int(1) DEFAULT NULL COMMENT '参数分类,类目1,类目2', |
| | | PRIMARY KEY (id) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci |
| | | </update> |
| | | <insert id="init"> |
| | | <choose> |
| | | <when test="list.size>0"> |
| | | INSERT INTO db_app_sys.tb_page_param(id,param,status,categoryId) VALUES |
| | | <foreach collection="list" item="p" index="index" separator=","> |
| | | (#{p.id},#{p.param},#{p.status},#{p.categoryId}) |
| | | </foreach> |
| | | </when> |
| | | </choose> |
| | | </insert> |
| | | <select id="findByCategoryId" resultType="com.whyc.pojo.PageParam"> |
| | | select id,param,status from db_app_sys.tb_page_param |
| | | <where> |
| | | <if test="#{categoryId}!=null"> |
| | | categoryId=#{categoryId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |