292 lines
14 KiB
XML
292 lines
14 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.yanzhu.jh.project.mapper.SurProjectCostOutputMapper">
|
|
|
|
<resultMap type="SurProjectCostOutput" id="SurProjectCostOutputResult">
|
|
<result property="id" column="id" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="money" column="money" />
|
|
<result property="year" column="year" />
|
|
<result property="month" column="month" />
|
|
<result property="costType" column="cost_type" />
|
|
<result property="remark" column="remark" />
|
|
<result property="isDel" column="is_del" />
|
|
<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="money2" column="money2" />
|
|
<result property="date1" column="date1" />
|
|
<result property="date2" column="date2" />
|
|
</resultMap>
|
|
|
|
<sql id="selectSurProjectCostOutputVo">
|
|
select id, project_id, money, year, month, cost_type, remark, is_del, create_by, create_time, update_by, update_time,money2,date1,date2 from sur_project_cost_output
|
|
</sql>
|
|
|
|
<select id="selectSurProjectCostOutputList" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult">
|
|
<include refid="selectSurProjectCostOutputVo"/>
|
|
<where>
|
|
<if test="projectId != null "> and project_id = #{projectId}</if>
|
|
<if test="money != null "> and money = #{money}</if>
|
|
<if test="year != null "> and year = #{year}</if>
|
|
<if test="month != null "> and month = #{month}</if>
|
|
<if test="costType != null "> and cost_type = #{costType}</if>
|
|
<if test="isDel != null "> and is_del = #{isDel}</if>
|
|
<if test="money2 != null "> and money2 = #{money2}</if>
|
|
<if test="date1 != null "> and date1 = #{date1}</if>
|
|
<if test="date2 != null "> and date2 = #{date2}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectSurProjectCostOutputById" parameterType="Long" resultMap="SurProjectCostOutputResult">
|
|
<include refid="selectSurProjectCostOutputVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertSurProjectCostOutput" parameterType="SurProjectCostOutput" useGeneratedKeys="true" keyProperty="id">
|
|
insert into sur_project_cost_output
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="money != null">money,</if>
|
|
<if test="year != null">year,</if>
|
|
<if test="month != null">month,</if>
|
|
<if test="costType != null">cost_type,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="isDel != null">is_del,</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="money2 != null">money2,</if>
|
|
<if test="date1 != null">date1,</if>
|
|
<if test="date2 != null">date2,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="money != null">#{money},</if>
|
|
<if test="year != null">#{year},</if>
|
|
<if test="month != null">#{month},</if>
|
|
<if test="costType != null">#{costType},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="isDel != null">#{isDel},</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="money2 != null">#{money2},</if>
|
|
<if test="date1 != null">#{date1},</if>
|
|
<if test="date2 != null">#{date2},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateSurProjectCostOutput" parameterType="SurProjectCostOutput">
|
|
update sur_project_cost_output
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="projectId != null">project_id = #{projectId},</if>
|
|
<if test="money != null">money = #{money},</if>
|
|
<if test="year != null">year = #{year},</if>
|
|
<if test="month != null">month = #{month},</if>
|
|
<if test="costType != null">cost_type = #{costType},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="isDel != null">is_del = #{isDel},</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="money2 != null">money2 = #{money2},</if>
|
|
<if test="date1 != null">date1 = #{date1},</if>
|
|
<if test="date2 != null">date2 = #{date2},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteSurProjectCostOutputById" parameterType="Long">
|
|
delete from sur_project_cost_output where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteSurProjectCostOutputByIds" parameterType="String">
|
|
delete from sur_project_cost_output where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectYearAndMonth" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult">
|
|
SELECT *
|
|
FROM sur_project_cost_output
|
|
WHERE project_id = #{projectId}
|
|
and (
|
|
(YEAR=#{year} AND cost_type=2) OR cost_type NOT IN (2, 9)
|
|
OR (cost_type = 9 AND YEAR = #{year} AND MONTH <= #{month})
|
|
OR (cost_type = 9 AND YEAR < #{year})
|
|
)
|
|
</select>
|
|
|
|
<select id="sumByDeptId" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult">
|
|
|
|
SELECT 10 cost_type , SUM(spco.money) money FROM sur_project_cost_output spco
|
|
left join sur_project sp on sp.id = spco.project_id
|
|
WHERE spco.cost_type=9 AND (spco.YEAR <#{year} or ( spco.Year =#{year} and spco.MONTH <= #{month})) and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and spco.project_id=#{projectId}
|
|
</if>
|
|
|
|
UNION
|
|
|
|
SELECT 2 cost_type , SUM(spco.money) money FROM sur_project_cost_output spco
|
|
left join sur_project sp on sp.id = spco.project_id
|
|
WHERE (spco.cost_type=9 AND spco.YEAR=#{year} AND spco.MONTH <= #{month} )
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and spco.project_id=#{projectId}
|
|
</if>
|
|
UNION
|
|
|
|
SELECT 9 cost_type , SUM(spco.money) money FROM sur_project_cost_output spco
|
|
left join sur_project sp on sp.id = spco.project_id
|
|
WHERE (spco.cost_type=9 AND spco.YEAR=#{year} AND spco.MONTH= #{month} )
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and spco.project_id=#{projectId}
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
<select id="sumForBsEnginAuditing" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult">
|
|
select 1 cost_type,sum(money) money,'合同总金额' remark
|
|
from sur_project_cost_output a,sur_project sp
|
|
where a.project_id=sp.id and a.cost_type=3
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and a.project_id=#{projectId}
|
|
</if>
|
|
<if test="prjIds !=null and prjIds.size()>0">
|
|
and a.project_id in
|
|
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
union
|
|
|
|
|
|
SELECT 2 cost_type,SUM(money) money,'建安费总金额' remark
|
|
FROM sur_project_cost_output a,sur_project sp
|
|
WHERE a.project_id=sp.id AND a.cost_type=10
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and a.project_id=#{projectId}
|
|
</if>
|
|
|
|
<if test="prjIds !=null and prjIds.size()>0">
|
|
and a.project_id in
|
|
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
|
|
union
|
|
|
|
SELECT 3 cost_type,SUM(money2) money,'总计付款' remark
|
|
FROM sur_project_cost_output a,sur_project sp
|
|
WHERE a.project_id=sp.id AND a.cost_type in (11,12)
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and a.project_id=#{projectId}
|
|
</if>
|
|
|
|
<if test="prjIds !=null and prjIds.size()>0">
|
|
and a.project_id in
|
|
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
|
|
union
|
|
|
|
SELECT 4 cost_type,SUM(money2) money,'进度款已支付' remark
|
|
FROM sur_project_cost_output a,sur_project sp
|
|
WHERE a.project_id=sp.id AND a.cost_type in (11)
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and a.project_id=#{projectId}
|
|
</if>
|
|
|
|
<if test="prjIds !=null and prjIds.size()>0">
|
|
and a.project_id in
|
|
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
|
|
union
|
|
SELECT 5 cost_type,SUM(money2) money,'安措费已支付' remark
|
|
FROM sur_project_cost_output a,sur_project sp
|
|
WHERE a.project_id=sp.id AND a.cost_type IN (12)
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and a.project_id=#{projectId}
|
|
</if>
|
|
<if test="prjIds !=null and prjIds.size()>0">
|
|
and a.project_id in
|
|
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
|
|
union
|
|
SELECT 6 cost_type,SUM(money-money2) money,'挂账总金额' remark
|
|
FROM sur_project_cost_output a,sur_project sp
|
|
WHERE a.project_id=sp.id AND a.cost_type IN (11,12)
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and a.project_id=#{projectId}
|
|
</if>
|
|
<if test="prjIds !=null and prjIds.size()>0">
|
|
and a.project_id in
|
|
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
|
|
</select>
|
|
<select id="selectForBigEnginList" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult">
|
|
SELECT a.id, a.project_id, a.money, a.year, a.month, a.cost_type, sp.projectName remark, a.is_del, a.create_by, a.create_time, a.update_by, a.update_time,a.money2,a.date1,a.date2
|
|
FROM sur_project_cost_output a,sur_project sp
|
|
WHERE a.project_id=sp.id AND a.cost_type IN (11,12)
|
|
and sp.isDel=0 and sp.progressVisible=0
|
|
<if test="id!=null and id>0"> and sp.deptId = #{id}</if>
|
|
<if test="proType != null and proType != ''"> and sp.projectType = #{proType}</if>
|
|
<if test="projectId!=null and projectId>0">
|
|
and a.project_id=#{projectId}
|
|
</if>
|
|
<if test="prjIds !=null and prjIds.size()>0">
|
|
and a.project_id in
|
|
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY a.create_time
|
|
</select>
|
|
</mapper> |