jhprjv2/yanzhu-jh/src/main/resources/mapper/video/SurProjectPhotographyMapper...

154 lines
8.4 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.video.mapper.SurProjectPhotographyMapper">
<resultMap type="SurProjectPhotography" id="SurProjectPhotographyResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="imageUrl" column="image_url" />
<result property="videoUrl" column="video_url" />
<result property="videoDate" column="video_date" />
<result property="state" column="state" />
<result property="remark" column="remark" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
</resultMap>
<sql id="selectSurProjectPhotographyVo">
select id, project_id, image_url, video_url, video_date, state, remark, is_del, create_by, create_date, update_by, update_date
from sur_project_photography
</sql>
<select id="selectSurProjectPhotographyList" parameterType="SurProjectPhotography" resultMap="SurProjectPhotographyResult">
<include refid="selectSurProjectPhotographyVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
<if test="videoUrl != null and videoUrl != ''"> and video_url = #{videoUrl}</if>
<if test="videoDate != null "> and video_date = #{videoDate}</if>
<if test="state != null "> and state = #{state}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
</where>
order by video_date
</select>
<select id="selectSurProjectPhotographyListForBg" parameterType="SurProjectPhotography" resultMap="SurProjectPhotographyResult">
select spp.id, spp.project_id, spp.image_url, spp.video_url, spp.video_date, spp.state, spp.remark, spp.is_del, spp.create_by,
spp.create_date, spp.update_date,sp.projectName update_by
from sur_project_photography as spp
left join sur_project sp on sp.id = spp.project_id
where sp.isDel=0 and sp.progressVisible=0
<if test="projectId != null and projectId!=0"> and spp.project_id = #{projectId}</if>
<if test="imageUrl != null and imageUrl != ''"> and spp.image_url = #{imageUrl}</if>
<if test="videoUrl != null and videoUrl != ''"> and spp.video_url = #{videoUrl}</if>
<if test="videoDate != null "> and spp.video_date = #{videoDate}</if>
<if test="state != null "> and spp.state = #{state}</if>
<if test="isDel != null "> and spp.is_del = #{isDel}</if>
<if test="createDate != null "> and spp.create_date = #{createDate}</if>
<if test="updateDate != null "> and spp.update_date = #{updateDate}</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<if test='proType != null and proType != "" and proType != "0"'> and sp.projectType = #{proType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and spp.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by sp.projectSort ASC,sp.projectName
</select>
<select id="querySurProjectPhotographyList" parameterType="SurProjectPhotography" resultMap="SurProjectPhotographyResult">
SELECT a.id, a.project_id, a.image_url, a.video_url, a.video_date, a.state, a.is_del, a.create_by, a.create_date, a.update_by, a.update_date,sp.projectName remark
FROM sur_project_photography a,sur_project sp
WHERE a.project_id=sp.id
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
<if test="videoUrl != null and videoUrl != ''"> and video_url = #{videoUrl}</if>
<if test="videoDate != null "> and video_date >= #{videoDate}</if>
<if test="state != null "> and state = #{state}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and video_date &lt;= #{updateDate}</if>
order by video_date desc
</select>
<select id="selectSurProjectPhotographyById" parameterType="Long" resultMap="SurProjectPhotographyResult">
<include refid="selectSurProjectPhotographyVo"/>
where id = #{id}
</select>
<select id="selectLastPhotography" parameterType="SurProjectPhotography" resultMap="SurProjectPhotographyResult">
<include refid="selectSurProjectPhotographyVo"/>
where DATE_FORMAT(video_date,'%Y-%m')=Date_Format(now(),'%Y-%m') and is_del =0
<if test="projectId != null "> and project_id = #{projectId}</if>
ORDER BY video_date
</select>
<insert id="insertSurProjectPhotography" parameterType="SurProjectPhotography" useGeneratedKeys="true" keyProperty="id">
insert into sur_project_photography
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">project_id,</if>
<if test="imageUrl != null">image_url,</if>
<if test="videoUrl != null">video_url,</if>
<if test="videoDate != null">video_date,</if>
<if test="state != null">state,</if>
<if test="remark != null">remark,</if>
<if test="isDel != null">is_del,</if>
<if test="createBy != null">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
<if test="imageUrl != null">#{imageUrl},</if>
<if test="videoUrl != null">#{videoUrl},</if>
<if test="videoDate != null">#{videoDate},</if>
<if test="state != null">#{state},</if>
<if test="remark != null">#{remark},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
</trim>
</insert>
<update id="updateSurProjectPhotography" parameterType="SurProjectPhotography">
update sur_project_photography
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="imageUrl != null">image_url = #{imageUrl},</if>
<if test="videoUrl != null">video_url = #{videoUrl},</if>
<if test="videoDate != null">video_date = #{videoDate},</if>
<if test="state != null">state = #{state},</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="createDate != null">create_date = #{createDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSurProjectPhotographyById" parameterType="Long">
delete from sur_project_photography where id = #{id}
</delete>
<delete id="deleteSurProjectPhotographyByIds" parameterType="String">
delete from sur_project_photography where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>