Commit 2091fe80 by henry

提交代码

1 parent 236f6d3c
package org.arch.log.config;
package org.arch.log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import javax.servlet.DispatcherType;
@Slf4j
@Configuration
......
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.arch.log.config.LogConfiguration
\ No newline at end of file
org.arch.log.LogConfiguration
\ No newline at end of file
<?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="org.arch.log.mapper.SysEventLogMapper">
<resultMap id="BaseResultMap" type="org.arch.log.entity.SysEventLog">
<!--@Table sys_event_log-->
<result property="logId" column="log_id" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="ipAddr" column="ip_addr" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="eventType" column="event_type" jdbcType="VARCHAR"/>
<result property="eventContent" column="event_content" jdbcType="VARCHAR"/>
<result property="logType" column="log_type" jdbcType="VARCHAR"/>
<result property="logLev" column="log_lev" jdbcType="VARCHAR"/>
<result property="result" column="result" jdbcType="VARCHAR"/>
<result property="userCode" column="user_code" jdbcType="VARCHAR"/>
<result property="isRead" column="is_read" jdbcType="INTEGER"/>
<result property="requestTime" column="request_time" jdbcType="TIMESTAMP"/>
<result property="moduleName" column="module_name" jdbcType="VARCHAR"/>
<result property="requestUrl" column="request_url" jdbcType="VARCHAR"/>
<result property="requestType" column="request_type" jdbcType="VARCHAR"/>
<result property="errorMessage" column="error_message" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="BaseResultMap">
select
log_id, user_id, username, ip_addr, create_time, event_type, event_content, log_type, log_lev, is_warn, result, user_code, menu_id, menu_uri, is_read, request_time, request_params
from sys_event_log
where log_id = #{logId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="BaseResultMap">
select
log_id, user_id, username, ip_addr, create_time, event_type, event_content, log_type, log_lev, is_warn, result, user_code, menu_id, menu_uri, is_read, request_time, request_params
from sys_event_log
<where>
<if test="logId != null and logId != ''">
and log_id = #{logId}
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="username != null and username != ''">
and username = #{username}
</if>
<if test="ipAddr != null and ipAddr != ''">
and ip_addr = #{ipAddr}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="eventType != null and eventType != ''">
and event_type = #{eventType}
</if>
<if test="eventContent != null and eventContent != ''">
and event_content = #{eventContent}
</if>
<if test="logType != null and logType != ''">
and log_type = #{logType}
</if>
<if test="logLev != null and logLev != ''">
and log_lev = #{logLev}
</if>
<if test="isWarn != null">
and is_warn = #{isWarn}
</if>
<if test="result != null and result != ''">
and result = #{result}
</if>
<if test="userCode != null and userCode != ''">
and user_code = #{userCode}
</if>
<if test="menuId != null and menuId != ''">
and menu_id = #{menuId}
</if>
<if test="menuUri != null and menuUri != ''">
and menu_uri = #{menuUri}
</if>
<if test="isRead != null">
and is_read = #{isRead}
</if>
<if test="requestTime != null">
and request_time = #{requestTime}
</if>
<if test="requestParams != null and requestParams != ''">
and request_params = #{requestParams}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="BaseResultMap">
select
log_id, user_id, username, ip_addr, create_time, event_type, event_content, log_type, log_lev, is_warn, result, user_code, menu_id, menu_uri, is_read, request_time, request_params
from eadc.sys_event_log
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from sys_event_log
<where>
<if test="logId != null and logId != ''">
and log_id = #{logId}
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="username != null and username != ''">
and username = #{username}
</if>
<if test="ipAddr != null and ipAddr != ''">
and ip_addr = #{ipAddr}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="eventType != null and eventType != ''">
and event_type = #{eventType}
</if>
<if test="eventContent != null and eventContent != ''">
and event_content = #{eventContent}
</if>
<if test="logType != null and logType != ''">
and log_type = #{logType}
</if>
<if test="logLev != null and logLev != ''">
and log_lev = #{logLev}
</if>
<if test="isWarn != null">
and is_warn = #{isWarn}
</if>
<if test="result != null and result != ''">
and result = #{result}
</if>
<if test="userCode != null and userCode != ''">
and user_code = #{userCode}
</if>
<if test="menuId != null and menuId != ''">
and menu_id = #{menuId}
</if>
<if test="menuUri != null and menuUri != ''">
and menu_uri = #{menuUri}
</if>
<if test="isRead != null">
and is_read = #{isRead}
</if>
<if test="requestTime != null">
and request_time = #{requestTime}
</if>
<if test="requestParams != null and requestParams != ''">
and request_params = #{requestParams}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="logId" useGeneratedKeys="true">
insert into sys_event_log(log_id,user_id, username, ip_addr, create_time, event_type, event_content, log_type, log_lev, is_warn, result, user_code, menu_id, menu_uri, is_read, request_time, request_params ,cost_time)
values (#{logId},#{userId}, #{username}, #{ipAddr}, #{createTime}, #{eventType}, #{eventContent}, #{logType}, #{logLev}, #{isWarn}, #{result}, #{userCode}, #{menuId}, #{menuUri}, #{isRead}, #{requestTime}, #{requestParams}, #{costTime})
</insert>
<insert id="insertBatch" keyProperty="logId" useGeneratedKeys="true">
insert into sys_event_log(user_id, username, ip_addr, create_time, event_type, event_content, log_type, log_lev, is_warn, result, user_code, menu_id, menu_uri, is_read, request_time, request_params)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.userId}, #{entity.username}, #{entity.ipAddr}, #{entity.createTime}, #{entity.eventType}, #{entity.eventContent}, #{entity.logType}, #{entity.logLev}, #{entity.isWarn}, #{entity.result}, #{entity.userCode}, #{entity.menuId}, #{entity.menuUri}, #{entity.isRead}, #{entity.requestTime}, #{entity.requestParams})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="logId" useGeneratedKeys="true">
insert into sys_event_log(user_id, username, ip_addr, create_time, event_type, event_content, log_type, log_lev, is_warn, result, user_code, menu_id, menu_uri, is_read, request_time, request_params)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.userId}, #{entity.username}, #{entity.ipAddr}, #{entity.createTime}, #{entity.eventType}, #{entity.eventContent}, #{entity.logType}, #{entity.logLev}, #{entity.isWarn}, #{entity.result}, #{entity.userCode}, #{entity.menuId}, #{entity.menuUri}, #{entity.isRead}, #{entity.requestTime}, #{entity.requestParams})
</foreach>
on duplicate key update
user_id = values(user_id),
username = values(username),
ip_addr = values(ip_addr),
create_time = values(create_time),
event_type = values(event_type),
event_content = values(event_content),
log_type = values(log_type),
log_lev = values(log_lev),
is_warn = values(is_warn),
result = values(result),
user_code = values(user_code),
menu_id = values(menu_id),
menu_uri = values(menu_uri),
is_read = values(is_read),
request_time = values(request_time),
request_params = values(request_params)
</insert>
<!--通过主键修改数据-->
<update id="update">
update sys_event_log
<set>
<if test="userId != null and userId != ''">
user_id = #{userId},
</if>
<if test="username != null and username != ''">
username = #{username},
</if>
<if test="ipAddr != null and ipAddr != ''">
ip_addr = #{ipAddr},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="eventType != null and eventType != ''">
event_type = #{eventType},
</if>
<if test="eventContent != null and eventContent != ''">
event_content = #{eventContent},
</if>
<if test="logType != null and logType != ''">
log_type = #{logType},
</if>
<if test="logLev != null and logLev != ''">
log_lev = #{logLev},
</if>
<if test="isWarn != null">
is_warn = #{isWarn},
</if>
<if test="result != null and result != ''">
result = #{result},
</if>
<if test="userCode != null and userCode != ''">
user_code = #{userCode},
</if>
<if test="menuId != null and menuId != ''">
menu_id = #{menuId},
</if>
<if test="menuUri != null and menuUri != ''">
menu_uri = #{menuUri},
</if>
<if test="isRead != null">
is_read = #{isRead},
</if>
<if test="requestTime != null">
request_time = #{requestTime},
</if>
<if test="requestParams != null and requestParams != ''">
request_params = #{requestParams},
</if>
</set>
where log_id = #{logId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from sys_event_log where log_id = #{logId}
</delete>
</mapper>
......@@ -11,7 +11,7 @@ import org.arch.common.modules.archoverall.vo.ArchiViewVO;
import java.util.List;
public interface ArchiTotalAssertMapper extends BaseMapper {
public interface ArchiTotalAssetMapper extends BaseMapper {
/**
* 总体架构资产自动图形化
......
......@@ -34,7 +34,7 @@ import org.arch.common.modules.archoverall.entity.AssetInfo;
import org.arch.overall.mapper.ArchiAbilityAssetsRelationMapper;
import org.arch.overall.mapper.ArchiAssertMapper;
import org.arch.overall.mapper.ArchiMetaModelMapper;
import org.arch.overall.mapper.ArchiTotalAssertMapper;
import org.arch.overall.mapper.ArchiTotalAssetMapper;
import org.arch.overall.service.ArchiAssetService;
import org.arch.overall.utils.MxFileUtil;
import org.springframework.stereotype.Service;
......@@ -54,7 +54,7 @@ import static cn.hutool.core.collection.CollUtil.isEmpty;
@Slf4j
public class ArchiAssertServiceImpl implements ArchiAssetService {
private final ArchiTotalAssertMapper archiTotalAssertMapper;
private final ArchiTotalAssetMapper archiTotalAssertMapper;
private final ArchiAssertMapper archiMapper;
......
server:
port: 17003
nacos:
server-addr: 192.168.0.200:18848
server-addr: 192.168.0.210:18848
username: nacos
password: nacos
namespace: ${NAMESPACE:arch}
......
<?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="org.arch.overall.mapper.ArchiTotalAssetMapper">
<resultMap id="ArchiAssetResulMap" type="org.arch.common.modules.archoverall.vo.ArchiAssetVO">
<id column="asset_id" property="assetId"/>
<result column="asset_name" property="assetName"/>
<result column="archi_belong_id" property="archiBelongId"/>
<collection property="subList" ofType="org.arch.common.modules.archoverall.vo.ArchiAssetVO">
<id column="sub_asset_id" property="assetId"/>
<result column="sub_asset_code" property="assetCode"/>
<result column="sub_asset_name" property="assetName"/>
<result column="sub_parent_asset_id" property="parentAssetId"/>
<result column="sub_icon" property="icon"/>
<result column="sub_icon_name" property="iconName"/>
<result column="sub_color" property="color"/>
</collection>
</resultMap>
<resultMap id="ArchiAssetTreeResulMap" type="org.arch.common.modules.archoverall.vo.ArchiAssetVO">
<id column="archi_ele_id" property="archiEleId"/>
<result column="ele_name" property="eleName"/>
<result column="asset_id" property="assetId"/>
<result column="asset_name" property="assetName"/>
<result column="parent_asset_id" property="parentAssetId"/>
</resultMap>
<resultMap id="AutoArchiAssetResulMap" type="org.arch.common.modules.archoverall.vo.ArchiAssetVO">
<id column="asset_id" property="assetId"/>
<result column="asset_name" property="assetName"/>
<result column="asset_number" property="assetNumber"/>
<result column="archi_belong_id" property="archiBelongId"/>
<result column="asset_code" property="assetCode"/>
<result column="parent_asset_id" property="parentAssetId"/>
<result column="parent_asset_name" property="parentAssetName"/>
<result column="element_id" property="elementId"/>
<result column="element_name" property="elementName"/>
</resultMap>
<!--总体架构资产-->
<sql id="assetSql">
and aai.state = 1
and aai.del_flag = 0
and aai.archi_stage = 1
</sql>
<!--总体架构可视化展示-->
<select id="treeListView" resultMap="ArchiAssetTreeResulMap">
SELECT aai.archi_ele_id,
aai.ele_name,
aai.asset_id,
aai.asset_name,
aai.parent_asset_id
from archi_asset_info aai
<where>
<if test="assetName != null and assetName != ''">
and aai.asset_name like concat('%', #{assetName}, '%')
</if>
<if test="versionId != null">
and aai.version_id = #{versionId}
</if>
<if test="archiBelongId != null">
and aai.archi_belong_id = #{archiBelongId}
</if>
<if test="archiAssetState != null">
and aai.archi_asset_state = #{archiAssetState}
</if>
<include refid="assetSql"/>
and aai.parent_asset_id is not null
</where>
order by aai.sort
</select>
<!--总体架构资产智能搜索-->
<select id="treeList" resultMap="ArchiAssetResulMap">
with archi_belong as (select amdd.value as belong_id,
amdd.label as name
from archi_model_dict_detail amdd
left join archi_model_dict amd on (amd.id = amdd.dict_id)
where amd.type_value = 'archi_belong'
and amd.del_flag = 0
and amd.state = 1
and amdd.del_flag = 0
order by amdd.sort)
SELECT ab.belong_id as asset_id,
ab.name as asset_name,
aai.archi_belong_id,
aai.asset_id as sub_asset_id,
concat(aai.archi_belong_id, '-', aai.asset_id) as sub_asset_code,
aai.asset_name as sub_asset_name,
aai.parent_asset_id as sub_parent_asset_id,
gmi.graph_name as sub_icon_name,
gmi.icon as sub_icon,
aai.color as sub_color
from archi_belong ab
left join archi_asset_info aai on
(aai.archi_belong_id = ab.belong_id and aai.state = 1
and aai.del_flag = 0 and aai.archi_asset_state = 2 and aai.archi_stage = 1)
left join graph_meta_info gmi on (aai.graph_id = gmi.graph_id)
<where>
<if test="assetName != null and assetName != ''">
and aai.asset_name like concat('%', #{assetName}, '%')
</if>
<if test="versionId != null">
and aai.version_id = #{versionId}
</if>
<if test="archiBelongId != null">
and aai.archi_belong_id = #{archiBelongId}
</if>
</where>
</select>
<!--根据项目查询架构视图-->
<select id="queryView" resultType="org.arch.common.modules.archoverall.vo.ArchiViewVO">
select avd.view_details_id,
avd.version as view_detail_name,
av.view_id,
av.view_name,
gr.icon as meta_model_svg,
gr.content as meta_model_data
from archi_view_relation avr
left join archi_view_details avd on (avr.archi_views_detail_id = avd.view_details_id)
left join archi_view av on (avd.view_id = av.view_id)
left join graph_repository gr on (avd.graph_id = gr.graph_id)
<where>
<if test="prjId != null">
and avr.prj_id = #{prjId}
</if>
<if test="archiBelongId != null">
and av.archi_belong_id = #{archiBelongId}
</if>
<if test="archiStage != null">
and av.archi_stage = #{archiStage}
</if>
</where>
</select>
<!--查询架构版本-->
<select id="queryArchiVersion" resultType="org.arch.common.modules.archoverall.vo.ArchiVersionVO">
select aav.version_id,
aav.version_name
from archi_asset_version aav
group by aav.version_id
</select>
<!-- 总体架构资产自动图形 -->
<select id="automaticGraphing" resultMap="AutoArchiAssetResulMap">
select aai.archi_belong_id,
aai.asset_id,
aai.asset_code,
aai.asset_name,
aai.parent_asset_id,
aai2.asset_name as parent_asset_name,
ae.element_id,
ae.element_name
from archi_asset_info aai
left join archi_asset_info aai2 on aai.parent_asset_id = aai2.asset_id
left join archi_element ae on aai.archi_ele_id = ae.element_id
<where>
and aai.archi_asset_state = 2
and aai.state = 1
and aai.del_flag = 0
and aai.archi_stage = 1
<if test="archiBelongId != null">
and aai.archi_belong_id = #{archiBelongId}
</if>
<if test="assetName != null and assetName != ''">
and aai.asset_name like concat('%', #{assetName}, '%')
</if>
<if test="parentAssetId != null">
and aai.parent_asset_id = #{parentAssetId}
</if>
</where>
</select>
<!--根据元素查询对应的资产-->
<select id="findAssertByElementId" resultMap="AutoArchiAssetResulMap">
select aai.asset_id,
aai.asset_number,
aai.asset_name
from archi_asset_info aai
left join archi_element ae on aai.archi_ele_id = ae.element_id
<where>
and aai.archi_asset_state = 2
and aai.state = 1
and aai.del_flag = 0
and aai.archi_stage = 1
<if test="elementId != null">
and ae.element_id = #{elementId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!