You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

364 lines
12 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="org.dromara.oa.erp.mapper.ErpProjectPlanMapper">
<resultMap type="org.dromara.oa.erp.domain.vo.ErpProjectPlanVo" id="ErpProjectPlanResult">
</resultMap>
<select id="selectCustomErpProjectPlanVoList" resultMap="ErpProjectPlanResult">
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.project_plan_code,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_id,
t.oss_id,
t.remark,
t.active_flag,
t.del_flag,
t.create_dept,
t.create_by,
t.create_time,
t.update_by,
t.update_time,
p.project_name,
p.project_code as projectCode,
u1.nick_name as managerName,
d1.dept_name as managerDeptName,
u2.nick_name as chargeName,
c.contract_name as contractName,
u3.nick_name as createName
from erp_project_plan t
left join erp_project_info p on t.project_id = p.project_id
left join sys_user u1 on t.manager_id = u1.user_id
left join sys_dept d1 on u1.dept_id = d1.dept_id
left join sys_user u2 on t.charge_id = u2.user_id
left join sys_user u3 on t.create_by = u3.user_id
left join erp_contract_info c on t.contract_id = c.contract_id
<where>
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</select>
<!-- 根据ID查询详情 -->
<select id="selectCustomErpProjectPlanVoById" resultMap="ErpProjectPlanResult">
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.project_plan_code,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_id,
t.oss_id,
t.remark,
t.active_flag,
t.del_flag,
t.create_dept,
t.create_by,
t.create_time,
t.update_by,
t.update_time,
p.project_name,
p.project_code as projectCode,
u1.nick_name as managerName,
d1.dept_name as managerDeptName,
u2.nick_name as chargeName,
c.contract_name as contractName
from erp_project_plan t
left join erp_project_info p on t.project_id = p.project_id
left join sys_user u1 on t.manager_id = u1.user_id
left join sys_dept d1 on u1.dept_id = d1.dept_id
left join sys_user u2 on t.charge_id = u2.user_id
left join erp_contract_info c on t.contract_id = c.contract_id
where t.project_plan_id = #{projectPlanId}
</select>
<!-- 批量查询 - 根据ID列表 -->
<select id="selectCustomErpProjectPlanVoByIds" resultMap="ErpProjectPlanResult">
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.project_plan_code,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_id,
t.oss_id,
t.remark,
t.active_flag,
t.del_flag,
t.create_dept,
t.create_by,
t.create_time,
t.update_by,
t.update_time,
p.project_name,
p.project_code as projectCode,
u1.nick_name as managerName,
d1.dept_name as managerDeptName,
u2.nick_name as chargeName,
c.contract_name as contractName
from erp_project_plan t
left join erp_project_info p on t.project_id = p.project_id
left join sys_user u1 on t.manager_id = u1.user_id
left join sys_dept d1 on u1.dept_id = d1.dept_id
left join sys_user u2 on t.charge_id = u2.user_id
left join erp_contract_info c on t.contract_id = c.contract_id
where t.project_plan_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<!-- 统计查询 -->
<select id="countCustomErpProjectPlan" resultType="java.lang.Long">
select count(1) from erp_project_plan t
<where>
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</select>
<!-- 分页查询(带自定义条件) -->
<select id="selectCustomErpProjectPlanVoPage" resultMap="ErpProjectPlanResult">
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.project_plan_code,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_id,
t.oss_id,
t.remark,
t.active_flag,
t.del_flag,
t.create_dept,
t.create_by,
t.create_time,
t.update_by,
t.update_time,
p.project_name,
p.project_code as projectCode,
u1.nick_name as managerName,
d1.dept_name as managerDeptName,
u2.nick_name as chargeName,
c.contract_name as contractName
from erp_project_plan t
left join erp_project_info p on t.project_id = p.project_id
left join sys_user u1 on t.manager_id = u1.user_id
left join sys_dept d1 on u1.dept_id = d1.dept_id
left join sys_user u2 on t.charge_id = u2.user_id
left join erp_contract_info c on t.contract_id = c.contract_id
<where>
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</select>
<!-- 批量插入 -->
<insert id="batchInsertErpProjectPlan">
insert into erp_project_plan(
tenant_id,
project_id,
project_plan_code,
manager_id,
charge_id,
payment_method,
project_plan_status,
flow_status,
sort_order,
contract_id,
oss_id,
remark,
active_flag,
del_flag,
create_dept,
create_by,
create_time,
update_by,
update_time
)
values
<foreach collection="list" item="item" separator=",">
(
#{item.tenantId},
#{item.projectId},
#{item.projectPlanCode},
#{item.managerId},
#{item.chargeId},
#{item.paymentMethod},
#{item.projectPlanStatus},
#{item.flowStatus},
#{item.sortOrder},
#{item.contractId},
#{item.ossId},
#{item.remark},
#{item.activeFlag},
#{item.delFlag},
#{item.createDept},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime}
)
</foreach>
</insert>
<!-- 批量更新 -->
<update id="batchUpdateErpProjectPlan">
<foreach collection="list" item="item" separator=";">
update erp_project_plan
<set>
<if test="item.tenantId != null and item.tenantId != ''">
tenant_id = #{item.tenantId},
</if>
<if test="item.projectId != null">
project_id = #{item.projectId},
</if>
<if test="item.projectPlanCode != null and item.projectPlanCode != ''">
project_plan_code = #{item.projectPlanCode},
</if>
<if test="item.managerId != null">
manager_id = #{item.managerId},
</if>
<if test="item.chargeId != null">
charge_id = #{item.chargeId},
</if>
<if test="item.paymentMethod != null and item.paymentMethod != ''">
payment_method = #{item.paymentMethod},
</if>
<if test="item.projectPlanStatus != null and item.projectPlanStatus != ''">
project_plan_status = #{item.projectPlanStatus},
</if>
<if test="item.flowStatus != null and item.flowStatus != ''">
flow_status = #{item.flowStatus},
</if>
<if test="item.sortOrder != null">
sort_order = #{item.sortOrder},
</if>
<if test="item.contractId != null">
contract_id = #{item.contractId},
</if>
<if test="item.ossId != null and item.ossId != ''">
oss_id = #{item.ossId},
</if>
<if test="item.remark != null and item.remark != ''">
remark = #{item.remark},
</if>
<if test="item.activeFlag != null and item.activeFlag != ''">
active_flag = #{item.activeFlag},
</if>
<if test="item.delFlag != null and item.delFlag != ''">
del_flag = #{item.delFlag},
</if>
<if test="item.createDept != null">
create_dept = #{item.createDept},
</if>
<if test="item.createBy != null">
create_by = #{item.createBy},
</if>
<if test="item.createTime != null">
create_time = #{item.createTime},
</if>
<if test="item.updateBy != null">
update_by = #{item.updateBy},
</if>
<if test="item.updateTime != null">
update_time = #{item.updateTime}
</if>
</set>
where project_plan_id = #{item.projectPlanId}
</foreach>
</update>
<!-- 根据自定义条件删除 -->
<delete id="deleteCustomErpProjectPlan">
delete from erp_project_plan
<where>
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</delete>
<!-- 根据ID列表批量删除 -->
<delete id="deleteCustomErpProjectPlanByIds">
delete from erp_project_plan
where project_plan_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 检查是否存在 -->
<select id="existsErpProjectPlan" resultType="java.lang.Boolean">
select count(1) > 0 from erp_project_plan t
<where>
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
AND ${ew.sqlSegment}
</if>
</where>
</select>
</mapper>