添加Swagger/OpenAPI依赖并更新用户账户管理相关的API文档注释,优化用户和管理员账户控制器的接口描述,移除不必要的字段和参数,调整数据库映射以简化用户账户管理逻辑。
This commit is contained in:
@@ -40,3 +40,16 @@ security:
|
||||
secret: "change-this-secret-to-a-long-random-string-please"
|
||||
access-token-minutes: 30
|
||||
refresh-token-days: 7
|
||||
|
||||
# Swagger/OpenAPI 配置
|
||||
springdoc:
|
||||
api-docs:
|
||||
path: /api-docs
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
doc-expansion: none
|
||||
disable-swagger-default-url: true
|
||||
display-request-duration: true
|
||||
packages-to-scan: com.gameplatform.server.controller
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
<id property="id" column="id" />
|
||||
<result property="userType" column="user_type" />
|
||||
<result property="username" column="username" />
|
||||
<result property="displayName" column="display_name" />
|
||||
<result property="passwordHash" column="password_hash" />
|
||||
<result property="role" column="role" />
|
||||
<result property="status" column="status" />
|
||||
<result property="pointsBalance" column="points_balance" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
@@ -15,7 +13,7 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="findByUsernameAndType" resultMap="UserAccountMap">
|
||||
SELECT id, user_type, username, display_name, password_hash, role, status, points_balance, created_at, updated_at
|
||||
SELECT id, user_type, username, password_hash, status, points_balance, created_at, updated_at
|
||||
FROM user_account
|
||||
WHERE username = #{username}
|
||||
AND user_type = #{userType}
|
||||
@@ -23,30 +21,29 @@
|
||||
</select>
|
||||
|
||||
<select id="findByUsername" resultMap="UserAccountMap">
|
||||
SELECT id, user_type, username, display_name, password_hash, role, status, points_balance, created_at, updated_at
|
||||
SELECT id, user_type, username, password_hash, status, points_balance, created_at, updated_at
|
||||
FROM user_account
|
||||
WHERE username = #{username}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="UserAccountMap">
|
||||
SELECT id, user_type, username, display_name, password_hash, role, status, points_balance, created_at, updated_at
|
||||
SELECT id, user_type, username, password_hash, status, points_balance, created_at, updated_at
|
||||
FROM user_account
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.gameplatform.server.model.entity.account.UserAccount" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO user_account (user_type, username, display_name, password_hash, role, status, points_balance)
|
||||
VALUES (#{userType}, #{username}, #{displayName}, #{passwordHash}, #{role}, #{status}, #{pointsBalance})
|
||||
INSERT INTO user_account (user_type, username, password_hash, status, points_balance)
|
||||
VALUES (#{userType}, #{username}, #{passwordHash}, #{status}, #{pointsBalance})
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.gameplatform.server.model.entity.account.UserAccount">
|
||||
UPDATE user_account
|
||||
<set>
|
||||
<if test="displayName != null">display_name = #{displayName},</if>
|
||||
<if test="role != null">role = #{role},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="pointsBalance != null">points_balance = #{pointsBalance},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
@@ -64,22 +61,20 @@
|
||||
<where>
|
||||
<if test="userType != null and userType != ''">AND user_type = #{userType}</if>
|
||||
<if test="status != null and status != ''">AND status = #{status}</if>
|
||||
<if test="role != null and role != ''">AND role = #{role}</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (username LIKE CONCAT('%', #{keyword}, '%') OR display_name LIKE CONCAT('%', #{keyword}, '%'))
|
||||
AND username LIKE CONCAT('%', #{keyword}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="listByFilter" resultMap="UserAccountMap">
|
||||
SELECT id, user_type, username, display_name, password_hash, role, status, points_balance, created_at, updated_at
|
||||
SELECT id, user_type, username, password_hash, status, points_balance, created_at, updated_at
|
||||
FROM user_account
|
||||
<where>
|
||||
<if test="userType != null and userType != ''">AND user_type = #{userType}</if>
|
||||
<if test="status != null and status != ''">AND status = #{status}</if>
|
||||
<if test="role != null and role != ''">AND role = #{role}</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (username LIKE CONCAT('%', #{keyword}, '%') OR display_name LIKE CONCAT('%', #{keyword}, '%'))
|
||||
AND username LIKE CONCAT('%', #{keyword}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
|
||||
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>
|
||||
52
src/main/resources/mapper/agent/AgentPointsTxMapper.xml
Normal file
52
src/main/resources/mapper/agent/AgentPointsTxMapper.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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.agent.AgentPointsTxMapper">
|
||||
<resultMap id="AgentPointsTxMap" type="com.gameplatform.server.model.entity.agent.AgentPointsTx">
|
||||
<id property="id" column="id" />
|
||||
<result property="accountId" column="account_id" />
|
||||
<result property="type" column="type" />
|
||||
<result property="beforePoints" column="before_points" />
|
||||
<result property="deltaPoints" column="delta_points" />
|
||||
<result property="afterPoints" column="after_points" />
|
||||
<result property="reason" column="reason" />
|
||||
<result property="refId" column="ref_id" />
|
||||
<result property="operatorId" column="operator_id" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="AgentPointsTxMap">
|
||||
SELECT id, account_id, type, before_points, delta_points, after_points, reason, ref_id, operator_id, created_at
|
||||
FROM agent_points_tx
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.gameplatform.server.model.entity.agent.AgentPointsTx" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO agent_points_tx (account_id, type, before_points, delta_points, after_points, reason, ref_id, operator_id)
|
||||
VALUES (#{accountId}, #{type}, #{beforePoints}, #{deltaPoints}, #{afterPoints}, #{reason}, #{refId}, #{operatorId})
|
||||
</insert>
|
||||
|
||||
<select id="findByAccountId" resultMap="AgentPointsTxMap">
|
||||
SELECT id, account_id, type, before_points, delta_points, after_points, reason, ref_id, operator_id, created_at
|
||||
FROM agent_points_tx
|
||||
WHERE account_id = #{accountId}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByAccountId" resultType="long">
|
||||
SELECT COUNT(1) FROM agent_points_tx WHERE account_id = #{accountId}
|
||||
</select>
|
||||
|
||||
<select id="findByAccountIdAndType" resultMap="AgentPointsTxMap">
|
||||
SELECT id, account_id, type, before_points, delta_points, after_points, reason, ref_id, operator_id, created_at
|
||||
FROM agent_points_tx
|
||||
WHERE account_id = #{accountId} AND type = #{type}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByAccountIdAndType" resultType="long">
|
||||
SELECT COUNT(1) FROM agent_points_tx WHERE account_id = #{accountId} AND type = #{type}
|
||||
</select>
|
||||
</mapper>
|
||||
49
src/main/resources/mapper/agent/LinkBatchMapper.xml
Normal file
49
src/main/resources/mapper/agent/LinkBatchMapper.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?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.agent.LinkBatchMapper">
|
||||
<resultMap id="LinkBatchMap" type="com.gameplatform.server.model.entity.agent.LinkBatch">
|
||||
<id property="id" column="id" />
|
||||
<result property="agentId" column="agent_id" />
|
||||
<result property="quantity" column="quantity" />
|
||||
<result property="times" column="times" />
|
||||
<result property="batchSize" column="batch_size" />
|
||||
<result property="deductPoints" column="deduct_points" />
|
||||
<result property="operatorId" column="operator_id" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="LinkBatchMap">
|
||||
SELECT id, agent_id, quantity, times, batch_size, deduct_points, operator_id, created_at
|
||||
FROM link_batch
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.gameplatform.server.model.entity.agent.LinkBatch" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO link_batch (agent_id, quantity, times, batch_size, deduct_points, operator_id)
|
||||
VALUES (#{agentId}, #{quantity}, #{times}, #{batchSize}, #{deductPoints}, #{operatorId})
|
||||
</insert>
|
||||
|
||||
<select id="findByAgentId" resultMap="LinkBatchMap">
|
||||
SELECT id, agent_id, quantity, times, batch_size, deduct_points, operator_id, created_at
|
||||
FROM link_batch
|
||||
WHERE agent_id = #{agentId}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByAgentId" resultType="long">
|
||||
SELECT COUNT(1) FROM link_batch WHERE agent_id = #{agentId}
|
||||
</select>
|
||||
|
||||
<select id="findAll" resultMap="LinkBatchMap">
|
||||
SELECT id, agent_id, quantity, times, batch_size, deduct_points, operator_id, created_at
|
||||
FROM link_batch
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countAll" resultType="long">
|
||||
SELECT COUNT(1) FROM link_batch
|
||||
</select>
|
||||
</mapper>
|
||||
113
src/main/resources/mapper/agent/LinkTaskMapper.xml
Normal file
113
src/main/resources/mapper/agent/LinkTaskMapper.xml
Normal file
@@ -0,0 +1,113 @@
|
||||
<?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.agent.LinkTaskMapper">
|
||||
<resultMap id="LinkTaskMap" type="com.gameplatform.server.model.entity.agent.LinkTask">
|
||||
<id property="id" column="id" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="agentId" column="agent_id" />
|
||||
<result property="codeNo" column="code_no" />
|
||||
<result property="tokenHash" column="token_hash" />
|
||||
<result property="expireAt" column="expire_at" />
|
||||
<result property="status" column="status" />
|
||||
<result property="region" column="region" />
|
||||
<result property="machineId" column="machine_id" />
|
||||
<result property="loginAt" column="login_at" />
|
||||
<result property="refundAt" column="refund_at" />
|
||||
<result property="revokedAt" column="revoked_at" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
</resultMap>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at
|
||||
FROM link_task
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="findByCodeNo" parameterType="string" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at
|
||||
FROM link_task
|
||||
WHERE code_no = #{codeNo}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="findByTokenHash" parameterType="string" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at
|
||||
FROM link_task
|
||||
WHERE token_hash = #{tokenHash}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.gameplatform.server.model.entity.agent.LinkTask" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO link_task (batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at)
|
||||
VALUES (#{batchId}, #{agentId}, #{codeNo}, #{tokenHash}, #{expireAt}, #{status}, #{region}, #{machineId}, #{loginAt}, #{refundAt}, #{revokedAt})
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.gameplatform.server.model.entity.agent.LinkTask">
|
||||
UPDATE link_task
|
||||
<set>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="region != null">region = #{region},</if>
|
||||
<if test="machineId != null">machine_id = #{machineId},</if>
|
||||
<if test="loginAt != null">login_at = #{loginAt},</if>
|
||||
<if test="refundAt != null">refund_at = #{refundAt},</if>
|
||||
<if test="revokedAt != null">revoked_at = #{revokedAt},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStatus">
|
||||
UPDATE link_task SET status = #{status} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStatusAndMachine">
|
||||
UPDATE link_task
|
||||
SET status = #{status}, region = #{region}, machine_id = #{machineId}, login_at = #{loginAt}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="findByAgentId" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at
|
||||
FROM link_task
|
||||
WHERE agent_id = #{agentId}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByAgentId" resultType="long">
|
||||
SELECT COUNT(1) FROM link_task WHERE agent_id = #{agentId}
|
||||
</select>
|
||||
|
||||
<select id="findByAgentIdAndStatus" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at
|
||||
FROM link_task
|
||||
WHERE agent_id = #{agentId} AND status = #{status}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByAgentIdAndStatus" resultType="long">
|
||||
SELECT COUNT(1) FROM link_task WHERE agent_id = #{agentId} AND status = #{status}
|
||||
</select>
|
||||
|
||||
<select id="findByBatchId" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at
|
||||
FROM link_task
|
||||
WHERE batch_id = #{batchId}
|
||||
ORDER BY created_at DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countByBatchId" resultType="long">
|
||||
SELECT COUNT(1) FROM link_task WHERE batch_id = #{batchId}
|
||||
</select>
|
||||
|
||||
<select id="findExpiredTasks" resultMap="LinkTaskMap">
|
||||
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at
|
||||
FROM link_task
|
||||
WHERE expire_at <= #{expireTime} AND status IN ('NEW', 'USING')
|
||||
ORDER BY expire_at ASC
|
||||
LIMIT #{size}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user