2.0 alpha

This commit is contained in:
zhuoda
2021-09-02 21:34:21 +08:00
parent c692d0e6d3
commit 959ef3dc4e
1223 changed files with 55849 additions and 73875 deletions

View File

@@ -0,0 +1,14 @@
${AnsiColor.BRIGHT_GREEN}
/ ____| | | /\ | | (_)
| (___ _ __ ___ __ _ _ __| |_ / \ __| |_ __ ___ _ _ __
\___ \| '_ ` _ \ / _` | '__| __| / /\ \ / _` | '_ ` _ \| | '_ \
____) | | | | | | (_| | | | |_ / ____ \ (_| | | | | | | | | | |
|_____/|_| |_| |_|\__,_|_| \__/_/ \_\__,_|_| |_| |_|_|_| |_|
热爱代码 热爱生活
永远年轻 永远前行
SmartAdmin v2.0.0 by 【1024lab team】
${AnsiColor.DEFAULT}

View File

@@ -0,0 +1,98 @@
######################### server ###################
server.servlet.context-path=/
server.port=10086
spring.profiles.active=@profiles.active@
######################### project ###################
project.name=smart-admin
project.module=net.lab1024.smartadmin.service.module
######################### tomcat ###################
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)
######################### jackson #########################
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
spring.jackson.serialization.write-dates-as-timestamps=false
######################### database #########################
spring.datasource.url=jdbc:p6spy:mysql://127.0.0.1:3306/smart_admin_v2?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=1024lab
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-idle-time-millis=300000
spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver
spring.datasource.filters=stat
spring.datasource.druid.username=druid
spring.datasource.druid.password=123456
spring.datasource.druid.login.enabled=false
spring.datasource.druid.service.scanner=net.lab1024.smartadmin.module..*Service.*
######################### redis #######################################
spring.redis.database=1
spring.redis.host=127.0.0.1
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
spring.redis.port=6379
spring.redis.timeout=10000ms
spring.redis.password=
######################### swagger #########################
swagger.apiGroupName=smartAdmin
swagger.title=SmartAdmin
swagger.description=SmartAdmin2.0
swagger.version=2.0
swagger.serviceUrl=http://localhost:${server.port}/smart-admin-api
swagger.packAge=net.lab1024.smartadmin.service
swagger.tagClass=net.lab1024.smartadmin.service.common.constant.SwaggerTagConst
########################## rest http pool #########################
http.pool.max-total=20
http.pool.connect-timeout=50000
http.pool.read-timeout=50000
http.pool.write-timeout=50000
http.pool.keep-alive=300000
######################### http file #########################
spring.servlet.multipart.max-file-size=30MB
spring.servlet.multipart.max-request-size=30MB
######################### ali oss #########################
file.storage.mode=cloud
file.storage.local.path=/home/upload/
file.storage.cloud.region=oss-cn-qingdao
file.storage.cloud.endpoint=oss-cn-qingdao.aliyuncs.com
file.storage.cloud.bucket-name=smart-admin-sit
file.storage.cloud.access-key=xxxx
file.storage.cloud.secret-key=xxxx
file.storage.cloud.url.expire=7200000
file.storage.cloud.url.public=https://${file.storage.cloud.bucket-name}.${file.storage.cloud.endpoint}/
######################### redis mq #########################
redis.mq.topic=smartAdmin
redis.mq.scanPath=${project.module}
######################### cros #########################
access-control-allow-origin=*
######################### heart beat #########################
heart-beat.delayHandlerTime=60000
heart-beat.intervalTime=300000
######################### cache config #########################
cache.maximumSize=5000
cache.expireDays=10
cache.scanPath=${project.module}

