数据库版本研究配置

This commit is contained in:
lvleigang 2024-05-23 15:33:25 +08:00
parent 6b422b6e13
commit bde253bf45
30 changed files with 8049 additions and 19 deletions

View File

@ -10,4 +10,34 @@
获取单个对象 getEntity
修改 updateEntity
删除 deleteEntity
启用停用 enableDisableEntity
启用停用 enableDisableEntity
Flyway
比较文件先后顺序规则:左对齐原则缺位用0代替
1.0.0.1 比 1.0.0 版本高。
1.0.10 比 1.0.9.4 版本高。
1.0.0_1 比 1.0.0 版本高。
1_0_0_1 比 1_0_0 版本高。
1.0.10 和 1.0.010 版本号一样高,这是因为每个版本号部分的前导 0 会被忽略。
Flyway 将 SQL 文件分为 Versioned 、Repeatable 和 Undo 三种:
Versioned 用于版本升级,每个版本有唯一的版本号并只能执行一次。
Repeatable 可重复执行,当 Flyway 检测到 Repeatable 类型的 SQL 脚本的 checksum 有变动Flyway 就会重新执行该脚本,它并不用于版本更新,这类的 migration 总是在 Versioned 执行之后才被执行。
Undo 用于撤销具有相同版本的版本化迁移带来的影响。但是该回滚过于粗暴,过于机械化,一般不推荐使用。一般建议使用 Versioned 模式来解决。
Prefix 可配置,前缀标识,默认值 V 表示 Versioned R 表示 Repeatable U 表示 Undo。
Version 标识版本号, 由一个或多个数字构成,数字之间的分隔符可用点 . 或下划线 _。
Separator 可配置,用于分隔版本标识与描述信息,默认为两个下划线 __
Description 描述信息,文字之间可以用下划线 _ 或空格 分隔。
Suffix 可配置,后续标识,默认为 .sql。
例如:
V3.0.1__initialize.sql 只执行一次
V3.0.2__test_insert.sql 这个文件会在V3.0.1__initialize.sql之后执行且只执行一次
R__TRUNCATE_bd_app.sql 这个文件会执行多次但是会校验是否checksum一般不使用用:注意因为多次执行所以不能有版本号
**校验checksum,简单来说就是文件的行数据发生改变时候会执行,如果内容不变也是不会去执行的**
表flyway_schema_history会记录sql执行的情况
本项目需要的sql统一放置到resources/flyway下

View File

@ -5,6 +5,7 @@ import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.druid.DruidDyna
import com.hzya.frame.DataSource.impl.DynamicDataSourceAssistConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
@ -17,7 +18,7 @@ import org.springframework.context.annotation.ImportResource;
@ImportResource(locations = {"classpath:cfgHome/**/spring/spring-*.xml"})
@Import({DruidDynamicDataSourceConfiguration.class, DynamicDataSourceCreatorAutoConfiguration.class, DynamicDataSourceAssistConfiguration.class})
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, FlywayAutoConfiguration.class})
public class WebappApplication {
public static void main(String[] args) {

View File

@ -2,7 +2,7 @@
logging:
#日志级别 指定目录级别
level:
root: error
root: warn
encodings: UTF-8
file:
# 日志保存路径
@ -12,9 +12,9 @@ spring:
dynamic:
datasource:
master:
url: jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: bd993088e8a7c3dc5f44441617f9b4bf
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径

View File

@ -12,9 +12,14 @@ spring:
dynamic:
datasource:
master:
url: jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# url: jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# url: jdbc:mysql://hzya.ufyct.com:9096/businesscenterauto?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# username: root
# password: bd993088e8a7c3dc5f44441617f9b4bf
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: bd993088e8a7c3dc5f44441617f9b4bf
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径

View File

@ -12,9 +12,9 @@ spring:
dynamic:
datasource:
master:
url: jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: bd993088e8a7c3dc5f44441617f9b4bf
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径

View File

@ -6,6 +6,24 @@ server:
tomcat:
uri-encoding: utf-8
spring:
flyway:
# 启动flyway migration, 默认为true
enabled: true
# flyway 的 clean 命令会删除指定 schema 下的所有 table, 生产务必禁掉。这个默认值是 false 理论上作为默认配置是不科学的。
clean-disabled: true
# SQL 脚本的目录,多个路径使用逗号分隔 默认值 classpath:db/migration
locations: classpath:flyway
# - classpath:flyway
# metadata 版本控制历史表 默认 flyway_schema_history
table: flyway_schema_history
# 如果没有 flyway_schema_history 这个 metadata 表, 在执行 flyway migrate 命令之前, 必须先执行 flyway baseline 命令
# 设置为 true 后 flyway 将在需要 baseline 的时候, 自动执行一次 baseline。
baseline-on-migrate: true
validate-on-migrate: true
sql-migration-prefix: V
sql-migration-separator: __
sql-migration-suffixes: .sql
placeholder-replacement: false
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8

File diff suppressed because one or more lines are too long

26
pom.xml
View File

@ -175,7 +175,10 @@
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
@ -364,9 +367,22 @@
<version>4.0.21</version>
<type>pom</type>
</dependency>
<!-- flyway依赖包 -->
<!-- <dependency>-->
<!-- <groupId>org.flywaydb</groupId>-->
<!-- <artifactId>flyway-core</artifactId>-->
<!-- <version>5.2.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>8.5.13</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
<version>8.5.13</version>
</dependency>
</dependencies>
<build>
@ -425,6 +441,7 @@
<include>**/*.xdb</include>
<!-- <include>**/*.jpg</include>-->
<include>**/*.txt</include>
<include>**/*.sql</include>
</includes>
<filtering>true</filtering>
</resource>
@ -439,6 +456,7 @@
<include>**/*.json</include>
<include>**/*.txt</include>
<!-- <include>**/*.jpg</include>-->
<include>**/*.sql</include>
</includes>
<filtering>true</filtering>

View File

@ -43,7 +43,7 @@
WHERE
sts = 'Y'
GROUP BY
api_id
api_id,app_id
) a
left join sys_application_api api on api.id = a.api_id and api.sts = 'Y'
WHERE api.id is not null
@ -83,11 +83,11 @@ WHERE
WHERE sts = 'Y' and status = '4' and
create_time BETWEEN DATE_SUB( NOW(), INTERVAL 6 DAY ) AND NOW()
GROUP BY
DATE_FORMAT( create_time, '%Y%m%d' )
DATE_FORMAT( create_time, '%Y-%m-%d' )
ORDER BY
DATE_FORMAT(
create_time,
'%Y%m%d')
'%Y-%m-%d')
</select>
<!-- 查询 采用==查询 -->
<select id="sevensuccessnum" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
@ -99,11 +99,11 @@ WHERE
WHERE sts = 'Y' and status = '3' and
create_time BETWEEN DATE_SUB( NOW(), INTERVAL 6 DAY ) AND NOW()
GROUP BY
DATE_FORMAT( create_time, '%Y%m%d' )
DATE_FORMAT( create_time, '%Y-%m-%d' )
ORDER BY
DATE_FORMAT(
create_time,
'%Y%m%d')
'%Y-%m-%d')
</select>
</mapper>

