添加Swagger/OpenAPI依赖并更新用户账户管理相关的API文档注释,优化用户和管理员账户控制器的接口描述,移除不必要的字段和参数,调整数据库映射以简化用户账户管理逻辑。
This commit is contained in:
67
src/main/resources/mapper/admin/AnnouncementMapper.xml
Normal file
67
src/main/resources/mapper/admin/AnnouncementMapper.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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.gameplatform.server.mapper.admin.AnnouncementMapper">
|
||||
<resultMap id="AnnouncementMap" type="com.gameplatform.server.model.entity.admin.Announcement">
|
||||
<id property="id" column="id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="content" column="content" />
|
||||
<result property="enabled" column="enabled" />
|
||||
<result property="jumpUrl" column="jump_url" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="AnnouncementMap">
|
||||
SELECT id, title, content, enabled, jump_url, created_at, updated_at
|
||||
FROM announcement
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.gameplatform.server.model.entity.admin.Announcement" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO announcement (title, content, enabled, jump_url)
|
||||
VALUES (#{title}, #{content}, #{enabled}, #{jumpUrl})
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.gameplatform.server.model.entity.admin.Announcement">
|
||||
UPDATE announcement
|
||||
<set>
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="enabled != null">enabled = #{enabled},</if>
|
||||
<if test="jumpUrl != null">jump_url = #{jumpUrl},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById" parameterType="long">
|
||||
DELETE FROM announcement WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="findAll" resultMap="AnnouncementMap">
|
||||
SELECT id, title, content, enabled, jump_url, created_at, updated_at
|
||||
FROM announcement
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countAll" resultType="long">
|
||||
SELECT COUNT(1) FROM announcement
|
||||
</select>
|
||||
|
||||
<select id="findByEnabled" resultMap="AnnouncementMap">
|
||||
SELECT id, title, content, enabled, jump_url, created_at, updated_at
|
||||
FROM announcement
|
||||
WHERE enabled = #{enabled}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByEnabled" resultType="long">
|
||||
SELECT COUNT(1) FROM announcement WHERE enabled = #{enabled}
|
||||
</select>
|
||||
|
||||
<update id="updateEnabled">
|
||||
UPDATE announcement SET enabled = #{enabled} WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
74
src/main/resources/mapper/admin/OperationLogMapper.xml
Normal file
74
src/main/resources/mapper/admin/OperationLogMapper.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?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.gameplatform.server.mapper.admin.OperationLogMapper">
|
||||
<resultMap id="OperationLogMap" type="com.gameplatform.server.model.entity.admin.OperationLog">
|
||||
<id property="id" column="id" />
|
||||
<result property="actorType" column="actor_type" />
|
||||
<result property="actorId" column="actor_id" />
|
||||
<result property="codeNo" column="code_no" />
|
||||
<result property="op" column="op" />
|
||||
<result property="detail" column="detail" />
|
||||
<result property="clientIp" column="client_ip" />
|
||||
<result property="userAgent" column="user_agent" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="OperationLogMap">
|
||||
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
|
||||
FROM operation_log
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.gameplatform.server.model.entity.admin.OperationLog" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO operation_log (actor_type, actor_id, code_no, op, detail, client_ip, user_agent)
|
||||
VALUES (#{actorType}, #{actorId}, #{codeNo}, #{op}, #{detail}, #{clientIp}, #{userAgent})
|
||||
</insert>
|
||||
|
||||
<select id="findByCodeNo" resultMap="OperationLogMap">
|
||||
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
|
||||
FROM operation_log
|
||||
WHERE code_no = #{codeNo}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByCodeNo" resultType="long">
|
||||
SELECT COUNT(1) FROM operation_log WHERE code_no = #{codeNo}
|
||||
</select>
|
||||
|
||||
<select id="findByActorId" resultMap="OperationLogMap">
|
||||
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
|
||||
FROM operation_log
|
||||
WHERE actor_id = #{actorId}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByActorId" resultType="long">
|
||||
SELECT COUNT(1) FROM operation_log WHERE actor_id = #{actorId}
|
||||
</select>
|
||||
|
||||
<select id="findByActorType" resultMap="OperationLogMap">
|
||||
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
|
||||
FROM operation_log
|
||||
WHERE actor_type = #{actorType}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByActorType" resultType="long">
|
||||
SELECT COUNT(1) FROM operation_log WHERE actor_type = #{actorType}
|
||||
</select>
|
||||
|
||||
<select id="findAll" resultMap="OperationLogMap">
|
||||
SELECT id, actor_type, actor_id, code_no, op, detail, client_ip, user_agent, created_at
|
||||
FROM operation_log
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countAll" resultType="long">
|
||||
SELECT COUNT(1) FROM operation_log
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user