211 lines
12 KiB
XML
211 lines
12 KiB
XML
<?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="top.fatweb.oxygen.api.mapper.tool.EditMapper">
|
|
<select id="selectTemplate" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolTemplateWithBaseDataMap">
|
|
select t_b_tool_template.id as tool_template_id,
|
|
t_b_tool_template.name as tool_template_name,
|
|
t_b_tool_template.base_id as tool_template_base_id,
|
|
t_b_tool_template.source_id as tool_template_source_id,
|
|
t_b_tool_template.entry_point as tool_template_entry_point,
|
|
t_b_tool_template.enable as tool_template_enable,
|
|
t_b_tool_template.create_time as tool_template_create_time,
|
|
t_b_tool_template.update_time as tool_template_update_time,
|
|
t_b_tool_template.deleted as tool_template_deleted,
|
|
t_b_tool_template.version as tool_template_version,
|
|
tbtds.data as tool_template_source_data,
|
|
tbtds.create_time as tool_template_source_create_time,
|
|
tbtds.update_time as tool_template_source_update_time,
|
|
tbtds.deleted as tool_template_source_delete,
|
|
tbtds.version as tool_template_source_version,
|
|
tbtb.name as tool_template_base_name,
|
|
tbtbd.data as tool_template_base_dist_data
|
|
from t_b_tool_template
|
|
left join (select * from t_b_tool_data where deleted = 0) as tbtds
|
|
on tbtds.id = t_b_tool_template.source_id
|
|
left join (select * from t_b_tool_base where deleted = 0) as tbtb
|
|
on tbtb.id = t_b_tool_template.base_id
|
|
left join (select * from t_b_tool_data where deleted = 0) as tbtbd
|
|
on tbtbd.id = tbtb.dist_id
|
|
where t_b_tool_template.deleted = 0
|
|
and t_b_tool_template.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectOne" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolWithDataMap">
|
|
select t_b_tool_main.id as tool_id,
|
|
t_b_tool_main.name as tool_name,
|
|
t_b_tool_main.tool_id as tool_tool_id,
|
|
t_b_tool_main.icon as tool_icon,
|
|
t_b_tool_main.description as tool_description,
|
|
t_b_tool_main.base_id as tool_base_id,
|
|
t_b_tool_main.author_id as tool_author_id,
|
|
t_b_tool_main.ver as tool_ver,
|
|
t_b_tool_main.keywords as tool_keywords,
|
|
t_b_tool_main.source_id as tool_source_id,
|
|
t_b_tool_main.dist_id as tool_dist_id,
|
|
t_b_tool_main.entry_point as tool_entry_point,
|
|
t_b_tool_main.publish as tool_publish,
|
|
t_b_tool_main.review as tool_review,
|
|
t_b_tool_main.create_time as tool_create_time,
|
|
t_b_tool_main.update_time as tool_update_time,
|
|
t_b_tool_main.deleted as tool_deleted,
|
|
t_b_tool_main.version as tool_version,
|
|
tsu.id as user_id,
|
|
tsu.username as user_username,
|
|
tsui.id as user_info_id,
|
|
tsui.nickname as user_info_nickname,
|
|
tsui.avatar as user_info_avatar,
|
|
tsui.email as user_info_email,
|
|
tbtb.name as tool_base_name,
|
|
tbtb.dist_id as tool_base_dist_id,
|
|
tbtbd.data as tool_base_dist_data,
|
|
tbts.data as tool_source_data,
|
|
tbts.create_time as tool_source_create_time,
|
|
tbts.update_time as tool_source_update_time,
|
|
tbts.deleted as tool_source_deleted,
|
|
tbts.version as tool_source_version,
|
|
tbtd.data as tool_dist_data,
|
|
tbtd.create_time as tool_dist_create_time,
|
|
tbtd.update_time as tool_dist_update_time,
|
|
tbtd.deleted as tool_dist_deleted,
|
|
tbtd.version as tool_dist_version,
|
|
tbtc.id as tool_category_id,
|
|
tbtc.name as tool_category_name,
|
|
tbtc.enable as tool_category_enable,
|
|
tbtc.create_time as tool_category_create_time,
|
|
tbtc.update_time as tool_category_update_time,
|
|
tbtc.deleted as tool_category_deleted,
|
|
tbtc.version as tool_category_version
|
|
from t_b_tool_main
|
|
left join (select * from t_s_user where deleted = 0) as tsu on tsu.id = t_b_tool_main.author_id
|
|
left join (select * from t_s_user_info where deleted = 0) as tsui
|
|
on tsui.user_id = t_b_tool_main.author_id
|
|
left join (select * from t_b_tool_base where deleted = 0) as tbtb on tbtb.id = t_b_tool_main.base_id
|
|
left join (select * from t_b_tool_data where deleted = 0) as tbtbd on tbtbd.id = tbtb.dist_id
|
|
left join (select * from t_b_tool_data where deleted = 0) as tbts on tbts.id = t_b_tool_main.source_id
|
|
left join (select * from t_b_tool_data where deleted = 0) as tbtd on tbtd.id = t_b_tool_main.dist_id
|
|
left join (select * from t_r_tool_main_category where deleted = 0) as trtmc
|
|
on t_b_tool_main.id = trtmc.tool_id
|
|
left join (select * from t_b_tool_category where deleted = 0 and enable = 1) as tbtc
|
|
on tbtc.id = trtmc.category_id
|
|
where t_b_tool_main.deleted = 0
|
|
and t_b_tool_main.author_id = #{userId}
|
|
and t_b_tool_main.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectPersonal" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolMap">
|
|
select t_b_tool_main.id as tool_id,
|
|
t_b_tool_main.name as tool_name,
|
|
t_b_tool_main.tool_id as tool_tool_id,
|
|
t_b_tool_main.icon as tool_icon,
|
|
t_b_tool_main.description as tool_description,
|
|
t_b_tool_main.base_id as tool_base_id,
|
|
t_b_tool_main.author_id as tool_author_id,
|
|
t_b_tool_main.ver as tool_ver,
|
|
t_b_tool_main.keywords as tool_keywords,
|
|
t_b_tool_main.source_id as tool_source_id,
|
|
t_b_tool_main.dist_id as tool_dist_id,
|
|
t_b_tool_main.entry_point as tool_entry_point,
|
|
t_b_tool_main.publish as tool_publish,
|
|
t_b_tool_main.review as tool_review,
|
|
t_b_tool_main.create_time as tool_create_time,
|
|
t_b_tool_main.update_time as tool_update_time,
|
|
t_b_tool_main.deleted as tool_deleted,
|
|
t_b_tool_main.version as tool_version,
|
|
tbtc.id as tool_category_id,
|
|
tbtc.name as tool_category_name,
|
|
tbtc.enable as tool_category_enable,
|
|
tbtc.create_time as tool_category_create_time,
|
|
tbtc.update_time as tool_category_update_time,
|
|
tbtc.deleted as tool_category_deleted,
|
|
tbtc.version as tool_category_version
|
|
from t_b_tool_main
|
|
left join (select * from t_r_tool_main_category where deleted = 0) as trtmc
|
|
on t_b_tool_main.id = trtmc.tool_id
|
|
left join (select * from t_b_tool_category where deleted = 0 and enable = 1) as tbtc
|
|
on tbtc.id = trtmc.category_id
|
|
where t_b_tool_main.deleted = 0
|
|
and t_b_tool_main.author_id = #{userId}
|
|
order by t_b_tool_main.id desc
|
|
</select>
|
|
|
|
<select id="selectDetail" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolWithDataMap">
|
|
select t_b_tool_main.id as tool_id,
|
|
t_b_tool_main.name as tool_name,
|
|
t_b_tool_main.tool_id as tool_tool_id,
|
|
t_b_tool_main.icon as tool_icon,
|
|
t_b_tool_main.description as tool_description,
|
|
t_b_tool_main.base_id as tool_base_id,
|
|
t_b_tool_main.author_id as tool_author_id,
|
|
t_b_tool_main.ver as tool_ver,
|
|
t_b_tool_main.keywords as tool_keywords,
|
|
t_b_tool_main.source_id as tool_source_id,
|
|
t_b_tool_main.dist_id as tool_dist_id,
|
|
t_b_tool_main.entry_point as tool_entry_point,
|
|
t_b_tool_main.publish as tool_publish,
|
|
t_b_tool_main.review as tool_review,
|
|
t_b_tool_main.create_time as tool_create_time,
|
|
t_b_tool_main.update_time as tool_update_time,
|
|
t_b_tool_main.deleted as tool_deleted,
|
|
t_b_tool_main.version as tool_version,
|
|
tsu.id as user_id,
|
|
tsu.username as user_username,
|
|
tsui.id as user_info_id,
|
|
tsui.nickname as user_info_nickname,
|
|
tsui.avatar as user_info_avatar,
|
|
tbtb.name as tool_base_name,
|
|
tbtb.dist_id as tool_base_dist_id,
|
|
tbtbd.data as tool_base_dist_data,
|
|
tbts.data as tool_source_data,
|
|
tbts.create_time as tool_source_create_time,
|
|
tbts.update_time as tool_source_update_time,
|
|
tbts.deleted as tool_source_deleted,
|
|
tbts.version as tool_source_version,
|
|
tbtd.data as tool_dist_data,
|
|
tbtd.create_time as tool_dist_create_time,
|
|
tbtd.update_time as tool_dist_update_time,
|
|
tbtd.deleted as tool_dist_deleted,
|
|
tbtd.version as tool_dist_version,
|
|
tbtc.id as tool_category_id,
|
|
tbtc.name as tool_category_name,
|
|
tbtc.enable as tool_category_enable,
|
|
tbtc.create_time as tool_category_create_time,
|
|
tbtc.update_time as tool_category_update_time,
|
|
tbtc.deleted as tool_category_deleted,
|
|
tbtc.version as tool_category_version
|
|
from t_b_tool_main
|
|
left join (select * from t_s_user where deleted = 0) as tsu on tsu.id = t_b_tool_main.author_id
|
|
left join (select * from t_s_user_info where deleted = 0) as tsui
|
|
on tsui.user_id = t_b_tool_main.author_id
|
|
left join (select * from t_b_tool_base where deleted = 0) as tbtb on tbtb.id = t_b_tool_main.base_id
|
|
left join (select * from t_b_tool_data where deleted = 0) as tbtbd on tbtbd.id = tbtb.dist_id
|
|
left join (select * from t_b_tool_data where deleted = 0) as tbts on tbts.id = t_b_tool_main.source_id
|
|
left join (select * from t_b_tool_data where deleted = 0) as tbtd on tbtd.id = t_b_tool_main.dist_id
|
|
left join (select * from t_r_tool_main_category where deleted = 0) as trtmc
|
|
on t_b_tool_main.id = trtmc.tool_id
|
|
left join (select * from t_b_tool_category where deleted = 0 and enable = 1) as tbtc
|
|
on tbtc.id = trtmc.category_id
|
|
<where>
|
|
and t_b_tool_main.deleted = 0
|
|
and t_b_tool_main.tool_id = #{toolId}
|
|
<choose>
|
|
<when test="operator == null">
|
|
and tsu.username = #{username}
|
|
</when>
|
|
<otherwise>
|
|
<choose>
|
|
<when test="username = '!'">
|
|
and tsu.username = #{operator}
|
|
<if test="ver != 'latest'">
|
|
and t_b_tool_main.ver = #{ver}
|
|
</if>
|
|
</when>
|
|
<otherwise>
|
|
and tsu.username = #{username}
|
|
</otherwise>
|
|
</choose>
|
|
</otherwise>
|
|
</choose>
|
|
</where>
|
|
order by t_b_tool_main.id desc
|
|
</select>
|
|
</mapper> |