若依 2.0
This commit is contained in:
79
src/main/resources/mybatis/monitor/JobLogMapper.xml
Normal file
79
src/main/resources/mybatis/monitor/JobLogMapper.xml
Normal file
@ -0,0 +1,79 @@
|
||||
<?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.ruoyi.project.monitor.job.mapper.JobLogMapper">
|
||||
|
||||
<resultMap type="JobLog" id="JobLogResult">
|
||||
<id property="jobLogId" column="job_log_id" />
|
||||
<result property="jobName" column="job_name" />
|
||||
<result property="jobGroup" column="job_group" />
|
||||
<result property="methodName" column="method_name" />
|
||||
<result property="params" column="params" />
|
||||
<result property="jobMessage" column="job_message" />
|
||||
<result property="status" column="status" />
|
||||
<result property="exceptionInfo" column="exception_info" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectJobLogList" parameterType="JobLog" resultMap="JobLogResult">
|
||||
select * from sys_job_log
|
||||
<where>
|
||||
<if test="jobName != null and jobName != ''">
|
||||
AND job_name like concat('%', #{jobName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="methodName != null and methodName != ''">
|
||||
AND method_name like concat('%', #{methodName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectJobAll" resultMap="JobLogResult">
|
||||
SELECT * FROM sys_job_log
|
||||
</select>
|
||||
|
||||
<select id="selectJobLogById" parameterType="Long" resultMap="JobLogResult">
|
||||
select *
|
||||
from sys_job_log u
|
||||
where u.job_log_id = #{jobLogId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteJobLogById" parameterType="Long">
|
||||
delete from sys_job_log where job_log_id = #{jobLogId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteJobLogByIds" parameterType="Long">
|
||||
delete from sys_job_log where job_log_id in
|
||||
<foreach collection="array" item="jobLogId" open="(" separator="," close=")">
|
||||
#{jobLogId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="insertJobLog" parameterType="JobLog">
|
||||
insert into sys_job_log(
|
||||
<if test="jobLogId != null and jobLogId != 0">job_log_id,</if>
|
||||
<if test="jobName != null and jobName != ''">job_name,</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">job_group,</if>
|
||||
<if test="methodName != null and methodName != ''">method_name,</if>
|
||||
<if test="params != null and params != ''">params,</if>
|
||||
<if test="jobMessage != null and jobMessage != ''">job_message,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="jobLogId != null and jobLogId != 0">#{jobLogId},</if>
|
||||
<if test="jobName != null and jobName != ''">#{jobName},</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
|
||||
<if test="methodName != null and methodName != ''">#{methodName},</if>
|
||||
<if test="params != null and params != ''">#{params},</if>
|
||||
<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
101
src/main/resources/mybatis/monitor/JobMapper.xml
Normal file
101
src/main/resources/mybatis/monitor/JobMapper.xml
Normal file
@ -0,0 +1,101 @@
|
||||
<?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.ruoyi.project.monitor.job.mapper.JobMapper">
|
||||
|
||||
<resultMap type="Job" id="JobResult">
|
||||
<id property="jobId" column="job_id" />
|
||||
<result property="jobName" column="job_name" />
|
||||
<result property="jobGroup" column="job_group" />
|
||||
<result property="methodName" column="method_name" />
|
||||
<result property="params" column="params" />
|
||||
<result property="cronExpression" column="cron_expression" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectJobList" parameterType="Job" resultMap="JobResult">
|
||||
select job_id, job_name, job_group, method_name, params, cron_expression, status, create_by, create_time, remark from sys_job
|
||||
<where>
|
||||
<if test="jobName != null and jobName != ''">
|
||||
AND job_name like concat('%', #{jobName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="methodName != null and methodName != ''">
|
||||
AND method_name like concat('%', #{methodName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectJobAll" resultMap="JobResult">
|
||||
SELECT job_id, job_name, job_group, method_name, params, cron_expression, status, create_by, create_time FROM sys_job
|
||||
</select>
|
||||
|
||||
<select id="selectJobById" parameterType="Long" resultMap="JobResult">
|
||||
select job_id, job_name, job_group, method_name, params, cron_expression, status, create_by, create_time
|
||||
from sys_job u
|
||||
where u.job_id = #{jobId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteJobById" parameterType="Long">
|
||||
delete from sys_job where job_id = #{jobId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteJobByIds" parameterType="Long">
|
||||
delete from sys_job where job_id in
|
||||
<foreach collection="array" item="jobId" open="(" separator="," close=")">
|
||||
#{jobId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateJob" parameterType="Job">
|
||||
update sys_job
|
||||
<set>
|
||||
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
|
||||
<if test="methodName != null and methodName != ''">method_name = #{methodName},</if>
|
||||
<if test="params != null and params != ''">params = #{params},</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
|
||||
<if test="status !=null">status = #{status},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="jobId != null">and job_id = #{jobId}</if>
|
||||
</update>
|
||||
|
||||
<insert id="insertJob" parameterType="Post" useGeneratedKeys="true" keyProperty="jobId">
|
||||
insert into sys_job(
|
||||
<if test="jobId != null and jobId != 0">job_id,</if>
|
||||
<if test="jobName != null and jobName != ''">job_name,</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">job_group,</if>
|
||||
<if test="methodName != null and methodName != ''">method_name,</if>
|
||||
<if test="params != null and params != ''">params,</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">cron_expression,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="jobId != null and jobId != 0">#{jobId},</if>
|
||||
<if test="jobName != null and jobName != ''">#{jobName},</if>
|
||||
<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
|
||||
<if test="methodName != null and methodName != ''">#{methodName},</if>
|
||||
<if test="params != null and params != ''">#{params},</if>
|
||||
<if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
46
src/main/resources/mybatis/monitor/LogininforMapper.xml
Normal file
46
src/main/resources/mybatis/monitor/LogininforMapper.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?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.ruoyi.project.monitor.logininfor.mapper.LogininforMapper">
|
||||
|
||||
<resultMap type="Logininfor" id="LogininforResult">
|
||||
<id property="infoId" column="info_id" />
|
||||
<result property="loginName" column="login_name" />
|
||||
<result property="status" column="status" />
|
||||
<result property="ipaddr" column="ipaddr" />
|
||||
<result property="loginLocation" column="login_location" />
|
||||
<result property="browser" column="browser" />
|
||||
<result property="os" column="os" />
|
||||
<result property="msg" column="msg" />
|
||||
<result property="loginTime" column="login_time" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertLogininfor" parameterType="Logininfor">
|
||||
insert into sys_logininfor (login_name, status, ipaddr, login_location, browser, os, msg, login_time)
|
||||
values (#{loginName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate())
|
||||
</insert>
|
||||
|
||||
<select id="selectLogininforList" parameterType="Logininfor" resultMap="LogininforResult">
|
||||
select * from sys_logininfor
|
||||
<where>
|
||||
<if test="ipaddr != null and ipaddr != ''">
|
||||
AND ipaddr like concat('%', #{ipaddr}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="loginName != null and loginName != ''">
|
||||
AND login_name like concat('%', #{loginName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteLogininforByIds" parameterType="Integer">
|
||||
delete from sys_logininfor where info_id in
|
||||
<foreach collection="array" item="infoId" open="(" separator="," close=")">
|
||||
#{infoId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
61
src/main/resources/mybatis/monitor/OnlineMapper.xml
Normal file
61
src/main/resources/mybatis/monitor/OnlineMapper.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<?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.ruoyi.project.monitor.online.mapper.UserOnlineMapper">
|
||||
|
||||
<resultMap type="UserOnline" id="UserOnlineResult">
|
||||
<id property="sessionId" column="sessionId" />
|
||||
<result property="loginName" column="login_name" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="ipaddr" column="ipaddr" />
|
||||
<result property="longinLocation" column="login_location" />
|
||||
<result property="browser" column="browser" />
|
||||
<result property="os" column="os" />
|
||||
<result property="status" column="status" />
|
||||
<result property="startTimestamp" column="start_timestsamp" />
|
||||
<result property="lastAccessTime" column="last_access_time" />
|
||||
<result property="expireTime" column="expire_time" />
|
||||
<association property="session" javaType="OnlineSession" resultMap="OnlineSessionResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="OnlineSession" id="OnlineSessionResult">
|
||||
<result property="host" column="ipaddr" />
|
||||
<result property="browser" column="browser" />
|
||||
<result property="os" column="os" />
|
||||
<result property="status" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectOnlineById" parameterType="String" resultMap="UserOnlineResult">
|
||||
select *
|
||||
from sys_user_online
|
||||
where sessionid = #{sessionid}
|
||||
</select>
|
||||
|
||||
<insert id="saveOnline" parameterType="UserOnline">
|
||||
replace into sys_user_online(sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestsamp, last_access_time, expire_time)
|
||||
values (#{sessionId}, #{loginName}, #{deptName}, #{ipaddr}, #{longinLocation}, #{browser}, #{os}, #{status}, #{startTimestamp}, #{lastAccessTime}, #{expireTime})
|
||||
</insert>
|
||||
|
||||
<delete id="deleteOnlineById" parameterType="String">
|
||||
delete from sys_user_online where sessionId = #{sessionId}
|
||||
</delete>
|
||||
|
||||
<select id="selectUserOnlineList" parameterType="UserOnline" resultMap="UserOnlineResult">
|
||||
select * from sys_user_online
|
||||
<where>
|
||||
<if test="ipaddr != null and ipaddr != ''">
|
||||
AND ipaddr like concat('%', #{ipaddr}, '%')
|
||||
</if>
|
||||
<if test="loginName != null and loginName != ''">
|
||||
AND login_name like concat('%', #{loginName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectOnlineByExpired" parameterType="String" resultMap="UserOnlineResult">
|
||||
SELECT * FROM sys_user_online o
|
||||
WHERE o.last_access_time <![CDATA[ <= ]]> #{lastAccessTime} ORDER BY o.last_access_time ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
57
src/main/resources/mybatis/monitor/OperLogMapper.xml
Normal file
57
src/main/resources/mybatis/monitor/OperLogMapper.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?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.ruoyi.project.monitor.operlog.mapper.OperLogMapper">
|
||||
|
||||
<resultMap type="OperLog" id="OperLogResult">
|
||||
<id property="operId" column="oper_id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="action" column="action" />
|
||||
<result property="method" column="method" />
|
||||
<result property="channel" column="channel" />
|
||||
<result property="operName" column="oper_name" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="operUrl" column="oper_url" />
|
||||
<result property="operIp" column="oper_ip" />
|
||||
<result property="operLocation" column="oper_location" />
|
||||
<result property="operParam" column="oper_param" />
|
||||
<result property="status" column="status" />
|
||||
<result property="errorMsg" column="error_msg" />
|
||||
<result property="operTime" column="oper_time" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOperlog" parameterType="OperLog">
|
||||
insert into sys_oper_log(title, action, method, channel, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time)
|
||||
values (#{title}, #{action}, #{method}, #{channel}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate())
|
||||
</insert>
|
||||
|
||||
<select id="selectOperLogList" parameterType="OperLog" resultMap="OperLogResult">
|
||||
select * from sys_oper_log
|
||||
<where>
|
||||
<if test="title != null and title != ''">
|
||||
AND title like concat('%', #{title}, '%')
|
||||
</if>
|
||||
<if test="action != null and action != ''">
|
||||
AND action = #{action}
|
||||
</if>
|
||||
<if test="operName != null and operName != ''">
|
||||
AND oper_name like concat('%', #{operName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteOperLogByIds" parameterType="Integer">
|
||||
delete from sys_oper_log where oper_id in
|
||||
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
||||
#{operId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectOperLogById" parameterType="Long" resultMap="OperLogResult">
|
||||
select *
|
||||
from sys_oper_log
|
||||
where oper_id = #{operId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
15
src/main/resources/mybatis/mybatis-config.xml
Normal file
15
src/main/resources/mybatis/mybatis-config.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 -->
|
||||
<setting name="useGeneratedKeys" value="true" /> <!-- 允许 JDBC 支持自动生成主键 -->
|
||||
<setting name="defaultExecutorType" value="REUSE" /> <!-- 配置默认的执行器 -->
|
||||
<setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 -->
|
||||
</settings>
|
||||
|
||||
</configuration>
|
89
src/main/resources/mybatis/system/ConfigMapper.xml
Normal file
89
src/main/resources/mybatis/system/ConfigMapper.xml
Normal file
@ -0,0 +1,89 @@
|
||||
<?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.ruoyi.project.system.config.mapper.ConfigMapper">
|
||||
|
||||
<resultMap type="Config" id="ConfigResult">
|
||||
<id property="configId" column="config_id" />
|
||||
<result property="configName" column="config_name" />
|
||||
<result property="configKey" column="config_key" />
|
||||
<result property="configValue" column="config_value" />
|
||||
<result property="configType" column="config_type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectConfigById" parameterType="Integer" resultMap="ConfigResult">
|
||||
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark from sys_config
|
||||
where config_id = #{configId}
|
||||
</select>
|
||||
|
||||
<select id="selectConfigByKey" parameterType="String" resultMap="ConfigResult">
|
||||
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark from sys_config
|
||||
where config_key = #{configKey}
|
||||
</select>
|
||||
|
||||
<select id="selectConfigList" parameterType="Config" resultMap="ConfigResult">
|
||||
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark from sys_config
|
||||
<where>
|
||||
<if test="configName != null and configName != ''">
|
||||
AND config_name like concat('%', #{configName}, '%')
|
||||
</if>
|
||||
<if test="configType != null and configType != ''">
|
||||
AND config_type = #{configType}
|
||||
</if>
|
||||
<if test="configKey != null and configKey != ''">
|
||||
AND config_key like concat('%', #{configKey}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertConfig" parameterType="Config">
|
||||
insert into sys_config (
|
||||
<if test="configName != null and configName != '' ">config_name,</if>
|
||||
<if test="configKey != null and configKey != '' ">config_key,</if>
|
||||
<if test="configValue != null and configValue != '' ">config_value,</if>
|
||||
<if test="configType != null and configType != '' ">config_type,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="configName != null and configName != ''">#{configName},</if>
|
||||
<if test="configKey != null and configKey != ''">#{configKey},</if>
|
||||
<if test="configValue != null and configValue != ''">#{configValue},</if>
|
||||
<if test="configType != null and configType != ''">#{configType},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateConfig" parameterType="Config">
|
||||
update sys_config
|
||||
<set>
|
||||
<if test="configName != null and configName != ''">config_name = #{configName},</if>
|
||||
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
|
||||
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
|
||||
<if test="configType != null and configType != ''">config_type = #{configType},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where config_id = #{configId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteConfigById" parameterType="Integer">
|
||||
delete from sys_config where config_id = #{value}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteConfigByIds" parameterType="Integer">
|
||||
delete from sys_config where config_id in
|
||||
<foreach item="configId" collection="array" open="(" separator="," close=")">
|
||||
#{configId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
98
src/main/resources/mybatis/system/DeptMapper.xml
Normal file
98
src/main/resources/mybatis/system/DeptMapper.xml
Normal file
@ -0,0 +1,98 @@
|
||||
<?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.ruoyi.project.system.dept.mapper.DeptMapper">
|
||||
|
||||
<resultMap type="Dept" id="DeptResult">
|
||||
<id property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="leader" column="leader" />
|
||||
<result property="phone" column="phone" />
|
||||
<result property="email" column="email" />
|
||||
<result property="status" column="status" />
|
||||
<result property="parentName" column="parent_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectDeptAll" resultMap="DeptResult">
|
||||
select dept_id, parent_id, dept_name, order_num, leader, phone, email, status, create_by, create_time from sys_dept
|
||||
</select>
|
||||
|
||||
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
||||
select count(*) from sys_user where dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<select id="selectDeptCount" parameterType="Dept" resultType="int">
|
||||
select count(*) from sys_dept
|
||||
<where>
|
||||
<if test="deptId != null and deptId != 0"> and dept_id = #{deptId} </if>
|
||||
<if test="parentId != null and parentId != 0"> and parent_id = #{parentId} </if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="checkDeptNameUnique" parameterType="String" resultMap="DeptResult">
|
||||
select t.dept_id, t.parent_id, t.dept_name, t.order_num, t.leader, t.phone, t.email, t.status from sys_dept t
|
||||
where dept_name=#{deptName}
|
||||
</select>
|
||||
|
||||
<select id="selectDeptById" parameterType="Long" resultMap="DeptResult">
|
||||
select t.dept_id, t.parent_id, t.dept_name, t.order_num, t.leader, t.phone, t.email, t.status,
|
||||
(select dept_name from sys_dept where dept_id = t.parent_id) parent_name
|
||||
from sys_dept t
|
||||
where dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDept" parameterType="Dept">
|
||||
insert into sys_dept(
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||
<if test="leader != null and leader != ''">leader,</if>
|
||||
<if test="phone != null and phone != ''">phone,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||
<if test="leader != null and leader != ''">#{leader},</if>
|
||||
<if test="phone != null and phone != ''">#{phone},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDept" parameterType="Dept">
|
||||
update sys_dept
|
||||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||
<if test="leader != null and leader != ''">leader = #{leader},</if>
|
||||
<if test="phone != null and phone != ''">phone = #{phone},</if>
|
||||
<if test="email != null and email != ''">email = #{email},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeptById" parameterType="Long">
|
||||
delete from sys_dept where dept_id = #{deptId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
103
src/main/resources/mybatis/system/DictDataMapper.xml
Normal file
103
src/main/resources/mybatis/system/DictDataMapper.xml
Normal file
@ -0,0 +1,103 @@
|
||||
<?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.ruoyi.project.system.dict.mapper.DictDataMapper">
|
||||
|
||||
<resultMap type="DictData" id="DictDataResult">
|
||||
<id property="dictCode" column="dict_code" />
|
||||
<result property="dictSort" column="dict_sort" />
|
||||
<result property="dictLabel" column="dict_label" />
|
||||
<result property="dictValue" column="dict_value" />
|
||||
<result property="dictType" column="dict_type" />
|
||||
<result property="cssClass" column="css_class" />
|
||||
<result property="isDefault" column="is_default" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectDictDataList" parameterType="DictData" resultMap="DictDataResult">
|
||||
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, is_default, status, create_by, create_time, remark from sys_dict_data
|
||||
<where>
|
||||
<if test="dictType != null and dictType != ''">
|
||||
AND dict_type like concat('%', #{dictType}, '%')
|
||||
</if>
|
||||
<if test="dictLabel != null and dictLabel != ''">
|
||||
AND dict_label like concat('%', #{dictLabel}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDictDataByType" parameterType="DictData" resultMap="DictDataResult">
|
||||
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, is_default, status, create_by, create_time, remark from sys_dict_data
|
||||
where dict_type = #{dictType} order by dict_sort asc
|
||||
</select>
|
||||
|
||||
<select id="selectDictDataById" parameterType="Long" resultMap="DictDataResult">
|
||||
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, is_default, status, create_by, create_time, remark
|
||||
from sys_dict_data
|
||||
where dict_code = #{dictCode}
|
||||
</select>
|
||||
|
||||
<delete id="deleteDictDataById" parameterType="Long">
|
||||
delete from sys_dict_data where dict_code = #{dictCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDictDataByIds" parameterType="Long">
|
||||
delete from sys_dict_data where dict_code in
|
||||
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
|
||||
#{dictCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateDictData" parameterType="DictData">
|
||||
update sys_dict_data
|
||||
<set>
|
||||
<if test="dictSort != null and dictSort != ''">dict_sort = #{dictSort},</if>
|
||||
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
|
||||
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
|
||||
<if test="cssClass != null and cssClass != ''">css_class = #{cssClass},</if>
|
||||
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="dictCode != null and dictCode != ''">and dict_code = #{dictCode}</if>
|
||||
</update>
|
||||
|
||||
<insert id="insertDictData" parameterType="DictData">
|
||||
insert into sys_dict_data(
|
||||
<if test="dictSort != null and dictSort != ''">dict_sort,</if>
|
||||
<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
|
||||
<if test="dictValue != null and dictValue != ''">dict_value,</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type,</if>
|
||||
<if test="cssClass != null and cssClass != ''">css_class,</if>
|
||||
<if test="isDefault != null and isDefault != ''">is_default,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="dictSort != null and dictSort != ''">#{dictSort},</if>
|
||||
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
|
||||
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
|
||||
<if test="dictType != null and dictType != ''">#{dictType},</if>
|
||||
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
|
||||
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
89
src/main/resources/mybatis/system/DictTypeMapper.xml
Normal file
89
src/main/resources/mybatis/system/DictTypeMapper.xml
Normal file
@ -0,0 +1,89 @@
|
||||
<?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.ruoyi.project.system.dict.mapper.DictTypeMapper">
|
||||
|
||||
<resultMap type="DictType" id="DictTypeResult">
|
||||
<id property="dictId" column="dict_id" />
|
||||
<result property="dictName" column="dict_name" />
|
||||
<result property="dictType" column="dict_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectDictTypeList" parameterType="DictType" resultMap="DictTypeResult">
|
||||
select dict_id, dict_name, dict_type, status, create_by, create_time, remark from sys_dict_type
|
||||
<where>
|
||||
<if test="dictName != null and dictName != ''">
|
||||
AND dict_name like concat('%', #{dictName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="dictType != null and dictType != ''">
|
||||
AND dict_type like concat('%', #{dictType}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDictTypeById" parameterType="Long" resultMap="DictTypeResult">
|
||||
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
|
||||
from sys_dict_type
|
||||
where dict_id = #{dictId}
|
||||
</select>
|
||||
|
||||
<select id="checkDictTypeUnique" parameterType="String" resultMap="DictTypeResult">
|
||||
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
|
||||
from sys_dict_type
|
||||
where dict_type = #{dictType}
|
||||
</select>
|
||||
|
||||
<delete id="deleteDictTypeById" parameterType="Long">
|
||||
delete from sys_dict_type where dict_id = #{dictId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDictTypeByIds" parameterType="Long">
|
||||
delete from sys_dict_type where dict_id in
|
||||
<foreach collection="array" item="dictId" open="(" separator="," close=")">
|
||||
#{dictId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateDictType" parameterType="DictType">
|
||||
update sys_dict_type
|
||||
<set>
|
||||
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="dictId != null and dictId != ''">and dict_id = #{dictId}</if>
|
||||
</update>
|
||||
|
||||
<insert id="insertDictType" parameterType="DictType">
|
||||
insert into sys_dict_type(
|
||||
<if test="dictName != null and dictName != ''">dict_name,</if>
|
||||
<if test="dictType != null and dictType != ''">dict_type,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="dictName != null and dictName != ''">#{dictName},</if>
|
||||
<if test="dictType != null and dictType != ''">#{dictType},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
123
src/main/resources/mybatis/system/MenuMapper.xml
Normal file
123
src/main/resources/mybatis/system/MenuMapper.xml
Normal file
@ -0,0 +1,123 @@
|
||||
<?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.ruoyi.project.system.menu.mapper.MenuMapper">
|
||||
|
||||
<resultMap type="Menu" id="MenuResult">
|
||||
<id property="menuId" column="menu_id" />
|
||||
<result property="menuName" column="menu_name" />
|
||||
<result property="parentName" column="parent_name" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="url" column="url" />
|
||||
<result property="menuType" column="menu_type" />
|
||||
<result property="visible" column="visible" />
|
||||
<result property="perms" column="perms" />
|
||||
<result property="icon" column="icon" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectMenusByUserId" parameterType="Long" resultMap="MenuResult">
|
||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.perms , m.menu_type, m.icon, m.order_num, m.create_time
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role ur on rm.role_id = ur.role_id
|
||||
where ur.user_id = #{userId} and m.menu_type in ('M', 'C') and m.visible = 0
|
||||
order by m.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectPermsByUserId" parameterType="Long" resultType="String">
|
||||
select distinct m.perms
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role ur on rm.role_id = ur.role_id
|
||||
where ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuTree" parameterType="Long" resultType="String">
|
||||
select concat(m.menu_id, m.perms) as perms
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
where rm.role_id = #{roleId}
|
||||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectMenuAll" resultMap="MenuResult">
|
||||
select menu_id, menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time from sys_menu
|
||||
</select>
|
||||
|
||||
<delete id="deleteMenuById" parameterType="Long">
|
||||
delete from sys_menu where menu_id = #{menuId} or parent_id = #{menuId}
|
||||
</delete>
|
||||
|
||||
<select id="selectMenuById" parameterType="Long" resultMap="MenuResult">
|
||||
SELECT t.menu_id, t.parent_id, t.menu_name, t.order_num, t.url, t.menu_type, t.visible, t.perms, t.icon, t.remark,
|
||||
(SELECT menu_name FROM sys_menu WHERE menu_id = t.parent_id) parent_name
|
||||
FROM sys_menu t
|
||||
where t.menu_id = #{menuId}
|
||||
</select>
|
||||
|
||||
<select id="selectCountMenuByParentId" resultType="Integer">
|
||||
select count(*) from sys_menu where parent_id=#{menuId}
|
||||
</select>
|
||||
|
||||
<select id="checkMenuNameUnique" parameterType="String" resultMap="MenuResult">
|
||||
select t.menu_id, t.parent_id, t.menu_name, t.order_num, t.url, t.menu_type, t.visible, t.perms, t.icon, t.remark
|
||||
from sys_menu t where menu_name=#{menuName}
|
||||
</select>
|
||||
|
||||
<update id="updateMenu" parameterType="Menu">
|
||||
update sys_menu
|
||||
<set>
|
||||
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||
<if test="url != null and url != ''">url = #{url},</if>
|
||||
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
|
||||
<if test="visible != null">visible = #{visible},</if>
|
||||
<if test="perms !=null and perms != ''">perms = #{perms},</if>
|
||||
<if test="icon !=null and icon != ''">icon = #{icon},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="menuId != null and menuId != ''">and menu_id = #{menuId}</if>
|
||||
</update>
|
||||
|
||||
<insert id="insertMenu" parameterType="Menu">
|
||||
insert into sys_menu(
|
||||
<if test="menuId != null and menuId != 0">menu_id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="menuName != null and menuName != ''">menu_name,</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||
<if test="url != null and url != ''">url,</if>
|
||||
<if test="menuType != null and menuType != ''">menu_type,</if>
|
||||
<if test="visible != null">visible,</if>
|
||||
<if test="perms !=null and perms != ''">perms,</if>
|
||||
<if test="icon != null and icon != ''">icon,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="menuId != null and menuId != 0">#{menuId},</if>
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
<if test="menuName != null and menuName != ''">#{menuName},</if>
|
||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||
<if test="url != null and url != ''">#{url},</if>
|
||||
<if test="menuType != null and menuType != ''">#{menuType},</if>
|
||||
<if test="visible != null">#{visible},</if>
|
||||
<if test="perms !=null and perms != ''">#{perms},</if>
|
||||
<if test="icon != null and icon != ''">#{icon},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
80
src/main/resources/mybatis/system/NoticeMapper.xml
Normal file
80
src/main/resources/mybatis/system/NoticeMapper.xml
Normal file
@ -0,0 +1,80 @@
|
||||
<?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.ruoyi.project.system.notice.mapper.NoticeMapper">
|
||||
|
||||
<resultMap type="Notice" id="NoticeResult">
|
||||
<result property="noticeId" column="notice_id" />
|
||||
<result property="noticeTitle" column="notice_title" />
|
||||
<result property="noticeType" column="notice_type" />
|
||||
<result property="noticeContent" column="notice_content" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectNoticeById" parameterType="Integer" resultMap="NoticeResult">
|
||||
select notice_id, notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark from sys_notice
|
||||
where notice_id = #{noticeId}
|
||||
</select>
|
||||
|
||||
<select id="selectNoticeList" parameterType="Notice" resultMap="NoticeResult">
|
||||
select notice_id, notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark from sys_notice
|
||||
<where>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">
|
||||
AND notice_title like concat('%', #{noticeTitle}, '%')
|
||||
</if>
|
||||
<if test="noticeType != null and noticeType != ''">
|
||||
AND notice_type = #{noticeType}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
AND create_by like concat('%', #{createBy}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertNotice" parameterType="Notice">
|
||||
insert into sys_notice (
|
||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
|
||||
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
|
||||
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
|
||||
<if test="status != null and status != '' ">status, </if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
|
||||
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
|
||||
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
|
||||
<if test="status != null and status != ''">#{status}, </if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateNotice" parameterType="Notice">
|
||||
update sys_notice
|
||||
<set>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
|
||||
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
|
||||
<if test="noticeContent != null and noticeContent != ''">notice_content = #{noticeContent}, </if>
|
||||
<if test="status != null and status != ''">status = #{status}, </if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where notice_id = #{noticeId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteNoticeByIds" parameterType="Integer">
|
||||
delete from sys_notice where notice_id in
|
||||
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
|
||||
#{noticeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
101
src/main/resources/mybatis/system/PostMapper.xml
Normal file
101
src/main/resources/mybatis/system/PostMapper.xml
Normal file
@ -0,0 +1,101 @@
|
||||
<?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.ruoyi.project.system.post.mapper.PostMapper">
|
||||
|
||||
<resultMap type="Post" id="PostResult">
|
||||
<id property="postId" column="post_id" />
|
||||
<result property="postCode" column="post_code" />
|
||||
<result property="postName" column="post_name" />
|
||||
<result property="postSort" column="post_sort" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectPostList" parameterType="Post" resultMap="PostResult">
|
||||
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark from sys_post
|
||||
<where>
|
||||
<if test="postCode != null and postCode != ''">
|
||||
AND post_code like concat('%', #{postCode}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="postName != null and postName != ''">
|
||||
AND post_name like concat('%', #{postName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPostAll" resultMap="PostResult">
|
||||
SELECT * FROM sys_post
|
||||
</select>
|
||||
|
||||
<select id="selectPostsByUserId" parameterType="Long" resultMap="PostResult">
|
||||
SELECT p.post_id, p.post_name, p.post_code
|
||||
FROM sys_user u
|
||||
LEFT JOIN sys_user_post up ON u.user_id = up.user_id
|
||||
LEFT JOIN sys_post p ON up.post_id = p.post_id
|
||||
WHERE up.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectPostById" parameterType="Long" resultMap="PostResult">
|
||||
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
|
||||
from sys_post u
|
||||
where u.post_id = #{postId}
|
||||
</select>
|
||||
|
||||
<delete id="deletePostById" parameterType="Long">
|
||||
delete from sys_post where post_id = #{postId}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePostByIds" parameterType="Long">
|
||||
delete from sys_post where post_id in
|
||||
<foreach collection="array" item="postId" open="(" separator="," close=")">
|
||||
#{postId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updatePost" parameterType="Post">
|
||||
update sys_post
|
||||
<set>
|
||||
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
|
||||
<if test="postName != null and postName != ''">post_name = #{postName},</if>
|
||||
<if test="postSort != null and postSort != ''">post_sort = #{postSort},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="postId != null">and post_id = #{postId}</if>
|
||||
</update>
|
||||
|
||||
<insert id="insertPost" parameterType="Post" useGeneratedKeys="true" keyProperty="postId">
|
||||
insert into sys_post(
|
||||
<if test="postId != null and postId != 0">post_id,</if>
|
||||
<if test="postCode != null and postCode != ''">post_code,</if>
|
||||
<if test="postName != null and postName != ''">post_name,</if>
|
||||
<if test="postSort != null and postSort != ''">post_sort,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="postId != null and postId != 0">#{postId},</if>
|
||||
<if test="postCode != null and postCode != ''">#{postCode},</if>
|
||||
<if test="postName != null and postName != ''">#{postName},</if>
|
||||
<if test="postSort != null and postSort != ''">#{postSort},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
106
src/main/resources/mybatis/system/RoleMapper.xml
Normal file
106
src/main/resources/mybatis/system/RoleMapper.xml
Normal file
@ -0,0 +1,106 @@
|
||||
<?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.ruoyi.project.system.role.mapper.RoleMapper">
|
||||
|
||||
<resultMap type="Role" id="RoleResult">
|
||||
<id property="roleId" column="role_id" />
|
||||
<result property="roleName" column="role_name" />
|
||||
<result property="roleKey" column="role_key" />
|
||||
<result property="roleSort" column="role_sort" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectRoleList" parameterType="Role" resultMap="RoleResult">
|
||||
select role_id, role_name, role_key, role_sort, status, create_time, remark from sys_role
|
||||
<where>
|
||||
<if test="roleName != null and roleName != ''">
|
||||
AND role_name like concat('%', #{roleName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="roleKey != null and roleKey != ''">
|
||||
AND role_key like concat('%', #{roleKey}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRolesByUserId" parameterType="Long" resultMap="RoleResult">
|
||||
SELECT r.role_id, r.role_name, r.role_key
|
||||
FROM sys_user u
|
||||
LEFT JOIN sys_user_role ur ON u.user_id = ur.user_id
|
||||
LEFT JOIN sys_role r ON ur.role_id = r.role_id
|
||||
WHERE ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectRolesAll" resultMap="RoleResult">
|
||||
SELECT role_id, role_name, role_key, role_sort, status, create_time, remark FROM sys_role
|
||||
</select>
|
||||
|
||||
<select id="selectRoleById" parameterType="Long" resultMap="RoleResult">
|
||||
select role_id, role_name, role_key, role_sort, status, create_time, remark
|
||||
from sys_role u
|
||||
where u.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<select id="checkRoleNameUnique" parameterType="String" resultMap="RoleResult">
|
||||
select role_id, role_name, role_key, role_sort, status, create_time
|
||||
from sys_role where role_name=#{roleName}
|
||||
</select>
|
||||
|
||||
<delete id="deleteRoleById" parameterType="Long">
|
||||
delete from sys_role where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRoleByIds" parameterType="Long">
|
||||
delete from sys_role where role_id in
|
||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateRole" parameterType="Role">
|
||||
update sys_role
|
||||
<set>
|
||||
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
|
||||
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
|
||||
<if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="roleId != null">and role_id = #{roleId}</if>
|
||||
</update>
|
||||
|
||||
<insert id="insertRole" parameterType="Role" useGeneratedKeys="true" keyProperty="roleId">
|
||||
insert into sys_role(
|
||||
<if test="roleId != null and roleId != 0">role_id,</if>
|
||||
<if test="roleName != null and roleName != ''">role_name,</if>
|
||||
<if test="roleKey != null and roleKey != ''">role_key,</if>
|
||||
<if test="roleSort != null and roleSort != ''">role_sort,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="roleId != null and roleId != 0">#{roleId},</if>
|
||||
<if test="roleName != null and roleName != ''">#{roleName},</if>
|
||||
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
|
||||
<if test="roleSort != null and roleSort != ''">#{roleSort},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
34
src/main/resources/mybatis/system/RoleMenuMapper.xml
Normal file
34
src/main/resources/mybatis/system/RoleMenuMapper.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?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.ruoyi.project.system.role.mapper.RoleMenuMapper">
|
||||
|
||||
<resultMap type="RoleMenu" id="RoleMenuResult">
|
||||
<result property="roleId" column="role_id" />
|
||||
<result property="menuId" column="menu_id" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
|
||||
delete from sys_role_menu where role_id=#{roleId}
|
||||
</delete>
|
||||
|
||||
<select id="selectCountRoleMenuByMenuId" resultType="Integer">
|
||||
select count(*) from sys_role_menu where menu_id=#{menuId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteRoleMenu" parameterType="Long">
|
||||
delete from sys_role_menu where role_id in
|
||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchRoleMenu">
|
||||
insert into sys_role_menu(role_id, menu_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.roleId},#{item.menuId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
203
src/main/resources/mybatis/system/UserMapper.xml
Normal file
203
src/main/resources/mybatis/system/UserMapper.xml
Normal file
@ -0,0 +1,203 @@
|
||||
<?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.ruoyi.project.system.user.mapper.UserMapper">
|
||||
|
||||
<resultMap type="User" id="UserResult">
|
||||
<id property="userId" column="user_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="loginName" column="login_name" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="email" column="email" />
|
||||
<result property="phonenumber" column="phonenumber" />
|
||||
<result property="sex" column="sex" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="password" column="password" />
|
||||
<result property="salt" column="salt" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="loginIp" column="login_ip" />
|
||||
<result property="loginDate" column="login_date" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<association property="dept" column="dept_id" javaType="Dept" resultMap="deptResult"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="deptResult" type="Dept">
|
||||
<id property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="status" column="dept_status" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectUserList" parameterType="User" resultMap="UserResult">
|
||||
select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.password, u.sex, u.avatar, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="loginName != null and loginName != ''">
|
||||
AND u.login_name like concat('%', #{loginName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="deptId != null and parentId != null and parentId != 0">
|
||||
AND u.dept_id IN (SELECT t.dept_id FROM sys_dept t WHERE t.dept_id = #{deptId} OR t.parent_id = #{deptId})
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUserByLoginName" parameterType="String" resultMap="UserResult">
|
||||
select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.sex, u.avatar, u.password, u.salt, u.status, u.login_ip, u.login_date, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.status as dept_status
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
where u.login_name = #{userName}
|
||||
</select>
|
||||
|
||||
<select id="selectUserByPhoneNumber" parameterType="String" resultMap="UserResult">
|
||||
select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.sex, u.avatar, u.password, u.salt, u.status, u.login_ip, u.login_date, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.status as dept_status
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
where u.phonenumber = #{phonenumber}
|
||||
</select>
|
||||
|
||||
<select id="selectUserByEmail" parameterType="String" resultMap="UserResult">
|
||||
select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.sex, u.avatar, u.password, u.salt, u.status, u.login_ip, u.login_date, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.status as dept_status
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
where u.email = #{email}
|
||||
</select>
|
||||
|
||||
<select id="checkLoginNameUnique" parameterType="String" resultType="int">
|
||||
select count(*) from sys_user where login_name=#{loginName}
|
||||
</select>
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="UserResult">
|
||||
select user_id, phonenumber from sys_user where phonenumber=#{phonenumber}
|
||||
</select>
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="UserResult">
|
||||
select user_id, email from sys_user where email=#{email}
|
||||
</select>
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="UserResult">
|
||||
select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.sex, u.avatar, u.password, u.salt, u.status, u.login_ip, u.login_date, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.status as dept_status
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
delete from sys_user where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserByIds" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateUser" parameterType="User">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||
<if test="loginName != null and loginName != ''">login_name = #{loginName},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="email != null and email != ''">email = #{email},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="salt != null and salt != ''">salt = #{salt},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where 1=1
|
||||
<if test="userId != null and userId != ''">and user_id = #{userId}</if>
|
||||
</update>
|
||||
|
||||
<insert id="insertUser" parameterType="User" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="loginName != null and loginName != ''">login_name,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="salt != null and salt != ''">salt,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="loginName != null and loginName != ''">#{loginName},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="salt != null and salt != ''">#{salt},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="batchAddUser" useGeneratedKeys="true" keyProperty="userId" >
|
||||
insert into sys_user(
|
||||
dept_id,
|
||||
login_name,
|
||||
user_name,
|
||||
email,
|
||||
phonenumber,
|
||||
sex,
|
||||
password,
|
||||
salt,
|
||||
status,
|
||||
create_by,
|
||||
remark,
|
||||
create_time
|
||||
) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(
|
||||
#{item.deptId},
|
||||
#{item.loginName},
|
||||
#{item.userName},
|
||||
#{item.email},
|
||||
#{item.phonenumber},
|
||||
#{item.sex},
|
||||
#{item.password},
|
||||
#{item.salt},
|
||||
#{item.status},
|
||||
#{item.createBy},
|
||||
#{item.remark},
|
||||
sysdate()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
34
src/main/resources/mybatis/system/UserPostMapper.xml
Normal file
34
src/main/resources/mybatis/system/UserPostMapper.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?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.ruoyi.project.system.user.mapper.UserPostMapper">
|
||||
|
||||
<resultMap type="UserPost" id="UserPostResult">
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="postId" column="post_id" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteUserPostByUserId" parameterType="Long">
|
||||
delete from sys_user_post where user_id=#{userId}
|
||||
</delete>
|
||||
|
||||
<select id="countUserPostById" resultType="Integer">
|
||||
select count(*) from sys_user_post where post_id=#{postId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserPost" parameterType="Long">
|
||||
delete from sys_user_post where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchUserPost">
|
||||
insert into sys_user_post(user_id, post_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.userId},#{item.postId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
34
src/main/resources/mybatis/system/UserRoleMapper.xml
Normal file
34
src/main/resources/mybatis/system/UserRoleMapper.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?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.ruoyi.project.system.user.mapper.UserRoleMapper">
|
||||
|
||||
<resultMap type="UserRole" id="UserRoleResult">
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="roleId" column="role_id" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteUserRoleByUserId" parameterType="Long">
|
||||
delete from sys_user_role where user_id=#{userId}
|
||||
</delete>
|
||||
|
||||
<select id="countUserRoleByRoleId" resultType="Integer">
|
||||
select count(*) from sys_user_role where role_id=#{roleId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserRole" parameterType="Long">
|
||||
delete from sys_user_role where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchUserRole">
|
||||
insert into sys_user_role(user_id, role_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.userId},#{item.roleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
44
src/main/resources/mybatis/tool/GenMapper.xml
Normal file
44
src/main/resources/mybatis/tool/GenMapper.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?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.ruoyi.project.tool.gen.mapper.GenMapper">
|
||||
|
||||
<resultMap type="TableInfo" id="TableInfoResult">
|
||||
<id property="tableName" column="table_name" />
|
||||
<result property="tableComment" column="table_comment" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ColumnInfo" id="ColumnInfoResult">
|
||||
<id property="columnName" column="column_name" />
|
||||
<result property="dataType" column="data_type" />
|
||||
<result property="columnComment" column="column_comment" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectTableList" parameterType="TableInfo" resultMap="TableInfoResult">
|
||||
select table_name, table_comment, create_time, update_time
|
||||
from information_schema.tables
|
||||
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
||||
<if test="tableName != null and tableName != ''">
|
||||
AND table_name like concat('%', #{tableName}, '%')
|
||||
</if>
|
||||
<if test="tableComment != null and tableComment != ''">
|
||||
AND table_comment like concat('%', #{tableComment}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectTableByName" parameterType="String" resultMap="TableInfoResult">
|
||||
select table_name, table_comment, create_time, update_time
|
||||
from information_schema.tables
|
||||
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
||||
and table_name = #{tableName}
|
||||
</select>
|
||||
|
||||
<select id="selectTableColumnsByName" parameterType="String" resultMap="ColumnInfoResult">
|
||||
select column_name, data_type, column_comment from information_schema.columns
|
||||
where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position
|
||||
</select>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user