hd_real_name/target/classes/mappers/push/ProBidRelationMapper.xml

138 lines
5.4 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="com.bonus.gzrn.rnbmw.push.dao.bid.ProBidRelationDao">
<select id="selectProBidRelationList" resultType="com.bonus.gzrn.rnbmw.push.entity.ProBidRelationBean">
SELECT
id,
pro_name as proName,
bpbr.bid_pro_id as bidProId,
bpbr.is_multiple as isMultiple
FROM
bm_project_bid_relation bpbr
where is_active = 1
<if test="params.proName != null and params.proName != ''">
and bpbr.pro_name like concat('%',#{params.proName},'%')
</if>
limit #{offset},#{limit}
</select>
<select id="selectProBidRelationCount" resultType="java.lang.Integer">
SELECT count(*) FROM bm_project_bid_relation bpbr where is_active = 1
<if test="params.proName != null and params.proName != ''">
and bpbr.pro_name like concat('%',#{params.proName},'%')
</if>
</select>
<select id="selectProjectById" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
select pro_type as proType,sdd.name as voltageLevel from bm_project p
left join sys_dic_detail sdd on sdd.id = p.voltage_level
where p.id = #{proId}
</select>
<select id="selectProjectList" resultType="com.bonus.gzrn.rnbmw.push.entity.ProBidRelationBean">
SELECT bp.id, bp.NAME AS proName, bp.abbreviation FROM
bm_project bp WHERE bp.IS_ACTIVE = 1 AND STATUS = '在建'
AND id NOT IN (
SELECT SUBSTRING_INDEX(
SUBSTRING_INDEX( a.bid_pro_id, ',',
b.help_topic_id + 1 ), ',',- 1 ) num FROM bm_project_bid_relation a
JOIN mysql.help_topic b
ON b.help_topic_id &lt; ( LENGTH( a.bid_pro_id ) -
LENGTH( REPLACE ( a.bid_pro_id, ',', '' ) ) + 1 )
WHERE a.is_active = 1
)
<if test="params.proName != null and params.proName != ''">
and bp.name like concat('%',#{params.proName},'%')
</if>
limit #{offset},#{limit}
</select>
<select id="selectProjectCount" resultType="java.lang.Integer">
SELECT count(*) FROM bm_project bp
where bp.IS_ACTIVE = 1 and status = '在建'
AND id NOT IN (
SELECT SUBSTRING_INDEX(
SUBSTRING_INDEX( a.bid_pro_id, ',',
b.help_topic_id + 1 ), ',',- 1 ) num FROM bm_project_bid_relation a
JOIN mysql.help_topic b
ON b.help_topic_id &lt; ( LENGTH( a.bid_pro_id ) -
LENGTH( REPLACE ( a.bid_pro_id, ',', '' ) ) + 1 )
WHERE a.is_active = 1
)
<if test="params.proName != null and params.proName != ''">
and bp.name like concat('%',#{params.proName},'%')
</if>
</select>
<select id="selectProBidMultiple" resultType="com.bonus.gzrn.rnbmw.push.entity.ProBidRelationBean">
SELECT
is_multiple as isMultiple
FROM
bm_project bp
JOIN bm_project_bid_relation bpbr ON FIND_IN_SET( bp.id, bpbr.bid_pro_id )
WHERE
bp.IS_ACTIVE = 1
AND STATUS = '在建'
and bpbr.is_active = 1
AND bp.id IN
<foreach collection="params.bidProList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
GROUP BY is_multiple
</select>
<select id="selectProBidList" resultType="com.bonus.gzrn.rnbmw.push.entity.ProBidRelationBean">
SELECT IFNULL(bp.pro_old_id,bp.id) as id,bp.name as proName,bp.abbreviation
FROM bm_project bp
where bp.IS_ACTIVE = 1 and status = '在建'
and id in
<foreach collection="params.bidProList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
limit #{offset},#{limit}
</select>
<select id="selectProBidCount" resultType="java.lang.Integer">
SELECT count(*) FROM bm_project bp
where bp.IS_ACTIVE = 1 and status = '在建'
and id in
<foreach collection="params.bidProList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<insert id="addProBidData">
<if test="id != ''">
update bm_project_bid_relation set
pro_name = #{proName},bid_pro_id = #{bidProId},is_multiple = #{isMultiple}
where id = #{id}
</if>
<if test="id == ''">
insert into bm_project_bid_relation(pro_name,bid_pro_id,is_multiple,is_active)
values(#{proName},#{bidProId},#{isMultiple},1)
</if>
</insert>
<delete id="deleteProBid">
update bm_project_bid_relation set is_active = 0 where id = #{id}
</delete>
<select id="selectPushDataById" resultType="com.bonus.gzrn.rnbmw.push.entity.ProBidRelationBean">
SELECT a.pro_name as proName,
concat('SongBianDianProject',SUBSTRING_INDEX(
SUBSTRING_INDEX( a.bid_pro_id, ',',
b.help_topic_id + 1 ), ',',- 1 )) bidProId,
SUBSTRING_INDEX(
SUBSTRING_INDEX( a.is_multiple, ',',
b.help_topic_id + 1 ), ',',- 1 ) isMultiple
FROM bm_project_bid_relation a
JOIN mysql.help_topic b
ON b.help_topic_id &lt; ( LENGTH( a.bid_pro_id ) -
LENGTH( REPLACE ( a.bid_pro_id, ',', '' ) ) + 1 )
WHERE a.is_active = 1 and a.bid_pro_id
like CONCAT('%',#{proId},'%')
</select>
</mapper>