fix: application 接口返回 user 对象

This commit is contained in:
zhangshuai
2024-08-06 18:15:11 +08:00
parent 875eb83d6e
commit d5f6aef383
9 changed files with 138 additions and 85 deletions

View File

@@ -1,40 +0,0 @@
<?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="net.geedge.asw.module.app.dao.ApplicationLogDao">
<select id="queryList" resultType="net.geedge.asw.module.app.entity.ApplicationLogEntity">
SELECT
app.*
FROM
(select * from application union select * from application_log) app
<where>
<if test="params.id != null and params.id != ''">
AND app.id = #{params.id}
</if>
</where>
<if test="params.orderBy == null or params.orderBy == ''">
ORDER BY app.id
</if>
</select>
<select id="compare" resultType="net.geedge.asw.module.app.entity.ApplicationLogEntity">
SELECT
app.*
FROM
(select * from application union select * from application_log ) app
<where>
<if test="params.ids != null and params.ids != ''">
app.id in
<foreach item="id" collection="params.ids" separator="," open="(" close=")">
#{id}
</foreach>
</if>
</where>
<if test="params.orderBy == null or params.orderBy == ''">
ORDER BY app.id
</if>
</select>
</mapper>

View File

@@ -2,13 +2,42 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.geedge.asw.module.app.dao.ApplicationDao">
<resultMap id="appResult" type="net.geedge.asw.module.app.entity.ApplicationEntity">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="longName" column="long_name"/>
<result property="properties" column="properties"/>
<result property="description" column="description"/>
<result property="surrogates" column="surrogates"/>
<result property="createTimestamp" column="create_timestamp"/>
<result property="updateTimestamp" column="update_timestamp"/>
<result property="createUserId" column="create_user_id"/>
<result property="updateUserId" column="update_user_id"/>
<result property="workspaceId" column="workspace_id"/>
<result property="opVersion" column="op_version"/>
<association property="createUser" columnPrefix="cu_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
</association>
<select id="queryList" resultType="net.geedge.asw.module.app.entity.ApplicationEntity">
<association property="updateUser" columnPrefix="uu_" javaType="net.geedge.asw.module.sys.entity.SysUserEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
</association>
</resultMap>
<select id="queryList" resultMap="appResult">
SELECT
app.*
app.*,
cu.id as cu_id,
cu.name as cu_name,
uu.id as uu_id,
uu.id as uu_name
FROM
application app
left join sys_user cu on app.create_user_id = cu.id
left join sys_user uu on app.update_user_id = uu.id
<where>
<if test="params.ids != null and params.ids != ''">
app.id in
@@ -20,16 +49,59 @@
<if test="params.q != null and params.q != ''">
AND ( locate(#{params.q}, app.name) OR locate(#{params.q}, app.description) )
</if>
<if test="params.id != null and params.id != ''">
AND app.id = #{params.id}
</if>
<if test="params.workspaceId != null and params.workspaceId != ''">
AND app.workspace_id = #{params.workspaceId}
</if>
</where>
GROUP BY
app.id
<if test="params.orderBy == null or params.orderBy == ''">
ORDER BY app.id
</if>
</select>
<select id="queryLogList" resultMap="appResult">
SELECT
app.*,
cu.id as cu_id,
cu.name as cu_name,
uu.id as uu_id,
uu.id as uu_name
FROM
(select * from application union select * from application_log) app
left join sys_user cu on app.create_user_id = cu.id
left join sys_user uu on app.update_user_id = uu.id
<where>
<if test="id != null and id != ''">
AND app.id = #{id}
</if>
</where>
</select>
<select id="compare" resultMap="appResult">
SELECT
app.*,
cu.id as cu_id,
cu.name as cu_name,
uu.id as uu_id,
uu.id as uu_name
FROM
(select * from application union select * from application_log ) app
left join sys_user cu on app.create_user_id = cu.id
left join sys_user uu on app.update_user_id = uu.id
<where>
<if test="params.ids != null and params.ids != ''">
app.id in
<foreach item="id" collection="params.ids" separator="," open="(" close=")">
#{id}
</foreach>
</if>
</where>
<if test="params.orderBy == null or params.orderBy == ''">
ORDER BY app.id
</if>
</select>
</mapper>