测试环境配置及带租房的登录功能

This commit is contained in:
2026-07-06 09:28:20 +08:00
parent 7c319a80a4
commit c43915105c
40 changed files with 1975 additions and 468 deletions

View File

@@ -0,0 +1,149 @@
<?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.zf.foodpurchase.system.mapper.SysTenantMapper">
<sql id="selectSysTenantVo">
select id,tenant_id tenantId,contact_user_name contactUserName,contact_phone contactPhone,company_name companyName,license_number licenseNumber,
address,intro,domain,remark,status,
package_id packageId,expire_time expireTime,account_count accountCount,del_flag delFlag,create_dept createDept,create_by createBy,
create_time createTime,update_by updateBy,update_time updateTime from sys_tenant
</sql>
<select id="queryById" resultType="SysTenantVo">
select id,st.tenant_id tenantId,contact_user_name contactUserName,contact_phone contactPhone,company_name companyName,license_number licenseNumber,
address,intro,domain,remark,st.status,st.create_dept deptId,
package_id packageId,expire_time expireTime,account_count accountCount,st.del_flag delFlag,create_dept createDept,st.create_by createBy,
st.create_time createTime,st.update_by updateBy,st.update_time updateTime from sys_tenant st
WHERE st.del_flag = '0' and st.id = #{id}
</select>
<select id="queryByCondition" parameterType="SysTenantBo" resultType="SysTenantVo">
<include refid="selectSysTenantVo"/>
where del_flag = '0'
<if test="tenantId != null and tenantId != ''">
AND tenant_id like concat('%', #{tenantId}, '%')
</if>
<if test="contactUserName != null and contactUserName != ''">
AND contact_user_name like concat('%', #{contactUserName}, '%')
</if>
<if test="contactPhone != null and contactPhone != ''">
AND contact_phone like concat('%', #{contactPhone}, '%')
</if>
<if test="companyName != null and companyName != ''">
AND company_name like concat('%', #{companyName}, '%')
</if>
order by create_time desc
</select>
<select id="queryByCompanyName" parameterType="String" resultType="SysTenantVo">
<include refid="selectSysTenantVo"/>
where del_flag = '0' AND company_name = #{companyName}
order by create_time desc
</select>
<select id="queryByPhone" parameterType="String" resultType="SysTenantVo">
<include refid="selectSysTenantVo"/>
where del_flag = '0' AND contact_phone = #{phone}
order by create_time desc
</select>
<select id="queryByTenantId" parameterType="String" resultType="SysTenantVo">
<include refid="selectSysTenantVo"/>
where del_flag = '0' AND tenant_id = #{tenantId}
</select>
<select id="queryByTenantIds" parameterType="String" resultType="SysTenantVo">
<include refid="selectSysTenantVo"/>
where del_flag = '0' AND tenant_id in
<foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")">
#{tenantId}
</foreach>
</select>
<delete id="deleteByIds" parameterType="Long">
update sys_tenant set del_flag = '1' where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateById" parameterType="SysTenant">
update sys_tenant
<set>
<if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
<if test="contactUserName != null and contactUserName != ''">contact_user_name = #{contactUserName},</if>
<if test="contactPhone != null and contactPhone != ''">contact_phone = #{contactPhone},</if>
<if test="expireTime != null">expire_time = #{expireTime},</if>
<if test="accountCount != null">account_count = #{accountCount},</if>
<if test="domain != null and domain != ''">domain = #{domain},</if>
<if test="address != null and address != ''">address = #{address},</if>
<if test="licenseNumber != null">license_number = #{licenseNumber},</if>
<if test="intro != null and intro != ''">intro = #{intro},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="createDept != null and createDept != ''">create_dept = #{createDept},</if>
<if test="packageId != null">package_id = #{packageId},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<insert id="insert" parameterType="SysTenant">
INSERT INTO sys_tenant
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tenantId != null">tenant_id,</if>
<if test="contactUserName != null">contact_user_name,</if>
<if test="contactPhone != null">contact_phone,</if>
<if test="companyName != null">company_name,</if>
<if test="licenseNumber != null">license_number,</if>
<if test="address != null">address,</if>
<if test="intro != null">intro,</if>
<if test="domain != null">domain,</if>
<if test="remark != null">remark,</if>
<if test="packageId != null">package_id,</if>
<if test="expireTime != null">expire_time,</if>
<if test="accountCount != null">account_count,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createDept != null">create_dept,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="tenantId != null">#{tenantId},</if>
<if test="contactUserName != null">#{contactUserName},</if>
<if test="contactPhone != null">#{contactPhone},</if>
<if test="companyName != null">#{companyName},</if>
<if test="licenseNumber != null">#{licenseNumber},</if>
<if test="address != null">#{address},</if>
<if test="intro != null">#{intro},</if>
<if test="domain != null">#{domain},</if>
<if test="remark != null">#{remark},</if>
<if test="packageId != null">#{packageId},</if>
<if test="expireTime != null">#{expireTime},</if>
<if test="accountCount != null">#{accountCount},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createDept != null">#{createDept},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<select id="selectObjs" resultType="String">
select tenant_id tenantId from sys_tenant where del_flag = '0'
</select>
<select id="queryByPackageIds" resultType="SysTenantVo">
<include refid="selectSysTenantVo"/>
WHERE del_flag = '0' and package_id in
<foreach collection="packageIds" item="packageId" open="(" separator="," close=")">
#{packageId}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zf.foodpurchase.system.mapper.SysTenantPackageMapper">
<sql id="selectSysTenantVo">
select package_id packageId,package_name packageName,menu_ids menuIds,remark,
menu_check_strictly menuCheckStrictly,status,del_flag delFlag,create_dept createDept,create_by createBy,create_time createTime,
update_by updateBy,update_time updateTime from sys_tenant_package
</sql>
<select id="selectById" resultType="SysTenantPackageVo">
<include refid="selectSysTenantVo"/>
where package_id=#{packageId} and del_flag = '0' limit 1
</select>
<select id="selectList" parameterType="SysTenantPackageBo" resultType="SysTenantPackageVo">
<include refid="selectSysTenantVo"/>
where del_flag = '0'
<if test="packageName != null">
AND package_name like concat('%',#{packageName},'%')
</if>
</select>
<delete id="deleteByIds" parameterType="Long">
update sys_tenant_package set del_flag = '1' where package_id in
<foreach collection="packageIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="update" parameterType="SysTenantPackage">
update sys_tenant_package
<trim prefix="SET" suffixOverrides=",">
<if test="packageName != null">package_name = #{packageName},</if>
<if test="menuIds != null">menu_ids = #{menuIds},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createDept != null">create_dept = #{createDept},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
WHERE package_id = #{packageId}
</update>
<insert id="insert" parameterType="SysTenantPackage">
INSERT INTO sys_tenant_package
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="packageName != null">package_name,</if>
<if test="menuIds != null">menu_ids,</if>
<if test="remark != null">remark,</if>
<if test="menuCheckStrictly != null">menu_check_strictly,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createDept != null">create_dept,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="packageName != null">#{packageName},</if>
<if test="menuIds != null">#{menuIds},</if>
<if test="remark != null">#{remark},</if>
<if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createDept != null">#{createDept},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
</mapper>

View File

@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SysRole" id="SysRoleResult">
<id property="roleId" column="role_id" />
<id property="tenantId" column="tenant_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
@@ -148,5 +149,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{roleId}
</foreach>
</delete>
<select id="selectRolesByTenantId" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.tenant_id = #{tenantId}
</select>
</mapper>

View File

@@ -30,5 +30,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{item.roleId},#{item.menuId})
</foreach>
</insert>
<delete id="deleteRoleMenuForSync" parameterType="Long">
delete from sys_role_menu where role_id in
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
<if test="menuIds != null and menuIds.size() > 0">
and menu_id not in
<foreach collection="menuIds" item="menuId" open="(" separator="," close=")">
#{menuId}
</foreach>
</if>
</delete>
</mapper>

View File

@@ -6,7 +6,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SysUser" id="SysUserResult">
<id property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="organiId" column="organi_id" />
<result property="tenantId" column="tenant_id" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
@@ -32,6 +34,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="tenantId" column="tenant_id" />
<result property="isTenant" column="is_tenant" />
<result property="deptName" column="dept_name" />
<result property="ancestors" column="ancestors" />
<result property="orderNum" column="order_num" />
@@ -41,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" />
<result property="tenantId" column="tenant_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
@@ -226,4 +231,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<update id="unableUser" parameterType="SysUser">
update sys_user set status = #{statusChar} where user_id in
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</update>
<select id="selectUserIdsByTenantId" resultType="Long">
select distinct user_id from sys_user
where tenant_id = #{tenantId}
</select>
<update id="updateTenantIdOfUsers">
<if test="deptIds != null and deptIds.size() > 0">
update sys_user set tenant_id = #{tenantId} where dept_id in
<foreach collection="deptIds" item="deptId" open="(" close=")" separator=",">
#{deptId}
</foreach>
</if>
</update>
<select id="selectUserByUserNameAndTenantId" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.del_flag = '0' and (u.status is not null or u.status =0) and u.user_name = #{userName} and u.tenant_id = #{tenantId}
</select>
</mapper>

View File

@@ -7,6 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SysDept" id="SysDeptResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="tenantId" column="tenant_id" />
<result property="isTenant" column="is_tenant" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
@@ -177,4 +179,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
<update id="updateDeptByTenantId">
update sys_dept
<set>
<if test="dept.parentId != null and dept.parentId != 0">parent_id = #{dept.parentId},</if>
<if test="dept.deptName != null and dept.deptName != ''">dept_name = #{dept.deptName},</if>
<if test="dept.ancestors != null and dept.ancestors != ''">ancestors = #{dept.ancestors},</if>
<if test="dept.orderNum != null">order_num = #{dept.orderNum},</if>
<if test="dept.leader != null">leader = #{dept.leader},</if>
<if test="dept.phone != null">phone = #{dept.phone},</if>
<if test="dept.email != null">email = #{dept.email},</if>
<if test="dept.status != null and dept.status != ''">status = #{dept.status},</if>
<if test="dept.updateBy != null and dept.updateBy != ''">update_by = #{dept.updateBy},</if>
<if test="dept.isTenant != null and dept.isTenant != ''">is_tenant = #{dept.isTenant},</if>
update_time = sysdate()
</set>
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</update>
<select id="selectByTenantId" parameterType="String" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0' and d.tenant_id = #{tenantId}
</select>
<select id="selectAllZSByDeptId" parameterType="Long" resultType="long">
select dept_id
from sys_dept
where find_in_set(#{deptId}, ancestors)
</select>
<update id="updateTenantId">
<if test="deptIds != null and deptIds.size() > 0">
update sys_dept
set tenant_id = #{tenantId}
where dept_id in
<foreach collection="deptIds" item="deptId" index="index"
separator="," open="(" close=")">
#{deptId}
</foreach>
</if>
</update>
</mapper>