View File

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
status : 这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,会看到log4j2内部各种详细输出
monitorInterval : Log4j能够自动检测修改配置文件和重新配置本身, 设置间隔秒数。
-->
<Configuration status="INFO" monitorInterval="30">
<Properties>
<Property name="log-path">/home/logs/smart-admin/dev/logs</Property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
</Console>
<RollingFile name="debug" fileName="${log-path}/debug/smart-admin_debug.log"
filePattern="${log-path}/debug/smart-admin_debug_%d{yyyy-MM-dd}-%i.log">
<Filters>
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
<DefaultRolloverStrategy max="30">
<Delete basePath="${log-path}/debug" maxDepth="1">
<IfFileName glob="smart-admin_debug_*.log"/>
<IfLastModified age="15d"/>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<RollingFile name="info" fileName="${log-path}/info/smart-admin_info.log"
filePattern="${log-path}/info/smart-admin_info_%d{yyyy-MM-dd}-%i.log">
<Filters>
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
<DefaultRolloverStrategy max="30">
<Delete basePath="${log-path}/info" maxDepth="1">
<IfFileName glob="smart-admin_info_*.log"/>
<IfLastModified age="15d"/>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<RollingFile name="warn" fileName="${log-path}/warn/smart-admin_warn.log"
filePattern="${log-path}/warn/smart-admin_warn_%d{yyyy-MM-dd}-%i.log">
<Filters>
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
<DefaultRolloverStrategy max="30">
<Delete basePath="${log-path}/warn" maxDepth="1">
<IfFileName glob="smart-admin_warn_*.log"/>
<IfLastModified age="15d"/>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<RollingFile name="error" fileName="${log-path}/error/smart-admin_error.log"
filePattern="${log-path}/error/smart-admin_error_%d{yyyy-MM-dd}-%i.log">
<Filters>
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="[%d][%-5p][%t] %m (%F:%L)%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
<DefaultRolloverStrategy max="30">
<Delete basePath="${log-path}/error" maxDepth="1">
<IfFileName glob="smart-admin_error_*.log"/>
<IfLastModified age="15d"/>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console"/>
<AppenderRef ref="debug"/>
<AppenderRef ref="info"/>
<AppenderRef ref="warn"/>
<AppenderRef ref="error"/>
</Root>
</Loggers>
</Configuration>

View File

@@ -0,0 +1,20 @@
#modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory
# \u81EA\u5B9A\u4E49\u65E5\u5FD7\u6253\u5370
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
#\u65E5\u5FD7\u8F93\u51FA\u5230\u63A7\u5236\u53F0
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
# \u4F7F\u7528\u65E5\u5FD7\u7CFB\u7EDF\u8BB0\u5F55 sql
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
# \u8BBE\u7F6E p6spy driver \u4EE3\u7406
deregisterdrivers=true
# \u53D6\u6D88JDBC URL\u524D\u7F00
useprefix=true
# \u914D\u7F6E\u8BB0\u5F55 Log \u4F8B\u5916,\u53EF\u53BB\u6389\u7684\u7ED3\u679C\u96C6\u6709error,info,batch,debug,statement,commit,rollback,result,resultset.
#excludecategories=info,debug,result,commit,resultset
# \u65E5\u671F\u683C\u5F0F
dateformat=yyyy-MM-dd HH:mm:ss
# \u662F\u5426\u5F00\u542F\u6162SQL\u8BB0\u5F55
outagedetection=true
# \u6162SQL\u8BB0\u5F55\u6807\u51C6 2 \u79D2
outagedetectioninterval=2

View File

@@ -0,0 +1,43 @@
<?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.service.module.business.category.CategoryDao">
<!-- 根据父级id 查询子类 -->
<select id="queryByParentId"
resultType="net.lab1024.smartadmin.service.module.business.category.domain.CategoryEntity">
SELECT * FROM t_category
WHERE
parent_id IN
<foreach collection="parentIdList" open="(" separator="," close=")" item="id">#{id}</foreach>
<if test="categoryType != null">
AND category_type = #{categoryType}
</if>
AND deleted_flag = #{deletedFlag}
ORDER BY sort ASC
</select>
<!-- 查看类目 -->
<select id="selectOne" resultType="net.lab1024.smartadmin.service.module.business.category.domain.CategoryEntity">
SELECT * FROM t_category
<where>
<if test="categoryType != null">
AND category_type = #{categoryType}
</if>
<if test="parentId != null">
AND parent_id = #{parentId}
</if>
<if test="categoryName != null">
AND category_name = #{categoryName}
</if>
<if test="deletedFlag != null">
AND deleted_flag = #{deletedFlag}
</if>
</where>
LIMIT 1
</select>
<select id="selectByTypeAndId"
resultType="net.lab1024.smartadmin.service.module.business.category.domain.CategoryEntity">
select * from t_category where category_type = #{categoryType} and category_id = #{categoryId}
</select>
</mapper>

