This commit is contained in:
zhuoda
2020-04-07 22:10:57 +08:00
parent 478b39d61a
commit 8394525697
456 changed files with 5963 additions and 2908 deletions

View File

@@ -4,5 +4,5 @@
____) | | | | | | (_| | | | |_ / ____ \ (_| | | | | | | | | | |
|_____/|_| |_| |_|\__,_|_| \__/_/ \_\__,_|_| |_| |_|_|_| |_|
SmartAdmin v1.0.0
SmartAdmin v1.1.0

View File

@@ -1,10 +1,10 @@
######################### server ###################
server.servlet.context-path=/smart-admin-api
server.port=10086
spring.profiles.active=dev
spring.profiles.active=@profiles.active@
######################### tomcat ###################
server.tomcat.basedir=/home/logs/smartadmin/tomcat-logs
server.tomcat.basedir=/home/logs/smart-admin/tomcat-logs
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%t %{X-Forwarded-For}i %a "%r" %s %D (%D ms)
@@ -32,7 +32,7 @@ spring.datasource.max-active=10
spring.datasource.max-wait=60000
spring.datasource.time-between-eviction-runs-millis=60000
spring.datasource.min-evictable-edle-time-millis=300000
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.filters=stat
spring.datasource.druid.username=druid
spring.datasource.druid.password=123456
@@ -41,13 +41,13 @@ spring.datasource.druid.login.enabled=false
######################### redis #######################################
spring.redis.database=0
spring.redis.host=127.0.0.1
spring.redis.jedis.pool.max-active=100
spring.redis.jedis.pool.min-idle=5
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.max-wait=30000ms
spring.redis.port=6379
spring.redis.timeout=10000ms
spring.redis.password=
spring.redis.lettuce..pool.max-active=100
spring.redis.lettuce.pool.min-idle=5
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.max-wait=30000ms
########################## rest http pool #########################
#\u6700\u5927\u8FDE\u63A5\u6570
@@ -65,8 +65,8 @@ http.pool.connection-request-timeout=8000
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
# mybatis-plus \u5B57\u6BB5\u9A7C\u5CF0\u81EA\u52A8\u8F6C\u6362
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.mapper-locations=classpath:/mapper/*Mapper.xml,/mapper/*/*Mapper.xml
mybatis-plus.typeAliasesPackage=com.gangquan360.smartadmin.*.*.domain.entity
mybatis-plus.mapper-locations=classpath:/mapper/**/*.xml
mybatis-plus.typeAliasesPackage=net.lab1024.smartadmin.*.*.domain.entity
mybatis-plus.global-config.refresh-mapper=true
mybatis-plus.global-config.db-column-underline=true
@@ -76,7 +76,7 @@ swagger.title=smartAdmin
swagger.description=smartAdmin
swagger.version=1.0
swagger.serviceUrl=http://localhost:10086/smart-admin-api
swagger.packAge=com.gangquan360.smartadmin.module
swagger.packAge=net.lab1024.smartadmin.module
######################### jwt #########################
jwt.key=smart-admin-jwt-key

View File

@@ -1,8 +1,8 @@
<?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.gangquan360.smartadmin.module.email.EmailDao">
<mapper namespace="net.lab1024.smartadmin.module.business.email.EmailDao">
<resultMap id="EmailEntity" type="com.gangquan360.smartadmin.module.email.domain.entity.EmailEntity"></resultMap>
<resultMap id="EmailEntity" type="net.lab1024.smartadmin.module.business.email.domain.entity.EmailEntity"></resultMap>
<select id="queryByPage" resultMap="EmailEntity">

View File

@@ -1,8 +1,8 @@
<?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.gangquan360.smartadmin.module.log.orderoperatelog.OrderOperateLogDao">
<mapper namespace="net.lab1024.smartadmin.module.business.log.orderoperatelog.OrderOperateLogDao">
<resultMap id="orderOperateLogSaveDTOMap"
type="com.gangquan360.smartadmin.module.log.orderoperatelog.domain.entity.OrderOperateLogEntity"></resultMap>
type="net.lab1024.smartadmin.module.business.log.orderoperatelog.domain.entity.OrderOperateLogEntity"></resultMap>
<select id="listOrderOperateLogsByOrderTypeAndOrderId" resultMap="orderOperateLogSaveDTOMap">

View File

@@ -1,8 +1,8 @@
<?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.gangquan360.smartadmin.module.log.userloginlog.UserLoginLogDao">
<mapper namespace="net.lab1024.smartadmin.module.business.log.userloginlog.UserLoginLogDao">
<resultMap id="UserLoginLogEntity" type="com.gangquan360.smartadmin.module.log.userloginlog.domain.UserLoginLogEntity"></resultMap>
<resultMap id="UserLoginLogEntity" type="net.lab1024.smartadmin.module.business.log.userloginlog.domain.UserLoginLogEntity"></resultMap>
<select id="queryByPage" resultMap="UserLoginLogEntity">

View File

@@ -1,8 +1,8 @@
<?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.gangquan360.smartadmin.module.log.useroperatelog.UserOperateLogDao">
<mapper namespace="net.lab1024.smartadmin.module.business.log.useroperatelog.UserOperateLogDao">
<resultMap id="UserOperateLogEntity" type="com.gangquan360.smartadmin.module.log.useroperatelog.domain.UserOperateLogEntity"></resultMap>
<resultMap id="UserOperateLogEntity" type="net.lab1024.smartadmin.module.business.log.useroperatelog.domain.UserOperateLogEntity"></resultMap>
<select id="queryByPage" resultMap="UserOperateLogEntity">

View File

@@ -1,17 +1,17 @@
<?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.gangquan360.smartadmin.module.notice.dao.NoticeDao">
<mapper namespace="net.lab1024.smartadmin.module.business.notice.dao.NoticeDao">
<resultMap id="NoticeEntity" type="com.gangquan360.smartadmin.module.notice.domain.entity.NoticeEntity"></resultMap>
<resultMap id="NoticeEntity" type="net.lab1024.smartadmin.module.business.notice.domain.entity.NoticeEntity"></resultMap>
<resultMap id="NoticeDTO" type="com.gangquan360.smartadmin.module.notice.domain.dto.NoticeVO"></resultMap>
<resultMap id="NoticeDTO" type="net.lab1024.smartadmin.module.business.notice.domain.dto.NoticeVO"></resultMap>
<resultMap id="NoticeDetailDTO" type="com.gangquan360.smartadmin.module.notice.domain.dto.NoticeDetailVO"></resultMap>
<resultMap id="NoticeDetailDTO" type="net.lab1024.smartadmin.module.business.notice.domain.dto.NoticeDetailVO"></resultMap>
<resultMap id="NoticeReceiveDTO" type="com.gangquan360.smartadmin.module.notice.domain.dto.NoticeReceiveDTO"></resultMap>
<resultMap id="NoticeReceiveDTO" type="net.lab1024.smartadmin.module.business.notice.domain.dto.NoticeReceiveDTO"></resultMap>
<resultMap id="NoticeReadCountDTO" type="com.gangquan360.smartadmin.module.notice.domain.dto.NoticeReadCountDTO"></resultMap>
<resultMap id="NoticeReadCountDTO" type="net.lab1024.smartadmin.module.business.notice.domain.dto.NoticeReadCountDTO"></resultMap>
<select id="queryByPage" resultMap="NoticeDTO">

View File

@@ -1,8 +1,8 @@
<?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.gangquan360.smartadmin.module.notice.dao.NoticeReceiveRecordDao">
<mapper namespace="net.lab1024.smartadmin.module.business.notice.dao.NoticeReceiveRecordDao">
<resultMap id="NoticeReceiveRecordEntity" type="com.gangquan360.smartadmin.module.notice.domain.entity.NoticeReceiveRecordEntity"></resultMap>
<resultMap id="NoticeReceiveRecordEntity" type="net.lab1024.smartadmin.module.business.notice.domain.entity.NoticeReceiveRecordEntity"></resultMap>
<delete id="deleteByNoticeId">

View File

@@ -0,0 +1,116 @@
<?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="net.lab1024.smartadmin.module.business.peony.dao.PeonyDao">
<resultMap id="PeonyVO" type="net.lab1024.smartadmin.module.business.peony.domain.vo.PeonyVO"></resultMap>
<resultMap id="PeonyExcelVO" type="net.lab1024.smartadmin.module.business.peony.domain.vo.PeonyExcelVO"></resultMap>
<select id="queryByPage" resultMap="PeonyVO">
select
id,
kind,
name,
color,
image_url,
create_time,
update_time
from t_peony
<where>
<if test="queryDTO.id != null">
AND id = #{queryDTO.id}
</if>
<if test="queryDTO.kind != null and queryDTO.kind != ''">
AND INSTR(kind,#{queryDTO.kind})
</if>
<if test="queryDTO.name != null and queryDTO.name != ''">
AND INSTR(name,#{queryDTO.name})
</if>
<if test="queryDTO.color != null and queryDTO.color != ''">
AND INSTR(color,#{queryDTO.color})
</if>
<if test="queryDTO.createTimeBegin != null ">
AND create_time &gt;= #{queryDTO.createTimeBegin}
</if>
<if test="queryDTO.createTimeEnd != null ">
AND create_time &lt;= #{queryDTO.createTimeEnd}
</if>
<if test="queryDTO.updateTimeBegin != null ">
AND update_time &gt;= #{queryDTO.updateTimeBegin}
</if>
<if test="queryDTO.updateTimeEnd != null ">
AND update_time &lt;= #{queryDTO.updateTimeEnd}
</if>
</where>
</select>
<select id="queryAllExportData" resultMap="PeonyExcelVO">
select
id,
kind,
name,
color,
image_url,
create_time,
update_time
from t_peony
<where>
<if test="queryDTO.id != null">
AND id = #{queryDTO.id}
</if>
<if test="queryDTO.kind != null and queryDTO.kind != ''">
AND INSTR(kind,#{queryDTO.kind})
</if>
<if test="queryDTO.name != null and queryDTO.name != ''">
AND INSTR(name,#{queryDTO.name})
</if>
<if test="queryDTO.color != null and queryDTO.color != ''">
AND INSTR(color,#{queryDTO.color})
</if>
<if test="queryDTO.createTimeBegin != null ">
AND create_time &gt;= #{queryDTO.createTimeBegin}
</if>
<if test="queryDTO.createTimeEnd != null ">
AND create_time &lt;= #{queryDTO.createTimeEnd}
</if>
<if test="queryDTO.updateTimeBegin != null ">
AND update_time &gt;= #{queryDTO.updateTimeBegin}
</if>
<if test="queryDTO.updateTimeEnd != null ">
AND update_time &lt;= #{queryDTO.updateTimeEnd}
</if>
</where>
</select>
<select id="queryBatchExportData" resultMap="PeonyExcelVO">
select
id,
kind,
name,
color,
image_url,
create_time,
update_time
from t_peony
where id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<delete id="deleteById">
delete from t_peony where id = #{id}
</delete>
<delete id="deleteByIdList">
delete from t_peony where id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</delete>
</mapper>

View File

@@ -1,8 +1,8 @@
<?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.gangquan360.smartadmin.module.codegenerator.dao.TableDao">
<mapper namespace="net.lab1024.smartadmin.module.support.codegenerator.dao.TableDao">
<resultMap id="ColumnDTO"
type="com.gangquan360.smartadmin.module.codegenerator.domain.ColumnVO"></resultMap>
type="net.lab1024.smartadmin.module.support.codegenerator.domain.ColumnVO"></resultMap>

View File

@@ -1,12 +1,12 @@
<?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.gangquan360.smartadmin.module.file.FileDao">
<mapper namespace="net.lab1024.smartadmin.module.support.file.FileDao">
<resultMap id="fileMap"
type="com.gangquan360.smartadmin.module.file.domain.entity.FileEntity"></resultMap>
type="net.lab1024.smartadmin.module.support.file.domain.entity.FileEntity"></resultMap>
<resultMap id="fileDTO"
type="com.gangquan360.smartadmin.module.file.domain.dto.FileDTO"></resultMap>
type="net.lab1024.smartadmin.module.support.file.domain.dto.FileDTO"></resultMap>
<resultMap id="fileVO" type="com.gangquan360.smartadmin.module.file.domain.vo.FileVO"></resultMap>
<resultMap id="fileVO" type="net.lab1024.smartadmin.module.support.file.domain.vo.FileVO"></resultMap>
<insert id="insertFileBatch" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.List">
INSERT INTO t_file (

View File

@@ -1,6 +1,6 @@
<?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.gangquan360.smartadmin.module.heartbeat.HeartBeatRecordDao">
<mapper namespace="net.lab1024.smartadmin.module.support.heartbeat.HeartBeatRecordDao">
<!-- 心跳日志 -->
<insert id="insertHeartBeat" useGeneratedKeys="true" keyProperty="id">
@@ -27,11 +27,11 @@
</where>
</update>
<select id="query" resultType="com.gangquan360.smartadmin.module.heartbeat.HeartBeatRecordEntity">
<select id="query" resultType="net.lab1024.smartadmin.module.support.heartbeat.HeartBeatRecordEntity">
select * from t_heart_beat_record where project_path = #{projectPath} and server_ip = #{serverIp} and process_no =#{processNo}
</select>
<select id="pageQuery" resultType="com.gangquan360.smartadmin.module.heartbeat.HeartBeatRecordVO">
<select id="pageQuery" resultType="net.lab1024.smartadmin.module.support.heartbeat.HeartBeatRecordVO">
SELECT
*
FROM

View File

@@ -1,14 +1,14 @@
<?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.gangquan360.smartadmin.module.idgenerator.IdGeneratorDao">
<mapper namespace="net.lab1024.smartadmin.module.support.idgenerator.IdGeneratorDao">
<resultMap id="idGeneratorLastNumberDTO"
type="com.gangquan360.smartadmin.module.idgenerator.domain.IdGeneratorLastNumberDTO">
type="net.lab1024.smartadmin.module.support.idgenerator.domain.IdGeneratorLastNumberDTO">
</resultMap>
<resultMap id="idGeneratorEntity" type="com.gangquan360.smartadmin.module.idgenerator.domain.IdGeneratorEntity">
<resultMap id="idGeneratorEntity" type="net.lab1024.smartadmin.module.support.idgenerator.domain.IdGeneratorEntity">
</resultMap>
<resultMap id="idGeneratorRecordDTO"
type="com.gangquan360.smartadmin.module.idgenerator.domain.IdGeneratorRecordDTO">
type="net.lab1024.smartadmin.module.support.idgenerator.domain.IdGeneratorRecordDTO">
</resultMap>

View File

@@ -1,9 +1,9 @@
<?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.gangquan360.smartadmin.module.quartz.dao.QuartzTaskLogDao">
<mapper namespace="net.lab1024.smartadmin.module.support.quartz.dao.QuartzTaskLogDao">
<resultMap id="QuartzTaskLogDTO"
type="com.gangquan360.smartadmin.module.quartz.domain.dto.QuartzTaskLogVO"></resultMap>
type="net.lab1024.smartadmin.module.support.quartz.domain.dto.QuartzTaskLogVO"></resultMap>

View File

@@ -1,9 +1,9 @@
<?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.gangquan360.smartadmin.module.quartz.dao.QuartzTaskDao">
<mapper namespace="net.lab1024.smartadmin.module.support.quartz.dao.QuartzTaskDao">
<resultMap id="QuartzTaskDTO"
type="com.gangquan360.smartadmin.module.quartz.domain.entity.QuartzTaskEntity"></resultMap>
type="net.lab1024.smartadmin.module.support.quartz.domain.entity.QuartzTaskEntity"></resultMap>
<sql id="baseSql">
t.id,

View File

@@ -1,6 +1,6 @@
<?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.gangquan360.smartadmin.module.smartreload.dao.ReloadItemDao">
<mapper namespace="net.lab1024.smartadmin.module.support.smartreload.dao.ReloadItemDao">
</mapper>

View File

@@ -1,9 +1,9 @@
<?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.gangquan360.smartadmin.module.smartreload.dao.ReloadResultDao">
<mapper namespace="net.lab1024.smartadmin.module.support.smartreload.dao.ReloadResultDao">
<resultMap id="reloadResultEntity"
type="com.gangquan360.smartadmin.module.smartreload.domain.entity.ReloadResultEntity"></resultMap>
type="net.lab1024.smartadmin.module.support.smartreload.domain.entity.ReloadResultEntity"></resultMap>
<select id="query" resultMap="reloadResultEntity">
SELECT

View File

@@ -1,8 +1,8 @@
<?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.gangquan360.smartadmin.module.datascope.DataScopeRoleDao">
<mapper namespace="net.lab1024.smartadmin.module.system.datascope.DataScopeRoleDao">
<resultMap id="DataScopeRoleEntity" type="com.gangquan360.smartadmin.module.datascope.domain.entity.DataScopeRoleEntity"></resultMap>
<resultMap id="DataScopeRoleEntity" type="net.lab1024.smartadmin.module.system.datascope.domain.entity.DataScopeRoleEntity"></resultMap>
<select id="listByRoleId" resultMap="DataScopeRoleEntity">
select id,data_scope_type,view_type,role_id,update_time,create_time from t_role_data_scope where role_id = #{roleId}

View File

@@ -1,10 +1,10 @@
<?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.gangquan360.smartadmin.module.department.DepartmentDao">
<mapper namespace="net.lab1024.smartadmin.module.system.department.DepartmentDao">
<resultMap id="DepartmentVO"
type="com.gangquan360.smartadmin.module.department.domain.dto.DepartmentVO"></resultMap>
type="net.lab1024.smartadmin.module.system.department.domain.dto.DepartmentVO"></resultMap>
<sql id="baseSql">

View File

@@ -1,12 +1,12 @@
<?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.gangquan360.smartadmin.module.employee.EmployeeDao">
<mapper namespace="net.lab1024.smartadmin.module.system.employee.EmployeeDao">
<resultMap id="EmployeeDTO"
type="com.gangquan360.smartadmin.module.employee.domain.dto.EmployeeDTO"></resultMap>
type="net.lab1024.smartadmin.module.system.employee.domain.dto.EmployeeDTO"></resultMap>
<resultMap id="EmployeeVO" type="com.gangquan360.smartadmin.module.employee.domain.vo.EmployeeVO"></resultMap>
<resultMap id="EmployeeVO" type="net.lab1024.smartadmin.module.system.employee.domain.vo.EmployeeVO"></resultMap>
<sql id="baseSql">
e.id,

View File

@@ -1,6 +1,6 @@
<?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.gangquan360.smartadmin.module.position.PositionDao">
<mapper namespace="net.lab1024.smartadmin.module.system.position.PositionDao">
<sql id="baseSql">
@@ -11,20 +11,20 @@
create_time
</sql>
<select id="selectByPage" resultType="com.gangquan360.smartadmin.module.position.domain.entity.PositionEntity">
<select id="selectByPage" resultType="net.lab1024.smartadmin.module.system.position.domain.entity.PositionEntity">
SELECT
<include refid="baseSql"></include>
FROM
t_position
<where>
<if test="positionName != null and positionName != ''">
AND INSTR(position_name,#{positionName})
<if test="queryDTO.positionName != null and queryDTO.positionName != ''">
AND INSTR(position_name,#{queryDTO.positionName})
</if>
</where>
order by create_time desc
</select>
<select id="selectRelation" resultType="com.gangquan360.smartadmin.module.position.domain.dto.PositionRelationResultDTO">
<select id="selectRelation" resultType="net.lab1024.smartadmin.module.system.position.domain.dto.PositionRelationResultDTO">
SELECT
job.position_name,
rel.position_id,
@@ -44,7 +44,7 @@
</where>
</select>
<select id="selectEmployeesRelation" resultType="com.gangquan360.smartadmin.module.position.domain.dto.PositionRelationResultDTO">
<select id="selectEmployeesRelation" resultType="net.lab1024.smartadmin.module.system.position.domain.dto.PositionRelationResultDTO">
SELECT
job.position_name,
rel.position_id,

View File

@@ -1,9 +1,9 @@
<?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.gangquan360.smartadmin.module.privilege.dao.PrivilegeDao">
<mapper namespace="net.lab1024.smartadmin.module.system.privilege.dao.PrivilegeDao">
<resultMap id="PrivilegeEntity"
type="com.gangquan360.smartadmin.module.privilege.domain.entity.PrivilegeEntity"></resultMap>
type="net.lab1024.smartadmin.module.system.privilege.domain.entity.PrivilegeEntity"></resultMap>
<sql id="baseSql">
p.id,

View File

@@ -1,10 +1,10 @@
<?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.gangquan360.smartadmin.module.role.roleemployee.RoleEmployeeDao">
<mapper namespace="net.lab1024.smartadmin.module.system.role.roleemployee.RoleEmployeeDao">
<resultMap id="EmployeeDTO"
type="com.gangquan360.smartadmin.module.employee.domain.dto.EmployeeDTO"></resultMap>
type="net.lab1024.smartadmin.module.system.employee.domain.dto.EmployeeDTO"></resultMap>
<sql id="baseSql">

View File

@@ -1,9 +1,9 @@
<?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.gangquan360.smartadmin.module.role.basic.RoleDao">
<mapper namespace="net.lab1024.smartadmin.module.system.role.basic.RoleDao">
<resultMap id="RoleEntity"
type="com.gangquan360.smartadmin.module.role.basic.domain.entity.RoleEntity"></resultMap>
type="net.lab1024.smartadmin.module.system.role.basic.domain.entity.RoleEntity"></resultMap>
<sql id="baseSql">

View File

@@ -1,12 +1,12 @@
<?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.gangquan360.smartadmin.module.role.roleprivilege.RolePrivilegeDao">
<mapper namespace="net.lab1024.smartadmin.module.system.role.roleprivilege.RolePrivilegeDao">
<resultMap id="RolePrivilegeEntity"
type="com.gangquan360.smartadmin.module.role.roleprivilege.domain.entity.RolePrivilegeEntity"></resultMap>
type="net.lab1024.smartadmin.module.system.role.roleprivilege.domain.entity.RolePrivilegeEntity"></resultMap>
<resultMap id="PrivilegeEntity"
type="com.gangquan360.smartadmin.module.privilege.domain.entity.PrivilegeEntity"></resultMap>
type="net.lab1024.smartadmin.module.system.privilege.domain.entity.PrivilegeEntity"></resultMap>
<sql id="baseSql">
rp.id,

View File

@@ -1,8 +1,12 @@
<?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.gangquan360.smartadmin.module.systemconfig.SystemConfigDao">
<mapper namespace="net.lab1024.smartadmin.module.system.systemconfig.SystemConfigDao">
<resultMap id="systemConfigMap" type="com.gangquan360.smartadmin.module.systemconfig.domain.entity.SystemConfigEntity"></resultMap>
<resultMap id="systemConfigMap" type="net.lab1024.smartadmin.module.system.systemconfig.domain.entity.SystemConfigEntity"></resultMap>
<select id="selectAll" resultMap="systemConfigMap">
select * from t_system_config
</select>
<!-- 查询所有系统配置(分页) -->
<select id="selectSystemSettingList" resultMap="systemConfigMap">
@@ -19,12 +23,12 @@
FROM
t_system_config
<where>
<if test="key != null and key != ''">
<bind name="keyLike" value=" '%' + key +'%' "></bind>
<if test="queryDTO.key != null and queryDTO.key != ''">
<bind name="keyLike" value=" '%' + queryDTO.key +'%' "></bind>
AND config_key LIKE #{keyLike}
</if>
<if test="configGroup != null">
<bind name="configGroupLike" value=" '%' + configGroup +'%' "></bind>
<if test="queryDTO.configGroup != null and queryDTO.configGroup != ''">
<bind name="configGroupLike" value=" '%' + queryDTO.configGroup +'%' "></bind>
AND config_group like #{configGroupLike}
</if>
</where>

View File

@@ -1,10 +1,10 @@
######################### server ###################
server.servlet.context-path=/smart-admin-api
server.port=10086
spring.profiles.active=dev
spring.profiles.active=@profiles.active@
######################### tomcat ###################
server.tomcat.basedir=/home/logs/smartadmin/tomcat-logs
server.tomcat.basedir=/home/logs/smart-admin/tomcat-logs
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%t %{X-Forwarded-For}i %a "%r" %s %D (%D ms)
@@ -24,30 +24,30 @@ file-upload-service.path=/home/upload/
######################### database #########################
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/smart-admin-dev?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC
spring.datasource.username=erp
spring.datasource.password=listen1015
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.initial-size=2
spring.datasource.min-idle=1
spring.datasource.max-active=10
spring.datasource.max-wait=60000
spring.datasource.time-between-eviction-runs-millis=60000
spring.datasource.min-evictable-edle-time-millis=300000
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.filters=stat
spring.datasource.druid.username=druid
spring.datasource.druid.password=Gq123456
spring.datasource.druid.password=123456
spring.datasource.druid.login.enabled=false
######################### redis #######################################
spring.redis.database=13
spring.redis.host=172.16.0.145
spring.redis.jedis.pool.max-active=100
spring.redis.jedis.pool.min-idle=5
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.max-wait=30000ms
spring.redis.port=50000
spring.redis.database=0
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.timeout=10000ms
spring.redis.password=
spring.redis.lettuce..pool.max-active=100
spring.redis.lettuce.pool.min-idle=5
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.max-wait=30000ms
########################## rest http pool #########################
#\u6700\u5927\u8FDE\u63A5\u6570
@@ -65,8 +65,8 @@ http.pool.connection-request-timeout=8000
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
# mybatis-plus \u5B57\u6BB5\u9A7C\u5CF0\u81EA\u52A8\u8F6C\u6362
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.mapper-locations=classpath:/mapper/*Mapper.xml,/mapper/*/*Mapper.xml
mybatis-plus.typeAliasesPackage=com.gangquan360.smartadmin.*.*.domain.entity
mybatis-plus.mapper-locations=classpath:/mapper/**/*.xml
mybatis-plus.typeAliasesPackage=net.lab1024.smartadmin.*.*.domain.entity
mybatis-plus.global-config.refresh-mapper=true
mybatis-plus.global-config.db-column-underline=true
@@ -76,7 +76,7 @@ swagger.title=smartAdmin
swagger.description=smartAdmin
swagger.version=1.0
swagger.serviceUrl=http://localhost:10086/smart-admin-api
swagger.packAge=com.gangquan360.smartadmin.module
swagger.packAge=net.lab1024.smartadmin.module
######################### jwt #########################
jwt.key=smart-admin-jwt-key

View File

@@ -12,7 +12,6 @@ server.tomcat.accesslog.pattern=%t %{X-Forwarded-For}i %a "%r" %s %D (%D ms)
spring.jackson.serialization.write-enums-using-to-string=true
spring.jackson.deserialization.read-enums-using-to-string=true
spring.jackson.deserialization.fail-on-unknown-properties=false
spring.jackson.default-property-inclusion=always
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
@@ -33,7 +32,7 @@ spring.datasource.max-active=10
spring.datasource.max-wait=60000
spring.datasource.time-between-eviction-runs-millis=60000
spring.datasource.min-evictable-edle-time-millis=300000
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.filters=stat
spring.datasource.druid.username=druid
spring.datasource.druid.password=Gq123456
@@ -42,13 +41,13 @@ spring.datasource.druid.login.enabled=false
######################### redis #######################################
spring.redis.database=13
spring.redis.host=127.0.0.1
spring.redis.jedis.pool.max-active=100
spring.redis.jedis.pool.min-idle=5
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.max-wait=30000ms
spring.redis.port=6379
spring.redis.timeout=10000ms
spring.redis.password=Gq123456@
spring.redis.lettuce..pool.max-active=100
spring.redis.lettuce.pool.min-idle=5
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.max-wait=30000ms
########################## rest http pool #########################
#\u6700\u5927\u8FDE\u63A5\u6570
@@ -66,8 +65,8 @@ http.pool.connection-request-timeout=8000
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
# mybatis-plus \u5B57\u6BB5\u9A7C\u5CF0\u81EA\u52A8\u8F6C\u6362
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.mapper-locations=classpath:/mapper/*Mapper.xml,/mapper/*/*Mapper.xml
mybatis-plus.typeAliasesPackage=com.gangquan360.smartadmin.*.*.domain.entity
mybatis-plus.mapper-locations=classpath:/mapper/**/*.xml
mybatis-plus.typeAliasesPackage=net.lab1024.smartadmin.*.*.domain.entity
mybatis-plus.global-config.refresh-mapper=true
mybatis-plus.global-config.db-column-underline=true
@@ -77,7 +76,7 @@ swagger.title=smartAdmin
swagger.description=smartAdmin
swagger.version=1.0
swagger.serviceUrl=http://localhost:10086/smart-admin-api
swagger.packAge=com.gangquan360.smartadmin.module
swagger.packAge=net.lab1024.smartadmin.module
######################### jwt #########################
jwt.key=smart-admin-jwt-key

View File

@@ -1,10 +1,10 @@
######################### server ###################
server.servlet.context-path=/smart-admin-api
server.port=10086
spring.profiles.active=dev
spring.profiles.active=@profiles.active@
######################### tomcat ###################
server.tomcat.basedir=/home/logs/smartadmin/tomcat-logs
server.tomcat.basedir=/home/logs/smart-admin/tomcat-logs
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%t %{X-Forwarded-For}i %a "%r" %s %D (%D ms)
@@ -23,31 +23,31 @@ spring.servlet.multipart.max-request-size=30MB
file-upload-service.path=/home/upload/
######################### database #########################
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/smart-admin-dev?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC
spring.datasource.username=erp
spring.datasource.password=listen1015
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/smart-admin-sit?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.initial-size=2
spring.datasource.min-idle=1
spring.datasource.max-active=10
spring.datasource.max-wait=60000
spring.datasource.time-between-eviction-runs-millis=60000
spring.datasource.min-evictable-edle-time-millis=300000
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.filters=stat
spring.datasource.druid.username=druid
spring.datasource.druid.password=Gq123456
spring.datasource.druid.password=123456
spring.datasource.druid.login.enabled=false
######################### redis #######################################
spring.redis.database=13
spring.redis.host=172.16.0.145
spring.redis.jedis.pool.max-active=100
spring.redis.jedis.pool.min-idle=5
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.max-wait=30000ms
spring.redis.port=50000
spring.redis.database=0
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.timeout=10000ms
spring.redis.password=
spring.redis.lettuce..pool.max-active=100
spring.redis.lettuce.pool.min-idle=5
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.max-wait=30000ms
########################## rest http pool #########################
#\u6700\u5927\u8FDE\u63A5\u6570
@@ -65,8 +65,8 @@ http.pool.connection-request-timeout=8000
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
# mybatis-plus \u5B57\u6BB5\u9A7C\u5CF0\u81EA\u52A8\u8F6C\u6362
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.mapper-locations=classpath:/mapper/*Mapper.xml,/mapper/*/*Mapper.xml
mybatis-plus.typeAliasesPackage=com.gangquan360.smartadmin.*.*.domain.entity
mybatis-plus.mapper-locations=classpath:/mapper/**/*.xml
mybatis-plus.typeAliasesPackage=net.lab1024.smartadmin.*.*.domain.entity
mybatis-plus.global-config.refresh-mapper=true
mybatis-plus.global-config.db-column-underline=true
@@ -76,7 +76,7 @@ swagger.title=smartAdmin
swagger.description=smartAdmin
swagger.version=1.0
swagger.serviceUrl=http://localhost:10086/smart-admin-api
swagger.packAge=com.gangquan360.smartadmin.module
swagger.packAge=net.lab1024.smartadmin.module
######################### jwt #########################
jwt.key=smart-admin-jwt-key

View File

@@ -1,63 +0,0 @@
package ${basePackage}.module.${modulePackage}.controller;
import ${basePackage}.common.domain.PageResultDTO;
import ${basePackage}.common.domain.ResponseDTO;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}DTO;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}QueryDTO;
import ${basePackage}.module.${modulePackage}.service.${moduleClass}Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) 2019 ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@RestController
@Api(tags = {"${tableDesc}"})
public class ${moduleClass}Controller {
@Autowired
private ${moduleClass}Service ${moduleVar}Service;
@ApiOperation(value = "分页查询${tableDesc}",notes = "@author ${author}")
@PostMapping("/${moduleVar}/page/query")
public ResponseDTO<PageResultDTO<${moduleClass}DTO>> queryByPage(@RequestBody ${moduleClass}QueryDTO queryDTO) {
return ${moduleVar}Service.queryByPage(queryDTO);
}
@ApiOperation(value = "添加${tableDesc}",notes = "@author ${author}")
@PostMapping("/${moduleVar}/add")
public ResponseDTO<String> add(@RequestBody @Valid ${moduleClass}DTO addTO){
return ${moduleVar}Service.add(addTO);
}
@ApiOperation(value="修改${tableDesc}",notes = "@author ${author}")
@PostMapping("/${moduleVar}/update")
public ResponseDTO<String> update(@RequestBody @Valid ${moduleClass}DTO updateDTO){
return ${moduleVar}Service.update(updateDTO);
}
@ApiOperation(value="删除${tableDesc}",notes = "@author ${author}")
@GetMapping("/${moduleVar}/delete/{id}")
public ResponseDTO<String> delete(@PathVariable("id") Long id){
return ${moduleVar}Service.delete(id);
}
@ApiOperation(value="详情${tableDesc}",notes = "@author ${author}")
@GetMapping("/${moduleVar}/detail/{id}")
public ResponseDTO<${moduleClass}DTO> detail(@PathVariable("id") Long id){
return ${moduleVar}Service.detail(id);
}
}

View File

@@ -1,47 +0,0 @@
package ${basePackage}.module.${modulePackage}.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}QueryDTO;
import ${basePackage}.module.${modulePackage}.domain.entity.${moduleClass}Entity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) 2018 ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@Mapper
@Component
public interface ${moduleClass}Dao extends BaseMapper<${moduleClass}Entity> {
/**
* 分页查询
* @param queryDTO
* @return ${moduleClass}Entity
*/
List<${moduleClass}Entity> queryByPage(Pagination page, @Param("queryDTO") ${moduleClass}QueryDTO queryDTO);
/**
* 根据id删除
* @param id
* @return
*/
void deleteById(@Param("id") Long id);
/**
* 批量删除
* @param idList
* @return
*/
void deleteByIds(@Param("idList") List<Long> idList);
}

View File

@@ -1,77 +0,0 @@
<?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="${basePackage}.module.${modulePackage}.dao.${moduleClass}Dao">
<resultMap id="${moduleClass}Entity" type="${basePackage}.module.${modulePackage}.domain.entity.${moduleClass}Entity"></resultMap>
<select id="queryByPage" resultMap="${moduleClass}Entity">
select
#foreach($column in $columnList)
#if($velocityCount != $columnList.size())
$column.columnName,
#else
$column.columnName
#end
#end
from ${tableName}
<where>
#foreach($queryField in $queryFieldList)
#if ($queryField.sqlOperate == 'like')
<if test="queryDTO.${queryField.fieldName} != null and queryDTO.${queryField.fieldName} != ''">
AND INSTR($queryField.columnName,#{queryDTO.$queryField.fieldName})
</if>
#end
#if ($queryField.sqlOperate == 'equals')
#if ($queryField.fieldType == 'String')
<if test="queryDTO.${queryField.fieldName} != null and queryDTO.${queryField.fieldName} != ''">
AND $queryField.columnName = #{queryDTO.$queryField.fieldName}
</if>
#else
<if test="queryDTO.${queryField.fieldName} != null">
AND $queryField.columnName = #{queryDTO.$queryField.fieldName}
</if>
#end
#end
#if ($queryField.sqlOperate == 'time_equals')
<if test="queryDTO.${queryField.fieldName} != null and queryDTO.${queryField.fieldName} != ''">
AND DATE_FORMAT($queryField.columnName, '%Y-%m-%d') = #{queryDTO.$queryField.fieldName}
</if>
#end
#if ($queryField.sqlOperate == 'time_between')
<if test="queryDTO.startDate != null and queryDTO.startDate != ''">
AND DATE_FORMAT($queryField.columnName, '%Y-%m-%d') &gt;= #{queryDTO.startDate}
</if>
<if test="queryDTO.endDate != null and queryDTO.endDate != ''">
AND DATE_FORMAT($queryField.columnName, '%Y-%m-%d') &lt;= #{queryDTO.endDate}
</if>
#end
#if ($queryField.sqlOperate == 'in')
<if test="queryDTO.${queryField.fieldName}List !=null and queryDTO.${queryField.fieldName}List.size() > 0">
and $queryField.columnName in
<foreach collection="queryDTO.${queryField.fieldName}List" open="(" index="index" separator="," close=")" item="item">
#{item}
</foreach>
</if>
#end
#if ($queryField.sqlOperate == 'gt')
<if test="queryDTO.startDate != null and queryDTO.startDate != ''">
and DATE_FORMAT($queryField.columnName, '%Y-%m-%d') &gt;= DATE_FORMAT(#{queryDTO.startDate}, '%Y-%m-%d')
</if>
#end
#end
</where>
</select>
<delete id="deleteById">
delete from ${tableName} where id = #{id}
</delete>
<delete id="deleteByIds">
delete from ${tableName} where id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</delete>
</mapper>

View File

@@ -1,4 +1,5 @@
package ${basePackage}.module.${modulePackage}.domain.dto;
import lombok.Data;
#foreach ($dtoImport in $dtoImports)
$dtoImport
@@ -7,19 +8,19 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
/**
* [ ${tableDesc} ]
* 新建 [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) 2018 ${company}Inc. All rights reserved.
* @date 2019/3/27 0027 下午 12:27
* @date ${date}
* @since JDK1.8
*/
@Data
public class ${moduleClass}DTO {
public class ${moduleClass}AddDTO {
#foreach ($column in $columnList)
#if($column.fieldName != 'id')
#if($column.fieldType == 'Date')
@ApiModelProperty("${column.columnDesc}")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -29,6 +30,7 @@ public class ${moduleClass}DTO {
private $column.fieldType $column.fieldName;
#end
#end
#end
}

View File

@@ -0,0 +1,88 @@
package ${basePackage}.module.${modulePackage}.controller;
import ${basePackage}.common.domain.PageResultDTO;
import ${basePackage}.common.controller.BaseController;
import ${basePackage}.common.domain.ResponseDTO;
import ${basePackage}.common.domain.ValidateList;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}AddDTO;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}UpdateDTO;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}QueryDTO;
import ${basePackage}.module.${modulePackage}.domain.vo.${moduleClass}VO;
import ${basePackage}.module.${modulePackage}.domain.vo.${moduleClass}ExcelVO;
import ${basePackage}.module.${modulePackage}.service.${moduleClass}Service;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.apache.poi.ss.usermodel.Workbook;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@RestController
@Api(tags = {"${tableDesc}"})
public class ${moduleClass}Controller extends BaseController {
@Autowired
private ${moduleClass}Service ${moduleVar}Service;
@ApiOperation(value = "分页查询${tableDesc}",notes = "@author ${author}")
@PostMapping("/${moduleVar}/page/query")
public ResponseDTO<PageResultDTO<${moduleClass}VO>> queryByPage(@RequestBody ${moduleClass}QueryDTO queryDTO) {
return ${moduleVar}Service.queryByPage(queryDTO);
}
@ApiOperation(value = "添加${tableDesc}",notes = "@author ${author}")
@PostMapping("/${moduleVar}/add")
public ResponseDTO<String> add(@RequestBody @Validated ${moduleClass}AddDTO addTO){
return ${moduleVar}Service.add(addTO);
}
@ApiOperation(value="修改${tableDesc}",notes = "@author ${author}")
@PostMapping("/${moduleVar}/update")
public ResponseDTO<String> update(@RequestBody @Validated ${moduleClass}UpdateDTO updateDTO){
return ${moduleVar}Service.update(updateDTO);
}
@ApiOperation(value="批量删除${tableDesc}",notes = "@author ${author}")
@PostMapping("/${moduleVar}/deleteByIds")
public ResponseDTO<String> delete(@RequestBody @Validated ValidateList<Long> idList) {
return ${moduleVar}Service.deleteByIds(idList);
}
@ApiOperation(value = "批量导出", notes = "@author ${author}")
@PostMapping("/${moduleVar}/export/batch")
public void batchExport(@RequestBody @Validated ValidateList<Long> idList, HttpServletResponse response) {
//查询数据
List<${moduleClass}ExcelVO> ${moduleVar}List = ${moduleVar}Service.queryBatchExportData(idList);
//导出操作
ExportParams ex = new ExportParams("${tableDesc}", "Sheet1");
Workbook workbook = ExcelExportUtil.exportExcel(ex, ${moduleClass}ExcelVO.class, ${moduleVar}List);
downloadExcel("${tableDesc}", workbook, response);
}
@ApiOperation(value = "导出全部", notes = "@author ${author}")
@PostMapping("/${moduleVar}/export/all")
public void exportAll(@RequestBody @Validated ${moduleClass}QueryDTO queryDTO, HttpServletResponse response) {
//查询数据
List<${moduleClass}ExcelVO> ${moduleVar}List = ${moduleVar}Service.queryAllExportData(queryDTO);
//导出操作
ExportParams ex = new ExportParams("${tableDesc}", "Sheet1");
Workbook workbook = ExcelExportUtil.exportExcel(ex, ${moduleClass}ExcelVO.class, ${moduleVar}List);
downloadExcel("${tableDesc}", workbook, response);
}
}

View File

@@ -0,0 +1,64 @@
package ${basePackage}.module.${modulePackage}.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}QueryDTO;
import ${basePackage}.module.${modulePackage}.domain.entity.${moduleClass}Entity;
import ${basePackage}.module.${modulePackage}.domain.vo.${moduleClass}VO;
import ${basePackage}.module.${modulePackage}.domain.vo.${moduleClass}ExcelVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@Mapper
@Component
public interface ${moduleClass}Dao extends BaseMapper<${moduleClass}Entity> {
/**
* 分页查询
* @param queryDTO
* @return ${moduleClass}VO
*/
IPage<${moduleClass}VO> queryByPage(Page page, @Param("queryDTO") ${moduleClass}QueryDTO queryDTO);
/**
* 根据id删除
* @param id
* @return
*/
void deleteById(@Param("id")Long id);
/**
* 根据id批量删除
* @param idList
* @return
*/
void deleteByIdList(@Param("idList") List<Long> idList);
/**
* 查询所有导出数据
* @param queryDTO
* @return
*/
List<${moduleClass}ExcelVO> queryAllExportData(@Param("queryDTO")${moduleClass}QueryDTO queryDTO);
/**
* 查询批量导出数据
* @param idList
* @return
*/
List<${moduleClass}ExcelVO> queryBatchExportData(@Param("idList")List<Long> idList);
}

View File

@@ -0,0 +1,144 @@
<?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="${basePackage}.module.${modulePackage}.dao.${moduleClass}Dao">
<resultMap id="${moduleClass}VO" type="${basePackage}.module.${modulePackage}.domain.vo.${moduleClass}VO"></resultMap>
<resultMap id="${moduleClass}ExcelVO" type="${basePackage}.module.${modulePackage}.domain.vo.${moduleClass}ExcelVO"></resultMap>
<select id="queryByPage" resultMap="${moduleClass}VO">
select
#foreach($column in $columnList)
#if($velocityCount != $columnList.size())
$column.columnName,
#else
$column.columnName
#end
#end
from ${tableName}
<where>
#foreach($queryField in $queryFieldList)
#if ($queryField.sqlOperate == 'like')
<if test="queryDTO.${queryField.fieldName} != null and queryDTO.${queryField.fieldName} != ''">
AND INSTR($queryField.columnName,#{queryDTO.$queryField.fieldName})
</if>
#end
#if ($queryField.sqlOperate == 'equals')
#if ($queryField.fieldType == 'String')
<if test="queryDTO.${queryField.fieldName} != null and queryDTO.${queryField.fieldName} != ''">
AND $queryField.columnName = #{queryDTO.$queryField.fieldName}
</if>
#else
<if test="queryDTO.${queryField.fieldName} != null">
AND $queryField.columnName = #{queryDTO.$queryField.fieldName}
</if>
#end
#end
#if ($queryField.sqlOperate == 'in')
<if test="queryDTO.${queryField.fieldName}List !=null and queryDTO.${queryField.fieldName}List.size() > 0">
and $queryField.columnName in
<foreach collection="queryDTO.${queryField.fieldName}List" open="(" index="index" separator="," close=")" item="item">
#{item}
</foreach>
</if>
#end
#end
<if test="queryDTO.createTimeBegin != null ">
AND create_time &gt;= #{queryDTO.createTimeBegin}
</if>
<if test="queryDTO.createTimeEnd != null ">
AND create_time &lt;= #{queryDTO.createTimeEnd}
</if>
<if test="queryDTO.updateTimeBegin != null ">
AND update_time &gt;= #{queryDTO.updateTimeBegin}
</if>
<if test="queryDTO.updateTimeEnd != null ">
AND update_time &lt;= #{queryDTO.updateTimeEnd}
</if>
</where>
</select>
<select id="queryAllExportData" resultMap="${moduleClass}ExcelVO">
select
#foreach($column in $columnList)
#if($velocityCount != $columnList.size())
$column.columnName,
#else
$column.columnName
#end
#end
from ${tableName}
<where>
#foreach($queryField in $queryFieldList)
#if ($queryField.sqlOperate == 'like')
<if test="queryDTO.${queryField.fieldName} != null and queryDTO.${queryField.fieldName} != ''">
AND INSTR($queryField.columnName,#{queryDTO.$queryField.fieldName})
</if>
#end
#if ($queryField.sqlOperate == 'equals')
#if ($queryField.fieldType == 'String')
<if test="queryDTO.${queryField.fieldName} != null and queryDTO.${queryField.fieldName} != ''">
AND $queryField.columnName = #{queryDTO.$queryField.fieldName}
</if>
#else
<if test="queryDTO.${queryField.fieldName} != null">
AND $queryField.columnName = #{queryDTO.$queryField.fieldName}
</if>
#end
#end
#if ($queryField.sqlOperate == 'in')
<if test="queryDTO.${queryField.fieldName}List !=null and queryDTO.${queryField.fieldName}List.size() > 0">
and $queryField.columnName in
<foreach collection="queryDTO.${queryField.fieldName}List" open="(" index="index" separator="," close=")" item="item">
#{item}
</foreach>
</if>
#end
#end
<if test="queryDTO.createTimeBegin != null ">
AND create_time &gt;= #{queryDTO.createTimeBegin}
</if>
<if test="queryDTO.createTimeEnd != null ">
AND create_time &lt;= #{queryDTO.createTimeEnd}
</if>
<if test="queryDTO.updateTimeBegin != null ">
AND update_time &gt;= #{queryDTO.updateTimeBegin}
</if>
<if test="queryDTO.updateTimeEnd != null ">
AND update_time &lt;= #{queryDTO.updateTimeEnd}
</if>
</where>
</select>
<select id="queryBatchExportData" resultMap="${moduleClass}ExcelVO">
select
#foreach($column in $columnList)
#if($velocityCount != $columnList.size())
$column.columnName,
#else
$column.columnName
#end
#end
from ${tableName}
where id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<delete id="deleteById">
delete from ${tableName} where id = #{id}
</delete>
<delete id="deleteByIdList">
delete from ${tableName} where id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</delete>
</mapper>

View File

@@ -1,27 +1,25 @@
package ${basePackage}.module.${modulePackage}.domain.entity;
import com.baomidou.mybatisplus.annotations.TableName;
import com.gangquan360.smartadmin.common.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import ${basePackage}.common.domain.BaseEntity;
#foreach ($entityImport in $entityImports)
$entityImport
#end
import lombok.Data;
import java.io.Serializable;
/**
* [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) 2018 ${company}Inc. All rights reserved.
* @copyright (c) ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@Data
@TableName("${tableName}")
public class ${moduleClass}Entity extends BaseEntity{
#foreach ($column in $columnList)
#if($column.columnName != 'id' && $column.fieldName != 'updateTime' && $column.fieldName != 'createTime')

View File

@@ -0,0 +1,33 @@
package ${basePackage}.module.${modulePackage}.domain.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
#foreach ($dtoImport in $dtoImports)
$dtoImport
#end
/**
* [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@Data
public class ${moduleClass}ExcelVO {
#foreach ($column in $columnList)
#if($column.fieldType == 'Date')
@Excel(name = "${column.columnDesc}", format = "yyyy-MM-dd HH:mm:ss")
private $column.fieldType $column.fieldName;
#else
@Excel(name = "${column.columnDesc}")
private $column.fieldType $column.fieldName;
#end
#end
}

View File

@@ -3,6 +3,7 @@ package ${basePackage}.module.${modulePackage}.domain.dto;
import ${basePackage}.common.domain.PageParamDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
#foreach ($queryImport in $queryImports)
$queryImport
#end
@@ -13,31 +14,32 @@ $queryImport
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) 2019 ${company}Inc. All rights reserved.
* @copyright (c) ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@Data
public class ${moduleClass}QueryDTO extends PageParamDTO {
#foreach ($queryField in $queryFieldList)
#if($queryField.sqlOperate == 'in')
@ApiModelProperty("${queryField.columnDesc}")
private List<${queryField.fieldType}> ${queryField.fieldName}List;
#elseif($queryField.sqlOperate == 'time_equals')
@ApiModelProperty("${queryField.columnDesc}")
private String ${queryField.fieldName};
#elseif($queryField.sqlOperate == 'time_between')
@ApiModelProperty("开始日期")
private String startDate;
@ApiModelProperty("结束日期")
private String endDate;
#else
@ApiModelProperty("${queryField.columnDesc}")
private ${queryField.fieldType} ${queryField.fieldName};
#end
#end
@ApiModelProperty("创建时间-开始")
private Date createTimeBegin;
@ApiModelProperty("创建时间-截止")
private Date createTimeEnd;
@ApiModelProperty("上次更新时间-开始")
private Date updateTimeBegin;
@ApiModelProperty("上次更新创建时间-开始")
private Date updateTimeEnd;
}

View File

@@ -1,13 +1,17 @@
package ${basePackage}.module.${modulePackage}.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import ${basePackage}.common.domain.PageResultDTO;
import ${basePackage}.common.domain.ResponseDTO;
import ${basePackage}.module.${modulePackage}.dao.${moduleClass}Dao;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}DTO;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}AddDTO;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}UpdateDTO;
import ${basePackage}.module.${modulePackage}.domain.dto.${moduleClass}QueryDTO;
import ${basePackage}.module.${modulePackage}.domain.entity.${moduleClass}Entity;
import ${basePackage}.util.SmartPaginationUtil;
import ${basePackage}.module.${modulePackage}.domain.vo.${moduleClass}VO;
import ${basePackage}.module.${modulePackage}.domain.vo.${moduleClass}ExcelVO;
import ${basePackage}.util.SmartPageUtil;
import ${basePackage}.util.SmartBeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -21,7 +25,7 @@ import java.util.List;
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) 2019 ${company}Inc. All rights reserved.
* @copyright (c) ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@@ -31,65 +35,74 @@ public class ${moduleClass}Service {
@Autowired
private ${moduleClass}Dao ${moduleVar}Dao;
/**
* 根据id查询
*/
public ${moduleClass}Entity getById(Long id){
return ${moduleVar}Dao.selectById(id);
}
/**
* 分页查询
* @author ${author}
* @description 分页查询
* @date ${date}
*/
public ResponseDTO<PageResultDTO<${moduleClass}DTO>> queryByPage(${moduleClass}QueryDTO queryDTO) {
Page page = SmartPaginationUtil.convert2PageQueryInfo(queryDTO);
List<${moduleClass}Entity> entities = ${moduleVar}Dao.queryByPage(page, queryDTO);
List<${moduleClass}DTO> dtoList = SmartBeanUtil.copyList(entities, ${moduleClass}DTO.class);
page.setRecords(dtoList);
PageResultDTO<${moduleClass}DTO> pageResultDTO = SmartPaginationUtil.convert2PageResultDTO(page);
public ResponseDTO<PageResultDTO<${moduleClass}VO>> queryByPage(${moduleClass}QueryDTO queryDTO) {
Page page = SmartPageUtil.convert2QueryPage(queryDTO);
IPage<${moduleClass}VO> voList = ${moduleVar}Dao.queryByPage(page, queryDTO);
PageResultDTO<${moduleClass}VO> pageResultDTO = SmartPageUtil.convert2PageResult(voList);
return ResponseDTO.succData(pageResultDTO);
}
/**
* 添加
* @author ${author}
* @description 添加
* @date ${date}
*/
public ResponseDTO<String> add(${moduleClass}DTO addDTO) {
public ResponseDTO<String> add(${moduleClass}AddDTO addDTO) {
${moduleClass}Entity entity = SmartBeanUtil.copy(addDTO, ${moduleClass}Entity.class);
${moduleVar}Dao.insert(entity);
return ResponseDTO.succ();
}
/**
* 编辑
* @author ${author}
* @description 编辑
* @date ${date}
*/
@Transactional(rollbackFor = Exception.class)
public ResponseDTO<String> update(${moduleClass}DTO updateDTO) {
public ResponseDTO<String> update(${moduleClass}UpdateDTO updateDTO) {
${moduleClass}Entity entity = SmartBeanUtil.copy(updateDTO, ${moduleClass}Entity.class);
${moduleVar}Dao.updateById(entity);
return ResponseDTO.succ();
}
/**
* 删除
* @author ${author}
* @description 删除
* @date ${date}
*/
@Transactional(rollbackFor = Exception.class)
public ResponseDTO<String> delete(Long id) {
${moduleVar}Dao.deleteById(id);
public ResponseDTO<String> deleteByIds(List<Long> idList) {
${moduleVar}Dao.deleteByIdList(idList);
return ResponseDTO.succ();
}
/**
* 查询全部导出对象
* @author ${author}
* @description 根据ID查询
* @date ${date}
*/
public ResponseDTO<${moduleClass}DTO> detail(Long id){
${moduleClass}Entity entity = ${moduleVar}Dao.selectById(id);
${moduleClass}DTO dto = SmartBeanUtil.copy(entity,${moduleClass}DTO.class);
return ResponseDTO.succData(dto);
*/
public List<${moduleClass}ExcelVO> queryAllExportData(${moduleClass}QueryDTO queryDTO) {
return ${moduleVar}Dao.queryAllExportData( queryDTO);
}
/**
* 批量查询导出对象
* @author ${author}
* @date ${date}
*/
public List<${moduleClass}ExcelVO> queryBatchExportData(List<Long> idList) {
return ${moduleVar}Dao.queryBatchExportData(idList);
}
}

View File

@@ -0,0 +1,20 @@
package ${basePackage}.module.${modulePackage}.domain.dto;
import lombok.Data;
/**
* 更新 [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) 2018 ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@Data
public class ${moduleClass}UpdateDTO extends ${moduleClass}AddDTO {
private Long id;
}

View File

@@ -0,0 +1,35 @@
package ${basePackage}.module.${modulePackage}.domain.vo;
import lombok.Data;
#foreach ($dtoImport in $dtoImports)
$dtoImport
#end
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
/**
* [ ${tableDesc} ]
*
* @author ${author}
* @version 1.0
* @company ${company}
* @copyright (c) ${company}Inc. All rights reserved.
* @date ${date}
* @since JDK1.8
*/
@Data
public class ${moduleClass}VO {
#foreach ($column in $columnList)
#if($column.fieldType == 'Date')
@ApiModelProperty("${column.columnDesc}")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private $column.fieldType $column.fieldName;
#else
@ApiModelProperty("${column.columnDesc}")
private $column.fieldType $column.fieldName;
#end
#end
}

View File

@@ -0,0 +1,28 @@
import { postAxios, getAxios, postDownloadAxios } from '@/lib/http';
export const ${moduleVar}Api = {
// 添加${tableDesc} @author ${author}
add${moduleClass}: (data) => {
return postAxios('/${moduleVar}/add', data);
},
// 分页查询${tableDesc} @author ${author}
query${moduleClass}: (data) => {
return postAxios('/${moduleVar}/page/query', data);
},
// 批量删除${tableDesc} @author ${author}
batchDelete${moduleClass}: (idList) => {
return postAxios('/${moduleVar}/deleteByIds', idList);
},
// 修改${tableDesc} @author ${author}
update${moduleClass}: (data) => {
return postAxios('/${moduleVar}/update',data);
},
// 导出全部 @author ${author}
exportAll:(data)=>{
return postDownloadAxios('/${moduleVar}/export/all',data);
},
// 批量导出 @author ${author}
batchExport: (idList) => {
return postDownloadAxios('/${moduleVar}/export/batch', idList);
},
};

View File

@@ -0,0 +1,439 @@
<template>
<div>
<Card class="smart-query-card">
<!------ 查询条件第一行 begin------->
<Row class="smart-query-form-row">
#foreach ($queryField in $queryFieldList)
<span>
${queryField.columnDesc} :
<Input placeholder="请输入${queryField.columnDesc}" style="width: 180px" v-model="queryForm.${queryField.fieldName}" />
</span>
#end
<ButtonGroup>
<Button
@click="queryList"
icon="ios-search"
type="primary"
v-privilege="'${webModuleName}-list-query'"
>查询</Button>
<Button
@click="resetQueryList"
icon="md-refresh"
type="default"
v-privilege="'${webModuleName}-list-query'"
>重置</Button>
</ButtonGroup>
<Button
@click="showMoreQueryConditionFlag = !showMoreQueryConditionFlag"
icon="md-more"
style="margin-left: 20px"
type="primary"
v-privilege="'${webModuleName}-list-query'"
>{{showMoreQueryConditionFlag?'隐藏':'展开'}}</Button>
</Row>
<!------ 查询条件第一行 begin------->
<!------ 查询条件第二行 begin------->
<Row class="smart-query-form-row" v-show="showMoreQueryConditionFlag">
<span>
xxx
<Input placeholder="请输入xxx" style="width: 250px" />
</span>
<span>
创建时间:
<DatePicker
placeholder="选择创建日期范围"
split-panels
style="width: 200px"
type="daterange"
v-model="queryForm.createTimeRange"
></DatePicker>
</span>
<span>
更新时间:
<DatePicker
placeholder="选择更新日期范围"
split-panels
style="width: 200px"
type="daterange"
v-model="queryForm.updateTimeRange"
></DatePicker>
</span>
</Row>
<!------ 查询条件第二行 end------->
</Card>
<Card class="warp-card">
<!-------操作按钮行 begin------->
<Row class="marginBottom10">
<Button
@click="showAdd${moduleClass}Form"
icon="md-add"
size="small"
type="primary"
v-privilege="'${webModuleName}-list-add'"
>新建数据</Button>
<Button
@click="showBatchDeleteModal"
class="marginLeft10"
icon="ios-trash-outline"
size="small"
type="error"
v-privilege="'${webModuleName}-list-batch-delete'"
>批量删除</Button>
<Button
:loading="allExportBtnLoading"
@click="exportAll"
class="marginLeft10 float-right"
icon="ios-cloud-download-outline"
size="small"
type="warning"
v-privilege="'${webModuleName}-list-export-all'"
>导出全部</Button>
<Button
:loading="batchExportBtnLoading"
@click="batchExport"
class="marginLeft10 float-right"
icon="ios-download-outline"
size="small"
type="warning"
v-privilege="'${webModuleName}-list-batch-export'"
>批量导出</Button>
</Row>
<!-------操作按钮行 end------->
<!-------表格列表 begin------->
<Table
:columns="mainTable.columnArray"
:data="mainTable.data"
:loading="mainTable.loading"
@on-sort-change="handleSortChange"
border
highlight-row
ref="mainTable"
></Table>
<Page
:current="queryForm.pageNum"
:page-size="queryForm.pageSize"
:page-size-opts="mainTablePage.pageSizeOps"
:total="mainTablePage.total"
@on-change="changeMainTablePagePageNum"
@on-page-size-change="changeMainTablePagePageSize"
class="smart-query-table-page"
show-elevator
show-sizer
show-total
/>
</Card>
<!-------表格列表 end------->
<!-------批量删除Modal begin------->
<Modal title="批量删除" v-model="batchDeleteModal.show" width="450">
<Form :label-width="80">
<FormItem>
<h3 class="error-color">确定要删除以下数据吗?</h3>
</FormItem>
<FormItem label="删除数据">
<Card style="width:350px;height:250px;overflow-y:scroll;">
<ul>
<li v-for="item in mainTableSelectArray">
<a href="#">{{ item.id }}</a>
</li>
</ul>
</Card>
</FormItem>
</Form>
<div slot="footer">
<Button @click="batchDeleteModal.show = false" size="small" type="default">取消</Button>
<Button @click="batchDelete" size="small" type="primary">确定删除</Button>
</div>
</Modal>
<!-------批量删除Modal end------->
<!-------添加、更新 Form表单 begin------->
<Modal
:footer-hide="true"
:title="saveModal.isUpdate?'更新':'新建'"
v-model="saveModal.show"
@on-cancel="saveFormClose"
width="500"
>
<${moduleClass}ListForm
:isUpdate="saveModal.isUpdate"
:updateData="saveModal.updateData"
@on-form-close="saveFormClose"
/>
</Modal>
<!-------添加、更新 Form表单 end------->
</div>
</template>
<script>
import {dateTimeRangeConvert} from '@/lib/util'
import { PAGE_SIZE_OPTIONS } from '@/constants/table-page';
import { ${moduleVar}Api } from '@/api/${webModuleName}';
import ${moduleClass}ListForm from './components/${webModuleName}-list-form';
const PAGE_SIZE_INIT = 20;
export default {
name: '${moduleClass}List',
components: {
${moduleClass}ListForm
},
props: {},
data() {
return {
/* -------------------------添加、更新表单 ------------------------- */
saveModal: {
show: false,
isUpdate: false,
updateData: null
},
/* -------------------------批量操作------------------------- */
//批量刪除彈出框
batchDeleteModal: {
show: false
},
//表格多选选中的元素数组
mainTableSelectArray: [],
/* -------------------------导出操作------------------------- */
//批量导出loading按钮
batchExportBtnLoading:false,
//导出全部loading按钮
allExportBtnLoading:false,
/* -------------------------查询条件相关数据-------------------- */
//搜索表单
queryForm: {
#foreach ($queryField in $queryFieldList)
//${queryField.columnDesc}
${queryField.fieldName}:null,
#end
createTimeRange: ["",""],
updateTimeRange: ["",""],
pageNum: 1,
pageSize: PAGE_SIZE_INIT,
orders: []
},
//是否展示更多搜索条件
showMoreQueryConditionFlag: false,
/* -------------------------表格相关数据------------------------- */
//表格分页
mainTablePage: {
total: 0,
pageSizeOps: PAGE_SIZE_OPTIONS
},
//表格
mainTable: {
//加载中
loading: false,
//表格数据
data: [],
//表格列
columnArray: [
{
type: 'selection',
width: 30,
align: 'center'
},
#foreach ($column in $columnList)
{
title: '${column.columnDesc}',
key: '${column.fieldName}',
tableColumn: '${tableName}.${column.columnName}',
sortable: 'custom'
},
#end
{
title: '操作',
key: 'action',
align: 'right',
width: 130,
className: 'action-hide',
render: (h, params) => {
let actions = [
{
title: '编辑',
directives: [
{
name: 'privilege',
value: '${webModuleName}-list-update'
}
],
action: () => {
this.showEdit${moduleClass}Form(params.row);
}
}
];
return this.$tableAction(h, actions);
}
}
]
}
};
},
computed: {},
watch: {},
filters: {},
created() {},
mounted() {
this.queryList();
},
beforeCreate() {},
beforeMount() {},
beforeUpdate() {},
updated() {},
beforeDestroy() {},
destroyed() {},
activated() {},
methods: {
/* -------------------------查询相关 begin------------------------- */
convertQueryParam(){
let createTimeArray = dateTimeRangeConvert(this.queryForm.createTimeRange);
let updateTimeArray = dateTimeRangeConvert(this.queryForm.updateTimeRange);
return {...this.queryForm,
createTimeBegin:createTimeArray[0],
createTimeEnd:createTimeArray[1],
updateTimeBegin:updateTimeArray[0],
updateTimeEnd:updateTimeArray[1]
};
},
//查询
async queryList() {
this.mainTable.loading = true;
try {
let params = this.convertQueryParam();
let result = await ${moduleVar}Api.query${moduleClass}(params);
this.mainTable.data = result.data.list;
this.mainTablePage.total = result.data.total;
} finally {
this.mainTable.loading = false;
}
},
//重置查询
resetQueryList() {
let pageSize = this.queryForm.pageSize;
this.queryForm = {
#foreach ($queryField in $queryFieldList)
${queryField.fieldName}:null,
#end
createTimeRange: ["",""],
updateTimeRange: ["",""],
pageNum: 1,
pageSize: pageSize,
orders: []
};
this.queryList();
},
//修改页码
changeMainTablePagePageNum(pageNum) {
this.queryForm.pageNum = pageNum;
this.queryList();
},
//修改页大小
changeMainTablePagePageSize(pageSize) {
this.queryForm.pageNum = 1;
this.queryForm.pageSize = pageSize;
this.queryList();
},
//处理排序
handleSortChange(column) {
if (column.order === 'normal') {
this.queryForm.orders = [];
} else {
this.queryForm.orders = [
{
column: column.column.tableColumn,
asc: 'asc' === column.order
}
];
}
this.queryList();
},
/*-------------------------查询相关 end------------------------- */
/*-------------------------批量操作 begin------------------------- */
//显示批量删除弹窗
showBatchDeleteModal() {
if (!this.validateMainTableSelection()) {
return;
}
this.batchDeleteModal.show = true;
},
//批量删除
async batchDelete() {
this.$Spin.show();
await ${moduleVar}Api.batchDelete${moduleClass}(
this.mainTableSelectArray.map(e => e.id)
);
this.batchDeleteModal.show = false;
this.${ViewUIMessage}.success('刪除成功');
this.$Spin.hide();
this.queryList();
},
//清空选中
clearMainTableSelection() {
this.mainTableSelectArray = [];
},
//校验是否有选中
validateMainTableSelection() {
this.mainTableSelectArray = this.$refs.mainTable.getSelection();
if (this.mainTableSelectArray.length < 1) {
this.$Message.error('请选择至少一条数据');
return false;
}
return true;
},
/*-------------------------批量操作 end------------------------- */
/*-------------------------导入导出 begin------------------------- */
//导出全部
async exportAll(){
try{
this.allExportBtnLoading = true;
let params = this.convertQueryParam();
await ${moduleVar}Api.exportAll(params);
} catch(e){
console.log(e);
}finally{
this.allExportBtnLoading = false;
}
},
//批量导出
async batchExport(){
if (!this.validateMainTableSelection()) {
return;
}
try{
this.batchExportBtnLoading = true;
await ${moduleVar}Api.batchExport(this.mainTableSelectArray.map(e => e.id));
} catch(e){
console.log(e);
}finally{
this.batchExportBtnLoading = false;
}
},
/*-------------------------导入导出 end------------------------- */
/*-------------------------添加,修改 表单 begin------------------------- */
//显示添加表单
showAdd${moduleClass}Form() {
this.saveModal.isUpdate = false;
this.saveModal.show = true;
},
showEdit${moduleClass}Form(updateObject){
this.saveModal.isUpdate =true;
this.saveModal.updateData = updateObject;
this.saveModal.show = true;
},
saveFormClose(){
this.saveModal.show = false;
this.queryList();
}
/*-------------------------添加,修改 表单 end------------------------- */
}
};
</script>

View File

@@ -0,0 +1,132 @@
<template>
<div>
<Form ref="form" :rules="formValidate" :label-width="90" :model="form">
#foreach ($column in $columnList)
#if($column.columnName != 'id' && $column.fieldName != 'updateTime' && $column.fieldName != 'createTime')
<FormItem label="${column.columnDesc}" prop="${column.fieldName}">
#if($column.isNumber)
<Input type="number" v-model.number="form.${column.fieldName}" />
#end
#if(!$column.isNumber)
<Input v-model="form.${column.fieldName}" />
#end
</FormItem>
#end
#end
</Form>
<Row class="code-row-bg" justify="end" type="flex">
<Button @click="cancel" style="margin-right:10px">取消</Button>
<Button @click="save" type="primary">保存</Button>
</Row>
</div>
</template>
<script>
import { ${moduleVar}Api } from '@/api/${webModuleName}';
export default {
name: 'CodeReviewListForm',
components: {
},
props: {
//是否为更新表单
isUpdate: {
type: Boolean,
default: true
},
//更新的表单数据对象
updateData: {
type: Object
}
},
data() {
return {
//表单数据
form: {
#foreach ($column in $columnList)
#if($column.columnName != 'id' && $column.fieldName != 'updateTime' && $column.fieldName != 'createTime')
//${column.columnDesc}
${column.fieldName}:null,
#end
#end
},
//表单验证
formValidate: {
#foreach ($column in $columnList)
#if($column.columnName != 'id' && $column.fieldName != 'updateTime' && $column.fieldName != 'createTime')
//${column.columnDesc}
#if($column.isNumber)
${column.fieldName}:[{ type:'number',required: true, message: '请输入${column.columnDesc}', trigger: 'blur' }],
#end
#if(!$column.isNumber)
${column.fieldName}:[{ required: true, message: '请输入${column.columnDesc}', trigger: 'blur' }],
#end
#end
#end
}
};
},
watch: {
updateData: function(newValue, oldValue) {
this.$refs['form'].resetFields();
if (this.isUpdate) {
for (let k in this.form) {
this.$set(this.form, k, newValue[k]);
}
this.$set(this.form, 'id', newValue['id']);
}
},
isUpdate: function(newValue, oldValue) {
if (!newValue) {
this.resetForm();
this.$refs['form'].resetFields();
}
}
},
created() {},
mounted() {},
methods: {
cancel() {
this.$emit('on-form-close');
},
save() {
this.${VueRefs}['form'].validate(valid => {
if (valid) {
if (this.isUpdate) {
this.update();
} else {
this.add();
}
} else {
this.$Message.error('参数验证错误,请仔细填写表单数据!');
}
});
},
resetForm() {
this.form = {
#foreach ($column in $columnList)
#if($column.columnName != 'id' && $column.fieldName != 'updateTime' && $column.fieldName != 'createTime')
//${column.columnDesc}
${column.fieldName}:null,
#end
#end
};
this.$refs['form'].resetFields();
},
async add() {
this.$Spin.show();
let res = await ${moduleVar}Api.add${moduleClass}(this.form);
this.${ViewUIMessage}.success(res.msg);
this.$Spin.hide();
this.resetForm();
this.$emit('on-form-close');
},
async update() {
this.$Spin.show();
let res = await ${moduleVar}Api.update${moduleClass}(this.form);
this.${ViewUIMessage}.success(res.msg);
this.$Spin.hide();
this.resetForm();
this.$emit('on-form-close');
}
}
};
</script>

View File

@@ -0,0 +1,32 @@
import Main from '@/components/main';
// ${tableName}路由
export const ${moduleVar} = [
{
path: '/${webModuleName}',
name: '${moduleClass}',
component: Main,
meta: {
title: '${tableDesc}管理',
icon: 'icon iconfont iconyoujianguanli'
},
children: [
// ${tableDesc}列表
{
path: '/${webModuleName}/${webModuleName}-list',
name: '${moduleClass}List',
meta: {
title: '${tableDesc}列表',
privilege: [
{ title: '查询', name: '${webModuleName}-list-query' },
{ title: '新增', name: '${webModuleName}-list-add' },
{ title: '编辑', name: '${webModuleName}-list-update' },
{ title: '批量删除', name: '${webModuleName}-list-batch-delete' },
{ title: '批量导出', name: '${webModuleName}-list-batch-export' },
{ title: '导出全部', name: '${webModuleName}-list-export-all' }
]
},
component: () => import('@/views/business/${webModuleName}/${webModuleName}-list.vue')
}
]
}
];