View File

@ -0,0 +1,15 @@
package com.hzya.frame.report.reportAccredit.dao;
import com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* 报表授权表(report_accredit: table)表数据库访问层
*
* @author makejava
* @since 2024-05-21 15:02:11
*/
public interface IReportAccreditDao extends IBaseDao<ReportAccreditEntity, String> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.report.reportAccredit.dao.impl;
import com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity;
import com.hzya.frame.report.reportAccredit.dao.IReportAccreditDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* 报表授权表(ReportAccredit)表数据库访问层
*
* @author makejava
* @since 2024-05-21 15:02:11
*/
@Repository(value = "ReportAccreditDaoImpl")
public class ReportAccreditDaoImpl extends MybatisGenericDao<ReportAccreditEntity, String> implements IReportAccreditDao{
}

View File

@ -0,0 +1,55 @@
package com.hzya.frame.report.reportAccredit.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 报表授权表(ReportAccredit)实体类
*
* @author makejava
* @since 2024-05-21 15:02:12
*/
public class ReportAccreditEntity extends BaseEntity {
/** 权限赋予对象id */
private String objectId;
/** 报表ID */
private String reportId;
/** 权限类型1、应用2、人员 */
private String kindId;
/** 公司id */
private String companyId;
public String getObjectId() {
return objectId;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId;
}
public String getKindId() {
return kindId;
}
public void setKindId(String kindId) {
this.kindId = kindId;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
}

View File

@ -0,0 +1,241 @@
<?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.hzya.frame.report.reportAccredit.dao.impl.ReportAccreditDaoImpl">
<resultMap id="get-ReportAccreditEntity-result" type="com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="objectId" column="object_id" jdbcType="VARCHAR"/>
<result property="reportId" column="report_id" jdbcType="VARCHAR"/>
<result property="kindId" column="kind_id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "ReportAccreditEntity_Base_Column_List">
id
,object_id
,report_id
,kind_id
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-ReportAccreditEntity-result">
select
<include refid="ReportAccreditEntity_Base_Column_List" />
from report_accredit where sts = 'Y' and id = #{id}
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-ReportAccreditEntity-result" parameterType = "com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity">
select
<include refid="ReportAccreditEntity_Base_Column_List" />
from report_accredit
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="objectId != null and objectId != ''"> and object_id = #{objectId} </if>
<if test="reportId != null and reportId != ''"> and report_id = #{reportId} </if>
<if test="kindId != null and kindId != ''"> and kind_id = #{kindId} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity">
select count(1) from report_accredit
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="objectId != null and objectId != ''"> and object_id = #{objectId} </if>
<if test="reportId != null and reportId != ''"> and report_id = #{reportId} </if>
<if test="kindId != null and kindId != ''"> and kind_id = #{kindId} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
and sts='Y'
</trim>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-ReportAccreditEntity-result" parameterType = "com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity">
select
<include refid="ReportAccreditEntity_Base_Column_List" />
from report_accredit
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="objectId != null and objectId != ''"> and object_id like concat('%',#{objectId},'%') </if>
<if test="reportId != null and reportId != ''"> and report_id like concat('%',#{reportId},'%') </if>
<if test="kindId != null and kindId != ''"> and kind_id like concat('%',#{kindId},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="ReportAccreditentity_list_or" resultMap="get-ReportAccreditEntity-result" parameterType = "com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity">
select
<include refid="ReportAccreditEntity_Base_Column_List" />
from report_accredit
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="objectId != null and objectId != ''"> or object_id = #{objectId} </if>
<if test="reportId != null and reportId != ''"> or report_id = #{reportId} </if>
<if test="kindId != null and kindId != ''"> or kind_id = #{kindId} </if>
<if test="sorts != null"> or sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
<if test="create_time != null"> or create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity" >
insert into report_accredit(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="objectId != null and objectId != ''"> object_id , </if>
<if test="reportId != null and reportId != ''"> report_id , </if>
<if test="kindId != null and kindId != ''"> kind_id , </if>
<if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="modify_time != null"> modify_time , </if>
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> #{id} ,</if>
<if test="objectId != null and objectId != ''"> #{objectId} ,</if>
<if test="reportId != null and reportId != ''"> #{reportId} ,</if>
<if test="kindId != null and kindId != ''"> #{kindId} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" >
insert into report_accredit(id, object_id, report_id, kind_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.id},#{entity.objectId},#{entity.reportId},#{entity.kindId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" >
insert into report_accredit(id, object_id, report_id, kind_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.id},#{entity.objectId},#{entity.reportId},#{entity.kindId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
</foreach>
on duplicate key update
id = values(id),
object_id = values(object_id),
report_id = values(report_id),
kind_id = values(kind_id),
sorts = values(sorts),
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity" >
update report_accredit set
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id = #{id},</if>
<if test="objectId != null and objectId != ''"> object_id = #{objectId},</if>
<if test="reportId != null and reportId != ''"> report_id = #{reportId},</if>
<if test="kindId != null and kindId != ''"> kind_id = #{kindId},</if>
<if test="sorts != null"> sorts = #{sorts},</if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
</trim>
where = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity" >
update report_accredit set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity" >
update report_accredit set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="objectId != null and objectId != ''"> and object_id = #{objectId} </if>
<if test="reportId != null and reportId != ''"> and report_id = #{reportId} </if>
<if test="kindId != null and kindId != ''"> and kind_id = #{kindId} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from report_accredit where = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,12 @@
package com.hzya.frame.report.reportAccredit.service;
import com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity;
import com.hzya.frame.basedao.service.IBaseService;
/**
* 报表授权表(ReportAccredit)表服务接口
*
* @author makejava
* @since 2024-05-21 15:02:12
*/
public interface IReportAccreditService extends IBaseService<ReportAccreditEntity, String>{
}

View File

@ -0,0 +1,26 @@
package com.hzya.frame.report.reportAccredit.service.impl;
import com.hzya.frame.report.reportAccredit.entity.ReportAccreditEntity;
import com.hzya.frame.report.reportAccredit.dao.IReportAccreditDao;
import com.hzya.frame.report.reportAccredit.service.IReportAccreditService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
/**
* 报表授权表(ReportAccredit)表服务实现类
*
* @author makejava
* @since 2024-05-21 15:02:12
*/
@Service(value = "reportAccreditService")
public class ReportAccreditServiceImpl extends BaseService<ReportAccreditEntity, String> implements IReportAccreditService {
private IReportAccreditDao reportAccreditDao;
@Autowired
public void setReportAccreditDao(IReportAccreditDao dao) {
this.reportAccreditDao = dao;
this.dao = dao;
}
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.report.reportClassify.dao;
import com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* 报表分类表(report_classify: table)表数据库访问层
*
* @author makejava
* @since 2024-05-21 15:03:14
*/
public interface IReportClassifyDao extends IBaseDao<ReportClassifyEntity, String> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.report.reportClassify.dao.impl;
import com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity;
import com.hzya.frame.report.reportClassify.dao.IReportClassifyDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* 报表分类表(ReportClassify)表数据库访问层
*
* @author makejava
* @since 2024-05-21 15:03:14
*/
@Repository(value = "ReportClassifyDaoImpl")
public class ReportClassifyDaoImpl extends MybatisGenericDao<ReportClassifyEntity, String> implements IReportClassifyDao{
}

View File

@ -0,0 +1,84 @@
package com.hzya.frame.report.reportClassify.entity;
import java.util.Date;
import java.util.List;
import com.hzya.frame.sysnew.organ.entity.SysOrganEntity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 报表分类表(ReportClassify)实体类
*
* @author makejava
* @since 2024-05-21 15:03:14
*/
public class ReportClassifyEntity extends BaseEntity {
/** 编码 */
private String code;
/** 名称 */
private String name;
/** 上级id */
private String parentId;
private String parentName;
/** 公司id */
private String companyId;
private List<ReportClassifyEntity> children;
private String label;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<ReportClassifyEntity> getChildren() {
return children;
}
public void setChildren(List<ReportClassifyEntity> children) {
this.children = children;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
}

View File

@ -0,0 +1,240 @@
<?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.hzya.frame.report.reportClassify.dao.impl.ReportClassifyDaoImpl">
<resultMap id="get-ReportClassifyEntity-result" type="com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "ReportClassifyEntity_Base_Column_List">
id
,code
,name
,parent_id
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-ReportClassifyEntity-result">
select
<include refid="ReportClassifyEntity_Base_Column_List" />
from report_classify where sts = 'Y' and id = #{id}
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-ReportClassifyEntity-result" parameterType = "com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity">
select
<include refid="ReportClassifyEntity_Base_Column_List" />
from report_classify
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="code != null and code != ''"> and code = #{code} </if>
<if test="name != null and name != ''"> and name = #{name} </if>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity">
select count(1) from report_classify
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="code != null and code != ''"> and code = #{code} </if>
<if test="name != null and name != ''"> and name = #{name} </if>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
and sts='Y'
</trim>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-ReportClassifyEntity-result" parameterType = "com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity">
select
<include refid="ReportClassifyEntity_Base_Column_List" />
from report_classify
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="code != null and code != ''"> and code like concat('%',#{code},'%') </if>
<if test="name != null and name != ''"> and name like concat('%',#{name},'%') </if>
<if test="parentId != null and parentId != ''"> and parent_id like concat('%',#{parentId},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="ReportClassifyentity_list_or" resultMap="get-ReportClassifyEntity-result" parameterType = "com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity">
select
<include refid="ReportClassifyEntity_Base_Column_List" />
from report_classify
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> or id = #{id} </if>
<if test="code != null and code != ''"> or code = #{code} </if>
<if test="name != null and name != ''"> or name = #{name} </if>
<if test="parentId != null and parentId != ''"> or parent_id = #{parentId} </if>
<if test="sorts != null"> or sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
<if test="create_time != null"> or create_time = #{create_time} </if>
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity" >
insert into report_classify(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if>
<if test="code != null and code != ''"> code , </if>
<if test="name != null and name != ''"> name , </if>
<if test="parentId != null and parentId != ''"> parent_id , </if>
<if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
<if test="modify_time != null"> modify_time , </if>
<if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> #{id} ,</if>
<if test="code != null and code != ''"> #{code} ,</if>
<if test="name != null and name != ''"> #{name} ,</if>
<if test="parentId != null and parentId != ''"> #{parentId} ,</if>
<if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
<if test="modify_time != null"> #{modify_time} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" >
insert into report_classify(id, code, name, parent_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.id},#{entity.code},#{entity.name},#{entity.parentId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" >
insert into report_classify(id, code, name, parent_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.id},#{entity.code},#{entity.name},#{entity.parentId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
</foreach>
on duplicate key update
id = values(id),
code = values(code),
name = values(name),
parent_id = values(parent_id),
sorts = values(sorts),
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity" >
update report_classify set
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id = #{id},</if>
<if test="code != null and code != ''"> code = #{code},</if>
<if test="name != null and name != ''"> name = #{name},</if>
<if test="parentId != null and parentId != ''"> parent_id = #{parentId},</if>
<if test="sorts != null"> sorts = #{sorts},</if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null"> modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
</trim>
where = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity" >
update report_classify set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity" >
update report_classify set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="code != null and code != ''"> and code = #{code} </if>
<if test="name != null and name != ''"> and name = #{name} </if>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
<if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from report_classify where = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,65 @@
package com.hzya.frame.report.reportClassify.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* 报表分类表(ReportClassify)表服务接口
*
* @author makejava
* @since 2024-05-21 15:03:14
*/
public interface IReportClassifyService extends IBaseService<ReportClassifyEntity, String>{
/**
* @Author lvleigang
* @Description 查询分类树
* @Date 3:14 下午 2024/5/21
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity queryEntityTree(JSONObject jsonObject);
/**
* @Author lvleigang
* @Description 保存分类
* @Date 3:16 下午 2024/5/21
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity saveEntity(JSONObject jsonObject);
/**
* @Author lvleigang
* @Description 获取分类
* @Date 3:16 下午 2024/5/21
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity getEntity(JSONObject jsonObject);
/**
* @Author lvleigang
* @Description 修改分类
* @Date 3:16 下午 2024/5/21
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity updateEntity(JSONObject jsonObject);
/**
* @Author lvleigang
* @Description 删除分类
* @Date 3:16 下午 2024/5/21
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity deleteEntity(JSONObject jsonObject);
}

View File

@ -0,0 +1,230 @@
package com.hzya.frame.report.reportClassify.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.report.reportClassify.entity.ReportClassifyEntity;
import com.hzya.frame.report.reportClassify.dao.IReportClassifyDao;
import com.hzya.frame.report.reportClassify.service.IReportClassifyService;
import com.hzya.frame.report.reportManage.dao.IReportManageDao;
import com.hzya.frame.report.reportManage.entity.ReportManageEntity;
import com.hzya.frame.sysnew.organ.entity.SysOrganEntity;
import com.hzya.frame.sysnew.person.entity.SysPersonEntity;
import com.hzya.frame.sysnew.userCompany.entity.SysUserCompanyEntity;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.ArrayList;
import java.util.List;
/**
* 报表分类表(ReportClassify)表服务实现类
*
* @author makejava
* @since 2024-05-21 15:03:14
*/
@Service(value = "reportClassifyService")
public class ReportClassifyServiceImpl extends BaseService<ReportClassifyEntity, String> implements IReportClassifyService {
private IReportClassifyDao reportClassifyDao;
@Resource
private IReportManageDao reportManageDao;
@Autowired
public void setReportClassifyDao(IReportClassifyDao dao) {
this.reportClassifyDao = dao;
this.dao = dao;
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询分类树
* @Date 3:14 下午 2024/5/21
**/
@Override
public JsonResultEntity queryEntityTree(JSONObject jsonObject) {
ReportClassifyEntity entity = getData("jsonStr", jsonObject, ReportClassifyEntity.class);
if (entity == null) {
entity = new ReportClassifyEntity();
}
List<ReportClassifyEntity> returnEntity = new ArrayList<>();
//查询符合条件的组织数据
List<ReportClassifyEntity> reportClassifyEntities = reportClassifyDao.queryByLike(entity);
if (reportClassifyEntities == null || reportClassifyEntities.size() == 0) {
ReportClassifyEntity first = new ReportClassifyEntity();
first.setCode("1");
first.setName("系统");
first.setParentId("0");
first.setCreate();
reportClassifyDao.save(first);
reportClassifyEntities = new ArrayList<>();
reportClassifyEntities.add(first);
}
if (reportClassifyEntities != null && reportClassifyEntities.size() > 0) {
for (int i = 0; i < reportClassifyEntities.size(); i++) {
if ("0".equals(reportClassifyEntities.get(i).getParentId())) {
recursiveSetTree(reportClassifyEntities.get(i), reportClassifyEntities);
reportClassifyEntities.get(i).setLabel("(" + reportClassifyEntities.get(i).getCode() + ")" + reportClassifyEntities.get(i).getName());
returnEntity.add(reportClassifyEntities.get(i));
}
}
}
return BaseResult.getSuccessMessageEntity("查询组织树成功", returnEntity);
}
/**
* @param reportClassifyEntity
* @param reportClassifyEntityList
* @return void
* @Author lvleigang
* @Description 递归设置树
* @Date 9:19 上午 2024/3/28
**/
private void recursiveSetTree(ReportClassifyEntity reportClassifyEntity, List<ReportClassifyEntity> reportClassifyEntityList) {
List<ReportClassifyEntity> children = new ArrayList<>();
for (int i = 0; i < reportClassifyEntityList.size(); i++) {
if (reportClassifyEntityList.get(i).getParentId() != null && !"".equals(reportClassifyEntityList.get(i).getParentId())) {
if (reportClassifyEntity.getId().equals(reportClassifyEntityList.get(i).getParentId())) {
reportClassifyEntityList.get(i).setLabel("(" + reportClassifyEntityList.get(i).getCode() + ")" + reportClassifyEntityList.get(i).getName());
children.add(reportClassifyEntityList.get(i));
recursiveSetTree(reportClassifyEntityList.get(i), reportClassifyEntityList);
}
}
}
reportClassifyEntity.setChildren(children);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 保存分类
* @Date 3:16 下午 2024/5/21
**/
@Override
public JsonResultEntity saveEntity(JSONObject jsonObject) {
ReportClassifyEntity entity = getData("jsonStr", jsonObject, ReportClassifyEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getCode() == null || "".equals(entity.getCode())) {
return BaseResult.getFailureMessageEntity("请先输入编码");
}
if (entity.getName() == null || "".equals(entity.getName())) {
return BaseResult.getFailureMessageEntity("请先输入名称");
}
if (entity.getParentId() == null || "".equals(entity.getParentId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setCreate();
//保存
reportClassifyDao.save(entity);
return BaseResult.getSuccessMessageEntity("保存分类成功", entity);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 获取分类
* @Date 3:16 下午 2024/5/21
**/
@Override
public JsonResultEntity getEntity(JSONObject jsonObject) {
ReportClassifyEntity entity = getData("jsonStr", jsonObject, ReportClassifyEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity = reportClassifyDao.get(entity.getId());
if (entity == null) {
return BaseResult.getFailureMessageEntity("获取组织失败");
}
if (entity.getParentId() != null && !"0".equals(entity.getParentId())) {
ReportClassifyEntity parentEntity = reportClassifyDao.get(entity.getParentId());
if (entity != null) {
entity.setParentName(parentEntity.getName());
}
}
return BaseResult.getSuccessMessageEntity("获取分类成功", entity);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 修改分类
* @Date 3:16 下午 2024/5/21
**/
@Override
public JsonResultEntity updateEntity(JSONObject jsonObject) {
ReportClassifyEntity entity = getData("jsonStr", jsonObject, ReportClassifyEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getName() == null || "".equals(entity.getName())) {
return BaseResult.getFailureMessageEntity("请先输入名称");
}
if (entity.getCode() == null || "".equals(entity.getCode())) {
return BaseResult.getFailureMessageEntity("请先输入编码");
}
if (entity.getParentId() == null || "".equals(entity.getParentId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();
//保存
reportClassifyDao.update(entity);
return BaseResult.getSuccessMessageEntity("修改分类成功", entity);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 删除分类
* @Date 3:16 下午 2024/5/21
**/
@Override
public JsonResultEntity deleteEntity(JSONObject jsonObject) {
ReportClassifyEntity entity = getData("jsonStr", jsonObject, ReportClassifyEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (!checkUse(entity)) {
return BaseResult.getFailureMessageEntity("当前组织已经使用,不允许删除");
}
entity.setUpdate();
reportClassifyDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除分类成功");
}
/**
* @Author lvleigang
* @Description 校验分类下面是否有配置报表
* @Date 3:27 下午 2024/3/27
* @param entity
* @return boolean
**/
private boolean checkUse(ReportClassifyEntity entity) {
ReportManageEntity reportManageEntity = new ReportManageEntity();
reportManageEntity.setClassifyId(entity.getId());
if(reportManageDao.getCount(reportManageEntity) > 0){
return false;
}
return true;
}
}

View File

@ -0,0 +1,23 @@
package com.hzya.frame.report.reportManage.dao;
import com.hzya.frame.report.reportManage.entity.JimuReportEntity;
import com.hzya.frame.report.reportManage.entity.ReportManageEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
import java.util.List;
/**
* 报表管理表(report_manage: table)表数据库访问层
*
* @author makejava
* @since 2024-05-21 15:04:12
*/
public interface IReportManageDao extends IBaseDao<ReportManageEntity, String> {
List<ReportManageEntity> queryByLikeClassify(ReportManageEntity entity);
List<JimuReportEntity> queryReportNotUse(JimuReportEntity entity);
JimuReportEntity queryReportEntity(JimuReportEntity entity);
}

View File

@ -0,0 +1,39 @@
package com.hzya.frame.report.reportManage.dao.impl;
import com.hzya.frame.report.reportManage.entity.JimuReportEntity;
import com.hzya.frame.report.reportManage.entity.ReportManageEntity;
import com.hzya.frame.report.reportManage.dao.IReportManageDao;
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import java.util.List;
/**
* 报表管理表(ReportManage)表数据库访问层
*
* @author makejava
* @since 2024-05-21 15:04:12
*/
@Repository(value = "ReportManageDaoImpl")
public class ReportManageDaoImpl extends MybatisGenericDao<ReportManageEntity, String> implements IReportManageDao{
@Override
public List<ReportManageEntity> queryByLikeClassify(ReportManageEntity entity) {
List<ReportManageEntity> o = super.query(getSqlIdPrifx() + "queryByLikeClassify", entity);
return o;
}
@Override
public List<JimuReportEntity> queryReportNotUse(JimuReportEntity entity) {
List<JimuReportEntity> o = (List<JimuReportEntity>) super.selectList(getSqlIdPrifx() + "queryReportNotUse", entity);
return o;
}
@Override
public JimuReportEntity queryReportEntity(JimuReportEntity entity) {
JimuReportEntity o = (JimuReportEntity) super.selectOne(getSqlIdPrifx() + "queryReportEntity", entity);
return o;
}
}

View File

@ -0,0 +1,45 @@
package com.hzya.frame.report.reportManage.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 积木报表jimu_report 实体类
*
* @author makejava
* @since 2024-05-21 15:04:12
*/
public class JimuReportEntity extends BaseEntity {
/** 编码 */
private String code;
/** 名称 */
private String name;
/** 删除标识0-正常,1-已删除 */
private String delFlag;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}

View File

@ -0,0 +1,85 @@
package com.hzya.frame.report.reportManage.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 报表管理表(ReportManage)实体类
*
* @author makejava
* @since 2024-05-21 15:04:12
*/
public class ReportManageEntity extends BaseEntity {
/** 报表ID */
private String reportId;
/** 报表名称 */
private String reportName;
/** 类别id */
private String classifyId;
/** 类别名称 */
private String classifyName;
/** 预览地址 */
private String previewAddress;
/** 状态: 0启用 1 停用 */
private String state;
/** 公司id */
private String companyId;
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId;
}
public String getReportName() {
return reportName;
}
public void setReportName(String reportName) {
this.reportName = reportName;
}
public String getClassifyId() {
return classifyId;
}
public void setClassifyId(String classifyId) {
this.classifyId = classifyId;
}
public String getPreviewAddress() {
return previewAddress;
}
public void setPreviewAddress(String previewAddress) {
this.previewAddress = previewAddress;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getClassifyName() {
return classifyName;
}
public void setClassifyName(String classifyName) {
this.classifyName = classifyName;
}
}

View File

@ -0,0 +1,352 @@
<?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.hzya.frame.report.reportManage.dao.impl.ReportManageDaoImpl">
<resultMap id="get-ReportManageEntity-result" type="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="reportId" column="report_id" jdbcType="VARCHAR"/>
<result property="reportName" column="report_name" jdbcType="VARCHAR"/>
<result property="classifyId" column="classify_id" jdbcType="VARCHAR"/>
<result property="classifyName" column="classify_name" jdbcType="VARCHAR"/>
<result property="previewAddress" column="preview_address" jdbcType="VARCHAR"/>
<result property="state" column="state" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id="ReportManageEntity_Base_Column_List">
id
,report_id
,report_name
,classify_id
,preview_address
,state
,sorts
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,org_id
,company_id
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-ReportManageEntity-result">
select
<include refid="ReportManageEntity_Base_Column_List"/>
from report_manage where sts = 'Y' and id = #{id}
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-ReportManageEntity-result"
parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
select
<include refid="ReportManageEntity_Base_Column_List"/>
from report_manage
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">and id = #{id}</if>
<if test="reportId != null and reportId != ''">and report_id = #{reportId}</if>
<if test="reportName != null and reportName != ''">and report_name = #{reportName}</if>
<if test="classifyId != null and classifyId != ''">and classify_id = #{classifyId}</if>
<if test="previewAddress != null and previewAddress != ''">and preview_address = #{previewAddress}</if>
<if test="state != null and state != ''">and state = #{state}</if>
<if test="sorts != null">and sorts = #{sorts}</if>
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
<if test="create_time != null">and create_time = #{create_time}</if>
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
<if test="modify_time != null">and modify_time = #{modify_time}</if>
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer"
parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
select count(1) from report_manage
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">and id = #{id}</if>
<if test="reportId != null and reportId != ''">and report_id = #{reportId}</if>
<if test="reportName != null and reportName != ''">and report_name = #{reportName}</if>
<if test="classifyId != null and classifyId != ''">and classify_id = #{classifyId}</if>
<if test="previewAddress != null and previewAddress != ''">and preview_address = #{previewAddress}</if>
<if test="state != null and state != ''">and state = #{state}</if>
<if test="sorts != null">and sorts = #{sorts}</if>
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
<if test="create_time != null">and create_time = #{create_time}</if>
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
<if test="modify_time != null">and modify_time = #{modify_time}</if>
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
and sts='Y'
</trim>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-ReportManageEntity-result"
parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
select
<include refid="ReportManageEntity_Base_Column_List"/>
from report_manage
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">and id like concat('%',#{id},'%')</if>
<if test="reportId != null and reportId != ''">and report_id like concat('%',#{reportId},'%')</if>
<if test="reportName != null and reportName != ''">and report_name like concat('%',#{reportName},'%')</if>
<if test="classifyId != null and classifyId != ''">and classify_id like concat('%',#{classifyId},'%')</if>
<if test="previewAddress != null and previewAddress != ''">and preview_address like
concat('%',#{previewAddress},'%')
</if>
<if test="state != null and state != ''">and state like concat('%',#{state},'%')</if>
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
concat('%',#{create_user_id},'%')
</if>
<if test="create_time != null">and create_time like concat('%',#{create_time},'%')</if>
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id like
concat('%',#{modify_user_id},'%')
</if>
<if test="modify_time != null">and modify_time like concat('%',#{modify_time},'%')</if>
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
<if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="ReportManageentity_list_or" resultMap="get-ReportManageEntity-result"
parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
select
<include refid="ReportManageEntity_Base_Column_List"/>
from report_manage
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">or id = #{id}</if>
<if test="reportId != null and reportId != ''">or report_id = #{reportId}</if>
<if test="reportName != null and reportName != ''">or report_name = #{reportName}</if>
<if test="classifyId != null and classifyId != ''">or classify_id = #{classifyId}</if>
<if test="previewAddress != null and previewAddress != ''">or preview_address = #{previewAddress}</if>
<if test="state != null and state != ''">or state = #{state}</if>
<if test="sorts != null">or sorts = #{sorts}</if>
<if test="create_user_id != null and create_user_id != ''">or create_user_id = #{create_user_id}</if>
<if test="create_time != null">or create_time = #{create_time}</if>
<if test="modify_user_id != null and modify_user_id != ''">or modify_user_id = #{modify_user_id}</if>
<if test="modify_time != null">or modify_time = #{modify_time}</if>
<if test="sts != null and sts != ''">or sts = #{sts}</if>
<if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
<if test="companyId != null and companyId != ''">or company_id = #{companyId}</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
insert into report_manage(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''">id ,</if>
<if test="reportId != null and reportId != ''">report_id ,</if>
<if test="reportName != null and reportName != ''">report_name ,</if>
<if test="classifyId != null and classifyId != ''">classify_id ,</if>
<if test="previewAddress != null and previewAddress != ''">preview_address ,</if>
<if test="state != null and state != ''">state ,</if>
<if test="sorts != null">sorts ,</if>
<if test="create_user_id != null and create_user_id != ''">create_user_id ,</if>
<if test="create_time != null">create_time ,</if>
<if test="modify_user_id != null and modify_user_id != ''">modify_user_id ,</if>
<if test="modify_time != null">modify_time ,</if>
<if test="sts != null and sts != ''">sts ,</if>
<if test="org_id != null and org_id != ''">org_id ,</if>
<if test="companyId != null and companyId != ''">company_id ,</if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''">#{id} ,</if>
<if test="reportId != null and reportId != ''">#{reportId} ,</if>
<if test="reportName != null and reportName != ''">#{reportName} ,</if>
<if test="classifyId != null and classifyId != ''">#{classifyId} ,</if>
<if test="previewAddress != null and previewAddress != ''">#{previewAddress} ,</if>
<if test="state != null and state != ''">#{state} ,</if>
<if test="sorts != null">#{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''">#{create_user_id} ,</if>
<if test="create_time != null">#{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''">#{modify_user_id} ,</if>
<if test="modify_time != null">#{modify_time} ,</if>
<if test="sts != null and sts != ''">#{sts} ,</if>
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch">
insert into report_manage(id, report_id, report_name, classify_id, preview_address, state, sorts,
create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.id},#{entity.reportId},#{entity.reportName},#{entity.classifyId},#{entity.previewAddress},#{entity.state},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},
'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch">
insert into report_manage(id, report_id, report_name, classify_id, preview_address, state, sorts,
create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.id},#{entity.reportId},#{entity.reportName},#{entity.classifyId},#{entity.previewAddress},#{entity.state},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
</foreach>
on duplicate key update
id = values(id),
report_id = values(report_id),
report_name = values(report_name),
classify_id = values(classify_id),
preview_address = values(preview_address),
state = values(state),
sorts = values(sorts),
create_user_id = values(create_user_id),
create_time = values(create_time),
modify_user_id = values(modify_user_id),
modify_time = values(modify_time),
sts = values(sts),
org_id = values(org_id),
company_id = values(company_id)
</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
update report_manage set
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''">id = #{id},</if>
<if test="reportId != null and reportId != ''">report_id = #{reportId},</if>
<if test="reportName != null and reportName != ''">report_name = #{reportName},</if>
<if test="classifyId != null and classifyId != ''">classify_id = #{classifyId},</if>
<if test="previewAddress != null and previewAddress != ''">preview_address = #{previewAddress},</if>
<if test="state != null and state != ''">state = #{state},</if>
<if test="sorts != null">sorts = #{sorts},</if>
<if test="create_user_id != null and create_user_id != ''">create_user_id = #{create_user_id},</if>
<if test="create_time != null">create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''">modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null">modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''">sts = #{sts},</if>
<if test="org_id != null and org_id != ''">org_id = #{org_id},</if>
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
</trim>
where = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
update report_manage set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition"
parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
update report_manage set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">and id = #{id}</if>
<if test="reportId != null and reportId != ''">and report_id = #{reportId}</if>
<if test="reportName != null and reportName != ''">and report_name = #{reportName}</if>
<if test="classifyId != null and classifyId != ''">and classify_id = #{classifyId}</if>
<if test="previewAddress != null and previewAddress != ''">and preview_address = #{previewAddress}</if>
<if test="state != null and state != ''">and state = #{state}</if>
<if test="sorts != null">and sorts = #{sorts}</if>
<if test="sts != null and sts != ''">and sts = #{sts}</if>
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from report_manage where = #{id}
</delete>
<!-- 分页查询列表 采用like格式 -->
<select id="queryByLikeClassify" resultMap="get-ReportManageEntity-result"
parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
select
a.id
,a.report_id
,a.report_name
,a.classify_id
,p.name as classify_name
,a.preview_address
,a.state
,a.sorts
,a.create_user_id
,a.create_time
,a.modify_user_id
,a.modify_time
,a.sts
,a.org_id
,a.company_id
from report_manage a
LEFT JOIN report_classify p on p.id = a.classify_id and p.sts = 'Y'
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">and a.id like concat('%',#{id},'%')</if>
<if test="reportId != null and reportId != ''">and a.report_id like concat('%',#{reportId},'%')</if>
<if test="reportName != null and reportName != ''">and a.report_name like concat('%',#{reportName},'%')</if>
<if test="classifyId != null and classifyId != ''">and a.classify_id like concat('%',#{classifyId},'%')</if>
<if test="previewAddress != null and previewAddress != ''">and a.preview_address like
concat('%',#{previewAddress},'%')
</if>
<if test="state != null and state != ''">and a.state like concat('%',#{state},'%')</if>
<if test="sorts != null">and a.sorts like concat('%',#{sorts},'%')</if>
<if test="create_user_id != null and create_user_id != ''">and a.create_user_id like
concat('%',#{create_user_id},'%')
</if>
<if test="create_time != null">and a.create_time like concat('%',#{create_time},'%')</if>
<if test="modify_user_id != null and modify_user_id != ''">and a.modify_user_id like
concat('%',#{modify_user_id},'%')
</if>
<if test="modify_time != null">and a.modify_time like concat('%',#{modify_time},'%')</if>
<if test="sts != null and sts != ''">and a.sts like concat('%',#{sts},'%')</if>
<if test="org_id != null and org_id != ''">and a.org_id like concat('%',#{org_id},'%')</if>
<if test="companyId != null and companyId != ''">and a.company_id like concat('%',#{companyId},'%')</if>
and a.sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by a.sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="queryReportNotUse" resultType="com.hzya.frame.report.reportManage.entity.JimuReportEntity"
parameterType="com.hzya.frame.report.reportManage.entity.JimuReportEntity">
SELECT
a.id as id
,a.code as code
,a.name as name
,a.del_flag as delFlag
FROM
jimu_report a
LEFT JOIN report_manage b on b.report_id = a.id and b.sts = 'Y'
WHERE a.del_flag = '0' and b.id is null ORDER BY a.create_time desc
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="queryReportEntity" resultType="com.hzya.frame.report.reportManage.entity.JimuReportEntity"
parameterType="com.hzya.frame.report.reportManage.entity.JimuReportEntity">
SELECT
id as id
,code as code
,name as name
,del_flag as delFlag
FROM
jimu_report
WHERE del_flag = '0' and id = #{id}
</select>
</mapper>

View File

@ -0,0 +1,116 @@
package com.hzya.frame.report.reportManage.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.report.reportManage.entity.ReportManageEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* 报表管理表(ReportManage)表服务接口
*
* @author makejava
* @since 2024-05-21 15:04:12
*/
public interface IReportManageService extends IBaseService<ReportManageEntity, String>{
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询报表管理列表分页
* @Date 11:52 上午 2024/3/27
**/
JsonResultEntity queryEntityPage(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询报表管理列表
* @Date 11:52 上午 2024/3/27
**/
JsonResultEntity queryEntity(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 保存报表管理
* @Date 2:36 下午 2024/3/27
**/
JsonResultEntity saveEntity(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询未配置的报表
* @Date 2:36 下午 2024/3/27
**/
JsonResultEntity queryReport(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询单个报表
* @Date 2:36 下午 2024/3/27
**/
JsonResultEntity queryReportEntity(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 获取报表管理
* @Date 2:36 下午 2024/3/27
**/
JsonResultEntity getEntity(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 修改报表管理
* @Date 2:37 下午 2024/3/27
**/
JsonResultEntity updateEntity(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 删除报表管理
* @Date 2:37 下午 2024/3/27
**/
JsonResultEntity deleteEntity(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 启用停用报表管理
* @Date 2:37 下午 2024/3/27
**/
JsonResultEntity enableDisableEntity(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 报表管理权限查询
* @Date 2:37 下午 2024/3/27
**/
JsonResultEntity jurisdiction(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 保存报表管理权限查询
* @Date 2:37 下午 2024/3/27
**/
JsonResultEntity saveJurisdiction(JSONObject jsonObject);
}

View File

@ -0,0 +1,300 @@
package com.hzya.frame.report.reportManage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.report.reportManage.entity.JimuReportEntity;
import com.hzya.frame.report.reportManage.entity.ReportManageEntity;
import com.hzya.frame.report.reportManage.dao.IReportManageDao;
import com.hzya.frame.report.reportManage.service.IReportManageService;
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
import com.hzya.frame.sysnew.userCompany.entity.SysUserCompanyEntity;
import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity;
import com.hzya.frame.util.AESUtil;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import dm.jdbc.d.U;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.List;
/**
* 报表管理表(ReportManage)表服务实现类
*
* @author makejava
* @since 2024-05-21 15:04:12
*/
@Service(value = "reportManageService")
public class ReportManageServiceImpl extends BaseService<ReportManageEntity, String> implements IReportManageService {
private IReportManageDao reportManageDao;
@Autowired
public void setReportManageDao(IReportManageDao dao) {
this.reportManageDao = dao;
this.dao = dao;
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询报表列表分页
* @Date 11:52 上午 2024/3/27
**/
@Override
public JsonResultEntity queryEntityPage(JSONObject jsonObject) {
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
//判断分页
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
}
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<ReportManageEntity> list = reportManageDao.queryByLikeClassify(entity);
PageInfo pageInfo = new PageInfo(list);
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询报表列表
* @Date 11:52 上午 2024/3/27
**/
@Override
public JsonResultEntity queryEntity(JSONObject jsonObject) {
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
if (entity == null) {
entity = new ReportManageEntity();
}
List<ReportManageEntity> list = reportManageDao.queryByLike(entity);
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 保存报表
* @Date 2:36 下午 2024/3/27
**/
@Override
public JsonResultEntity saveEntity(JSONObject jsonObject) {
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getReportId() == null || "".equals(entity.getReportId())) {
return BaseResult.getFailureMessageEntity("请先选择报表");
}
if (entity.getReportName() == null || "".equals(entity.getReportName())) {
return BaseResult.getFailureMessageEntity("请先输入报表名称");
}
if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) {
return BaseResult.getFailureMessageEntity("请先选择分类");
}
if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setState("0");
if (!checkIsUse(entity)) {
return BaseResult.getFailureMessageEntity("当前报表已经配置,请勿重复配置");
}
entity.setCreate();
//保存
reportManageDao.save(entity);
return BaseResult.getSuccessMessageEntity("保存报表成功", entity);
}
private boolean checkIsUse(ReportManageEntity entity) {
ReportManageEntity checkUse = new ReportManageEntity();
checkUse.setReportId(entity.getReportId());
if (reportManageDao.getCount(checkUse) > 0) {
return false;
}
return true;
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 获取报表
* @Date 2:36 下午 2024/3/27
**/
@Override
public JsonResultEntity getEntity(JSONObject jsonObject) {
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity = reportManageDao.get(entity.getId());
if (entity == null) {
return BaseResult.getFailureMessageEntity("获取报表失败");
}
return BaseResult.getSuccessMessageEntity("获取报表成功", entity);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 修改报表
* @Date 2:37 下午 2024/3/27
**/
@Override
public JsonResultEntity updateEntity(JSONObject jsonObject) {
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getReportId() == null || "".equals(entity.getReportId())) {
return BaseResult.getFailureMessageEntity("请先选择报表");
}
if (entity.getReportName() == null || "".equals(entity.getReportName())) {
return BaseResult.getFailureMessageEntity("请先输入报表名称");
}
if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) {
return BaseResult.getFailureMessageEntity("请先选择分类");
}
if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();
//保存
reportManageDao.update(entity);
return BaseResult.getSuccessMessageEntity("修改报表成功");
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 删除报表
* @Date 2:37 下午 2024/3/27
**/
@Override
public JsonResultEntity deleteEntity(JSONObject jsonObject) {
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();
reportManageDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除报表成功");
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 启用停用报表
* @Date 2:37 下午 2024/3/27
**/
@Override
public JsonResultEntity enableDisableEntity(JSONObject jsonObject) {
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getState() == null || "".equals(entity.getState())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity.setUpdate();
reportManageDao.update(entity);
//0启用 1 停用
if ("0".equals(entity.getState())) {
return BaseResult.getSuccessMessageEntity("启用用户成功");
} else {
return BaseResult.getSuccessMessageEntity("停用用户成功");
}
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询报表
* @Date 2:36 下午 2024/3/27
**/
@Override
public JsonResultEntity queryReport(JSONObject jsonObject) {
JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class);
//判断分页
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
}
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<JimuReportEntity> list = reportManageDao.queryReportNotUse(entity);
PageInfo pageInfo = new PageInfo(list);
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 查询报表
* @Date 2:36 下午 2024/3/27
**/
@Override
public JsonResultEntity queryReportEntity(JSONObject jsonObject) {
JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
entity = reportManageDao.queryReportEntity(entity);
if (entity == null) {
return BaseResult.getFailureMessageEntity("获取报表失败");
}
return BaseResult.getSuccessMessageEntity("获取报表成功", entity);
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 权限查询
* @Date 2:37 下午 2024/3/27
**/
@Override
public JsonResultEntity jurisdiction(JSONObject jsonObject) {
return null;
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 保存权限查询
* @Date 2:37 下午 2024/3/27
**/
@Override
public JsonResultEntity saveJurisdiction(JSONObject jsonObject) {
return null;
}
}

View File

@ -154,6 +154,7 @@ public class SysUserServiceImpl extends BaseService<SysUserEntity, String> imple
}
entity.setPassword(AESUtil.encrypt(entity.getLoginCode()+"-123456"));
entity.setCreate();
entity.setState("0");
//保存
sysUserDao.save(entity);
//保存用户公司
@ -185,7 +186,7 @@ public class SysUserServiceImpl extends BaseService<SysUserEntity, String> imple
private boolean checkPersonIsUse(SysUserEntity entity) {
SysUserEntity sysUserEntity = new SysUserEntity();
sysUserEntity.setPersonId(entity.getPersonId());
sysUserEntity.setState("0");//启用
//sysUserEntity.setState("0");//启用
if (sysUserDao.getCount(sysUserEntity) > 0) {
return false;
}

View File

@ -0,0 +1,65 @@
package com.hzya.frame.webapp.web.init;
import com.hzya.frame.util.AESUtil;
import lombok.RequiredArgsConstructor;
import org.flywaydb.core.Flyway;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.annotation.PostConstruct;
@Configuration
@RequiredArgsConstructor
@EnableTransactionManagement
public class FlywayConfig {
@Value("${spring.flyway.enabled}")
private String enabled;
@Value("${spring.flyway.clean-disabled}")
private boolean cleanDisabled;
@Value("${spring.flyway.locations}")
private String locations;
@Value("${spring.flyway.table}")
private String table;
@Value("${spring.flyway.placeholder-replacement}")
private boolean placeholderReplacement;
@Value("${spring.flyway.baseline-on-migrate}")
private boolean baselineOnMigrate;
@Value("${spring.flyway.validate-on-migrate}")
private boolean validateOnMigrat;
@Value("${spring.flyway.sql-migration-prefix}")
private String sqlMigrationPrefix;
@Value("${spring.flyway.sql-migration-separator}")
private String sqlMigrationSeparator;
@Value("${spring.flyway.sql-migration-suffixes}")
private String sqlMigrationSuffixes;
@Value("${spring.datasource.dynamic.datasource.master.url}")
private String url;
@Value("${spring.datasource.dynamic.datasource.master.username}")
private String username;
@Value("${spring.datasource.dynamic.datasource.master.password}")
private String password;
@PostConstruct
public void migrateOrder() {
String pwd = AESUtil.decrypt(password);
// 将路径转换
Flyway flyway = Flyway.configure()
.dataSource(url,username,pwd)
.cleanDisabled(cleanDisabled)
.locations(locations)
.table(table)
.encoding("utf-8")
.outOfOrder(true)
.baselineOnMigrate(true)
.validateOnMigrate(baselineOnMigrate)
.validateOnMigrate(validateOnMigrat)
.sqlMigrationPrefix(sqlMigrationPrefix)
.sqlMigrationSeparator(sqlMigrationSeparator)
.sqlMigrationSuffixes(sqlMigrationSuffixes)
.placeholderReplacement(placeholderReplacement)
.load();
flyway.migrate();
}
}