|
|
@@ -5,17 +5,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<mapper namespace="com.fs.company.mapper.CompanyVoiceApiTenantMapper">
|
|
|
|
|
|
<resultMap type="CompanyVoiceApiTenant" id="CompanyVoiceApiTenantResult">
|
|
|
- <result property="id" column="id" />
|
|
|
- <result property="apiId" column="api_id" />
|
|
|
- <result property="companyId" column="company_id" />
|
|
|
- <result property="status" column="status" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="companyName" column="company_name" />
|
|
|
- <result property="apiName" column="api_name" />
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="apiId" column="api_id" />
|
|
|
+ <result property="companyId" column="company_id" />
|
|
|
+ <result property="price" column="price" />
|
|
|
+ <result property="priority" column="priority" />
|
|
|
+ <result property="isPrimary" column="is_primary" />
|
|
|
+ <result property="allowManual" column="allow_manual"/>
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="companyName" column="company_name"/>
|
|
|
+ <result property="apiName" column="api_name" />
|
|
|
+ <result property="costPrice" column="cost_price" />
|
|
|
+ <result property="apiType" column="api_type" />
|
|
|
+ <result property="provider" column="provider" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectCompanyVoiceApiTenantVo">
|
|
|
- select t.id, t.api_id, t.company_id, t.status, t.create_time
|
|
|
+ select t.id, t.api_id, t.company_id, t.price, t.priority, t.is_primary, t.allow_manual, t.status, t.create_time
|
|
|
from company_voice_api_tenant t
|
|
|
</sql>
|
|
|
|
|
|
@@ -29,34 +36,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
where t.api_id = #{apiId} and t.company_id = #{companyId}
|
|
|
</select>
|
|
|
|
|
|
- <!-- 查询接口已分配的租户列表(含租户名) -->
|
|
|
+ <!-- 查询接口已分配的租户列表(含租户名、定价信息) -->
|
|
|
<select id="selectTenantsByApiId" resultMap="CompanyVoiceApiTenantResult">
|
|
|
- select t.id, t.api_id, t.company_id, t.status, t.create_time,
|
|
|
- c.company_name
|
|
|
+ select t.id, t.api_id, t.company_id, t.price, t.priority, t.is_primary, t.allow_manual, t.status, t.create_time,
|
|
|
+ c.company_name, a.cost_price, a.provider, a.api_type
|
|
|
from company_voice_api_tenant t
|
|
|
left join company c on c.company_id = t.company_id
|
|
|
+ left join company_voice_api a on a.api_id = t.api_id
|
|
|
where t.api_id = #{apiId}
|
|
|
- order by t.id desc
|
|
|
+ order by t.priority asc, t.id desc
|
|
|
</select>
|
|
|
|
|
|
- <!-- 查询租户已分配的接口列表(含接口名) -->
|
|
|
+ <!-- 查询租户已分配的接口列表(含接口名、成本价、服务商) -->
|
|
|
<select id="selectApisByCompanyId" resultMap="CompanyVoiceApiTenantResult">
|
|
|
- select t.id, t.api_id, t.company_id, t.status, t.create_time,
|
|
|
- a.api_name
|
|
|
+ select t.id, t.api_id, t.company_id, t.price, t.priority, t.is_primary, t.allow_manual, t.status, t.create_time,
|
|
|
+ a.api_name, a.cost_price, a.provider, a.api_type
|
|
|
from company_voice_api_tenant t
|
|
|
left join company_voice_api a on a.api_id = t.api_id
|
|
|
where t.company_id = #{companyId}
|
|
|
- order by t.id desc
|
|
|
+ order by t.priority asc, t.id desc
|
|
|
</select>
|
|
|
|
|
|
<select id="selectCompanyVoiceApiTenantList" resultMap="CompanyVoiceApiTenantResult">
|
|
|
- <include refid="selectCompanyVoiceApiTenantVo"/>
|
|
|
+ select t.id, t.api_id, t.company_id, t.price, t.priority, t.is_primary, t.allow_manual, t.status, t.create_time,
|
|
|
+ c.company_name, a.api_name, a.cost_price, a.provider, a.api_type
|
|
|
+ from company_voice_api_tenant t
|
|
|
+ left join company c on c.company_id = t.company_id
|
|
|
+ left join company_voice_api a on a.api_id = t.api_id
|
|
|
<where>
|
|
|
<if test="apiId != null"> and t.api_id = #{apiId}</if>
|
|
|
<if test="companyId != null"> and t.company_id = #{companyId}</if>
|
|
|
<if test="status != null"> and t.status = #{status}</if>
|
|
|
</where>
|
|
|
- order by t.id desc
|
|
|
+ order by t.priority asc, t.id desc
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertCompanyVoiceApiTenant" useGeneratedKeys="true" keyProperty="id">
|
|
|
@@ -64,22 +76,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="apiId != null">api_id,</if>
|
|
|
<if test="companyId != null">company_id,</if>
|
|
|
+ <if test="price != null">price,</if>
|
|
|
+ <if test="priority != null">priority,</if>
|
|
|
+ <if test="isPrimary != null">is_primary,</if>
|
|
|
+ <if test="allowManual != null">allow_manual,</if>
|
|
|
<if test="status != null">status,</if>
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="apiId != null">#{apiId},</if>
|
|
|
<if test="companyId != null">#{companyId},</if>
|
|
|
+ <if test="price != null">#{price},</if>
|
|
|
+ <if test="priority != null">#{priority},</if>
|
|
|
+ <if test="isPrimary != null">#{isPrimary},</if>
|
|
|
+ <if test="allowManual != null">#{allowManual},</if>
|
|
|
<if test="status != null">#{status},</if>
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
<insert id="batchInsertCompanyVoiceApiTenant">
|
|
|
- insert into company_voice_api_tenant (api_id, company_id, status, create_time)
|
|
|
+ insert into company_voice_api_tenant (api_id, company_id, price, priority, is_primary, allow_manual, status, create_time)
|
|
|
values
|
|
|
<foreach item="item" collection="list" separator=",">
|
|
|
- (#{item.apiId}, #{item.companyId}, #{item.status}, NOW())
|
|
|
+ (#{item.apiId}, #{item.companyId}, #{item.price}, #{item.priority}, #{item.isPrimary}, #{item.allowManual}, #{item.status}, NOW())
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
|
|
|
@@ -88,6 +108,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="apiId != null">api_id = #{apiId},</if>
|
|
|
<if test="companyId != null">company_id = #{companyId},</if>
|
|
|
+ <if test="price != null">price = #{price},</if>
|
|
|
+ <if test="priority != null">priority = #{priority},</if>
|
|
|
+ <if test="isPrimary != null">is_primary = #{isPrimary},</if>
|
|
|
+ <if test="allowManual != null">allow_manual = #{allowManual},</if>
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
</trim>
|
|
|
where id = #{id}
|