jhprjv2/yanzhu-jh/src/main/resources/mapper/project/SurProjectWorkingCommitteeM...

170 lines
9.1 KiB
XML
Raw Normal View History

2024-04-08 23:34:32 +08:00
<?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.SurProjectWorkingCommitteeMapper">
<resultMap type="SurProjectWorkingCommittee" id="SurProjectWorkingCommitteeResult">
<result property="id" column="id" />
<result property="committeeId" column="committeeId" />
<result property="projectId" column="projectId" />
<result property="workingType" column="workingType" />
<result property="costName" column="costName" />
<result property="money" column="money" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
2024-04-10 00:12:56 +08:00
<result property="committeeName" column="committeeName" />
<result property="projectName" column="projectName" />
<result property="typeName" column="typeName" />
2024-07-04 23:54:11 +08:00
<result property="applicationDate" column="applicationDate"/>
2024-04-08 23:34:32 +08:00
</resultMap>
<sql id="selectSurProjectWorkingCommitteeVo">
2024-07-04 23:54:11 +08:00
select id, committeeId, projectId, workingType, costName, money, remark, create_by, create_time, update_by, update_time,applicationDate
2024-04-10 00:12:56 +08:00
from sur_project_working_committee
2024-04-08 23:34:32 +08:00
</sql>
<select id="selectSurProjectWorkingCommitteeList" parameterType="SurProjectWorkingCommittee" resultMap="SurProjectWorkingCommitteeResult">
2024-04-10 00:12:56 +08:00
select * from (
select a.*,b.name as committeeName,c.projectName,d.dict_label as typeName,b.ord,b.create_time ctime
from sur_project_working_committee a, base_working_committee b,sur_project c,sys_dict_data d
where a.committeeId=b.id and a.projectId=c.id and a.workingType=d.dict_value and d.dict_type='project_working_type'
) sur_project_working_committee
2024-04-08 23:34:32 +08:00
<where>
<if test="committeeId != null "> and committeeId = #{committeeId}</if>
<if test="projectId != null "> and projectId = #{projectId}</if>
<if test="workingType != null "> and workingType = #{workingType}</if>
2024-04-10 00:12:56 +08:00
<if test="committeeName != null and committeeName!=''"> and committeeName like concat('%',#{committeeName,jdbcType=VARCHAR},'%')</if>
<if test="projectName != null and projectName !=''"> and projectName like concat('%',#{projectName,jdbcType=VARCHAR},'%')</if>
2024-04-08 23:34:32 +08:00
<if test="costName != null and costName != ''"> and costName like concat('%', #{costName}, '%')</if>
<if test="money != null "> and money = #{money}</if>
</where>
2024-04-10 00:12:56 +08:00
ORDER BY ORD DESC,ctime DESC
2024-04-08 23:34:32 +08:00
</select>
<select id="selectSurProjectWorkingCommitteeById" parameterType="Long" resultMap="SurProjectWorkingCommitteeResult">
<include refid="selectSurProjectWorkingCommitteeVo"/>
where id = #{id}
</select>
<insert id="insertSurProjectWorkingCommittee" parameterType="SurProjectWorkingCommittee" useGeneratedKeys="true" keyProperty="id">
insert into sur_project_working_committee
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="committeeId != null">committeeId,</if>
<if test="projectId != null">projectId,</if>
<if test="workingType != null">workingType,</if>
<if test="costName != null">costName,</if>
<if test="money != null">money,</if>
<if test="remark != null">remark,</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>
2024-07-04 23:54:11 +08:00
<if test="applicationDate != null">applicationDate,</if>
2024-04-08 23:34:32 +08:00
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="committeeId != null">#{committeeId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="workingType != null">#{workingType},</if>
<if test="costName != null">#{costName},</if>
<if test="money != null">#{money},</if>
<if test="remark != null">#{remark},</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>
2024-07-04 23:54:11 +08:00
<if test="applicationDate != null">#{applicationDate},</if>
2024-04-08 23:34:32 +08:00
</trim>
</insert>
<update id="updateSurProjectWorkingCommittee" parameterType="SurProjectWorkingCommittee">
update sur_project_working_committee
<trim prefix="SET" suffixOverrides=",">
<if test="committeeId != null">committeeId = #{committeeId},</if>
<if test="projectId != null">projectId = #{projectId},</if>
<if test="workingType != null">workingType = #{workingType},</if>
<if test="costName != null">costName = #{costName},</if>
<if test="money != null">money = #{money},</if>
<if test="remark != null">remark = #{remark},</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>
2024-07-04 23:54:11 +08:00
<if test="applicationDate != null">applicationDate = #{applicationDate},</if>
2024-04-08 23:34:32 +08:00
</trim>
where id = #{id}
</update>
<delete id="deleteSurProjectWorkingCommitteeById" parameterType="Long">
delete from sur_project_working_committee where id = #{id}
</delete>
<delete id="deleteSurProjectWorkingCommitteeByIds" parameterType="String">
delete from sur_project_working_committee where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
2024-04-14 22:29:50 +08:00
<select id="sumGroupByType" parameterType="SurProjectWorkingCommittee" resultMap="SurProjectWorkingCommitteeResult">
2024-07-01 23:10:46 +08:00
select sum(x.money*10000.0) id, c.dict_value workingType,c.dict_label costName
2024-04-14 22:29:50 +08:00
from (
select a.* from sur_project_working_committee a,sur_project b
where a.projectId=b.id
2024-07-05 23:33:45 +08:00
<if test="createTime!=null "> and a.applicationDate &gt;= #{createTime}</if>
<if test="updateTime!=null "> and a.applicationDate &lt;= #{updateTime}</if>
2024-04-14 22:29:50 +08:00
<if test="committeeId!=null and committeeId!='0' and committeeId &gt; 0">
and a.committeeId=#{committeeId}
</if>
<if test="projectId!=null and projectId>0">
and a.projectId=#{projectId}
</if>
<if test="deptId!=null and deptId>0">
and b.deptId=#{deptId}
</if>
<if test='proType != null and proType != "" and proType != "0"'> and b.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and a.projectId in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) x
right join sys_dict_data c on x.workingtype=c.dict_value
where
c.dict_type='project_working_type'
group by c.dict_value,c.dict_label
</select>
<select id="selectByWorkingType" parameterType="SurProjectWorkingCommittee" resultMap="SurProjectWorkingCommitteeResult">
2024-07-04 23:54:11 +08:00
select a.id,a.costName,a.money,b.projectName remark,a.committeeid,a.workingType,a.projectId,a.create_by,a.create_time,a.update_time,c.name update_by,a.applicationDate
2024-04-14 22:29:50 +08:00
from sur_project_working_committee a,sur_project b ,base_working_committee c
where a.projectId=b.id and a.committeeid=c.id
2024-07-05 23:33:45 +08:00
<if test="createTime!=null "> and a.applicationDate &gt;= #{createTime}</if>
<if test="updateTime!=null "> and a.applicationDate &lt;= #{updateTime}</if>
2024-04-14 22:29:50 +08:00
<if test="committeeId!=null and committeeId!='0' and committeeId &gt; 0">
and a.committeeId=#{committeeId}
</if>
<if test="workingType!=null and workingType!='0' and workingType &gt; 0">
and a.workingType=#{workingType}
</if>
<if test="projectId!=null and projectId>0">
and a.projectId=#{projectId}
</if>
<if test="deptId!=null and deptId>0">
and b.deptId=#{deptId}
</if>
<if test='proType != null and proType != "" and proType != "0"'> and b.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and a.projectId in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by c.ord desc,c.create_time desc
</select>
2024-04-08 23:34:32 +08:00
</mapper>