feat(scenic-account): 添加景区账号激活/停用功能并优化登录验证

- 新增激活/停用景区账号的接口和相关逻辑
- 在登录时增加账号激活状态的验证
- 更新数据库表结构,添加 isActive 字段
- 优化 MyBatis 映射文件,支持新功能
This commit is contained in:
2025-08-28 11:12:37 +08:00
parent e694aac928
commit ce7e055ada
8 changed files with 38 additions and 5 deletions

View File

@@ -2,8 +2,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.ScenicAccountMapper">
<insert id="add">
insert into scenic_account(id, is_super, name, phone, account, password, create_time, update_time)
values (#{id}, #{isSuper}, #{name}, #{phone}, #{account}, #{password}, now(), now())
insert into scenic_account(id, is_super, name, phone, account, password, is_active, create_time, update_time)
values (#{id}, #{isSuper}, #{name}, #{phone}, #{account}, #{password}, #{isActive}, now(), now())
</insert>
<insert id="addAccountScenicRelation">
insert into account_scenic(account_id, scenic_id, is_admin)
@@ -24,6 +24,9 @@
<if test="password != null and password != ''">
password = #{password},
</if>
<if test="isActive != null">
is_active = #{isActive},
</if>
update_time = now()
</set>
where id = #{id}
@@ -39,6 +42,17 @@
END)
where id = #{id}
</update>
<update id="updateActiveStatus">
update scenic_account
set is_active = (CASE
WHEN is_active = 1 THEN
0
WHEN is_active = 0 THEN
1
ELSE 1
END)
where id = #{id}
</update>
<delete id="deleteById">
delete from scenic_account where id = #{id}
</delete>
@@ -53,12 +67,12 @@
</delete>
<select id="getSuperAccountOfScenic"
resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity">
select a.id, b.scenic_id, b.is_admin as isSuper, a.name, a.phone, a.account, a.password, a.create_time, a.update_time
select a.id, b.scenic_id, b.is_admin as isSuper, a.name, a.phone, a.account, a.password, a.status, a.is_active, a.create_time, a.update_time
from scenic_account a left join account_scenic b on a.id = b.account_id
where b.scenic_id = #{scenicId} and b.is_admin = 1
</select>
<select id="getByAccount" resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity">
select id, scenic_id, is_super, name, phone, account, password, status,create_time, update_time
select id, scenic_id, is_super, name, phone, account, password, status, is_active, create_time, update_time
from scenic_account
where account = #{account}
</select>