You've already forked FrameTour-BE
Init
This commit is contained in:
103
src/main/resources/mapper/pc/AdminUserMapper.xml
Normal file
103
src/main/resources/mapper/pc/AdminUserMapper.xml
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ycwl.basic.mapper.pc.AdminUserMapper">
|
||||
<insert id="add" parameterType="com.ycwl.basic.model.pc.adminUser.req.AddOrUpdateAdminUserReqVO">
|
||||
insert into admin_user(`id`,
|
||||
`role_id`,
|
||||
`staff_id`,
|
||||
`account`,
|
||||
`password`)
|
||||
values (#{id},
|
||||
#{roleId},
|
||||
#{staffId},
|
||||
#{account},
|
||||
#{password})
|
||||
</insert>
|
||||
<update id="delete">
|
||||
update
|
||||
admin_user
|
||||
set is_remove=1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="resetPassword" parameterType="com.ycwl.basic.model.pc.adminUser.req.ResetPasswordReqVO">
|
||||
update
|
||||
admin_user
|
||||
set password=#{password}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="update" parameterType="com.ycwl.basic.model.pc.adminUser.req.AddOrUpdateAdminUserReqVO">
|
||||
update admin_user
|
||||
set `role_id` =#{roleId},
|
||||
`staff_id` =#{staffId}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updatePassword">
|
||||
update
|
||||
admin_user
|
||||
set password=#{newPwd}
|
||||
where staff_id = #{id}
|
||||
and is_remove = 0
|
||||
</update>
|
||||
|
||||
<select id="list" parameterType="com.ycwl.basic.model.pc.adminUser.req.AdminUserListReqVO"
|
||||
resultType="com.ycwl.basic.model.pc.adminUser.resp.AdminUserListRespVO">
|
||||
select
|
||||
s.id as staffId,
|
||||
au.id,
|
||||
s.phone,
|
||||
s.name as staffName,
|
||||
s.job_no,
|
||||
c.name as companyName,
|
||||
s.company_id,
|
||||
r.id as roleId,
|
||||
r.name as roleName
|
||||
from admin_user au,
|
||||
staff s,
|
||||
company c,
|
||||
role r
|
||||
where au.staff_id = s.id
|
||||
and au.is_remove=0
|
||||
and au.role_id = r.id
|
||||
and s.company_id = c.id
|
||||
and s.is_remove=0
|
||||
<if test="name!=null and name!=''">
|
||||
and
|
||||
locate(#{name},s.`name`) > 0
|
||||
</if>
|
||||
<if test="phone!=null and phone!=''">
|
||||
and
|
||||
locate(#{phone},s.`phone`) > 0
|
||||
</if>
|
||||
<if test="jobNo!=null and jobNo!=''">
|
||||
and
|
||||
locate(#{jobNo},s.`job_no`) > 0
|
||||
</if>
|
||||
<if test="roleId!=null and roleId!=''">
|
||||
and
|
||||
r.id=#{roleId}
|
||||
</if>
|
||||
<if test="companyId!=null and companyId!=''">
|
||||
and
|
||||
s.company_id=#{companyId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="login" resultType="com.ycwl.basic.model.pc.adminUser.entity.LoginEntity">
|
||||
select
|
||||
au.account,
|
||||
au.password,
|
||||
au.role_id
|
||||
from admin_user au
|
||||
where account = #{account}
|
||||
and au.is_remove = 0
|
||||
</select>
|
||||
|
||||
<select id="getPasswordByAccount" resultType="java.lang.String">
|
||||
select `password`
|
||||
from admin_user
|
||||
where staff_id = #{id}
|
||||
and is_remove = 0
|
||||
</select>
|
||||
</mapper>
|
31
src/main/resources/mapper/pc/MenuMapper.xml
Normal file
31
src/main/resources/mapper/pc/MenuMapper.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ycwl.basic.mapper.pc.MenuMapper">
|
||||
<insert id="addRoleMenu">
|
||||
insert into role_menu(`role_id`, `menu_id`)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{id},#{item})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="delete">
|
||||
delete
|
||||
from role_menu
|
||||
where role_id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getListByType" resultType="com.ycwl.basic.model.pc.menu.MenuNode">
|
||||
select id,
|
||||
parent_id,
|
||||
target,
|
||||
`name`,
|
||||
`type`,
|
||||
sort
|
||||
from menu
|
||||
where is_remove = 0
|
||||
and business_type = #{type}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
80
src/main/resources/mapper/pc/RoleMapper.xml
Normal file
80
src/main/resources/mapper/pc/RoleMapper.xml
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ycwl.basic.mapper.pc.RoleMapper">
|
||||
<insert id="add" parameterType="com.ycwl.basic.model.pc.role.req.AddOrUpdateRoleReqVO">
|
||||
insert into role(`id`, `name`, `type`)
|
||||
values (#{id}, #{name}, #{type})
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
update
|
||||
role
|
||||
set is_remove=1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="update" parameterType="com.ycwl.basic.model.pc.role.req.AddOrUpdateRoleReqVO">
|
||||
update
|
||||
role
|
||||
set `name`=#{name}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="list" resultType="com.ycwl.basic.model.pc.role.resp.RoleListRespVO">
|
||||
select
|
||||
`id`,
|
||||
`name`,
|
||||
`status`,
|
||||
create_time
|
||||
from
|
||||
role
|
||||
where
|
||||
is_remove=0
|
||||
and
|
||||
`type`=#{type}
|
||||
<if test="name!=null and name!=''">
|
||||
and
|
||||
locate(#{name},`name`) > 0
|
||||
</if>
|
||||
</select>
|
||||
<select id="getMenuById" resultType="com.ycwl.basic.model.pc.menu.MenuNode">
|
||||
select m.`id`,
|
||||
m.`parent_id`,
|
||||
m.`target`,
|
||||
m.`name`,
|
||||
m.`type`,
|
||||
m.`sort`
|
||||
from menu m,
|
||||
role_menu rm
|
||||
where is_remove = 0
|
||||
and business_type = 0
|
||||
and rm.menu_id = m.id
|
||||
and rm.role_id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getRoleStatus" resultType="java.lang.Integer">
|
||||
select
|
||||
`status`
|
||||
from
|
||||
role
|
||||
where
|
||||
id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateStatus">
|
||||
update
|
||||
role
|
||||
set status =
|
||||
(CASE
|
||||
status
|
||||
WHEN 1 THEN
|
||||
0
|
||||
WHEN 0 THEN
|
||||
1
|
||||
ELSE null
|
||||
END)
|
||||
where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
Reference in New Issue
Block a user