jhprjv2/ruoyi-wechat/src/main/resources/mapper/PshMarksMapper.xml

419 lines
21 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.ruoyi.web.pshMarks.mapper.PshMarksMapper">
<resultMap type="com.ruoyi.web.sspMarks.domain.SspMarks" id="SspMarksResult">
<result property="id" column="id" />
<result property="marksLocation" column="marks_location" />
<result property="marksTime" column="marksTime" />
<result property="marksPicture" column="marks_picture" />
<result property="marksVideo" column="marks_video" />
<result property="projectType" column="project_type" />
<result property="processName" column="process_name" />
<result property="positionPart" column="position_part" />
<result property="marksRemark" column="marks_remark" />
<result property="auditorPerson" column="auditor_person" />
<result property="auditorPhone" column="auditorPhone" />
<result property="checkState" column="checkState" />
<result property="createDate" column="createDate" />
<result property="createUser" column="create_user" />
<result property="projectId" column="projectId" />
<result property="projectName" column="project_name" />
<result property="idcardnum" column="idcardnum" />
<result property="infoType" column="infoType" />
<result property="smarkUrl" column="smark_url" />
<result property="engineeringName" column="engineeringName" />
<result property="procedure" column="procedure" />
<result property="synchronization" column="synchronization" />
<result property="typeOfProject" column="projectType" />
<result property="name" column="pointName" />
</resultMap>
<sql id="selectSspMarksVo">
select id, marks_location, marks_time, marks_picture, marks_video,
project_type, process_name, position_part, marks_remark,
auditor_person, create_date, create_user, auditorPhone,checkState, projectId,project_name from smz_ssp_marks
</sql>
<!--查询留痕上报列表-->
<select id="selectSspMarksList" parameterType="com.ruoyi.web.sspMarks.domain.SspMarks" resultMap="SspMarksResult">
SELECT
s.id,
s.marks_location ,
DATE_FORMAT(s.marks_time,'%Y-%m-%d %H:%i:%s') as "marksTime",
s.marks_picture ,
s.marks_video ,
s.project_type,
s.process_name ,
s.position_part ,
s.marks_remark ,
s.auditor_person ,
s.auditorPhone ,
s.checkState,
s.projectId,
s.project_name ,
t.project_type projectType ,
p.name as "procedure",
w.name as "engineeringName",
s.idcardnum,
s.infoType,
s.smark_url,
DATE_FORMAT(s.create_date,'%Y-%m-%d %H:%i:%s') as "createDate",
f.id as "mainId",
s.synchronization,
IFNULL(w.NAME, '') pointName
FROM
smz_ssp_marks s LEFT JOIN smz_project_type t on s.project_type = t.id
LEFT JOIN smz_process_name p on p.id = s.process_name
LEFT JOIN smz_work_area w ON w.CODE = s.project_name
left join smz_ssp_marksflow f on f.mainId = s.id
<where>
<if test="id != null and id != ''"> and s.id = #{id}</if>
<if test="marksLocation != null and marksLocation != ''"> and s.marks_location = #{marksLocation}</if>
<if test="marksTime != null and marksTime != ''"> and s.marks_time = #{marksTime}</if>
<if test="marksPicture != null and marksPicture != ''"> and s.marks_picture = #{marksPicture}</if>
<if test="marksVideo != null and marksVideo != ''"> and s.marks_video = #{marksVideo}</if>
<if test="projectType != null and projectType != ''"> and s.project_type = #{projectType}</if>
<if test="processName != null and processName != ''"> and s.process_name = #{processName}</if>
<if test="positionPart != null and positionPart != ''"> and s.position_part = #{positionPart}</if>
<if test="marksRemark != null and marksRemark != ''"> and s.marks_remark = #{marksRemark}</if>
<if test="auditorPerson != null and auditorPerson != ''"> and s.auditor_person = #{auditorPerson}</if>
<if test="createUser != null and createUser != ''"> and s.create_user = #{createUser}</if>
<if test="projectId != null and projectId != ''"> and s.projectId = #{projectId}</if>
<if test="startTime != null and startTime != ''"> AND Date(s.create_date) >= #{startTime} </if>
<if test="endTime != null and endTime != ''"> AND #{endTime} >= Date(s.create_date) </if>
<if test="beginDate != null and beginDate != ''"> AND Date(s.marks_time) >= #{beginDate} </if>
<if test="endDate != null and endDate != ''"> AND #{endDate} >= Date(s.marks_time) </if>
<if test="checkState != null and checkState != ''"> AND s.checkState = #{checkState} </if>
and s.infoType = 0
and s.is_del = 0
</where>
order by s.create_date desc
<if test="size != null and size != ''">
limit #{nowPage},#{size}
</if>
</select>
<!--查询留痕上报列表-->
<select id="queryByCheckState" parameterType="map" resultMap="SspMarksResult">
SELECT
s.id,
s.marks_location ,
s. marks_time ,
s.marks_picture ,
s.marks_video ,
s.project_type,
s.process_name ,
s.position_part ,
s.marks_remark ,
s.auditor_person ,
s.auditorPhone ,
s.checkState,
s.projectId,
s.project_name ,
t.project_type ,
p.name,
i.name,
s.idcardnum,
s.infoType,
s.smark_url,
DATE_FORMAT(s.create_date,'%Y-%m-%d %H:%i:%s') as "createDate",
f.id as "mainId",
IFNULL(w.NAME, '') pointName
FROM
smz_ssp_marks s LEFT JOIN smz_project_type t on s.project_type = t.id
LEFT JOIN smz_process_name p on p.id = s.process_name
LEFT JOIN smz_progress_info i on i.code = s.project_name
left join smz_ssp_marksflow f on f.mainId = s.id
LEFT JOIN smz_work_area w ON s.project_name = w.CODE
<where>
1 = 1
and s.infoType = 0
<!-- <if test="startTime != null and startTime != ''"> AND Date(s.create_date) >= #{startTime} </if>
<if test="endTime != null and endTime != ''"> AND #{endTime} >= Date(s.create_date) </if>-->
<if test="positionPart != null and positionPart != ''"> and s.position_part = #{positionPart}</if>
<if test="checkState != null and checkState != ''"> and s.checkState = #{checkState}</if>
<if test="projectId != null and projectId != ''"> and s.projectId = #{projectId}</if>
</where>
</select>
<select id="selectSspMarksById" parameterType="Integer" resultMap="SspMarksResult">
<include refid="selectSspMarksVo"/>
where id = #{id}
</select>
<insert id="insertSspMarks" parameterType="com.ruoyi.web.sspMarks.domain.SspMarks">
insert into smz_ssp_marks
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != '' ">id, </if>
<if test="marksLocation != null and marksLocation != '' ">marks_location, </if>
<if test="marksTime != null and marksTime != '' ">marks_time, </if>
<if test="marksPicture != null and marksPicture != '' ">marks_picture, </if>
<if test="marksVideo != null and marksVideo != '' ">marks_video, </if>
<if test="projectType != null and projectType != '' ">project_type, </if>
<if test="processName != null and processName != '' ">process_name, </if>
<if test="positionPart != null and positionPart != '' ">position_part, </if>
<if test="marksRemark != null and marksRemark != '' ">marks_remark, </if>
<if test="auditorPerson != null and auditorPerson != '' ">auditor_person, </if>
<if test="createDate != null and createDate != '' ">create_date, </if>
<if test="createUser != null and createUser != '' ">create_user, </if>
<if test="projectId != null and projectId != '' ">projectId,</if>
project_name,
checkState,
auditorPhone,
infoType,
is_del
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id}, </if>
<if test="marksLocation != null and marksLocation != ''">#{marksLocation}, </if>
<if test="marksTime != null and marksTime != ''">#{marksTime}, </if>
<if test="marksPicture != null and marksPicture != ''">#{marksPicture}, </if>
<if test="marksVideo != null and marksVideo != ''">#{marksVideo}, </if>
<if test="projectType != null and projectType != ''">#{projectType}, </if>
<if test="processName != null and processName != ''">#{processName}, </if>
<if test="positionPart != null and positionPart != ''">#{positionPart}, </if>
<if test="marksRemark != null and marksRemark != ''">#{marksRemark}, </if>
<if test="auditorPerson != null and auditorPerson != ''">#{auditorPerson}, </if>
<if test="createDate != null and createDate != ''">#{createDate}, </if>
<if test="createUser != null and createUser != ''">#{createUser}, </if>
<if test="projectId != null and projectId != ''">#{projectId},</if>
#{projectName},
#{checkState},
#{auditorPhone},
0,
0
</trim>
</insert>
<update id="updateSspMarks" parameterType="com.ruoyi.web.sspMarks.domain.SspMarks">
update smz_ssp_marks
<trim prefix="SET" suffixOverrides=",">
<if test="marksLocation != null and marksLocation != ''">marks_location = #{marksLocation}, </if>
<if test="marksTime != null and marksTime != ''">marks_time = #{marksTime}, </if>
<if test="marksPicture != null and marksPicture != ''">marks_picture = #{marksPicture}, </if>
<if test="marksVideo != null and marksVideo != ''">marks_video = #{marksVideo}, </if>
<if test="projectType != null and projectType != ''">project_type = #{projectType}, </if>
<if test="processName != null and processName != ''">process_name = #{processName}, </if>
<if test="positionPart != null and positionPart != ''">position_part = #{positionPart}, </if>
<if test="marksRemark != null and marksRemark != ''">marks_remark = #{marksRemark}, </if>
<if test="auditorPerson != null and auditorPerson != ''">auditor_person = #{auditorPerson}, </if>
<if test="createDate != null and createDate != ''">create_date = #{createDate}, </if>
<if test="createUser != null and createUser != ''">create_user = #{createUser}, </if>
<if test="projectId != null and projectId != ''">projectId = #{projectId},</if>
<if test="projectName != null and projectName != ''">project_name = #{projectName},</if>
<if test="auditorPhone != null and auditorPhone != ''">auditorPhone = #{auditorPhone},</if>
<if test="checkState != null and checkState != ''">checkState = #{checkState},</if>
<if test="smarkUrl != null and smarkUrl != ''">smark_url = #{smarkUrl},</if>
<if test="surveyorName != null and surveyorName != ''">surveyorName = #{surveyorName},</if>
<if test="surveyorId != null and surveyorId != ''">surveyorId = #{surveyorId},</if>
<if test="surveyorTime != null and surveyorTime != ''">surveyorTime = #{surveyorTime},</if>
<if test="surveyorContent != null and surveyorContent != ''">surveyorContent = #{surveyorContent}</if>
<if test="updateDate != null">update_date = #{updateDate}</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSspMarksById" parameterType="Integer">
delete from smz_ssp_marks where id = #{id}
</delete>
<delete id="deleteSspMarksByIds" parameterType="String">
delete from smz_ssp_marks where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!--新增留痕上报-->
<insert id="addSspMarks" parameterType="com.ruoyi.web.sspMarks.domain.SspMarks" >
insert into smz_ssp_marks
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != '' ">id, </if>
<if test="marksLocation != null and marksLocation != '' ">marks_location, </if>
<if test="marksTime != null and marksTime != '' ">marks_time, </if>
<if test="projectType != null and projectType != '' ">project_type, </if>
<if test="processName != null and processName != '' ">process_name, </if>
<if test="positionPart != null and positionPart != '' ">position_part, </if>
<if test="marksRemark != null and marksRemark != '' ">marks_remark, </if>
<if test="auditorPerson != null and auditorPerson != '' ">auditor_person, </if>
create_date,
<if test="createUser != null and createUser != '' ">create_user, </if>
<if test="projectId != null and projectId != '' ">projectId,</if>
<if test="projectName != null and projectName != '' ">project_name,</if>
checkState,
<if test="auditorPhone != null and auditorPhone != '' ">auditorPhone,</if>
<if test="idcardnum != null and idcardnum != '' ">idcardnum,</if>
infoType,
is_del
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id}, </if>
<if test="marksLocation != null and marksLocation != ''">#{marksLocation}, </if>
<if test="marksTime != null and marksTime != ''">#{marksTime}, </if>
<if test="projectType != null and projectType != ''">#{projectType}, </if>
<if test="processName != null and processName != ''">#{processName}, </if>
<if test="positionPart != null and positionPart != ''">#{positionPart}, </if>
<if test="marksRemark != null and marksRemark != ''">#{marksRemark}, </if>
<if test="auditorPerson != null and auditorPerson != ''">#{auditorPerson}, </if>
NOW(),
<if test="createUser != null and createUser != ''">#{createUser}, </if>
<if test="projectId != null and projectId != ''">#{projectId},</if>
<if test="projectName != null and projectName != ''">#{projectName},</if>
0,
<if test="auditorPhone != null and auditorPhone != ''">#{auditorPhone},</if>
<if test="idcardnum != null and idcardnum != ''">#{idcardnum},</if>
0,
0
</trim>
</insert>
<!-- 根据id查询相关的文件 -->
<select id="queryPicture" parameterType="com.ruoyi.web.sspMarks.domain.SspMarkfileinfo" resultType="com.ruoyi.web.sspMarks.domain.SspMarkfileinfo">
SELECT
fileUrl
FROM
smz_ssp_markfileinfo
WHERE
externalId = #{mainId}
AND fileType = 0
</select>
<!-- 根据id查询相关的文件 -->
<select id="queryVideo" parameterType="com.ruoyi.web.sspMarks.domain.SspMarkfileinfo" resultType="com.ruoyi.web.sspMarks.domain.SspMarkfileinfo">
SELECT
fileUrl
FROM
smz_ssp_markfileinfo
WHERE
externalId = #{mainId}
AND fileType = 1
</select>
<!-- 根据id查询相关的文件 -->
<select id="queryPictureUrl" parameterType="com.ruoyi.web.sspMarks.domain.SspMarkfileinfo" resultType="com.ruoyi.web.sspMarks.domain.SspMarkfileinfo">
SELECT
fileUrl
FROM
smz_ssp_markfileinfo
WHERE
externalId = #{externalId}
AND fileType = 0
</select>
<!-- 根据id查询相关的文件 -->
<select id="queryVideoUrl" parameterType="com.ruoyi.web.sspMarks.domain.SspMarkfileinfo" resultType="com.ruoyi.web.sspMarks.domain.SspMarkfileinfo">
SELECT
fileUrl
FROM
smz_ssp_markfileinfo
WHERE
externalId = #{externalId}
AND fileType = 1
</select>
<update id="updatePicture" parameterType="map">
update smz_ssp_marks
<trim prefix="SET" suffixOverrides=",">
marks_picture = #{picture}
</trim>
where id = #{id}
</update>
<update id="updateVideo" parameterType="map">
update smz_ssp_marks
<trim prefix="SET" suffixOverrides=",">
marks_video = #{video}
</trim>
where id = #{id}
</update>
<update id="updateSmarkUrl" parameterType="map">
update smz_ssp_marks
<trim prefix="SET" suffixOverrides=",">
smark_url = #{smarkUrl}
</trim>
where id = #{id}
</update>
<!--根据id查询-->
<select id="queryById" parameterType="String" resultMap="SspMarksResult">
SELECT
s.id,
s.marks_location ,
s. marks_time ,
s.marks_picture ,
s.marks_video ,
s.project_type,
s.process_name ,
s.position_part ,
s.marks_remark ,
s.auditor_person ,
s.auditorPhone ,
s.checkState,
s.projectId,
s.project_name ,
t.project_type ,
p.name,
i.name,
s.idcardnum,
s.infoType,
s.smark_url,
DATE_FORMAT(s.create_date,'%Y-%m-%d %H:%i:%s') as "createDate",
f.id as "mainId"
FROM
smz_ssp_marks s LEFT JOIN smz_project_type t on s.project_type = t.id
LEFT JOIN smz_process_name p on p.id = s.process_name
LEFT JOIN smz_progress_info i on i.code = s.project_name
left join smz_ssp_marksflow f on f.mainId = s.id
where s.id = #{id}
</select>
<insert id="insertSspQualityMark" parameterType="java.util.Map" useGeneratedKeys ="true" keyProperty="markId" keyColumn="mark_id">
INSERT INTO `smz_ssp_quality_mark`(
<if test="projectId != null and projectId != ''">project_id,</if>
<if test="workTime != null and workTime != ''">work_time,</if>
<if test="beforeImgs != null and beforeImgs != ''">before_imgs,</if>
<if test="afterImgs != null and afterImgs != ''">after_imgs,</if>
<if test="positionId != null and positionId != ''">position_id,</if>
<if test="paragrapId != null and paragrapId != ''">paragrap_id,</if>
<if test="locationId != null and locationId != ''">location_id,</if>
<if test="conclusion != null and conclusion != ''">conclusion,</if>
<if test="szUser != null and szUser != ''">sz_user,</if>
<if test="zjUserId != null and zjUserId != ''">zj_user_id,</if>
<if test="zbUserId != null and zbUserId != ''">zb_user_id,</if>
<if test="jlUserId != null and jlUserId != ''">jl_user_id,</if>
<if test="createUser != null and createUser != ''">create_user,</if>
create_time
)
VALUES(
<if test="projectId != null and projectId != ''">#{projectId},</if>
<if test="workTime != null and workTime != ''">#{workTime},</if>
<if test="beforeImgs != null and beforeImgs != ''">#{beforeImgs},</if>
<if test="afterImgs != null and afterImgs != ''">#{afterImgs},</if>
<if test="positionId != null and positionId != ''">#{positionId},</if>
<if test="paragrapId != null and paragrapId != ''">#{paragrapId},</if>
<if test="locationId != null and locationId != ''">#{locationId},</if>
<if test="conclusion != null and conclusion != ''">#{conclusion},</if>
<if test="szUser != null and szUser != ''">#{szUser},</if>
<if test="zjUserId != null and zjUserId != ''">#{zjUserId},</if>
<if test="zbUserId != null and zbUserId != ''">#{zbUserId},</if>
<if test="jlUserId != null and jlUserId != ''">#{jlUserId},</if>
<if test="createUser != null and createUser != ''">#{createUser},</if>
NOW()
)
</insert>
<insert id="insertSspQualityMarkApprove" parameterType="java.util.Map">
INSERT INTO `smz_ssp_quality_mark_approve`(mark_id,user_id,user_name,login_name,sort,state,create_time)
VALUES(#{markId},#{userId},#{userName},#{loginName},#{sort},0,NOW())
</insert>
</mapper>