Mapper实体类增加映射路径

This commit is contained in:
yuyang 2021-07-29 10:09:11 +08:00
parent fcc90c421d
commit 2aee9fa71a
16 changed files with 1330 additions and 1324 deletions

View File

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysPostMapper"> <mapper namespace="com.xhpc.system.mapper.SysPostMapper">
<resultMap type="SysPost" id="SysPostResult"> <resultMap type="com.xhpc.system.domain.SysPost" id="SysPostResult">
<id property="postId" column="post_id"/> <id property="postId" column="post_id"/>
<result property="postCode" column="post_code"/> <result property="postCode" column="post_code"/>
<result property="postName" column="post_name"/> <result property="postName" column="post_name"/>
@ -29,7 +29,7 @@
from sys_post from sys_post
</sql> </sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult"> <select id="selectPostList" parameterType="com.xhpc.system.domain.SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
<where> <where>
<if test="postCode != null and postCode != ''"> <if test="postCode != null and postCode != ''">
@ -61,7 +61,7 @@
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult"> <select id="selectPostsByUserName" parameterType="java.lang.String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code select p.post_id, p.post_name, p.post_code
from sys_post p from sys_post p
left join sys_user_post up on up.post_id = p.post_id left join sys_user_post up on up.post_id = p.post_id
@ -69,17 +69,17 @@
where u.user_name = #{userName} where u.user_name = #{userName}
</select> </select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult"> <select id="checkPostNameUnique" parameterType="java.lang.String" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
where post_name=#{postName} limit 1 where post_name=#{postName} limit 1
</select> </select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult"> <select id="checkPostCodeUnique" parameterType="java.lang.String" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
where post_code=#{postCode} limit 1 where post_code=#{postCode} limit 1
</select> </select>
<update id="updatePost" parameterType="SysPost"> <update id="updatePost" parameterType="com.xhpc.system.domain.SysPost">
update sys_post update sys_post
<set> <set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if> <if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
@ -93,7 +93,7 @@
where post_id = #{postId} where post_id = #{postId}
</update> </update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId"> <insert id="insertPost" parameterType="com.xhpc.system.domain.SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post( insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if> <if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if> <if test="postCode != null and postCode != ''">post_code,</if>

View File

@ -1,121 +1,121 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysConfigMapper"> <mapper namespace="com.xhpc.system.mapper.SysConfigMapper">
<resultMap type="SysConfig" id="SysConfigResult"> <resultMap type="com.xhpc.system.domain.SysConfig" id="SysConfigResult">
<id property="configId" column="config_id"/> <id property="configId" column="config_id"/>
<result property="configName" column="config_name"/> <result property="configName" column="config_name"/>
<result property="configKey" column="config_key"/> <result property="configKey" column="config_key"/>
<result property="configValue" column="config_value"/> <result property="configValue" column="config_value"/>
<result property="configType" column="config_type"/> <result property="configType" column="config_type"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
</resultMap> </resultMap>
<sql id="selectConfigVo"> <sql id="selectConfigVo">
select config_id, select config_id,
config_name, config_name,
config_key, config_key,
config_value, config_value,
config_type, config_type,
create_by, create_by,
create_time, create_time,
update_by, update_by,
update_time, update_time,
remark remark
from sys_config from sys_config
</sql> </sql>
<!-- 查询条件 --> <!-- 查询条件 -->
<sql id="sqlwhereSearch"> <sql id="sqlwhereSearch">
<where> <where>
<if test="configId !=null"> <if test="configId !=null">
and config_id = #{configId} and config_id = #{configId}
</if> </if>
<if test="configKey !=null and configKey != ''"> <if test="configKey !=null and configKey != ''">
and config_key = #{configKey} and config_key = #{configKey}
</if> </if>
</where> </where>
</sql> </sql>
<select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult"> <select id="selectConfig" parameterType="com.xhpc.system.domain.SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/> <include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/> <include refid="sqlwhereSearch"/>
</select> </select>
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult"> <select id="selectConfigList" parameterType="com.xhpc.system.domain.SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/> <include refid="selectConfigVo"/>
<where> <where>
<if test="configName != null and configName != ''"> <if test="configName != null and configName != ''">
AND config_name like concat('%', #{configName}, '%') AND config_name like concat('%', #{configName}, '%')
</if> </if>
<if test="configType != null and configType != ''"> <if test="configType != null and configType != ''">
AND config_type = #{configType} AND config_type = #{configType}
</if> </if>
<if test="configKey != null and configKey != ''"> <if test="configKey != null and configKey != ''">
AND config_key like concat('%', #{configKey}, '%') AND config_key like concat('%', #{configKey}, '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if> </if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
</where> </where>
</select> </select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult"> <select id="checkConfigKeyUnique" parameterType="java.lang.String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/> <include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1 where config_key = #{configKey} limit 1
</select> </select>
<insert id="insertConfig" parameterType="SysConfig"> <insert id="insertConfig" parameterType="com.xhpc.system.domain.SysConfig">
insert into sys_config ( insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if> <if test="configName != null and configName != '' ">config_name,</if>
<if test="configKey != null and configKey != '' ">config_key,</if> <if test="configKey != null and configKey != '' ">config_key,</if>
<if test="configValue != null and configValue != '' ">config_value,</if> <if test="configValue != null and configValue != '' ">config_value,</if>
<if test="configType != null and configType != '' ">config_type,</if> <if test="configType != null and configType != '' ">config_type,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
create_time create_time
)values( )values(
<if test="configName != null and configName != ''">#{configName},</if> <if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if> <if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if> <if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if> <if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
sysdate() sysdate()
) )
</insert> </insert>
<update id="updateConfig" parameterType="SysConfig"> <update id="updateConfig" parameterType="com.xhpc.system.domain.SysConfig">
update sys_config update sys_config
<set> <set>
<if test="configName != null and configName != ''">config_name = #{configName},</if> <if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if> <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if> <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="configType != null and configType != ''">config_type = #{configType},</if> <if test="configType != null and configType != ''">config_type = #{configType},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where config_id = #{configId} where config_id = #{configId}
</update> </update>
<delete id="deleteConfigById" parameterType="Long"> <delete id="deleteConfigById" parameterType="Long">
delete from sys_config where config_id = #{configId} delete from sys_config where config_id = #{configId}
</delete> </delete>
<delete id="deleteConfigByIds" parameterType="Long"> <delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")"> <foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId} #{configId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -1,167 +1,167 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysDeptMapper"> <mapper namespace="com.xhpc.system.mapper.SysDeptMapper">
<resultMap type="SysDept" id="SysDeptResult"> <resultMap type="com.xhpc.system.api.domain.SysDept" id="SysDeptResult">
<id property="deptId" column="dept_id"/> <id property="deptId" column="dept_id"/>
<result property="parentId" column="parent_id"/> <result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/> <result property="ancestors" column="ancestors"/>
<result property="deptName" column="dept_name"/> <result property="deptName" column="dept_name"/>
<result property="orderNum" column="order_num"/> <result property="orderNum" column="order_num"/>
<result property="leader" column="leader"/> <result property="leader" column="leader"/>
<result property="phone" column="phone"/> <result property="phone" column="phone"/>
<result property="email" column="email"/> <result property="email" column="email"/>
<result property="status" column="status" /> <result property="status" column="status" />
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" /> <result property="parentName" column="parent_name" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
</resultMap> </resultMap>
<sql id="selectDeptVo"> <sql id="selectDeptVo">
select d.dept_id, select d.dept_id,
d.parent_id, d.parent_id,
d.ancestors, d.ancestors,
d.dept_name, d.dept_name,
d.order_num, d.order_num,
d.leader, d.leader,
d.phone, d.phone,
d.email, d.email,
d.status, d.status,
d.del_flag, d.del_flag,
d.create_by, d.create_by,
d.create_time d.create_time
from sys_dept d from sys_dept d
</sql> </sql>
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult"> <select id="selectDeptList" parameterType="com.xhpc.system.api.domain.SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where d.del_flag = '0' where d.del_flag = '0'
<if test="parentId != null and parentId != 0"> <if test="parentId != null and parentId != 0">
AND parent_id = #{parentId} AND parent_id = #{parentId}
</if> </if>
<if test="deptName != null and deptName != ''"> <if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%') AND dept_name like concat('%', #{deptName}, '%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptListByRoleId" resultType="Integer"> <select id="selectDeptListByRoleId" resultType="Integer">
select d.dept_id select d.dept_id
from sys_dept d from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id left join sys_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId} where rd.role_id = #{roleId}
<if test="deptCheckStrictly"> <if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if> </if>
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult"> <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where dept_id = #{deptId} where dept_id = #{deptId}
</select> </select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int"> <select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0' select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select> </select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int"> <select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} where del_flag = '0' and parent_id = #{deptId}
</select> </select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult"> <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors) select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select> </select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="java.lang.Integer"> <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="java.lang.Integer">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors) select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select> </select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult"> <select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} limit 1 where dept_name=#{deptName} and parent_id = #{parentId} limit 1
</select> </select>
<insert id="insertDept" parameterType="SysDept"> <insert id="insertDept" parameterType="com.xhpc.system.api.domain.SysDept">
insert into sys_dept( insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if> <if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if> <if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if> <if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null and orderNum != ''">order_num,</if> <if test="orderNum != null and orderNum != ''">order_num,</if>
<if test="leader != null and leader != ''">leader,</if> <if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if> <if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if> <if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="deptId != null and deptId != 0">#{deptId},</if> <if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if> <if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if> <if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if> <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null and orderNum != ''">#{orderNum},</if> <if test="orderNum != null and orderNum != ''">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if> <if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if> <if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if> <if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )
</insert> </insert>
<update id="updateDept" parameterType="SysDept"> <update id="updateDept" parameterType="com.xhpc.system.api.domain.SysDept">
update sys_dept update sys_dept
<set> <set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if> <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if> <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if> <if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if> <if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if> <if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where dept_id = #{deptId} where dept_id = #{deptId}
</update> </update>
<update id="updateDeptChildren" parameterType="java.util.List"> <update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors = update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index" <foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end"> separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors} when #{item.deptId} then #{item.ancestors}
</foreach> </foreach>
where dept_id in where dept_id in
<foreach collection="depts" item="item" index="index" <foreach collection="depts" item="item" index="index"
separator="," open="(" close=")"> separator="," open="(" close=")">
#{item.deptId} #{item.deptId}
</foreach> </foreach>
</update> </update>
<update id="updateDeptStatusNormal" parameterType="Long"> <update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")"> <foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId} #{deptId}
</foreach> </foreach>
</update> </update>
<delete id="deleteDeptById" parameterType="Long"> <delete id="deleteDeptById" parameterType="Long">
update sys_dept update sys_dept
set del_flag = '2' set del_flag = '2'
where dept_id = #{deptId} where dept_id = #{deptId}
</delete> </delete>
</mapper> </mapper>