View File

@@ -0,0 +1,51 @@
<?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.service.module.business.goods.GoodsDao">
<!-- 查询1个商品 -->
<select id="selectOne"
resultType="net.lab1024.smartadmin.service.module.business.goods.domain.GoodsEntity">
SELECT * FROM t_goods
<where>
<if test="goodsName != null">
AND goods_name = #{goodsName}
</if>
<if test="goodsType != null">
AND goods_type = #{goodsType}
</if>
<if test="categoryId != null">
AND category_id = #{categoryId}
</if>
<if test="deletedFlag != null">
AND deleted_flag = #{deletedFlag}
</if>
</where>
LIMIT 1
</select>
<!-- 分页 查询商品 -->
<select id="query" resultType="net.lab1024.smartadmin.service.module.business.goods.domain.GoodsAdminVO">
SELECT * FROM t_goods
<where>
<if test="query.searchWord != null and query.searchWord !=''">
INSTR(goods_name,#{query.searchWord})
</if>
<if test="query.goodsType != null">
AND goods_type = #{query.goodsType}
</if>
<if test="query.categoryId != null">
AND category_id = #{query.categoryId}
</if>
<if test="query.shelvesFlag != null">
AND shelves_flag = #{query.shelvesFlag}
</if>
<if test="query.deletedFlag != null">
AND deleted_flag = #{query.deletedFlag}
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
ORDER BY goods_id DESC
</if>
</select>
</mapper>

View File

@@ -0,0 +1,143 @@
<?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.service.module.business.notice.dao.NoticeDao">
<select id="queryByPage" resultType="net.lab1024.smartadmin.service.module.business.notice.domain.vo.NoticeVO">
select
n.id,
n.title,
n.create_user,
e.actual_name as createUserName,
n.send_status,
n.create_time
from t_notice n
left join t_employee e on e.id = n.create_user
<where>
<if test="queryDTO.startDate != null and queryDTO.startDate != ''">
AND DATE_FORMAT(n.create_time, '%Y-%m-%d') &gt;= #{queryDTO.startDate}
</if>
<if test="queryDTO.endDate != null and queryDTO.endDate != ''">
AND DATE_FORMAT(n.create_time, '%Y-%m-%d') &lt;= #{queryDTO.endDate}
</if>
<if test="queryDTO.title != null and queryDTO.title != ''">
AND INSTR(n.title,#{queryDTO.title})
</if>
<if test="queryDTO.deletedFlag != null">
AND n.deleted_flag = #{queryDTO.deletedFlag}
</if>
</where>
ORDER by n.create_time desc
</select>
<select id="queryUnreadByPage" resultType="net.lab1024.smartadmin.service.module.business.notice.domain.vo.NoticeVO">
select
n.id,
n.title,
n.send_status,
n.create_user,
e.actual_name as createUserName,
n.create_time
from t_notice n
left join t_employee e on e.id = n.create_user
where n.id not in (select notice_id from t_notice_receive_record nrr where nrr.employee_id = #{employeeId})
and n.send_status = #{sendStatus}
ORDER by n.create_time desc
</select>
<select id="queryReceiveByPage" resultType="net.lab1024.smartadmin.service.module.business.notice.domain.dto.NoticeReceiveDTO">
select
n.id,
n.title,
n.create_user,
n.send_status,
e.actual_name as createUserName,
n.create_time,
nrr.create_time as receiveTime
from t_notice n
left join t_employee e on e.id = n.create_user
left join t_notice_receive_record nrr on nrr.notice_id=n.id and nrr.employee_id=#{queryDTO.employeeId}
<where>
<if test="queryDTO.startDate != null and queryDTO.startDate != ''">
AND DATE_FORMAT(n.create_time, '%Y-%m-%d') &gt;= #{queryDTO.startDate}
</if>
<if test="queryDTO.endDate != null and queryDTO.endDate != ''">
AND DATE_FORMAT(n.create_time, '%Y-%m-%d') &lt;= #{queryDTO.endDate}
</if>
<if test="queryDTO.title != null and queryDTO.title != ''">
AND INSTR(n.title,#{queryDTO.title})
</if>
<if test="queryDTO.sendStatus != null">
AND n.send_status = #{queryDTO.sendStatus}
</if>
</where>
ORDER by n.create_time desc
</select>
<select id="detail" resultType="net.lab1024.smartadmin.service.module.business.notice.domain.vo.NoticeDetailVO">
select
n.id,
n.title,
n.content,
n.send_status,
n.create_user,
e.actual_name as createUserName,
n.create_time,
n.update_time
from t_notice n
left join t_employee e on e.id = n.create_user
where n.id = #{id}
</select>
<update id="logicDeleteById">
UPDATE t_notice
set deleted_flag = #{deletedFlag}
WHERE id =#{id}
</update>
<delete id="logicDeleteByIds">
UPDATE t_notice set deleted_flag = #{deletedFlag} where id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</delete>
<select id="noticeCount" resultType="integer">
select
count(1)
from t_notice where send_status = #{sendStatus}
</select>
<select id="readCount" resultType="net.lab1024.smartadmin.service.module.business.notice.domain.dto.NoticeReadCountDTO">
SELECT
nrr.employee_id,
count(1) as readCount
from t_notice_receive_record nrr
where nrr.employee_id in
<foreach collection="employeeIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
GROUP BY nrr.employee_id
</select>
<select id="noticeUnreadCount" resultType="integer">
select
count(1)
from t_notice n
where n.id not in (select msg_id from t_notice_receive_record nrr where nrr.employee_id = #{employeeId})
and n.send_status = #{sendStatus}
</select>
</mapper>

View File

@@ -0,0 +1,39 @@
<?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.service.module.business.notice.dao.NoticeReceiveRecordDao">
<resultMap id="NoticeReceiveRecordEntity" type="net.lab1024.smartadmin.service.module.business.notice.domain.entity.NoticeReceiveRecordEntity"></resultMap>
<delete id="deleteByNoticeId">
delete from t_notice_receive_record where notice_id = #{noticeId}
</delete>
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.List">
INSERT INTO t_notice_receive_record (notice_id, employee_id, update_time, create_time) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.noticeId},
#{item.employeeId},
now(),
now()
)
</foreach>
</insert>
<select id="selectByEmployeeAndNotice" resultMap="NoticeReceiveRecordEntity">
SELECT
nrr.id,
nrr.employee_id,
nrr.notice_id,
nrr.create_time,
nrr.update_time
from t_notice_receive_record nrr
where nrr.employee_id = #{employeeId} and nrr.notice_id=#{noticeId}
</select>
</mapper>

View File

@@ -0,0 +1,25 @@
<?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.service.module.support.datatracer.DataTracerDao">
<select id="selectRecord"
resultType="net.lab1024.smartadmin.service.module.support.datatracer.domain.DataTracerVO">
select * from t_data_tracer where business_type = #{businessType} and business_id = #{businessId}
</select>
<select id="query" resultType="net.lab1024.smartadmin.service.module.support.datatracer.domain.DataTracerVO">
SELECT * FROM t_data_tracer
<where>
<if test="query.businessType != null">
AND business_type = #{query.businessType}
</if>
<if test="query.businessId != null">
AND business_id = #{query.businessId}
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
ORDER BY id DESC
</if>
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
<?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.service.module.support.file.FileDao">
<select id="queryListByPage" resultType="net.lab1024.smartadmin.service.module.support.file.domain.vo.FileVO">
SELECT * FROM t_file
<where>
<if test="query.folderType != null">
AND folder_type = #{query.folderType}
</if>
<if test="query.fileName != null and query.fileName != '' ">
AND INSTR(file_name,#{query.fileName})
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
order by create_time desc
</if>
</select>
<select id="listByFileKeyList" resultType="net.lab1024.smartadmin.service.module.support.file.domain.vo.FileVO">
SELECT * FROM t_file where file_key in
<foreach collection="fileKeyList" item="item" open="(" close=")" index="index" separator=",">
#{item}
</foreach>
</select>
<select id="getByFileKey" resultType="net.lab1024.smartadmin.service.module.support.file.domain.vo.FileVO">
SELECT * FROM t_file where file_key = #{fileKey}
</select>
</mapper>

View File

@@ -0,0 +1,42 @@
<?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.service.module.support.heartbeat.HeartBeatRecordDao">
<!-- 心跳日志 -->
<insert id="insertHeartBeat" useGeneratedKeys="true" keyProperty="id">
INSERT INTO t_heart_beat_record (
project_path,
server_ip,
process_no,
process_start_time,
heart_beat_time
)
VALUES
(#{projectPath},
#{serverIp},
#{processNo},
#{processStartTime},
#{heartBeatTime})
</insert>
<update id="updateHeartBeatTimeById">
update t_heart_beat_record
set heart_beat_time = #{heartBeatTime}
<where>
id = #{id}
</where>
</update>
<select id="query" resultType="net.lab1024.smartadmin.service.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="net.lab1024.smartadmin.service.module.support.heartbeat.HeartBeatRecordVO">
SELECT
*
FROM
t_heart_beat_record
order by heart_beat_time desc
</select>
</mapper>

View File

@@ -0,0 +1,21 @@
<?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.service.module.support.idgenerator.IdGeneratorDao">
<!-- 查询上次id -->
<select id="selectAll" resultType="net.lab1024.smartadmin.service.module.support.idgenerator.domain.IdGeneratorEntity">
select * from t_id_generator
</select>
<select id="selectHistoryLastNumber" resultType="net.lab1024.smartadmin.service.module.support.idgenerator.domain.IdGeneratorRecordDTO">
select * from t_id_generator_record
where generator_id = #{generatorId} and year=#{year} and month=#{month} and day=#{day}
</select>
<update id="replaceIdGeneratorRecord">
REPLACE INTO t_id_generator_record (generator_id, `year`, `month`, `day`, last_number,`count`)
values (#{generatorId}, #{year}, #{month}, #{day}, #{lastNumber},#{count})
</update>
</mapper>

View File

@@ -0,0 +1,48 @@
<?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.service.module.support.operatelog.OperateLogDao">
<select id="queryByPage" resultType="net.lab1024.smartadmin.service.module.support.operatelog.domain.OperateLogEntity">
select
id,
user_id,
user_name,
module,
content,
url,
method,
param,
success_flag,
fail_reason,
update_time,
create_time
from t_user_operate_log
<where>
<if test="queryDTO.startDate != null and queryDTO.startDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{queryDTO.startDate}
</if>
<if test="queryDTO.endDate != null and queryDTO.endDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{queryDTO.endDate}
</if>
<if test="queryDTO.userName != null and queryDTO.userName != ''">
AND INSTR(user_name,#{queryDTO.userName})
</if>
<if test="queryDTO.resultFlag != null">
AND result = #{queryDTO.resultFlag}
</if>
</where>
order by create_time desc
</select>
<delete id="deleteById">
delete from t_user_operate_log where id = #{id}
</delete>
<delete id="deleteByIds">
delete from t_user_operate_log where id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,25 @@
<?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.service.module.support.systemconfig.SystemConfigDao">
<!-- 分页查询系统配置 -->
<select id="queryByPage" resultType="net.lab1024.smartadmin.service.module.support.systemconfig.domain.SystemConfigEntity">
SELECT *
FROM t_system_config
<where>
<if test="query.configKey != null and query.configKey != ''">
AND INSTR(config_key,#{query.configKey})
</if>
<if test="query.configGroup != null">
AND config_group = #{query.configGroup}
</if>
</where>
</select>
<!-- 根据key查询获取数据 -->
<select id="selectByKey" resultType="net.lab1024.smartadmin.service.module.support.systemconfig.domain.SystemConfigEntity">
SELECT *
FROM t_system_config
WHERE config_key = #{key}
</select>
</mapper>

View File

@@ -0,0 +1,36 @@
<?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.service.module.system.datascope.DataScopeRoleDao">
<resultMap id="DataScopeRoleEntity" type="net.lab1024.smartadmin.service.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}
</select>
<select id="listByRoleIdList" resultMap="DataScopeRoleEntity">
select id,data_scope_type,view_type,role_id,update_time,create_time from t_role_data_scope where role_id IN
<foreach collection="roleIdList" item="item" open="(" close= ")" separator=",">
#{item}
</foreach>
</select>
<delete id="deleteByRoleId">
DELETE FROM t_role_data_scope
WHERE role_id = #{roleId}
</delete>
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.List">
INSERT INTO t_role_data_scope (data_scope_type,view_type,role_id,update_time,create_time) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.dataScopeType},
#{item.viewType},
#{item.roleId},
now(),
now()
)
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,41 @@
<?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.service.module.system.department.DepartmentDao">
<sql id="baseSql">
</sql>
<select id="listAll" resultType="net.lab1024.smartadmin.service.module.system.department.domain.vo.DepartmentVO">
SELECT
d.*,
e.actual_name as managerName,
pd.`name` as parentName
FROM
t_department d
left join t_employee e on d.manager_id= e.id
left join t_department pd on d.parent_id = pd.id
order by sort asc
</select>
<select id="countSubDepartment" resultType="java.lang.Integer">
SELECT
count(1)
FROM
t_department
WHERE
parent_id = #{deptId}
</select>
<select id="queryByParentId"
resultType="net.lab1024.smartadmin.service.module.system.department.domain.vo.DepartmentVO">
SELECT d.*,
e.actual_name as managerName,
pd.`name` as parentName
FROM t_department d
left join t_employee e on d.manager_id = e.id
left join t_department pd on d.parent_id = pd.id
where d.parent_id = #{parentId}
</select>
</mapper>

View File

@@ -0,0 +1,158 @@
<?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.service.module.system.employee.EmployeeDao">
<select id="queryEmployee" resultType="net.lab1024.smartadmin.service.module.system.employee.domain.vo.EmployeeVO">
SELECT
e.*,
d.name AS departmentName
FROM t_employee e
LEFT JOIN t_department d ON d.id = e.department_id
<where>
<if test="queryDTO.keyword != null and queryDTO.keyword != ''">
AND (
INSTR(e.actual_name,#{queryDTO.keyword})
OR INSTR(e.phone,#{queryDTO.keyword})
)
</if>
<if test="queryDTO.departmentId != null">
AND e.department_id = #{queryDTO.departmentId}
</if>
<if test="queryDTO.disabledFlag != null">
AND e.disabled_flag = #{queryDTO.disabledFlag}
</if>
<if test="queryDTO.deletedFlag != null">
AND e.deleted_flag = #{queryDTO.deletedFlag}
</if>
<if test="queryDTO.employeeIdList != null and queryDTO.employeeIdList.size > 0">
AND e.id IN
<foreach collection="queryDTO.employeeIdList" open="(" close= ")" item="item" separator="," >
#{item}
</foreach>
</if>
</where>
<if test="queryDTO.sortItemList == null or queryDTO.sortItemList.size == 0">
ORDER BY e.id DESC
</if>
</select>
<update id="batchUpdateDisableFlag">
UPDATE t_employee
SET disabled_flag = #{disabledFlag}
WHERE id in
<foreach collection="employeeIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</update>
<update id="updateDisableFlag">
UPDATE t_employee
SET disabled_flag = #{disabledFlag}
WHERE id = #{id}
</update>
<select id="selectByLoginNameAndPwd" resultType="net.lab1024.smartadmin.service.module.system.employee.domain.entity.EmployeeEntity">
SELECT *
FROM t_employee
WHERE login_name = #{loginName}
AND login_pwd = #{loginPwd}
AND deleted_flag = #{deletedFlag}
LIMIT 1
</select>
<select id="getByLoginName" resultType="net.lab1024.smartadmin.service.module.system.employee.domain.dto.EmployeeDTO">
SELECT * FROM t_employee
WHERE login_name = #{loginName} and disabled_flag = #{disabledFlag} and deleted_flag = #{deletedFlag}
</select>
<select id="getByPhone" resultType="net.lab1024.smartadmin.service.module.system.employee.domain.dto.EmployeeDTO">
SELECT * FROM t_employee
WHERE phone = #{phone} AND disabled_flag = #{disabledFlag}
</select>
<select id="listAll" resultType="net.lab1024.smartadmin.service.module.system.employee.domain.dto.EmployeeDTO">
SELECT * FROM t_employee
ORDER BY create_time DESC
</select>
<select id="countByDepartmentId" resultType="integer">
SELECT count(1) FROM t_employee
WHERE
department_id = #{departmentId}
<if test="deletedFlag != null">
AND deleted_flag = #{deletedFlag}
</if>
</select>
<select id="selectByDepartmentId" resultType="net.lab1024.smartadmin.service.module.system.employee.domain.entity.EmployeeEntity">
SELECT * FROM t_employee
WHERE
disabled_flag = #{disabledFlag}
AND deleted_flag = #{deletedFlag}
AND department_id = #{departmentId}
ORDER BY create_time DESC
</select>
<select id="getEmployeeIdByDepartmentIdList" resultType="java.lang.Long">
SELECT id
FROM t_employee
WHERE
disabled_flag = #{disabledFlag}
AND deleted_flag = #{deletedFlag}
AND department_id IN
<foreach collection="departmentIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
ORDER BY create_time DESC
</select>
<select id="getEmployeeId" resultType="java.lang.Long">
SELECT id
FROM t_employee
WHERE
disabled_flag = #{disabledFlag}
AND deleted_flag = #{deletedFlag}
</select>
<select id="getEmployeeIdByDepartmentId" resultType="java.lang.Long">
SELECT id
FROM t_employee
WHERE
disabled_flag = #{disabledFlag}
and deleted_flag = #{deletedFlag}
and department_id = #{departmentId}
ORDER BY create_time DESC
</select>
<select id="getEmployeeByIds" resultType="net.lab1024.smartadmin.service.module.system.employee.domain.dto.EmployeeDTO">
SELECT * FROM t_employee
where id IN
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
ORDER BY create_time DESC
</select>
<select id="getEmployeeById" resultType="net.lab1024.smartadmin.service.module.system.employee.domain.dto.EmployeeDTO">
SELECT
e.*,
d.name AS departmentName
FROM t_employee e
LEFT JOIN t_department d ON d.id = e.department_id
where e.id = #{id}
</select>
<update id="updatePassword">
UPDATE t_employee
SET login_pwd = #{password}
WHERE id = #{employeeId}
</update>
</mapper>

View File

@@ -0,0 +1,76 @@
<?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.service.module.system.menu.MenuDao">
<sql id="menuVo">
select m.menu_id,
m.menu_name,
m.menu_type,
m.parent_id,
m.sort,
m.path,
m.component,
m.frame_flag,
m.cache_flag,
m.visible_flag,
m.disabled_flag,
m.perms,
m.icon,
m.context_menu_id,
m.create_user_id,
m.create_time,
m.update_user_id,
m.update_time
from t_menu m
</sql>
<delete id="deleteByMenuIdList">
<if test="menuIdList != null and menuIdList.size > 0">
<foreach collection="menuIdList" item="item" separator=";">
update t_menu
set delete_flag = #{deleteFlag},
update_user_id = #{updateUserId}
where menu_id = #{item}
</foreach>
</if>
</delete>
<select id="getByMenuName"
resultType="net.lab1024.smartadmin.service.module.system.menu.domain.MenuEntity">
<include refid="menuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} and delete_flag = #{deleteFlag} limit 1
</select>
<select id="queryMenuList" resultType="net.lab1024.smartadmin.service.module.system.menu.domain.MenuVO">
<include refid="menuVo"/>
where delete_flag = #{deleteFlag}
<if test="disabledFlag != null">
and disabled_flag = #{disabledFlag}
</if>
<if test="menuTypeList != null and menuTypeList.size > 0">
and menu_type in
<foreach collection="menuTypeList" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</if>
order by parent_id desc,sort asc
</select>
<select id="getPointListByMenuId"
resultType="net.lab1024.smartadmin.service.module.system.menu.domain.MenuEntity">
<include refid="menuVo"/>
where parent_id = #{menuId} and delete_flag = #{deleteFlag} and menu_type = #{menuType}
</select>
<select id="queryMenuByEmployeeId"
resultType="net.lab1024.smartadmin.service.module.system.menu.domain.MenuVO">
<include refid="menuVo"/>
left join t_role_menu rm on rm.menu_id = m.menu_id
left join t_role_employee re on re.role_id = rm.role_id
where m.disabled_flag = #{disabledFlag} and m.delete_flag = #{deleteFlag}
<if test="employeeId != null">
and re.employee_id = #{employeeId}
</if>
</select>
<select id="queryAllPoint" resultType="net.lab1024.smartadmin.service.module.system.menu.domain.MenuEntity">
<include refid="menuVo"/>
where disabled_flag = #{disabledFlag} and delete_flag = #{deleteFlag} and menu_type = #{menuType}
</select>
</mapper>

View File

@@ -0,0 +1,124 @@
<?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.service.module.system.role.roleemployee.RoleEmployeeDao">
<resultMap id="EmployeeDTO"
type="net.lab1024.smartadmin.service.module.system.employee.domain.dto.EmployeeDTO"></resultMap>
<sql id="baseSql">
er
.
id
,
er.role_id,
er.employee_id,
er.update_time,
er.create_time
</sql>
<select id="selectRoleIdByEmployeeId" resultType="java.lang.Long">
SELECT er.role_id
FROM t_role_employee er
WHERE er.employee_id = #{employeeId}
</select>
<select id="selectEmployeeByNamePage" resultMap="EmployeeDTO">
SELECT
e.id,
e.login_name,
e.login_pwd,
e.actual_name,
e.phone,
e.department_id,
e.disabled_flag,
e.remark,
e.update_time,
e.create_time
FROM
t_role_employee er
left join t_employee e on er.employee_id = e.id
left join t_role r on er.role_id = r.id
<where>
<if test="queryDTO.roleName != null and queryDTO.roleName != ''">
AND INSTR(r.role_name,#{queryDTO.roleName})
</if>
<if test="queryDTO.roleId != null">
AND er.role_id = #{queryDTO.roleId}
</if>
</where>
</select>
<select id="selectEmployeeByRoleId" resultMap="EmployeeDTO">
SELECT e.id,
e.login_name,
e.login_pwd,
e.actual_name,
e.phone,
e.department_id,
e.disabled_flag,
e.remark,
e.update_time,
e.create_time
FROM t_role_employee er
left join t_employee e on er.employee_id = e.id
WHERE er.role_id = #{roleId}
</select>
<select id="selectEmployeeIdByRoleIdList" resultType="java.lang.Long">
SELECT
employee_id
FROM
t_role_employee
WHERE
role_id in
<foreach collection="roleIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="selectRoleIdByEmployeeIdList"
resultType="net.lab1024.smartadmin.service.module.system.role.roleemployee.domain.RoleEmployeeEntity">
SELECT
*
FROM
t_role_employee
WHERE
employee_id in
<foreach collection="employeeIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<delete id="deleteByEmployeeId">
DELETE
FROM t_role_employee
WHERE employee_id = #{employeeId}
</delete>
<delete id="deleteByRoleId">
DELETE
FROM t_role_employee
WHERE role_id = #{roleId}
</delete>
<delete id="deleteByEmployeeIdRoleId">
DELETE
FROM t_role_employee
WHERE role_id = #{roleId}
and employee_id = #{employeeId}
</delete>
<delete id="batchDeleteEmployeeRole">
DELETE FROM t_role_employee
WHERE role_id = #{roleId} and employee_id in
<foreach collection="employeeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,27 @@
<?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.service.module.system.role.basic.RoleDao">
<resultMap id="RoleEntity"
type="net.lab1024.smartadmin.service.module.system.role.basic.domain.entity.RoleEntity"></resultMap>
<sql id="baseSql">
r.id,
r.role_name,
r.remark,
r.update_time,
r.create_time
</sql>
<select id="getByRoleName" resultMap="RoleEntity">
SELECT
<include refid="baseSql"></include>
FROM
t_role r
WHERE
r.role_name = #{roleName}
</select>
</mapper>

View File

@@ -0,0 +1,18 @@
<?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.service.module.system.role.rolemenu.RoleMenuDao">
<delete id="deleteByRoleId">
delete
from t_role_menu
where role_id = #{roleId}
</delete>
<select id="queryMenuIdByRoleId" resultType="java.lang.Long">
select menu_id
from t_role_menu
where role_id = #{roleId}
</select>
<select id="queryAllRoleMenu"
resultType="net.lab1024.smartadmin.service.module.system.role.rolemenu.domain.RoleMenuEntity">
select * from t_role_menu
</select>
</mapper>