<?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" >
|
<!-- Table:epc_app_stander_def_{rule} -->
|
<mapper namespace="com.changhong.epc.admin.mapper.centen.initguide.InitCompanyMapper">
|
<select id="isInitCompany" resultType="java.lang.Integer">
|
SELECT
|
COUNT(0)
|
FROM
|
epc_init_company
|
WHERE
|
companyId = #{companyId}
|
|
</select>
|
|
<select id="getCostGroupType" resultType="com.changhong.epc.bean.admin.CostGroupType">
|
SELECT
|
a.id id,
|
case when b.node_name != '' then b.node_name else a.node_name end as type,
|
a.node_name nodeName,
|
case when b.codeId !='' then b.codeId else '0' end as parentId,
|
a.g_id as gId,
|
a.codeId as codeId
|
FROM
|
epc_cost_type_template a
|
LEFT JOIN
|
epc_cost_type_template b
|
ON
|
a.parent_id = b.codeId
|
WHERE
|
a.g_id = #{id}
|
AND
|
a.data_start = 0
|
LIMIT 0, 100000
|
</select>
|
|
<insert id="addInitCompany">
|
INSERT INTO
|
epc_init_company
|
(
|
company_id,
|
tenant_id,
|
power_app_key,
|
power_secret_key
|
)
|
VALUE
|
(
|
#{company.id},
|
#{company.tenantId},
|
#{tableRule.appKey},
|
#{tableRule.secretKey}
|
)
|
|
</insert>
|
|
<select id="selectInitCompany" parameterType="com.changhong.epc.bean.admin.InitCompany" resultType="com.changhong.epc.bean.admin.InitCompany">
|
SELECT
|
id,
|
company_id companyId,
|
company_name companyName,
|
tenant_id tenantId,
|
tenant_name tenantName,
|
init_state initState,
|
power_app_key powerAppKey,
|
power_secret_key powerSecretKey,
|
ins_t insT,
|
upd_t updT,
|
ins_p insP,
|
upd_p updP,
|
data_start dataStart,
|
power_name powerName,
|
db_name dbName
|
FROM
|
epc_init_company
|
WHERE
|
data_start = 0
|
<if test="id != null">
|
AND
|
id = #{id}
|
</if>
|
<if test="companyId != null">
|
AND
|
company_id = #{companyId}
|
</if>
|
<if test="tenantId != null">
|
AND
|
tenant_id = #{tenantId}
|
</if>
|
<if test="initState != null">
|
AND
|
init_state = #{initState}
|
</if>
|
<if test="powerAppKey != null">
|
AND
|
power_app_key = #{powerAppKey}
|
</if>
|
<if test="powerSecretKey != null">
|
AND
|
power_secret_key = #{powerSecretKey}
|
</if>
|
<if test="powerName != null">
|
AND
|
power_name = #{powerName}
|
</if>
|
</select>
|
|
<select id="initMenu" statementType="CALLABLE">
|
{
|
call init_menu(#{tenantId}, #{companyId})
|
}
|
</select>
|
|
<select id="selectInitCompanyId" resultType="java.lang.String">
|
select GROUP_CONCAT(company_id) from epc_init_company where tenant_id = #{tenantId}
|
</select>
|
|
<select id="selectTenantnameAndCompanynameByid" resultType="map">
|
select company_name,tenant_name from epc_init_company
|
<where>
|
<if test="tenantId != null and tenantId != '' ">
|
AND tenant_id = #{tenantId}
|
</if>
|
<if test="companyId != null and companyId != '' ">
|
AND company_id = #{companyId}
|
</if>
|
</where>
|
</select>
|
|
</mapper>
|