View File

@ -1,137 +1,143 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysDictDataMapper"> <mapper namespace="com.xhpc.system.mapper.SysDictDataMapper">
<resultMap type="SysDictData" id="SysDictDataResult"> <resultMap type="com.xhpc.system.domain.SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code"/> <id property="dictCode" column="dict_code"/>
<result property="dictSort" column="dict_sort"/> <result property="dictSort" column="dict_sort"/>
<result property="dictLabel" column="dict_label"/> <result property="dictLabel" column="dict_label"/>
<result property="dictValue" column="dict_value"/> <result property="dictValue" column="dict_value"/>
<result property="dictType" column="dict_type"/> <result property="dictType" column="dict_type"/>
<result property="cssClass" column="css_class"/> <result property="cssClass" column="css_class"/>
<result property="listClass" column="list_class"/> <result property="listClass" column="list_class"/>
<result property="isDefault" column="is_default"/> <result property="isDefault" column="is_default"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
</resultMap> </resultMap>
<sql id="selectDictDataVo"> <sql id="selectDictDataVo">
select dict_code, select dict_code,
dict_sort, dict_sort,
dict_label, dict_label,
dict_value, dict_value,
dict_type, dict_type,
css_class, css_class,
list_class, list_class,
is_default, is_default,
status, status,
create_by, create_by,
create_time, create_time,
remark remark
from sys_dict_data from sys_dict_data
</sql> </sql>
<select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult"> <select id="selectDictDataList" parameterType="com.xhpc.system.domain.SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/> <include refid="selectDictDataVo"/>
<where> <where>
<if test="dictType != null and dictType != ''"> <if test="dictType != null and dictType != ''">
AND dict_type = #{dictType} AND dict_type = #{dictType}
</if> </if>
<if test="dictLabel != null and dictLabel != ''"> <if test="dictLabel != null and dictLabel != ''">
AND dict_label like concat('%', #{dictLabel}, '%') AND dict_label like concat('%', #{dictLabel}, '%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
</where> </where>
order by dict_sort asc order by dict_sort asc
</select> </select>
<select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult"> <select id="selectDictDataByType" parameterType="com.xhpc.system.domain.SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/> <include refid="selectDictDataVo"/>
where status = '0' and dict_type = #{dictType} order by dict_sort asc where status = '0' and dict_type = #{dictType} order by dict_sort asc
</select> </select>
<select id="selectDictLabel" resultType="String"> <select id="selectDictLabel" resultType="java.lang.String">
select dict_label from sys_dict_data select dict_label
where dict_type = #{dictType} and dict_value = #{dictValue} from sys_dict_data
</select> where dict_type = #{dictType}
and dict_value = #{dictValue}
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult"> </select>
<include refid="selectDictDataVo"/>
where dict_code = #{dictCode} <select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
</select> <include refid="selectDictDataVo"/>
where dict_code = #{dictCode}
<select id="countDictDataByType" resultType="Integer"> </select>
select count(1)
from sys_dict_data <select id="countDictDataByType" resultType="Integer">
where dict_type = #{dictType} select count(1)
</select> from sys_dict_data
where dict_type = #{dictType}
<delete id="deleteDictDataById" parameterType="Long"> </select>
delete from sys_dict_data where dict_code = #{dictCode}
</delete> <delete id="deleteDictDataById" parameterType="Long">
delete
<delete id="deleteDictDataByIds" parameterType="Long"> from sys_dict_data
delete from sys_dict_data where dict_code in where dict_code = #{dictCode}
<foreach collection="array" item="dictCode" open="(" separator="," close=")"> </delete>
#{dictCode}
</foreach> <delete id="deleteDictDataByIds" parameterType="Long">
</delete> delete from sys_dict_data where dict_code in
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
<update id="updateDictData" parameterType="SysDictData"> #{dictCode}
update sys_dict_data </foreach>
<set> </delete>
<if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if> <update id="updateDictData" parameterType="com.xhpc.system.domain.SysDictData">
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if> update sys_dict_data
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if> <set>
<if test="cssClass != null">css_class = #{cssClass},</if> <if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="listClass != null">list_class = #{listClass},</if> <if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if> <if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
<if test="status != null">status = #{status},</if> <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="remark != null">remark = #{remark},</if> <if test="cssClass != null">css_class = #{cssClass},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="listClass != null">list_class = #{listClass},</if>
update_time = sysdate() <if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
</set> <if test="status != null">status = #{status},</if>
where dict_code = #{dictCode} <if test="remark != null">remark = #{remark},</if>
</update> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
<update id="updateDictDataType" parameterType="String"> </set>
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType} where dict_code = #{dictCode}
</update> </update>
<insert id="insertDictData" parameterType="SysDictData"> <update id="updateDictDataType" parameterType="java.lang.String">
insert into sys_dict_data( update sys_dict_data
<if test="dictSort != null">dict_sort,</if> set dict_type = #{newDictType}
<if test="dictLabel != null and dictLabel != ''">dict_label,</if> where dict_type = #{oldDictType}
<if test="dictValue != null and dictValue != ''">dict_value,</if> </update>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="cssClass != null and cssClass != ''">css_class,</if> <insert id="insertDictData" parameterType="com.xhpc.system.domain.SysDictData">
<if test="listClass != null and listClass != ''">list_class,</if> insert into sys_dict_data(
<if test="isDefault != null and isDefault != ''">is_default,</if> <if test="dictSort != null">dict_sort,</if>
<if test="status != null">status,</if> <if test="dictLabel != null and dictLabel != ''">dict_label,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="dictValue != null and dictValue != ''">dict_value,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="dictType != null and dictType != ''">dict_type,</if>
create_time <if test="cssClass != null and cssClass != ''">css_class,</if>
)values( <if test="listClass != null and listClass != ''">list_class,</if>
<if test="dictSort != null">#{dictSort},</if> <if test="isDefault != null and isDefault != ''">is_default,</if>
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if> <if test="status != null">status,</if>
<if test="dictValue != null and dictValue != ''">#{dictValue},</if> <if test="remark != null and remark != ''">remark,</if>
<if test="dictType != null and dictType != ''">#{dictType},</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="cssClass != null and cssClass != ''">#{cssClass},</if> create_time
<if test="listClass != null and listClass != ''">#{listClass},</if> )values(
<if test="isDefault != null and isDefault != ''">#{isDefault},</if> <if test="dictSort != null">#{dictSort},</if>
<if test="status != null">#{status},</if> <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="dictType != null and dictType != ''">#{dictType},</if>
sysdate() <if test="cssClass != null and cssClass != ''">#{cssClass},</if>
) <if test="listClass != null and listClass != ''">#{listClass},</if>
</insert> <if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="status != null">#{status},</if>
</mapper> <if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@ -1,105 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysDictTypeMapper"> <mapper namespace="com.xhpc.system.mapper.SysDictTypeMapper">
<resultMap type="SysDictType" id="SysDictTypeResult"> <resultMap type="com.xhpc.system.domain.SysDictType" id="SysDictTypeResult">
<id property="dictId" column="dict_id"/> <id property="dictId" column="dict_id"/>
<result property="dictName" column="dict_name"/> <result property="dictName" column="dict_name"/>
<result property="dictType" column="dict_type"/> <result property="dictType" column="dict_type"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
</resultMap> </resultMap>
<sql id="selectDictTypeVo"> <sql id="selectDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, remark select dict_id, dict_name, dict_type, status, create_by, create_time, remark
from sys_dict_type from sys_dict_type
</sql> </sql>
<select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult"> <select id="selectDictTypeList" parameterType="com.xhpc.system.domain.SysDictType" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/> <include refid="selectDictTypeVo"/>
<where> <where>
<if test="dictName != null and dictName != ''"> <if test="dictName != null and dictName != ''">
AND dict_name like concat('%', #{dictName}, '%') AND dict_name like concat('%', #{dictName}, '%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
<if test="dictType != null and dictType != ''"> <if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%') AND dict_type like concat('%', #{dictType}, '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if> </if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
</where> </where>
</select> </select>
<select id="selectDictTypeAll" resultMap="SysDictTypeResult"> <select id="selectDictTypeAll" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/> <include refid="selectDictTypeVo"/>
</select> </select>
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult"> <select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/> <include refid="selectDictTypeVo"/>
where dict_id = #{dictId} where dict_id = #{dictId}
</select> </select>
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult"> <select id="selectDictTypeByType" parameterType="java.lang.String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/> <include refid="selectDictTypeVo"/>
where dict_type = #{dictType} where dict_type = #{dictType}
</select> </select>
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult"> <select id="checkDictTypeUnique" parameterType="java.lang.String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/> <include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1 where dict_type = #{dictType} limit 1
</select> </select>
<delete id="deleteDictTypeById" parameterType="Long"> <delete id="deleteDictTypeById" parameterType="Long">
delete from sys_dict_type where dict_id = #{dictId} delete from sys_dict_type where dict_id = #{dictId}
</delete> </delete>
<delete id="deleteDictTypeByIds" parameterType="Long"> <delete id="deleteDictTypeByIds" parameterType="Long">
delete from sys_dict_type where dict_id in delete from sys_dict_type where dict_id in
<foreach collection="array" item="dictId" open="(" separator="," close=")"> <foreach collection="array" item="dictId" open="(" separator="," close=")">
#{dictId} #{dictId}
</foreach> </foreach>
</delete> </delete>
<update id="updateDictType" parameterType="SysDictType"> <update id="updateDictType" parameterType="com.xhpc.system.domain.SysDictType">
update sys_dict_type update sys_dict_type
<set> <set>
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if> <if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if> <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where dict_id = #{dictId} where dict_id = #{dictId}
</update> </update>
<insert id="insertDictType" parameterType="SysDictType"> <insert id="insertDictType" parameterType="com.xhpc.system.domain.SysDictType">
insert into sys_dict_type( insert into sys_dict_type(
<if test="dictName != null and dictName != ''">dict_name,</if> <if test="dictName != null and dictName != ''">dict_name,</if>
<if test="dictType != null and dictType != ''">dict_type,</if> <if test="dictType != null and dictType != ''">dict_type,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="dictName != null and dictName != ''">#{dictName},</if> <if test="dictName != null and dictName != ''">#{dictName},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if> <if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )
</insert> </insert>
</mapper> </mapper>

View File

@ -1,54 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysLogininforMapper"> <mapper namespace="com.xhpc.system.mapper.SysLogininforMapper">
<resultMap type="SysLogininfor" id="SysLogininforResult"> <resultMap type="com.xhpc.system.domain.SysLogininfor" id="SysLogininforResult">
<id property="infoId" column="info_id"/> <id property="infoId" column="info_id"/>
<result property="userName" column="user_name"/> <result property="userName" column="user_name"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="ipaddr" column="ipaddr"/> <result property="ipaddr" column="ipaddr"/>
<result property="msg" column="msg"/> <result property="msg" column="msg"/>
<result property="accessTime" column="access_time"/> <result property="accessTime" column="access_time"/>
</resultMap> </resultMap>
<insert id="insertLogininfor" parameterType="SysLogininfor"> <insert id="insertLogininfor" parameterType="com.xhpc.system.domain.SysLogininfor">
insert into sys_logininfor (user_name, status, ipaddr, msg, access_time) insert into sys_logininfor (user_name, status, ipaddr, msg, access_time)
values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate()) values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate())
</insert> </insert>
<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult"> <select id="selectLogininforList" parameterType="com.xhpc.system.domain.SysLogininfor" resultMap="SysLogininforResult">
select info_id, user_name, ipaddr, status, msg, access_time from sys_logininfor select info_id, user_name, ipaddr, status, msg, access_time from sys_logininfor
<where> <where>
<if test="ipaddr != null and ipaddr != ''"> <if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%') AND ipaddr like concat('%', #{ipaddr}, '%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
AND user_name like concat('%', #{userName}, '%') AND user_name like concat('%', #{userName}, '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(access_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') and date_format(access_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if> </if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(access_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') and date_format(access_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
</where> </where>
order by info_id desc order by info_id desc
</select> </select>
<delete id="deleteLogininforByIds" parameterType="Long"> <delete id="deleteLogininforByIds" parameterType="Long">
delete from sys_logininfor where info_id in delete from sys_logininfor where info_id in
<foreach collection="array" item="infoId" open="(" separator="," close=")"> <foreach collection="array" item="infoId" open="(" separator="," close=")">
#{infoId} #{infoId}
</foreach> </foreach>
</delete> </delete>
<update id="cleanLogininfor"> <update id="cleanLogininfor">
truncate table sys_logininfor truncate table sys_logininfor
</update> </update>
</mapper> </mapper>

View File

@ -1,208 +1,208 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysMenuMapper"> <mapper namespace="com.xhpc.system.mapper.SysMenuMapper">
<resultMap type="SysMenu" id="SysMenuResult"> <resultMap type="com.xhpc.system.domain.SysMenu" id="SysMenuResult">
<id property="menuId" column="menu_id"/> <id property="menuId" column="menu_id"/>
<result property="menuName" column="menu_name"/> <result property="menuName" column="menu_name"/>
<result property="parentName" column="parent_name"/> <result property="parentName" column="parent_name"/>
<result property="parentId" column="parent_id"/> <result property="parentId" column="parent_id"/>
<result property="orderNum" column="order_num"/> <result property="orderNum" column="order_num"/>
<result property="path" column="path"/> <result property="path" column="path"/>
<result property="component" column="component"/> <result property="component" column="component"/>
<result property="isFrame" column="is_frame"/> <result property="isFrame" column="is_frame"/>
<result property="isCache" column="is_cache" /> <result property="isCache" column="is_cache" />
<result property="menuType" column="menu_type" /> <result property="menuType" column="menu_type" />
<result property="visible" column="visible" /> <result property="visible" column="visible" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="perms" column="perms" /> <result property="perms" column="perms" />
<result property="icon" column="icon" /> <result property="icon" column="icon" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
</resultMap> </resultMap>
<sql id="selectMenuVo"> <sql id="selectMenuVo">
select menu_id, select menu_id,
menu_name, menu_name,
parent_id, parent_id,
order_num, order_num,
path, path,
component, component,
is_frame, is_frame,
is_cache, is_cache,
menu_type, menu_type,
visible, visible,
status, status,
ifnull(perms, '') as perms, ifnull(perms, '') as perms,
icon, icon,
create_time create_time
from sys_menu from sys_menu
</sql> </sql>
<select id="selectMenuList" parameterType="SysMenu" resultMap="SysMenuResult"> <select id="selectMenuList" parameterType="com.xhpc.system.domain.SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/> <include refid="selectMenuVo"/>
<where> <where>
<if test="menuName != null and menuName != ''"> <if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%') AND menu_name like concat('%', #{menuName}, '%')
</if> </if>
<if test="visible != null and visible != ''"> <if test="visible != null and visible != ''">
AND visible = #{visible} AND visible = #{visible}
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
</where> </where>
order by parent_id, order_num order by parent_id, order_num
</select> </select>
<select id="selectMenuTreeAll" resultMap="SysMenuResult"> <select id="selectMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0 from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num order by m.parent_id, m.order_num
</select> </select>
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult"> <select id="selectMenuListByUserId" parameterType="com.xhpc.system.domain.SysMenu" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id 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 left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id left join sys_role ro on ur.role_id = ro.role_id
where ur.user_id = #{params.userId} where ur.user_id = #{params.userId}
<if test="menuName != null and menuName != ''"> <if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%') AND menu_name like concat('%', #{menuName}, '%')
</if> </if>
<if test="visible != null and visible != ''"> <if test="visible != null and visible != ''">
AND visible = #{visible} AND visible = #{visible}
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
order by m.parent_id, m.order_num order by m.parent_id, m.order_num
</select> </select>
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult"> <select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id 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 left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id left join sys_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0 where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num order by m.parent_id, m.order_num
</select> </select>
<select id="selectMenuListByRoleId" resultType="Integer"> <select id="selectMenuListByRoleId" resultType="Integer">
select m.menu_id select m.menu_id
from sys_menu m from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id left join sys_role_menu rm on m.menu_id = rm.menu_id
where rm.role_id = #{roleId} where rm.role_id = #{roleId}
<if test="menuCheckStrictly"> <if test="menuCheckStrictly">
and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId}) and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId})
</if> </if>
order by m.parent_id, m.order_num order by m.parent_id, m.order_num
</select> </select>
<select id="selectMenuPerms" resultType="String"> <select id="selectMenuPerms" resultType="java.lang.String">
select distinct m.perms select distinct m.perms
from sys_menu m from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id 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 left join sys_user_role ur on rm.role_id = ur.role_id
</select> </select>
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String"> <select id="selectMenuPermsByUserId" parameterType="Long" resultType="java.lang.String">
select distinct m.perms select distinct m.perms
from sys_menu m from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id 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 left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role r on r.role_id = ur.role_id left join sys_role r on r.role_id = ur.role_id
where m.status = '0' and r.status = '0' and ur.user_id = #{userId} where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select> </select>
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult"> <select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
<include refid="selectMenuVo"/> <include refid="selectMenuVo"/>
where menu_id = #{menuId} where menu_id = #{menuId}
</select> </select>
<select id="hasChildByMenuId" resultType="Integer"> <select id="hasChildByMenuId" resultType="Integer">
select count(1) select count(1)
from sys_menu from sys_menu
where parent_id = #{menuId} where parent_id = #{menuId}
</select> </select>
<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult"> <select id="checkMenuNameUnique" parameterType="com.xhpc.system.domain.SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/> <include refid="selectMenuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} limit 1 where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select> </select>
<update id="updateMenu" parameterType="SysMenu"> <update id="updateMenu" parameterType="com.xhpc.system.domain.SysMenu">
update sys_menu update sys_menu
<set> <set>
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if> <if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
<if test="parentId != null">parent_id = #{parentId},</if> <if test="parentId != null">parent_id = #{parentId},</if>
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
<if test="path != null and path != ''">path = #{path},</if> <if test="path != null and path != ''">path = #{path},</if>
<if test="component != null">component = #{component},</if> <if test="component != null">component = #{component},</if>
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if> <if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if> <if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if> <if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
<if test="visible != null">visible = #{visible},</if> <if test="visible != null">visible = #{visible},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="perms !=null">perms = #{perms},</if> <if test="perms !=null">perms = #{perms},</if>
<if test="icon !=null and icon != ''">icon = #{icon},</if> <if test="icon !=null and icon != ''">icon = #{icon},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if> <if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where menu_id = #{menuId} where menu_id = #{menuId}
</update> </update>
<insert id="insertMenu" parameterType="SysMenu"> <insert id="insertMenu" parameterType="com.xhpc.system.domain.SysMenu">
insert into sys_menu( insert into sys_menu(
<if test="menuId != null and menuId != 0">menu_id,</if> <if test="menuId != null and menuId != 0">menu_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if> <if test="parentId != null and parentId != 0">parent_id,</if>
<if test="menuName != null and menuName != ''">menu_name,</if> <if test="menuName != null and menuName != ''">menu_name,</if>
<if test="orderNum != null and orderNum != ''">order_num,</if> <if test="orderNum != null and orderNum != ''">order_num,</if>
<if test="path != null and path != ''">path,</if> <if test="path != null and path != ''">path,</if>
<if test="component != null and component != ''">component,</if> <if test="component != null and component != ''">component,</if>
<if test="isFrame != null and isFrame != ''">is_frame,</if> <if test="isFrame != null and isFrame != ''">is_frame,</if>
<if test="isCache != null and isCache != ''">is_cache,</if> <if test="isCache != null and isCache != ''">is_cache,</if>
<if test="menuType != null and menuType != ''">menu_type,</if> <if test="menuType != null and menuType != ''">menu_type,</if>
<if test="visible != null">visible,</if> <if test="visible != null">visible,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="perms !=null and perms != ''">perms,</if> <if test="perms !=null and perms != ''">perms,</if>
<if test="icon != null and icon != ''">icon,</if> <if test="icon != null and icon != ''">icon,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="menuId != null and menuId != 0">#{menuId},</if> <if test="menuId != null and menuId != 0">#{menuId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if> <if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="menuName != null and menuName != ''">#{menuName},</if> <if test="menuName != null and menuName != ''">#{menuName},</if>
<if test="orderNum != null and orderNum != ''">#{orderNum},</if> <if test="orderNum != null and orderNum != ''">#{orderNum},</if>
<if test="path != null and path != ''">#{path},</if> <if test="path != null and path != ''">#{path},</if>
<if test="component != null and component != ''">#{component},</if> <if test="component != null and component != ''">#{component},</if>
<if test="isFrame != null and isFrame != ''">#{isFrame},</if> <if test="isFrame != null and isFrame != ''">#{isFrame},</if>
<if test="isCache != null and isCache != ''">#{isCache},</if> <if test="isCache != null and isCache != ''">#{isCache},</if>
<if test="menuType != null and menuType != ''">#{menuType},</if> <if test="menuType != null and menuType != ''">#{menuType},</if>
<if test="visible != null">#{visible},</if> <if test="visible != null">#{visible},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="perms !=null and perms != ''">#{perms},</if> <if test="perms !=null and perms != ''">#{perms},</if>
<if test="icon != null and icon != ''">#{icon},</if> <if test="icon != null and icon != ''">#{icon},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )
</insert> </insert>
<delete id="deleteMenuById" parameterType="Long"> <delete id="deleteMenuById" parameterType="Long">
delete delete
from sys_menu from sys_menu
where menu_id = #{menuId} where menu_id = #{menuId}
</delete> </delete>
</mapper> </mapper>

View File

@ -1,98 +1,98 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysNoticeMapper"> <mapper namespace="com.xhpc.system.mapper.SysNoticeMapper">
<resultMap type="SysNotice" id="SysNoticeResult"> <resultMap type="com.xhpc.system.domain.SysNotice" id="SysNoticeResult">
<result property="noticeId" column="notice_id"/> <result property="noticeId" column="notice_id"/>
<result property="noticeTitle" column="notice_title"/> <result property="noticeTitle" column="notice_title"/>
<result property="noticeType" column="notice_type"/> <result property="noticeType" column="notice_type"/>
<result property="noticeContent" column="notice_content"/> <result property="noticeContent" column="notice_content"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
</resultMap> </resultMap>
<sql id="selectNoticeVo"> <sql id="selectNoticeVo">
select notice_id, select notice_id,
notice_title, notice_title,
notice_type, notice_type,
cast(notice_content as char) as notice_content, cast(notice_content as char) as notice_content,
status, status,
create_by, create_by,
create_time, create_time,
update_by, update_by,
update_time, update_time,
remark remark
from sys_notice from sys_notice
</sql> </sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult"> <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/> <include refid="selectNoticeVo"/>
where notice_id = #{noticeId} where notice_id = #{noticeId}
</select> </select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult"> <select id="selectNoticeList" parameterType="com.xhpc.system.domain.SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/> <include refid="selectNoticeVo"/>
<where> <where>
<if test="noticeTitle != null and noticeTitle != ''"> <if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%') AND notice_title like concat('%', #{noticeTitle}, '%')
</if> </if>
<if test="noticeType != null and noticeType != ''"> <if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType} AND notice_type = #{noticeType}
</if> </if>
<if test="createBy != null and createBy != ''"> <if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%') AND create_by like concat('%', #{createBy}, '%')
</if> </if>
</where> </where>
</select> </select>
<insert id="insertNotice" parameterType="SysNotice"> <insert id="insertNotice" parameterType="com.xhpc.system.domain.SysNotice">
insert into sys_notice ( insert into sys_notice (
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if> <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
<if test="noticeType != null and noticeType != '' ">notice_type, </if> <if test="noticeType != null and noticeType != '' ">notice_type, </if>
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if> <if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
<if test="status != null and status != '' ">status, </if> <if test="status != null and status != '' ">status, </if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if> <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if> <if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if> <if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
<if test="status != null and status != ''">#{status}, </if> <if test="status != null and status != ''">#{status}, </if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )
</insert> </insert>
<update id="updateNotice" parameterType="SysNotice"> <update id="updateNotice" parameterType="com.xhpc.system.domain.SysNotice">
update sys_notice update sys_notice
<set> <set>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if> <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if> <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
<if test="noticeContent != null">notice_content = #{noticeContent}, </if> <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
<if test="status != null and status != ''">status = #{status}, </if> <if test="status != null and status != ''">status = #{status}, </if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where notice_id = #{noticeId} where notice_id = #{noticeId}
</update> </update>
<delete id="deleteNoticeById" parameterType="Long"> <delete id="deleteNoticeById" parameterType="Long">
delete from sys_notice where notice_id = #{noticeId} delete from sys_notice where notice_id = #{noticeId}
</delete> </delete>
<delete id="deleteNoticeByIds" parameterType="Long"> <delete id="deleteNoticeByIds" parameterType="Long">
delete from sys_notice where notice_id in delete from sys_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")"> <foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId} #{noticeId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -1,82 +1,82 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysOperLogMapper"> <mapper namespace="com.xhpc.system.mapper.SysOperLogMapper">
<resultMap type="SysOperLog" id="SysOperLogResult"> <resultMap type="com.xhpc.system.api.domain.SysOperLog" id="SysOperLogResult">
<id property="operId" column="oper_id"/> <id property="operId" column="oper_id"/>
<result property="title" column="title"/> <result property="title" column="title"/>
<result property="businessType" column="business_type"/> <result property="businessType" column="business_type"/>
<result property="method" column="method"/> <result property="method" column="method"/>
<result property="requestMethod" column="request_method"/> <result property="requestMethod" column="request_method"/>
<result property="operatorType" column="operator_type"/> <result property="operatorType" column="operator_type"/>
<result property="operName" column="oper_name"/> <result property="operName" column="oper_name"/>
<result property="deptName" column="dept_name"/> <result property="deptName" column="dept_name"/>
<result property="operUrl" column="oper_url" /> <result property="operUrl" column="oper_url" />
<result property="operIp" column="oper_ip" /> <result property="operIp" column="oper_ip" />
<result property="operParam" column="oper_param" /> <result property="operParam" column="oper_param" />
<result property="jsonResult" column="json_result" /> <result property="jsonResult" column="json_result" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="errorMsg" column="error_msg" /> <result property="errorMsg" column="error_msg" />
<result property="operTime" column="oper_time" /> <result property="operTime" column="oper_time" />
</resultMap> </resultMap>
<sql id="selectOperLogVo"> <sql id="selectOperLogVo">
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time
from sys_oper_log from sys_oper_log
</sql> </sql>
<insert id="insertOperlog" parameterType="SysOperLog"> <insert id="insertOperlog" parameterType="com.xhpc.system.api.domain.SysOperLog">
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time) insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate()) values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
</insert> </insert>
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult"> <select id="selectOperLogList" parameterType="com.xhpc.system.api.domain.SysOperLog" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/> <include refid="selectOperLogVo"/>
<where> <where>
<if test="title != null and title != ''"> <if test="title != null and title != ''">
AND title like concat('%', #{title}, '%') AND title like concat('%', #{title}, '%')
</if> </if>
<if test="businessType != null and businessType != ''"> <if test="businessType != null and businessType != ''">
AND business_type = #{businessType} AND business_type = #{businessType}
</if> </if>
<if test="businessTypes != null and businessTypes.length > 0"> <if test="businessTypes != null and businessTypes.length > 0">
AND business_type in AND business_type in
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")"> <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
#{businessType} #{businessType}
</foreach> </foreach>
</if> </if>
<if test="status != null"> <if test="status != null">
AND status = #{status} AND status = #{status}
</if> </if>
<if test="operName != null and operName != ''"> <if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%') AND oper_name like concat('%', #{operName}, '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if> </if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') and date_format(oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
</where> </where>
order by oper_id desc order by oper_id desc
</select> </select>
<delete id="deleteOperLogByIds" parameterType="Long"> <delete id="deleteOperLogByIds" parameterType="Long">
delete from sys_oper_log where oper_id in delete from sys_oper_log where oper_id in
<foreach collection="array" item="operId" open="(" separator="," close=")"> <foreach collection="array" item="operId" open="(" separator="," close=")">
#{operId} #{operId}
</foreach> </foreach>
</delete> </delete>
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult"> <select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/> <include refid="selectOperLogVo"/>
where oper_id = #{operId} where oper_id = #{operId}
</select> </select>
<update id="cleanOperLog"> <update id="cleanOperLog">
truncate table sys_oper_log truncate table sys_oper_log
</update> </update>
</mapper> </mapper>

View File

@ -1,36 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysRoleDeptMapper"> <mapper namespace="com.xhpc.system.mapper.SysRoleDeptMapper">
<resultMap type="SysRoleDept" id="SysRoleDeptResult"> <resultMap type="com.xhpc.system.domain.SysRoleDept" id="SysRoleDeptResult">
<result property="roleId" column="role_id"/> <result property="roleId" column="role_id"/>
<result property="deptId" column="dept_id"/> <result property="deptId" column="dept_id"/>
</resultMap> </resultMap>
<delete id="deleteRoleDeptByRoleId" parameterType="Long"> <delete id="deleteRoleDeptByRoleId" parameterType="Long">
delete delete
from sys_role_dept from sys_role_dept
where role_id = #{roleId} where role_id = #{roleId}
</delete> </delete>
<select id="selectCountRoleDeptByDeptId" resultType="Integer"> <select id="selectCountRoleDeptByDeptId" resultType="Integer">
select count(1) from sys_role_dept where dept_id=#{deptId} select count(1) from sys_role_dept where dept_id=#{deptId}
</select> </select>
<delete id="deleteRoleDept" parameterType="Long"> <delete id="deleteRoleDept" parameterType="Long">
delete from sys_role_dept where role_id in delete from sys_role_dept where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")"> <foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId} #{roleId}
</foreach> </foreach>
</delete> </delete>
<insert id="batchRoleDept"> <insert id="batchRoleDept">
insert into sys_role_dept(role_id, dept_id) values insert into sys_role_dept(role_id, dept_id) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.deptId}) (#{item.roleId},#{item.deptId})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>

View File

@ -1,162 +1,162 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysRoleMapper"> <mapper namespace="com.xhpc.system.mapper.SysRoleMapper">
<resultMap type="SysRole" id="SysRoleResult"> <resultMap type="com.xhpc.system.api.domain.SysRole" id="SysRoleResult">
<id property="roleId" column="role_id"/> <id property="roleId" column="role_id"/>
<result property="roleName" column="role_name"/> <result property="roleName" column="role_name"/>
<result property="roleKey" column="role_key"/> <result property="roleKey" column="role_key"/>
<result property="roleSort" column="role_sort"/> <result property="roleSort" column="role_sort"/>
<result property="dataScope" column="data_scope"/> <result property="dataScope" column="data_scope"/>
<result property="menuCheckStrictly" column="menu_check_strictly"/> <result property="menuCheckStrictly" column="menu_check_strictly"/>
<result property="deptCheckStrictly" column="dept_check_strictly"/> <result property="deptCheckStrictly" column="dept_check_strictly"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
</resultMap> </resultMap>
<sql id="selectRoleVo"> <sql id="selectRoleVo">
select distinct r.role_id, select distinct r.role_id,
r.role_name, r.role_name,
r.role_key, r.role_key,
r.role_sort, r.role_sort,
r.data_scope, r.data_scope,
r.menu_check_strictly, r.menu_check_strictly,
r.dept_check_strictly, r.dept_check_strictly,
r.status, r.status,
r.del_flag, r.del_flag,
r.create_time, r.create_time,
r.remark r.remark
from sys_role r from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
</sql> </sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult"> <select id="selectRoleList" parameterType="com.xhpc.system.api.domain.SysRole" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.del_flag = '0' where r.del_flag = '0'
<if test="roleName != null and roleName != ''"> <if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%') AND r.role_name like concat('%', #{roleName}, '%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND r.status = #{status} AND r.status = #{status}
</if> </if>
<if test="roleKey != null and roleKey != ''"> <if test="roleKey != null and roleKey != ''">
AND r.role_key like concat('%', #{roleKey}, '%') AND r.role_key like concat('%', #{roleKey}, '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if> </if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
order by r.role_sort order by r.role_sort
</select> </select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult"> <select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId} WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select> </select>
<select id="selectRoleAll" resultMap="SysRoleResult"> <select id="selectRoleAll" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
</select> </select>
<select id="selectRoleListByUserId" parameterType="Long" resultType="Integer"> <select id="selectRoleListByUserId" parameterType="Long" resultType="Integer">
select r.role_id select r.role_id
from sys_role r from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id left join sys_user u on u.user_id = ur.user_id
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult"> <select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_id = #{roleId} where r.role_id = #{roleId}
</select> </select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult"> <select id="selectRolesByUserName" parameterType="java.lang.String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName} WHERE r.del_flag = '0' and u.user_name = #{userName}
</select> </select>
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult"> <select id="checkRoleNameUnique" parameterType="java.lang.String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_name=#{roleName} limit 1 where r.role_name=#{roleName} limit 1
</select> </select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult"> <select id="checkRoleKeyUnique" parameterType="java.lang.String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_key=#{roleKey} limit 1 where r.role_key=#{roleKey} limit 1
</select> </select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId"> <insert id="insertRole" parameterType="com.xhpc.system.api.domain.SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role( insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if> <if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if> <if test="roleName != null and roleName != ''">role_name,</if>
<if test="roleKey != null and roleKey != ''">role_key,</if> <if test="roleKey != null and roleKey != ''">role_key,</if>
<if test="roleSort != null and roleSort != ''">role_sort,</if> <if test="roleSort != null and roleSort != ''">role_sort,</if>
<if test="dataScope != null and dataScope != ''">data_scope,</if> <if test="dataScope != null and dataScope != ''">data_scope,</if>
<if test="menuCheckStrictly != null">menu_check_strictly,</if> <if test="menuCheckStrictly != null">menu_check_strictly,</if>
<if test="deptCheckStrictly != null">dept_check_strictly,</if> <if test="deptCheckStrictly != null">dept_check_strictly,</if>
<if test="status != null and status != ''">status,</if> <if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="roleId != null and roleId != 0">#{roleId},</if> <if test="roleId != null and roleId != 0">#{roleId},</if>
<if test="roleName != null and roleName != ''">#{roleName},</if> <if test="roleName != null and roleName != ''">#{roleName},</if>
<if test="roleKey != null and roleKey != ''">#{roleKey},</if> <if test="roleKey != null and roleKey != ''">#{roleKey},</if>
<if test="roleSort != null and roleSort != ''">#{roleSort},</if> <if test="roleSort != null and roleSort != ''">#{roleSort},</if>
<if test="dataScope != null and dataScope != ''">#{dataScope},</if> <if test="dataScope != null and dataScope != ''">#{dataScope},</if>
<if test="menuCheckStrictly != null">#{menuCheckStrictly},</if> <if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">#{deptCheckStrictly},</if> <if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
<if test="status != null and status != ''">#{status},</if> <if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )
</insert> </insert>
<update id="updateRole" parameterType="SysRole"> <update id="updateRole" parameterType="com.xhpc.system.api.domain.SysRole">
update sys_role update sys_role
<set> <set>
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if> <if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if> <if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
<if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if> <if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if>
<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if> <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
<if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if> <if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if> <if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where role_id = #{roleId} where role_id = #{roleId}
</update> </update>
<delete id="deleteRoleById" parameterType="Long"> <delete id="deleteRoleById" parameterType="Long">
update sys_role set del_flag = '2' where role_id = #{roleId} update sys_role set del_flag = '2' where role_id = #{roleId}
</delete> </delete>
<delete id="deleteRoleByIds" parameterType="Long"> <delete id="deleteRoleByIds" parameterType="Long">
update sys_role set del_flag = '2' where role_id in update sys_role set del_flag = '2' where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")"> <foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId} #{roleId}
</foreach> </foreach>
</delete> </delete>
<select id="getRoleByUserID" parameterType="Long" resultMap="SysRoleResult"> <select id="getRoleByUserID" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
where r.role_key=#{roleKey} ORDER BY r.update_time DESC limit 1 where r.role_key=#{roleKey} ORDER BY r.update_time DESC limit 1
</select> </select>
</mapper> </mapper>

View File

@ -1,36 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysRoleMenuMapper"> <mapper namespace="com.xhpc.system.mapper.SysRoleMenuMapper">
<resultMap type="SysRoleMenu" id="SysRoleMenuResult"> <resultMap type="com.xhpc.system.domain.SysRoleMenu" id="SysRoleMenuResult">
<result property="roleId" column="role_id"/> <result property="roleId" column="role_id"/>
<result property="menuId" column="menu_id"/> <result property="menuId" column="menu_id"/>
</resultMap> </resultMap>
<select id="checkMenuExistRole" resultType="Integer"> <select id="checkMenuExistRole" resultType="Integer">
select count(1) select count(1)
from sys_role_menu from sys_role_menu
where menu_id = #{menuId} where menu_id = #{menuId}
</select> </select>
<delete id="deleteRoleMenuByRoleId" parameterType="Long"> <delete id="deleteRoleMenuByRoleId" parameterType="Long">
delete from sys_role_menu where role_id=#{roleId} delete from sys_role_menu where role_id=#{roleId}
</delete> </delete>
<delete id="deleteRoleMenu" parameterType="Long"> <delete id="deleteRoleMenu" parameterType="Long">
delete from sys_role_menu where role_id in delete from sys_role_menu where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")"> <foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId} #{roleId}
</foreach> </foreach>
</delete> </delete>
<insert id="batchRoleMenu"> <insert id="batchRoleMenu">
insert into sys_role_menu(role_id, menu_id) values insert into sys_role_menu(role_id, menu_id) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.menuId}) (#{item.roleId},#{item.menuId})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>

View File

@ -31,7 +31,7 @@
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
</resultMap> </resultMap>
<resultMap id="deptResult" type="SysDept"> <resultMap id="deptResult" type="com.xhpc.system.api.domain.SysDept">
<id property="deptId" column="dept_id"/> <id property="deptId" column="dept_id"/>
<result property="parentId" column="parent_id"/> <result property="parentId" column="parent_id"/>
<result property="deptName" column="dept_name"/> <result property="deptName" column="dept_name"/>
@ -40,7 +40,7 @@
<result property="status" column="dept_status"/> <result property="status" column="dept_status"/>
</resultMap> </resultMap>
<resultMap id="RoleResult" type="SysRole"> <resultMap id="RoleResult" type="com.xhpc.system.api.domain.SysRole">
<id property="roleId" column="role_id"/> <id property="roleId" column="role_id"/>
<result property="roleName" column="role_name"/> <result property="roleName" column="role_name"/>
<result property="roleKey" column="role_key"/> <result property="roleKey" column="role_key"/>
@ -59,7 +59,7 @@
left join sys_role r on r.role_id = ur.role_id left join sys_role r on r.role_id = ur.role_id
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserList" parameterType="com.xhpc.system.api.domain.SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from
sys_user u sys_user u
@ -88,7 +88,7 @@
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectAllocatedList" parameterType="com.xhpc.system.api.domain.SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
@ -105,7 +105,7 @@
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUnallocatedList" parameterType="com.xhpc.system.api.domain.SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
@ -124,7 +124,7 @@
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> <select id="selectUserByUserName" parameterType="java.lang.String" resultMap="SysUserResult">
<include refid="selectUserVo"/> <include refid="selectUserVo"/>
where u.user_name = #{userName} where u.user_name = #{userName}
</select> </select>
@ -134,19 +134,19 @@
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="checkUserNameUnique" parameterType="String" resultType="int"> <select id="checkUserNameUnique" parameterType="java.lang.String" resultType="int">
select count(1) from sys_user where user_name = #{userName} limit 1 select count(1) from sys_user where user_name = #{userName} limit 1
</select> </select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> <select id="checkPhoneUnique" parameterType="java.lang.String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1 select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
</select> </select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> <select id="checkEmailUnique" parameterType="java.lang.String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} limit 1 select user_id, email from sys_user where email = #{email} limit 1
</select> </select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> <insert id="insertUser" parameterType="com.xhpc.system.api.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user( insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if> <if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
@ -184,7 +184,7 @@
) )
</insert> </insert>
<update id="updateUser" parameterType="SysUser"> <update id="updateUser" parameterType="com.xhpc.system.api.domain.SysUser">
update sys_user update sys_user
<set> <set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if> <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
@ -208,15 +208,15 @@
where user_id = #{userId} where user_id = #{userId}
</update> </update>
<update id="updateUserStatus" parameterType="SysUser"> <update id="updateUserStatus" parameterType="com.xhpc.system.api.domain.SysUser">
update sys_user set status = #{status} where user_id = #{userId} update sys_user set status = #{status} where user_id = #{userId}
</update> </update>
<update id="updateUserAvatar" parameterType="SysUser"> <update id="updateUserAvatar" parameterType="com.xhpc.system.api.domain.SysUser">
update sys_user set avatar = #{avatar} where user_name = #{userName} update sys_user set avatar = #{avatar} where user_name = #{userName}
</update> </update>
<update id="resetUserPwd" parameterType="SysUser"> <update id="resetUserPwd" parameterType="com.xhpc.system.api.domain.SysUser">
update sys_user set password = #{password} where user_name = #{userName} update sys_user set password = #{password} where user_name = #{userName}
</update> </update>

