You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
4.5 KiB

7 months ago
<?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.dongjian.dashboard.back.dao.ex.BasicProjectMapperExt">
<insert id="selfInsertSelective" parameterType="com.dongjian.dashboard.back.model.BasicProject">
insert into data_center_third_${companyId}.basic_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyId != null">
company_id,
</if>
<if test="projectName != null">
project_name,
</if>
<if test="flag != null">
flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="modifierId != null">
modifier_id,
</if>
<if test="udfProjectId != null">
udf_project_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyId != null">
#{companyId,jdbcType=BIGINT},
</if>
<if test="projectName != null">
#{projectName,jdbcType=VARCHAR},
</if>
<if test="flag != null">
#{flag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="modifyTime != null">
#{modifyTime,jdbcType=BIGINT},
</if>
<if test="modifierId != null">
#{modifierId,jdbcType=BIGINT},
</if>
<if test="udfProjectId != null">
#{udfProjectId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="selfSelectByPrimaryKey" resultType="com.dongjian.dashboard.back.model.BasicProject">
select
id, company_id, project_name, flag, create_time, creator_id, modify_time, modifier_id, udf_project_id
from
data_center_third_${companyId}.basic_project
where id = #{projectId}
</select>
<update id="selfUpdateByPrimaryKeySelective" parameterType="com.dongjian.dashboard.back.model.BasicProject">
update data_center_third_${companyId}.basic_project
<set>
<if test="companyId != null">
company_id = #{companyId,jdbcType=BIGINT},
</if>
<if test="projectName != null">
project_name = #{projectName,jdbcType=VARCHAR},
</if>
<if test="flag != null">
flag = #{flag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=BIGINT},
</if>
<if test="modifierId != null">
modifier_id = #{modifierId,jdbcType=BIGINT},
</if>
<if test="udfProjectId != null">
udf_project_id = #{udfProjectId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="checkExist" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
data_center_third_${companyId}.basic_project
WHERE
flag != 1 AND project_name = #{projectName}
<if test="companyId != null">
AND company_id = #{companyId}
</if>
<if test="projectId != null">
AND id != #{projectId}
</if>
</select>
<select id="getListPage" resultType="com.dongjian.dashboard.back.vo.project.ProjectPageVO">
SELECT
bpro.id projectId,
bpro.company_id companyId,
bcomp.company_name companyName,
bpro.project_name projectName,
bpro.udf_project_id udfProjectId
FROM
data_center_third_${companyId}.basic_project bpro
INNER JOIN basic_company bcomp ON bcomp.id = bpro.company_id
WHERE
bpro.flag != 1 AND bcomp.flag != 1
AND bpro.company_id = #{companyId}
<if test="projectIdList != null">
AND bpro.id IN <foreach collection="projectIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
</if>
<if test="projectName != null">
AND bpro.project_name LIKE CONCAT('%',#{projectName},'%')
</if>
order by bpro.id desc
</select>
</mapper>