| | |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>jfpt</artifactId> |
| | | <artifactId>blade-jfpts</artifactId> |
| | | <name>${project.artifactId}</name> |
| | | <version>${bladex.project.version</version> |
| | | <packaging>jar</packaging> |
| | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.jfpt.catalog.entitly.catalog; |
| | | import org.springblade.jfpt.catalog.service.catalogService; |
| | | import org.springblade.jfpt.catalog.vo.catalogVO; |
| | | import org.springblade.system.vo.DeptVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springblade.jfpt.catalog.wrapper.catalogWrapper; |
| | | |
| | |
| | | String result = format.format(today); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构 |
| | | */ |
| | | @GetMapping("/lazy-tree") |
| | | public R<List<catalogVO>> lazyTree(String tenantId, Long parentId, BladeUser bladeUser) { |
| | | List<catalogVO> tree = catalogService.lazyTree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), parentId); |
| | | return R.data(tree); |
| | | } |
| | | } |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Integer id; |
| | | private Long id; |
| | | @TableField("name") |
| | | private String name; |
| | | @TableField("pId") |
| | | private Integer pId; |
| | | private Long pId; |
| | | @TableField("eqid") |
| | | private String eqid; |
| | | private String tenant_id; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.springblade.jfpt.catalog.entitly.catalog; |
| | | import org.springblade.jfpt.catalog.vo.catalogVO; |
| | | import org.springblade.system.vo.DeptVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | List<Map<String, Object>> selectWar(String beginTime,String endTime); |
| | | |
| | | List selectCatalogEqNUmber(String pid); |
| | | |
| | | List<catalogVO> lazyTree(String tenantId, Long parentId); |
| | | } |
| | |
| | | <result column="name" property="name"/> |
| | | <result column="pId" property="pId"/> |
| | | <result column="eqid" property="eqid"/> |
| | | <result column="tenant_id" property="tenant_id"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode"> |
| | | <id column="id" property="id"/> |
| | | <result column="parent_id" property="parentId"/> |
| | | <result column="title" property="title"/> |
| | | <result column="value" property="value"/> |
| | | <result column="key" property="key"/> |
| | | <result column="has_children" property="hasChildren"/> |
| | | </resultMap> |
| | | |
| | | |
| | |
| | | SELECT COUNT(*) as cou,waringType FROM `sys_alarm` where DATE_FORMAT(alarmTime,'%Y-%m-%d')>=#{beginTime} and DATE_FORMAT(alarmTime,'%Y-%m-%d')<=#{endTime} GROUP BY waringType ORDER BY cou desc |
| | | </select> |
| | | |
| | | <select id="lazyTree" resultMap="treeNodeResultMap" > |
| | | SELECT |
| | | dept.id, |
| | | dept.pId as parent_id, |
| | | dept.name AS title, |
| | | dept.eqid AS "value", |
| | | dept.eqid AS "key", |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | sys_catalog |
| | | WHERE |
| | | pId = dept.id |
| | | ) AS "has_children" |
| | | FROM |
| | | sys_catalog dept |
| | | WHERE |
| | | dept.pId = #{param2} |
| | | <if test="param1!=null and param1!=''"> |
| | | and dept.tenant_id = #{param1} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.jfpt.catalog.entitly.catalog; |
| | | import org.springblade.jfpt.catalog.vo.catalogVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | List<Map<String, Object>> selectAddvcd(); |
| | | List<Map<String, Object>> selectEq(); |
| | | List<Map<String, Object>> selectWar(String beginTime,String endTime); |
| | | List<catalogVO> lazyTree(String tenantId, Long parentId); |
| | | } |
| | |
| | | import org.springblade.jfpt.catalog.entitly.catalog; |
| | | import org.springblade.jfpt.catalog.mapper.catalogMapper; |
| | | import org.springblade.jfpt.catalog.service.catalogService; |
| | | import org.springblade.jfpt.catalog.vo.catalogVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | public List<Map<String, Object>> selectWar(String beginTime,String endTime) { |
| | | return baseMapper.selectWar(beginTime, endTime); |
| | | } |
| | | |
| | | @Override |
| | | public List<catalogVO> lazyTree(String tenantId, Long parentId) { |
| | | return baseMapper.lazyTree(tenantId, parentId); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.springblade.jfpt.catalog.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.core.tool.node.INode; |
| | | import org.springblade.jfpt.catalog.entitly.catalog; |
| | | import org.springblade.system.vo.DeptVO; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 视图实体类 |
| | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "catalogVO对象", description = "catalogVO对象") |
| | | public class catalogVO extends catalog { |
| | | public class catalogVO extends catalog implements INode<catalogVO> { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键ID |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 父节点ID |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * 子孙节点 |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | private List<catalogVO> children; |
| | | |
| | | /** |
| | | * 是否有子孙节点 |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | private Boolean hasChildren; |
| | | |
| | | @Override |
| | | public List<catalogVO> getChildren() { |
| | | if (this.children == null) { |
| | | this.children = new ArrayList<>(); |
| | | } |
| | | return this.children; |
| | | } |
| | | } |
| | |
| | | #服务器端口 |
| | | server: |
| | | port: 9101 |
| | | port: 89 |
| | | |
| | | #数据源配置 |
| | | spring: |