View File

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysUserPostMapper"> <mapper namespace="com.xhpc.system.mapper.SysUserPostMapper">
<resultMap type="SysUserPost" id="SysUserPostResult"> <resultMap type="com.xhpc.system.domain.SysUserPost" id="SysUserPostResult">
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
<result property="postId" column="post_id"/> <result property="postId" column="post_id"/>
</resultMap> </resultMap>
<delete id="deleteUserPostByUserId" parameterType="Long"> <delete id="deleteUserPostByUserId" parameterType="Long">
delete delete
from sys_user_post from sys_user_post
where user_id = #{userId} where user_id = #{userId}
</delete> </delete>
<select id="countUserPostById" resultType="Integer"> <select id="countUserPostById" resultType="Integer">
select count(1) select count(1)
from sys_user_post from sys_user_post
where post_id = #{postId} where post_id = #{postId}
</select> </select>
<delete id="deleteUserPost" parameterType="Long"> <delete id="deleteUserPost" parameterType="Long">
delete from sys_user_post where user_id in delete from sys_user_post where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")"> <foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId} #{userId}
</foreach> </foreach>
</delete> </delete>
<insert id="batchUserPost"> <insert id="batchUserPost">
insert into sys_user_post(user_id, post_id) values insert into sys_user_post(user_id, post_id) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.postId}) (#{item.userId},#{item.postId})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>

View File

@ -1,51 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.SysUserRoleMapper"> <mapper namespace="com.xhpc.system.mapper.SysUserRoleMapper">
<resultMap type="SysUserRole" id="SysUserRoleResult"> <resultMap type="com.xhpc.system.domain.SysUserRole" id="SysUserRoleResult">
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
<result property="roleId" column="role_id"/> <result property="roleId" column="role_id"/>
</resultMap> </resultMap>
<delete id="deleteUserRoleByUserId" parameterType="Long"> <delete id="deleteUserRoleByUserId" parameterType="Long">
delete delete
from sys_user_role from sys_user_role
where user_id = #{userId} where user_id = #{userId}
</delete> </delete>
<select id="countUserRoleByRoleId" resultType="Integer"> <select id="countUserRoleByRoleId" resultType="Integer">
select count(1) select count(1)
from sys_user_role from sys_user_role
where role_id = #{roleId} where role_id = #{roleId}
</select> </select>
<delete id="deleteUserRole" parameterType="Long"> <delete id="deleteUserRole" parameterType="Long">
delete from sys_user_role where user_id in delete from sys_user_role where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")"> <foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId} #{userId}
</foreach> </foreach>
</delete> </delete>
<insert id="batchUserRole"> <insert id="batchUserRole">
insert into sys_user_role(user_id, role_id) values insert into sys_user_role(user_id, role_id) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.roleId}) (#{item.userId},#{item.roleId})
</foreach> </foreach>
</insert> </insert>
<delete id="deleteUserRoleInfo" parameterType="SysUserRole"> <delete id="deleteUserRoleInfo" parameterType="com.xhpc.system.domain.SysUserRole">
delete delete
from sys_user_role from sys_user_role
where user_id = #{userId} where user_id = #{userId}
and role_id = #{roleId} and role_id = #{roleId}
</delete> </delete>
<delete id="deleteUserRoleInfos"> <delete id="deleteUserRoleInfos">
delete from sys_user_role where role_id=#{roleId} and user_id in delete from sys_user_role where role_id=#{roleId} and user_id in
<foreach collection="userIds" item="userId" open="(" separator="," close=")"> <foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId} #{userId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -4,13 +4,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.system.mapper.XhpcUserPrivilegeMapper"> <mapper namespace="com.xhpc.system.mapper.XhpcUserPrivilegeMapper">
<resultMap type="XhpcUserPrivilege" id="XhpcUserPrivilegeResult"> <resultMap type="com.xhpc.system.domain.XhpcUserPrivilege" id="XhpcUserPrivilegeResult">
<result column="user_id" property="userId"/> <result column="user_id" property="userId"/>
<result column="charging_station_id" property="chargingStationId"/> <result column="charging_station_id" property="chargingStationId"/>
</resultMap> </resultMap>
<insert id="insert" parameterType="XhpcUserPrivilege"> <insert id="insert" parameterType="com.xhpc.system.domain.XhpcUserPrivilege">
insert into xhpc_user_privilege( insert into xhpc_user_privilege(
<if test="null != userId and '' != userId"> <if test="null != userId and '' != userId">
user_id, user_id,
@ -36,7 +36,7 @@
select charging_station_id chargingStationId from xhpc_user_privilege where user_id = #{userId} select charging_station_id chargingStationId from xhpc_user_privilege where user_id = #{userId}
</select> </select>
<select id="getOperatorId" parameterType="String" resultType="java.util.Map"> <select id="getOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
select xo.operator_id operatorId, xo.name, xo.contact_name contactName, select xo.operator_id operatorId, xo.name, xo.contact_name contactName,
xo.contact_phone contactPhone, xo.phone, xo.attribute, xo.contact_phone contactPhone, xo.phone, xo.attribute,
xdb.dict_value attributenName xdb.dict_value attributenName
@ -52,7 +52,7 @@
ORDER BY xo.create_time DESC ORDER BY xo.create_time DESC
</select> </select>
<select id="getOperatorIdByUserId" parameterType="String" resultType="java.util.Map"> <select id="getOperatorIdByUserId" parameterType="java.lang.String" resultType="java.util.Map">
select xo.operator_id operatorId, xo.name, xo.contact_name contactName, select xo.operator_id operatorId, xo.name, xo.contact_name contactName,
xo.contact_phone contactPhone, xo.phone, xo.attribute, xo.contact_phone contactPhone, xo.phone, xo.attribute,
xdb.dict_value attributenName xdb.dict_value attributenName
@ -70,7 +70,7 @@
ORDER BY xo.create_time DESC ORDER BY xo.create_time DESC
</select> </select>
<select id="groupProvinceByOperatorId" parameterType="String" resultType="java.util.Map"> <select id="groupProvinceByOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
select `code` ,`name` from xhpc_area where `code` in ( select `code` ,`name` from xhpc_area where `code` in (
select `pxa`.pcode province select `pxa`.pcode province
from xhpc_charging_station xcs from xhpc_charging_station xcs
@ -88,7 +88,7 @@
) )
</select> </select>
<select id="groupCityByOperatorId" parameterType="String" resultType="java.util.Map"> <select id="groupCityByOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
select `code` ,`name` from xhpc_area where `code` in ( select `code` ,`name` from xhpc_area where `code` in (
select `pxa`.code city select `pxa`.code city
from xhpc_charging_station xcs from xhpc_charging_station xcs
@ -109,7 +109,7 @@
) )
</select> </select>
<select id="groupAreaByOperatorId" parameterType="String" resultType="java.util.Map"> <select id="groupAreaByOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
select `code` ,`name` from xhpc_area where `code` in ( select `code` ,`name` from xhpc_area where `code` in (
select `xa`.code select `xa`.code
from xhpc_charging_station xcs from xhpc_charging_station xcs
@ -130,7 +130,7 @@
) )
</select> </select>
<select id="dataPowerByOperatorId" parameterType="String" resultType="java.util.Map"> <select id="dataPowerByOperatorId" parameterType="java.lang.String" resultType="java.util.Map">
select xcs.charging_station_id chargingStationId,xcs.name select xcs.charging_station_id chargingStationId,xcs.name
from xhpc_charging_station xcs from xhpc_charging_station xcs