YZProjectCloud/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsMappe...

147 lines
9.1 KiB
XML
Raw Normal View History

2024-08-25 13:31:15 +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.manage.mapper.ProProjectInfoSubdeptsMapper">
<resultMap type="ProProjectInfoSubdepts" id="ProProjectInfoSubdeptsResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
2024-08-25 21:25:51 +08:00
<result property="deptName" column="dept_name" />
2024-08-25 13:31:15 +08:00
<result property="projectId" column="project_id" />
2024-08-25 21:25:51 +08:00
<result property="projectName" column="project_name" />
2024-08-25 13:31:15 +08:00
<result property="subDeptId" column="sub_dept_id" />
<result property="subDeptType" column="sub_dept_type" />
<result property="subDeptName" column="sub_dept_name" />
<result property="subDeptCode" column="sub_dept_code" />
<result property="subDeptLeaderId" column="sub_dept_leader_id" />
<result property="subDeptLeaderName" column="sub_dept_leader_name" />
<result property="subDeptLeaderCode" column="sub_dept_leader_code" />
<result property="subDeptLeaderPhone" column="sub_dept_leader_phone" />
<result property="useStatus" column="use_status" />
<result property="approveStatus" column="approve_status" />
<result property="qrCode" column="qr_code" />
<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="selectProProjectInfoSubdeptsVo">
2024-08-25 21:25:51 +08:00
select ps.id, dept_id, sd.dept_name, ps.project_id, pi.project_name, ps.sub_dept_id, ps.sub_dept_type, ps.sub_dept_name, ps.sub_dept_code, ps.sub_dept_leader_id, ps.sub_dept_leader_name, ps.sub_dept_leader_code, ps.sub_dept_leader_phone, ps.use_status, ps.approve_status, ps.qr_code, ps.is_del, ps.create_by, ps.create_time, ps.update_by, ps.update_time, ps.remark from pro_project_info_subdepts ps
left join pro_project_info pi on pi.id = ps.project_id
left join sys_dept sd on sd.dept_id = pi.dept_id
2024-08-25 13:31:15 +08:00
</sql>
<select id="selectProProjectInfoSubdeptsList" parameterType="ProProjectInfoSubdepts" resultMap="ProProjectInfoSubdeptsResult">
<include refid="selectProProjectInfoSubdeptsVo"/>
<where>
2024-08-25 21:25:51 +08:00
<if test="deptId != null "> and ps.dept_id = #{deptId}</if>
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
<if test="projectId != null "> and ps.project_id = #{projectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="subDeptId != null "> and ps.sub_dept_id = #{subDeptId}</if>
<if test="subDeptType != null and subDeptType != ''"> and ps.sub_dept_type = #{subDeptType}</if>
<if test="subDeptName != null and subDeptName != ''"> and ps.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="subDeptCode != null and subDeptCode != ''"> and ps.sub_dept_code = #{subDeptCode}</if>
<if test="subDeptLeaderId != null "> and ps.sub_dept_leader_id = #{subDeptLeaderId}</if>
<if test="subDeptLeaderName != null and subDeptLeaderName != ''"> and ps.sub_dept_leader_name like concat('%', #{subDeptLeaderName}, '%')</if>
<if test="subDeptLeaderCode != null and subDeptLeaderCode != ''"> and ps.sub_dept_leader_code = #{subDeptLeaderCode}</if>
<if test="subDeptLeaderPhone != null and subDeptLeaderPhone != ''"> and ps.sub_dept_leader_phone = #{subDeptLeaderPhone}</if>
<if test="useStatus != null and useStatus != ''"> and ps.use_status = #{useStatus}</if>
<if test="approveStatus != null "> and ps.approve_status = #{approveStatus}</if>
<if test="isDel != null "> and ps.is_del = #{isDel}</if>
2024-08-25 13:31:15 +08:00
</where>
2024-08-25 21:25:51 +08:00
order by ps.id desc
2024-08-25 13:31:15 +08:00
</select>
<select id="selectProProjectInfoSubdeptsById" parameterType="Long" resultMap="ProProjectInfoSubdeptsResult">
<include refid="selectProProjectInfoSubdeptsVo"/>
2024-08-25 21:25:51 +08:00
where ps.id = #{id}
2024-08-25 13:31:15 +08:00
</select>
<insert id="insertProProjectInfoSubdepts" parameterType="ProProjectInfoSubdepts" useGeneratedKeys="true" keyProperty="id">
insert into pro_project_info_subdepts
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="projectId != null">project_id,</if>
<if test="subDeptId != null">sub_dept_id,</if>
<if test="subDeptType != null">sub_dept_type,</if>
<if test="subDeptName != null">sub_dept_name,</if>
<if test="subDeptCode != null">sub_dept_code,</if>
<if test="subDeptLeaderId != null">sub_dept_leader_id,</if>
<if test="subDeptLeaderName != null">sub_dept_leader_name,</if>
<if test="subDeptLeaderCode != null">sub_dept_leader_code,</if>
<if test="subDeptLeaderPhone != null">sub_dept_leader_phone,</if>
<if test="useStatus != null">use_status,</if>
<if test="approveStatus != null">approve_status,</if>
<if test="qrCode != null">qr_code,</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="deptId != null">#{deptId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="subDeptId != null">#{subDeptId},</if>
<if test="subDeptType != null">#{subDeptType},</if>
<if test="subDeptName != null">#{subDeptName},</if>
<if test="subDeptCode != null">#{subDeptCode},</if>
<if test="subDeptLeaderId != null">#{subDeptLeaderId},</if>
<if test="subDeptLeaderName != null">#{subDeptLeaderName},</if>
<if test="subDeptLeaderCode != null">#{subDeptLeaderCode},</if>
<if test="subDeptLeaderPhone != null">#{subDeptLeaderPhone},</if>
<if test="useStatus != null">#{useStatus},</if>
<if test="approveStatus != null">#{approveStatus},</if>
<if test="qrCode != null">#{qrCode},</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="updateProProjectInfoSubdepts" parameterType="ProProjectInfoSubdepts">
update pro_project_info_subdepts
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="subDeptId != null">sub_dept_id = #{subDeptId},</if>
<if test="subDeptType != null">sub_dept_type = #{subDeptType},</if>
<if test="subDeptName != null">sub_dept_name = #{subDeptName},</if>
<if test="subDeptCode != null">sub_dept_code = #{subDeptCode},</if>
<if test="subDeptLeaderId != null">sub_dept_leader_id = #{subDeptLeaderId},</if>
<if test="subDeptLeaderName != null">sub_dept_leader_name = #{subDeptLeaderName},</if>
<if test="subDeptLeaderCode != null">sub_dept_leader_code = #{subDeptLeaderCode},</if>
<if test="subDeptLeaderPhone != null">sub_dept_leader_phone = #{subDeptLeaderPhone},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
<if test="qrCode != null">qr_code = #{qrCode},</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="deleteProProjectInfoSubdeptsById" parameterType="Long">
delete from pro_project_info_subdepts where id = #{id}
</delete>
<delete id="deleteProProjectInfoSubdeptsByIds" parameterType="String">
delete from pro_project_info_subdepts where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>