123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- <?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.ruoyi.system.mapper.project.BmDeptPlanMapper">
-
- <resultMap type="BmDeptPlan" id="BmDeptPlanResult">
- <result property="id" column="id" />
- <result property="sysDeptId" column="sys_dept_id" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="isDel" column="is_del" />
- <result property="year" column="year" />
- <result property="targetContractAmount" column="target_contract_amount" />
- <result property="targetArrivalAmount" column="target_arrival_amount" />
- <result property="remark" column="remark" />
- <result property="deptName" column="dept_name" />
- </resultMap>
- <sql id="selectBmDeptPlanVo">
- select id, sys_dept_id, create_by, create_time, update_by, update_time, is_del, year, target_contract_amount, target_arrival_amount, remark from bm_dept_Plan
- </sql>
- <select id="selectBmDeptPlanList" parameterType="BmDeptPlan" resultMap="BmDeptPlanResult">
- select p.id, p.sys_dept_id, p.create_by, p.create_time, p.update_by, p.update_time, p.is_del, p.year, p.target_contract_amount, p.target_arrival_amount, p.remark, d.dept_name
- from bm_dept_plan p
- left join sys_dept d on p.sys_dept_id = d.dept_id and p.is_del = '0'
- <where>
- is_del = '0'
- <if test="sysDeptId != null "> and sys_dept_id = #{sysDeptId}</if>
- <if test="year != null and year != ''"> and year = #{year}</if>
- <if test="targetContractAmount != null "> and target_contract_amount = #{targetContractAmount}</if>
- <if test="targetArrivalAmount != null "> and target_arrival_amount = #{targetArrivalAmount}</if>
- </where>
- order by p.create_time DESC
- </select>
- <select id="selectBmDeptPlanById" parameterType="Long" resultMap="BmDeptPlanResult">
- <include refid="selectBmDeptPlanVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertBmDeptPlan" parameterType="BmDeptPlan" useGeneratedKeys="true" keyProperty="id">
- insert into bm_dept_plan
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="sysDeptId != null">sys_dept_id,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="isDel != null">is_del,</if>
- <if test="year != null">year,</if>
- <if test="targetContractAmount != null">target_contract_amount,</if>
- <if test="targetArrivalAmount != null">target_arrival_amount,</if>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="sysDeptId != null">#{sysDeptId},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="isDel != null">#{isDel},</if>
- <if test="year != null">#{year},</if>
- <if test="targetContractAmount != null">#{targetContractAmount},</if>
- <if test="targetArrivalAmount != null">#{targetArrivalAmount},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateBmDeptPlan" parameterType="BmDeptPlan">
- update bm_dept_plan
- <trim prefix="SET" suffixOverrides=",">
- <if test="sysDeptId != null">sys_dept_id = #{sysDeptId},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="isDel != null">is_del = #{isDel},</if>
- <if test="year != null">year = #{year},</if>
- <if test="targetContractAmount != null">target_contract_amount = #{targetContractAmount},</if>
- <if test="targetArrivalAmount != null">target_arrival_amount = #{targetArrivalAmount},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteBmDeptPlanById" parameterType="Long">
- delete from bm_dept_plan where id = #{id}
- </delete>
- <delete id="deleteBmDeptPlanByIds" parameterType="String">
- delete from bm_dept_plan where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectUnitList" parameterType="string" resultMap="BmDeptPlanResult">
- select ifnull(p.target_contract_amount,0) as target_contract_amount , ifnull(p.target_arrival_amount,0) as target_arrival_amount, d.dept_name
- from bm_dept_plan p right join sys_dept d on p.sys_dept_id = d.dept_id and p.is_del = '0' and p.year = #{year} where d.parent_id = 124
- </select>
- <select id="selectUnitClueList" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- ifnull( s1.dept_name, '' ) AS deptName,
- ifnull( s1.plan, 0 ) AS plan,
- ifnull( count( p.id ), 0 ) AS successMission
- FROM
- (
- SELECT
- sd.dept_id,
- sd.dept_name,
- sd.parent_id,
- a.sys_dept_id,
- (ifnull(a.project_million_num,0)+ ifnull(a.project_pro_num,0)+ ifnull(a.project_investment_num,0))as plan
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan_area` a ON a.sys_dept_id = sd.dept_id
- AND a.is_del = '0'
- WHERE
- sd.del_flag = '0'
- ) s1
- LEFT JOIN bm_project p ON p.dept_id = s1.sys_dept_id
- AND p.is_del = '0'
- and year(p.create_time) = #{year}
- where
- s1.parent_id = 105
- GROUP BY
- s1.dept_id
- ORDER BY
- successMission DESC,
- plan DESC
- </select>
- <select id="selectUnitClueCityList" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- ifnull( s1.dept_name, '' ) AS deptName,
- ifnull( s1.target_arrival_amount, 0 ) AS targetArrivalAmount,
- ifnull( count( p.id ), 0 ) AS successMission
- FROM
- (
- SELECT
- sd.dept_id,
- sd.dept_name,
- sd.parent_id,
- a.sys_dept_id,
- a.target_arrival_amount
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan` a ON a.sys_dept_id = sd.dept_id
- AND a.is_del = '0'
- WHERE
- sd.del_flag = '0'
- ) s1
- LEFT JOIN bm_project p ON p.dept_id = s1.sys_dept_id
- AND p.is_del = '0'
- and year(p.create_time) = #{year}
- where
- s1.parent_id = 124
- and p.project_status in (1,2,3,4)
- GROUP BY
- s1.dept_id
- ORDER BY
- successMission DESC,
- targetArrivalAmount DESC
- </select>
- <select id="selectTargetSigningList" parameterType="String" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- ifnull(s1.dept_name,'') AS deptName,
- ifnull(s1.target_signing_num,0) AS targetSigningNum,
- ifnull(count( p.id ),0) AS successMission
- FROM
- (
- SELECT
- sd.dept_id,
- sd.dept_name,
- sd.parent_id,
- a.sys_dept_id,
- (ifnull(a.project_million_num,0)+ ifnull(a.project_pro_num,0)+ ifnull(a.project_investment_num,0))as target_signing_num
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan_area` a ON a.sys_dept_id = sd.dept_id and a.is_del = '0'
- where sd.del_flag = '0'
- ) s1
- LEFT JOIN bm_project p ON p.dept_id = s1.sys_dept_id
- and p.is_del = '0' and p.project_status > 4 and year(p.create_time) = #{year}
- where
- s1.parent_id = 105
- GROUP BY
- s1.dept_id
- ORDER BY
- successMission DESC,
- targetSigningNum DESC
- </select>
- <select id="selectTotAmtList" parameterType="String" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- d.dept_name AS deptName,
- ifnull( dp.target_arrival_amount, 0 ) AS targetArrivalAmount,
- ifnull( p.tot_amt, 0 ) AS totAmt
- FROM
- sys_dept d
- LEFT JOIN bm_project p ON p.dept_id = d.dept_id
- AND p.is_del = '0' and year(p.create_time) = #{year}
- LEFT JOIN bm_dept_plan dp ON dp.sys_dept_id = d.dept_id and year(dp.create_time) = #{year}
- WHERE
- d.del_flag = '0'
- and d.parent_id = 124
- GROUP BY
- d.dept_id
- ORDER BY
- targetArrivalAmount DESC,
- totAmt DESC
- </select>
- <select id="selectProjectUnitAmountEharts" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- sd.dept_name AS deptName,
- ifnull( s1.payForMoney, 0 ) AS payForMoney
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan` d ON d.sys_dept_id = sd.dept_id and year(d.create_time) = #{year}
- AND d.is_del = '0'
- LEFT JOIN (
- SELECT
- sum( s.payForMoney ) AS payForMoney,
- s.dept_id
- FROM
- (
- SELECT
- cp.pay_for_money AS payForMoney,
- p.dept_id
- FROM
- bm_project p
- LEFT JOIN bm_construction_pay cp ON cp.bm_project_id = p.id
- AND p.is_del = '0' and year(cp.create_time) = #{year}
- ) s
- GROUP BY
- s.dept_id
- ) s1 ON s1.dept_id = d.sys_dept_id
- WHERE
- sd.del_flag = '0'
- ORDER BY
- s1.payForMoney DESC
- </select>
- <select id="selectProjectUnitAmountUnit" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- sd.dept_name AS deptName,
- ifnull( s1.payForMoney, 0 ) AS payForMoney,
- ifnull(d.target_contract_amount,0) as targetContractAmount
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan` d ON d.sys_dept_id = sd.dept_id
- AND d.is_del = '0' and year(d.create_time) = #{year}
- LEFT JOIN (
- SELECT
- sum( s.payForMoney ) AS payForMoney,
- s.dept_id
- FROM
- (
- SELECT
- cp.pay_for_money AS payForMoney,
- p.dept_id
- FROM
- bm_project p
- LEFT JOIN bm_construction_pay cp ON cp.bm_project_id = p.id
- AND p.is_del = '0' and year(cp.create_time) = #{year}
- ) s
- GROUP BY
- s.dept_id
- ) s1 ON s1.dept_id = d.sys_dept_id
- WHERE
- sd.del_flag = '0'
- and sd.parent_id = 124
- ORDER BY
- s1.payForMoney DESC
- </select>
- <select id="selectProjectAreaAmountUnit" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- ifnull(s1.dept_name,'') AS deptName,
- ifnull(s1.target_signing_num,0) AS targetSigningNum,
- ifnull(count( p.id ),0) AS successMission
- FROM
- (
- SELECT
- sd.dept_id,
- sd.dept_name,
- sd.parent_id,
- a.sys_dept_id,
- (ifnull(a.project_million_num,0)+ ifnull(a.project_pro_num,0)+ ifnull(a.project_investment_num,0))as target_signing_num
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan_area` a ON a.sys_dept_id = sd.dept_id and a.is_del = '0'
- where sd.del_flag = '0'
- ) s1
- LEFT JOIN bm_project p ON p.dept_id = s1.sys_dept_id
- and p.is_del = '0' and p.project_status in (8,9) and year(p.create_time) = #{year}
- where
- s1.parent_id = 105
- GROUP BY
- s1.dept_id
- ORDER BY
- successMission DESC,
- targetSigningNum DESC
- </select>
- <select id="selectInvestmentList" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- d.dept_name AS deptName,
- (ifnull( dp.project_million_num, 0 )+ ifnull( dp.project_pro_num, 0 )+ ifnull( dp.project_investment_num, 0 )) AS targetSigningNum,
- ifnull( count(p.id), 0 ) AS successMission
- FROM
- sys_dept d
- LEFT JOIN bm_project p ON p.dept_id = d.dept_id
- and p.is_del = '0' and p.project_status > 8 and year(p.create_time) = #{year}
- LEFT JOIN bm_dept_plan_area dp ON dp.sys_dept_id = d.dept_id and year(dp.create_time) = #{year}
- where d.del_flag = '0' and d.parent_id = 105
- GROUP BY
- d.dept_id
- order by successMission DESC,
- targetSigningNum DESC
- </select>
- <select id="selectInvestmentCityList" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- sd.dept_name AS deptName,
- ifnull( s1.payForMoney, 0 ) AS payForMoney,
- ifnull( count(p.id), 0 ) AS successMission
- FROM
- sys_dept sd
- LEFT JOIN `bm_project` p ON p.dept_id = sd.dept_id and p.project_status > 8
- AND p.is_del = '0' and year(p.create_time) = #{year}
- LEFT JOIN (
- SELECT
- sum( s.payForMoney ) AS payForMoney,
- s.dept_id
- FROM
- (
- SELECT
- cp.pay_for_money AS payForMoney,
- p.dept_id
- FROM
- bm_project p
- LEFT JOIN bm_construction_pay cp ON cp.bm_project_id = p.id
- AND p.is_del = '0' and year(cp.create_time) = #{year}
- ) s
- GROUP BY
- s.dept_id
- ) s1 ON s1.dept_id = p.dept_id
- WHERE
- sd.del_flag = '0'
- and sd.parent_id = 124
- GROUP BY
- sd.dept_id
- ORDER BY
- s1.payForMoney DESC
- </select>
- <select id="selectProjectInvestmentEharts" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- d.dept_name AS deptName,
- ifnull( count(p.id), 0 ) AS successMission
- FROM
- sys_dept d
- LEFT JOIN bm_project p ON p.dept_id = d.dept_id
- and p.is_del = '0' and p.project_status > 8 and year(p.create_time) = #{year}
- where d.del_flag = '0'
- GROUP BY
- d.dept_id
- ORDER BY successMission
- </select>
- </mapper>
|