初始化项目
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?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.njcn.mapper.configuration.DicDataMapper">
|
||||
<!-- 查询排序最大 -->
|
||||
<select id="selNumMax" resultType="int">
|
||||
select max(dic_number) from pqs_dicdata where state=1 order by dic_number desc
|
||||
</select>
|
||||
|
||||
<!-- 更新字典表根据主键-->
|
||||
<update id="updateByPrimaryKeyBySql">
|
||||
UPDATE PQS_DICDATA
|
||||
SET DIC_LEAVE = #{dicLeave}
|
||||
WHERE
|
||||
DIC_INDEX = #{dicIndex}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?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.njcn.mapper.log.UserLogDetailMapper">
|
||||
|
||||
<!-- 日志 -->
|
||||
<resultMap type="com.njcn.pojo.log.UserLogDetail" id="UserLogDetailMapperMap" autoMapping="true">
|
||||
|
||||
</resultMap>
|
||||
<!-- 查询所有日志 -->
|
||||
<select id="getUserLog" resultMap="UserLogDetailMapperMap">
|
||||
select t.dictype_name as type,
|
||||
a.dic_name as name,
|
||||
u.USERLOG_DESCRIBE as describe,
|
||||
u.updatetime as updatetime,
|
||||
u.ip as ip,
|
||||
decode(a.DIC_LEAVE, 0, '普通', 1, '中等',2,'严重') as leval
|
||||
from pqs_userlog u ,
|
||||
pqs_dicdata a ,
|
||||
pqs_dictype t
|
||||
where u.type=a.dic_index
|
||||
and a.dic_type=t.dictype_index
|
||||
order by u.updatetime desc
|
||||
</select>
|
||||
<!-- 根据条件查询所有日志 -->
|
||||
<select id="getUserLogId" resultMap="UserLogDetailMapperMap">
|
||||
select t.dictype_name as type,
|
||||
a.dic_name as name,
|
||||
u.USERLOG_DESCRIBE as describe,
|
||||
u.updatetime as updatetime,
|
||||
u.ip as ip,
|
||||
decode(a.DIC_LEAVE, 0, '普通', 1, '中等',2,'严重') as leval
|
||||
from pqs_userlog u ,
|
||||
pqs_dicdata a ,
|
||||
pqs_dictype t
|
||||
where u.type=a.dic_index
|
||||
and a.dic_type=t.dictype_index
|
||||
and t.dictype_index like #{type}
|
||||
and a.dic_index like #{name}
|
||||
and to_number(to_char(u.updatetime, 'yyyyMMddHHmiss')) between #{startTime}
|
||||
and #{endTime}
|
||||
order by u.updatetime desc
|
||||
</select>
|
||||
<!-- 统计事件类型 -->
|
||||
<select id="geteventtype" resultMap="UserLogDetailMapperMap">
|
||||
select t.dictype_name as type,
|
||||
count(1) as num
|
||||
from pqs_userlog u ,
|
||||
pqs_dicdata a ,
|
||||
pqs_dictype t
|
||||
where u.type=a.dic_index
|
||||
and a.dic_type=t.dictype_index
|
||||
and to_number(to_char(u.updatetime, 'yyyyMMddHHmmss')) between #{startTime}
|
||||
and #{endTime}
|
||||
group by t.dictype_name
|
||||
</select>
|
||||
<!-- 统计详细事件 -->
|
||||
<select id="getdetailtype" resultMap="UserLogDetailMapperMap">
|
||||
select a.dic_name as name,
|
||||
count(1) as num
|
||||
from pqs_userlog u ,
|
||||
pqs_dicdata a ,
|
||||
pqs_dictype t
|
||||
where u.type=a.dic_index
|
||||
and a.dic_type=t.dictype_index
|
||||
and to_number(to_char(u.updatetime, 'yyyyMMddHHmmss')) between #{startTime}
|
||||
and #{endTime}
|
||||
group by a.dic_name
|
||||
</select>
|
||||
<!-- 统计用户统计 -->
|
||||
<select id="getUserStatistics" resultMap="UserLogDetailMapperMap">
|
||||
select b.loginname name,
|
||||
count(1) num
|
||||
from pqs_userlog a,
|
||||
pqs_user b
|
||||
where A.USERLOG_DESCRIBE like '%'||b.loginname||'%'
|
||||
and a.user_index=b.user_index
|
||||
and to_number(to_char(a.updatetime, 'yyyyMMddHHmmss')) between #{startTime}
|
||||
and #{endTime}
|
||||
group by b.loginname
|
||||
</select>
|
||||
|
||||
<delete id="delExpireLog" databaseId="Oracle">
|
||||
delete from pqs_userlog
|
||||
where rowid = (select rowid
|
||||
from (select UPDATETIME from pqs_userlog where UPDATETIME < #{endTime} order by UPDATETIME)
|
||||
where rownum = 1)
|
||||
</delete>
|
||||
|
||||
<delete id="delExpireLog" databaseId="MariaDB">
|
||||
delete from pqs_userlog
|
||||
where UPDATETIME = (select UPDATETIME from pqs_userlog where UPDATETIME < #{endTime} order by UPDATETIME LIMIT 1 )
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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.njcn.mapper.log.UserLoginMapper">
|
||||
|
||||
<!-- 日志 -->
|
||||
<resultMap type="com.njcn.pojo.log.UserLogin" id="UserLoginMapperMap" autoMapping="true">
|
||||
|
||||
</resultMap>
|
||||
<!-- 查询所有登录信息 -->
|
||||
<select id="getUserLogin" resultMap="UserLoginMapperMap">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
pqs_userlogin ul,
|
||||
pqs_user U
|
||||
WHERE
|
||||
ul.user_index = U .user_index
|
||||
AND TO_NUMBER (
|
||||
TO_CHAR (
|
||||
ul.loginTime,
|
||||
'yyyyMMddHHmiss'
|
||||
)
|
||||
) BETWEEN # { startTime }
|
||||
AND # { endTime }
|
||||
ORDER BY
|
||||
ul.loginTime DESC
|
||||
</select>
|
||||
<select id="getLastedLogin" resultType="userLogin" databaseId="MariaDB">
|
||||
SELECT * FROM (SELECT * FROM PQS_USERLOGIN WHERE USER_INDEX=#{userIndex} ORDER BY LOGINTIME DESC) a limit 1
|
||||
</select>
|
||||
|
||||
<select id="getLastedLogin" resultType="userLogin" databaseId="Oracle">
|
||||
SELECT * FROM (SELECT * FROM PQS_USERLOGIN WHERE USER_INDEX=#{userIndex} ORDER BY LOGINTIME DESC) where ROWNUM = 1
|
||||
</select>
|
||||
</mapper>
|
||||
35
sso/src/main/resources/mybatis/mappers/user/UserMapper.xml
Normal file
35
sso/src/main/resources/mybatis/mappers/user/UserMapper.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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.njcn.mapper.user.UserMapper">
|
||||
|
||||
<update id="updateLockState">
|
||||
update pqs_user set state = #{state},login_error_times = 0 where user_index = #{userIndex}
|
||||
</update>
|
||||
|
||||
<update id="updateByPrimaryKeyBySql" parameterType="user">
|
||||
update pqs_user
|
||||
<set>
|
||||
<if test="userIndex != null">user_Index=#{userIndex},</if>
|
||||
<if test="name != null">name=#{name},</if>
|
||||
<if test="loginName != null">loginName=#{loginName},</if>
|
||||
<if test="password != null">password=#{password},</if>
|
||||
<if test="phone != null">phone=#{phone},</if>
|
||||
<if test="email != null">email=#{email},</if>
|
||||
<if test="registerTime != null">registerTime=#{registerTime},</if>
|
||||
<if test="psdvalidity != null">psdvalidity=#{psdvalidity},</if>
|
||||
<if test="loginTime != null">loginTime=#{loginTime},</if>
|
||||
<if test="state != null">state=#{state},</if>
|
||||
<if test="mark != null">mark=#{mark},</if>
|
||||
<if test="limitIpStart != null">limit_IpStart=#{limitIpStart},</if>
|
||||
<if test="limitIpEnd != null">limit_IpEnd=#{limitIpEnd},</if>
|
||||
<if test="limitTime != null">limit_Time=#{limitTime},</if>
|
||||
<if test="loginErrorTimes != null">LOGIN_ERROR_TIMES=#{loginErrorTimes},</if>
|
||||
<if test="casualUser != null">casual_User=#{casualUser},</if>
|
||||
<if test="firstErrorTime != null">firstError_Time=#{firstErrorTime},</if>
|
||||
<if test="lockTime != null">lock_Time=#{lockTime}</if>
|
||||
</set>
|
||||
where user_Index=#{userIndex}
|
||||
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
28
sso/src/main/resources/mybatis/mybatis-config.xml
Normal file
28
sso/src/main/resources/mybatis/mybatis-config.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
|
||||
<settings>
|
||||
<!-- 开启驼峰自动映射 -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true" />
|
||||
<!--输出mybatis执行的SQL日志-->
|
||||
<!-- <setting name="logImpl" value="STDOUT_LOGGING"/>-->
|
||||
<!--懒加载配置-->
|
||||
<setting name="lazyLoadingEnabled" value="true"/>
|
||||
<setting name="aggressiveLazyLoading" value="false"/>
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
|
||||
</settings>
|
||||
<!--使用mybatis的分页插件-->
|
||||
<!-- <plugins> -->
|
||||
<!-- <plugin interceptor="com.github.pagehelper.PageHelper"> -->
|
||||
<!-- <property name="dialect" value="mysql"/> -->
|
||||
<!-- 该参数默认为false -->
|
||||
<!-- 设置为true时,使用RowBounds分页会进行count查询 -->
|
||||
<!-- <property name="rowBoundsWithCount" value="true"/> -->
|
||||
<!-- </plugin> -->
|
||||
<!-- </plugins> -->
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user