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

170 lines
10 KiB
XML
Raw Normal View History

2023-08-22 14:02:51 +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.SurProjectMaterialSealMapper">
<resultMap type="SurProjectMaterialSeal" id="SurProjectMaterialSealResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="projectName" column="projectName" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="mainImage" column="main_image" />
2023-08-22 18:09:42 +08:00
<result property="imageUrls" column="image_urls" />
2023-08-22 14:02:51 +08:00
<result property="materialName" column="material_name" />
<result property="usePosition" column="use_position" />
<result property="contractBrand" column="contract_brand" />
<result property="useBrand" column="use_brand" />
<result property="sealDate" column="seal_date" />
<result property="signFiles" column="sign_files" />
<result property="alterationFiles" column="alteration_files" />
<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="remark" column="remark" />
</resultMap>
<sql id="selectSurProjectMaterialSealVo">
2023-08-22 18:09:42 +08:00
select spme.id, spme.project_id, spme.dept_id, spme.main_image, spme.image_urls, spme.material_name, spme.use_position, spme.contract_brand, spme.use_brand, spme.seal_date, spme.sign_files, spme.alteration_files, spme.is_del, spme.create_by, spme.create_time, spme.update_by, spme.update_time, spme.remark, sp.projectName, sd.dept_name from sur_project_material_seal spme
2023-08-22 14:02:51 +08:00
left join sur_project sp on spme.project_id = sp.id
left join sys_dept sd on sd.dept_id = spme.dept_id
</sql>
<select id="selectSurProjectMaterialSealList" parameterType="SurProjectMaterialSeal" resultMap="SurProjectMaterialSealResult">
<include refid="selectSurProjectMaterialSealVo"/>
<!--监理单位/总包公司/分包单位-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> left join sur_project_unit_info spui on spui.projectId = sp.id</if>
<!--普通用户查询项目人员-->
<if test='nowRole == "99"'> left join sur_project_userinfo spu on spu.project_id = sp.id</if>
<where>
and spme.is_del='0'
<if test="projectId != null "> and spme.project_id = #{projectId}</if>
<if test="deptId != null "> and spme.dept_id = #{deptId}</if>
2023-08-22 18:09:42 +08:00
<if test="imageUrls != null and imageUrls != ''"> and spme.image_urls = #{imageUrls}</if>
2023-08-22 14:02:51 +08:00
<if test="materialName != null and materialName != ''"> and spme.material_name like concat('%', #{materialName}, '%')</if>
<if test="usePosition != null and usePosition != ''"> and spme.use_position like concat('%', #{usePosition}, '%')</if>
<if test="contractBrand != null and contractBrand != ''"> and spme.contract_brand like concat('%', #{contractBrand}, '%')</if>
<if test="useBrand != null and useBrand != ''"> and spme.use_brand like concat('%', #{useBrand}, '%')</if>
<if test="params.beginSealDate != null and params.beginSealDate != '' and params.endSealDate != null and params.endSealDate != ''"> and spme.seal_date between #{params.beginSealDate} and #{params.endSealDate}</if>
<if test="isDel != null and isDel != ''"> and spme.is_del = #{isDel}</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and spui.unitId = #{nowDept}</if>
<!--普通用户查询项目人员-->
<if test='nowRole == "99"'> and spu.user_id = #{nowUser} and spu.is_del=0</if>
</where>
</select>
2023-09-03 14:07:36 +08:00
<select id="findGroupCountByProjectId" parameterType="Long" resultType="map">
SELECT
use_position AS type,
count(1) total
FROM
sur_project_material_seal
where is_del=0
and project_id=1
GROUP BY
use_position
</select>
2023-08-22 14:02:51 +08:00
<select id="selectSurProjectMaterialSealById" parameterType="Long" resultMap="SurProjectMaterialSealResult">
<include refid="selectSurProjectMaterialSealVo"/>
2023-08-22 18:09:42 +08:00
where spme.id = #{id}
2023-08-22 14:02:51 +08:00
</select>
<insert id="insertSurProjectMaterialSeal" parameterType="SurProjectMaterialSeal" useGeneratedKeys="true" keyProperty="id">
insert into sur_project_material_seal
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">project_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="mainImage != null">main_image,</if>
2023-08-22 18:09:42 +08:00
<if test="imageUrls != null">image_urls,</if>
2023-08-22 14:02:51 +08:00
<if test="materialName != null">material_name,</if>
<if test="usePosition != null">use_position,</if>
<if test="contractBrand != null">contract_brand,</if>
<if test="useBrand != null">use_brand,</if>
<if test="sealDate != null">seal_date,</if>
<if test="signFiles != null">sign_files,</if>
<if test="alterationFiles != null">alteration_files,</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="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="mainImage != null">#{mainImage},</if>
2023-08-22 18:09:42 +08:00
<if test="imageUrls != null">#{imageUrls},</if>
2023-08-22 14:02:51 +08:00
<if test="materialName != null">#{materialName},</if>
<if test="usePosition != null">#{usePosition},</if>
<if test="contractBrand != null">#{contractBrand},</if>
<if test="useBrand != null">#{useBrand},</if>
<if test="sealDate != null">#{sealDate},</if>
<if test="signFiles != null">#{signFiles},</if>
<if test="alterationFiles != null">#{alterationFiles},</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="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSurProjectMaterialSeal" parameterType="SurProjectMaterialSeal">
update sur_project_material_seal
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="mainImage != null">main_image = #{mainImage},</if>
2023-08-22 18:09:42 +08:00
<if test="imageUrls != null">image_urls = #{imageUrls},</if>
2023-08-22 14:02:51 +08:00
<if test="materialName != null">material_name = #{materialName},</if>
<if test="usePosition != null">use_position = #{usePosition},</if>
<if test="contractBrand != null">contract_brand = #{contractBrand},</if>
<if test="useBrand != null">use_brand = #{useBrand},</if>
<if test="sealDate != null">seal_date = #{sealDate},</if>
<if test="signFiles != null">sign_files = #{signFiles},</if>
<if test="alterationFiles != null">alteration_files = #{alterationFiles},</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="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSurProjectMaterialSealById" parameterType="Long">
delete from sur_project_material_seal where id = #{id}
</delete>
<delete id="deleteSurProjectMaterialSealByIds" parameterType="String">
delete from sur_project_material_seal where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
2023-08-27 11:00:00 +08:00
<select id="selectTop20" parameterType="SurProjectMaterialSeal" resultMap="SurProjectMaterialSealResult">
select spme.id, spme.project_id, spme.dept_id, spme.main_image, spme.image_urls, spme.material_name, spme.use_position, spme.contract_brand, spme.use_brand, spme.seal_date, spme.sign_files, spme.alteration_files, spme.is_del, spme.create_by, spme.create_time, spme.update_by, spme.update_time, spme.remark, sp.projectName, sd.dept_name
from (
select * from sur_project_material_seal spme
where if(spme.is_del is null,0,spme.is_del)=0
<if test="deptId!=null and deptId>0"> and spme.project_id in (SELECT id FROM sur_project WHERE deptid=#{deptId}) </if>
<if test="projectId!=null and projectId>0">and spme.project_id = #{projectId}</if>
) spme
left join sur_project sp on spme.project_id = sp.id
left join sys_dept sd on sd.dept_id = spme.dept_id
order by spme.create_time desc
LIMIT 0,20
</select>
2023-08-22 14:02:51 +08:00
</mapper>