123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <?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="plan" column="plan" />
- <result property="targetSigningNum" column="target_signing_num" />
- <result property="targetContractAmount" column="target_contract_amount" />
- <result property="targetArrivalAmount" column="target_arrival_amount" />
- <result property="targetInvestmentNum" column="target_investment_num" />
- <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, plan, target_signing_num, target_contract_amount, target_arrival_amount, target_investment_num 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.plan, p.target_signing_num, p.target_contract_amount, p.target_arrival_amount, p.target_investment_num, 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>
- <if test="sysDeptId != null "> and sys_dept_id = #{sysDeptId}</if>
- <if test="isDel != null "> and is_del = #{isDel}</if>
- <if test="year != null and year != ''"> and year = #{year}</if>
- <if test="plan != null "> and plan = #{plan}</if>
- <if test="targetSigningNum != null "> and target_signing_num = #{targetSigningNum}</if>
- <if test="targetContractAmount != null "> and target_contract_amount = #{targetContractAmount}</if>
- <if test="targetArrivalAmount != null "> and target_arrival_amount = #{targetArrivalAmount}</if>
- <if test="targetInvestmentNum != null "> and target_investment_num = #{targetInvestmentNum}</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="plan != null">plan,</if>
- <if test="targetSigningNum != null">target_signing_num,</if>
- <if test="targetContractAmount != null">target_contract_amount,</if>
- <if test="targetArrivalAmount != null">target_arrival_amount,</if>
- <if test="targetInvestmentNum != null">target_investment_num,</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="plan != null">#{plan},</if>
- <if test="targetSigningNum != null">#{targetSigningNum},</if>
- <if test="targetContractAmount != null">#{targetContractAmount},</if>
- <if test="targetArrivalAmount != null">#{targetArrivalAmount},</if>
- <if test="targetInvestmentNum != null">#{targetInvestmentNum},</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="plan != null">plan = #{plan},</if>
- <if test="targetSigningNum != null">target_signing_num = #{targetSigningNum},</if>
- <if test="targetContractAmount != null">target_contract_amount = #{targetContractAmount},</if>
- <if test="targetArrivalAmount != null">target_arrival_amount = #{targetArrivalAmount},</if>
- <if test="targetInvestmentNum != null">target_investment_num = #{targetInvestmentNum},</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" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- ifnull(s1.dept_name,'') AS deptName,
- ifnull(s1.plan,0) AS targetInvestmentNum,
- ifnull(count( p.id ),0) AS successMission
- FROM
- (
- SELECT
- sd.dept_name,
- d.sys_dept_id,
- d.plan
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan` d ON d.sys_dept_id = sd.dept_id and d.is_del = '0' and sd.del_flag = '0'
- ) s1
- LEFT JOIN bm_project p ON p.dept_id = s1.sys_dept_id and p.is_del = '0'
- GROUP BY
- s1.sys_dept_id
- ORDER BY
- successMission DESC,
- targetInvestmentNum DESC
- </select>
- <select id="selectUnitAmountList" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- sd.dept_name AS deptName,
- ifnull(d.target_arrival_amount,0) AS targetArrivalAmount,
- 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 sd.del_flag = '0'
- 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'
- ) s
- GROUP BY
- s.dept_id
- ) s1 ON s1.dept_id = d.sys_dept_id
- ORDER BY
- s1.payForMoney DESC,
- d.target_arrival_amount DESC
- </select>
- <select id="selectUnitClueList" 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_name,
- d.sys_dept_id,
- d.plan
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan` d ON d.sys_dept_id = sd.dept_id and d.is_del = '0' and sd.del_flag = '0'
- ) s1
- LEFT JOIN bm_project p ON p.dept_id = s1.sys_dept_id and p.is_del = '0'
- GROUP BY
- s1.sys_dept_id
- ORDER BY
- successMission DESC,
- plan DESC
- </select>
- <select id="selectTargetSigningList" 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_name,
- d.sys_dept_id,
- d.target_signing_num
- FROM
- sys_dept sd
- LEFT JOIN `bm_dept_plan` d ON d.sys_dept_id = sd.dept_id and d.is_del = '0' and 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
- GROUP BY
- s1.sys_dept_id
- ORDER BY
- successMission DESC,
- targetSigningNum DESC
- </select>
- <select id="selectTotAmtList" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- d.dept_name as deptName,
- ifnull(dp.target_contract_amount,0) as targetContractAmount,
- ifnull(p.tot_amt,0) as totAmt
- FROM
- sys_dept d
- LEFT JOIN bm_project p ON p.dept_id = d.dept_id
- AND d.del_flag = '0' and p.is_del = '0'
- LEFT JOIN bm_dept_plan dp ON dp.sys_dept_id = d.dept_id
- GROUP BY d.dept_id
- </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 sd.del_flag = '0'
- 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
- ORDER BY
- s1.payForMoney DESC
- </select>
- <select id="selectInvestmentList" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
- SELECT
- d.dept_name AS deptName,
- ifnull( dp.target_investment_num, 0 ) AS targetInvestmentNum,
- ifnull( count(p.id), 0 ) AS successMission
- FROM
- sys_dept d
- LEFT JOIN bm_project p ON p.dept_id = d.dept_id
- AND d.del_flag = '0' and p.is_del = '0' and p.project_status > 8
- LEFT JOIN bm_dept_plan dp ON dp.sys_dept_id = d.dept_id
- GROUP BY
- d.dept_id
- order by successMission DESC,
- targetInvestmentNum 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 d.del_flag = '0' and p.is_del = '0' and p.project_status > 8 and year(p.create_time) = #{year}
- LEFT JOIN bm_dept_plan dp ON dp.sys_dept_id = d.dept_id
- GROUP BY
- d.dept_id
- </select>
- </mapper>
|