feat(oa): 添加创建者名称字段并优化查询逻辑

- 在 CrmQuoteInfo、CrmSupplierInfo 和 ErpProjectPlan 实体中新增 createName 字段- 修改对应的 XML 查询语句,关联 sys_user 表获取创建者昵称
- 更新 VO 对象,补充 createBy、createName 和 createTime 字段
- 为 ErpProjectPlan 添加唯一性校验逻辑,确保一个项目仅有一个计划
- 调整 SQL 查询结构,提升可读性和维护性
dev
zangch@mesnac.com 1 month ago
parent 6c62fc7507
commit 2b44842c0c

@ -236,4 +236,10 @@ public class CrmQuoteInfo extends TenantEntity {
private List<CrmQuoteMaterial> items;
/**
*
*/
@TableField(exist = false )
private String createName;
}

@ -174,5 +174,11 @@ public class CrmSupplierInfo extends TenantEntity {
@TableField(exist = false)
private String ownerDeptName;
/**
*
*/
@TableField(exist = false)
private String createName;
}

@ -275,4 +275,19 @@ public class CrmQuoteInfoVo implements Serializable {
@ExcelProperty(value = "报价单子表-物料明细")
private List<CrmQuoteMaterialVo> itemsVo;
/**
*
*/
private Long createBy;
/**
*
*/
private String createName;
/**
*
*/
private Date createTime;
}

@ -205,5 +205,19 @@ public class CrmSupplierInfoVo implements Serializable {
@ExcelIgnore
private List<RemoteFile> attachmentList;
/**
*
*/
private Long createBy;
/**
*
*/
private String createName;
/**
*
*/
private Date createTime;
}

@ -75,7 +75,7 @@ public class CrmQuoteInfoServiceImpl implements ICrmQuoteInfoService {
@Override
public TableDataInfo<CrmQuoteInfoVo> queryPageList(CrmQuoteInfoBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<CrmQuoteInfo> lqw = buildQueryWrapper(bo);
Page<CrmQuoteInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
Page<CrmQuoteInfoVo> result = baseMapper.selectCustomCrmQuoteInfoVoList(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}

@ -84,4 +84,12 @@ public class ErpProjectPlan extends TenantEntity {
private String delFlag;
/**
*
*/
@TableField(exist = false )
private String createName;
}

@ -1,5 +1,7 @@
package org.dromara.oa.erp.domain.vo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import org.dromara.oa.erp.domain.ErpProjectPlan;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
@ -126,4 +128,20 @@ public class ErpProjectPlanVo implements Serializable {
@ExcelProperty(value = "合同名称")
private String contractName;
/**
*
*/
private Long createBy;
/**
*
*/
private String createName;
/**
*
*/
private Date createTime;
}

@ -235,7 +235,22 @@ public class ErpProjectPlanServiceImpl implements IErpProjectPlanService {
*
*/
private void validEntityBeforeSave(ErpProjectPlan entity){
//TODO 做一些数据校验,如唯一约束
// 唯一性校验:一个项目只能有一个项目计划
Long projectId = entity.getProjectId();
if (projectId == null) {
throw new ServiceException("项目不能为空");
}
MPJLambdaWrapper<ErpProjectPlan> lqw = JoinWrappers.lambda(ErpProjectPlan.class)
.eq(ErpProjectPlan::getProjectId, projectId)
.eq(ErpProjectPlan::getDelFlag, "0");
// 更新时排除自身ID
if (entity.getProjectPlanId() != null) {
lqw.ne(ErpProjectPlan::getProjectPlanId, entity.getProjectPlanId());
}
long cnt = baseMapper.selectCount(lqw);
if (cnt > 0) {
throw new ServiceException("该项目已存在项目计划,一个项目只能有一个项目计划");
}
}
/**

@ -7,20 +7,32 @@
</resultMap>
<select id="selectCustomCrmQuoteInfoVoList" resultMap="CrmQuoteInfoResult">
select quote_id, tenant_id, quote_code, quote_name, quote_round, quote_category, quote_type, business_direction, quote_dept_id, quote_date, valid_from, valid_days, valid_to, delivery_period, delivery_method, payment_method, currency_type, tax_included_info, tax_rate, total_price, total_before_tax, total_tax, total_including_tax, customer_contact_id, customer_contact_name, customer_contact_phone, customer_contact_email, supplier_contact_id, supplier_contact_name, supplier_contact_phone, supplier_contact_email, project_id, template_id, oss_id, quote_status, flow_status, remark, del_flag, create_dept, create_by, create_time, update_by, update_time from crm_quote_info t
select t.quote_id, t.tenant_id, t.quote_code, t.quote_name, t.quote_round, t.quote_category,
t.quote_type, t.business_direction, t.quote_dept_id, t.quote_date, t.valid_from, t.valid_days, t.valid_to,
t.delivery_period, t.delivery_method, t.payment_method, t.currency_type, t.tax_included_info, t.tax_rate, t.total_price, t.total_before_tax,
t.total_tax, t.total_including_tax, t.customer_contact_id, t.customer_contact_name, t.customer_contact_phone, t.customer_contact_email,
t.supplier_contact_id, t.supplier_contact_name, t.supplier_contact_phone, t.supplier_contact_email, t.project_id, t.template_id, t.oss_id, t.quote_status,
t.flow_status, t.remark,
u3.nick_name as createName,
t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
from crm_quote_info t
left join sys_user u3 on t.create_by = u3.user_id
${ew.getCustomSqlSegment}
</select>
<!-- 根据ID查询详情 -->
<select id="selectCustomCrmQuoteInfoVoById" resultMap="CrmQuoteInfoResult">
select quote_id, tenant_id, quote_code, quote_name, quote_round, quote_category, quote_type, business_direction, quote_dept_id, quote_date, valid_from, valid_days, valid_to, delivery_period, delivery_method, payment_method, currency_type, tax_included_info, tax_rate, total_price, total_before_tax, total_tax, total_including_tax, customer_contact_id, customer_contact_name, customer_contact_phone, customer_contact_email, supplier_contact_id, supplier_contact_name, supplier_contact_phone, supplier_contact_email, project_id, template_id, oss_id, quote_status, flow_status, remark, del_flag, create_dept, create_by, create_time, update_by, update_time
select t.quote_id, t.tenant_id, t.quote_code, t.quote_name, t.quote_round, t.quote_category, t.quote_type, t.business_direction, t.quote_dept_id, t.quote_date, t.valid_from, t.valid_days, t.valid_to, t.delivery_period, t.delivery_method, t.payment_method, t.currency_type, t.tax_included_info, t.tax_rate, t.total_price, t.total_before_tax, t.total_tax, t.total_including_tax, t.customer_contact_id, t.customer_contact_name, t.customer_contact_phone, t.customer_contact_email, t.supplier_contact_id, t.supplier_contact_name, t.supplier_contact_phone, t.supplier_contact_email, t.project_id, t.template_id, t.oss_id, t.quote_status, t.flow_status, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
from crm_quote_info t
where t.quote_id = #{quoteId}
</select>
<!-- 批量查询 - 根据ID列表 -->
<select id="selectCustomCrmQuoteInfoVoByIds" resultMap="CrmQuoteInfoResult">
select quote_id, tenant_id, quote_code, quote_name, quote_round, quote_category, quote_type, business_direction, quote_dept_id, quote_date, valid_from, valid_days, valid_to, delivery_period, delivery_method, payment_method, currency_type, tax_included_info, tax_rate, total_price, total_before_tax, total_tax, total_including_tax, customer_contact_id, customer_contact_name, customer_contact_phone, customer_contact_email, supplier_contact_id, supplier_contact_name, supplier_contact_phone, supplier_contact_email, project_id, template_id, oss_id, quote_status, flow_status, remark, del_flag, create_dept, create_by, create_time, update_by, update_time
select t.quote_id, t.tenant_id, t.quote_code, t.quote_name, t.quote_round, t.quote_category,
t.quote_type, t.business_direction, t.quote_dept_id, t.quote_date, t.valid_from, t.valid_days,
t.valid_to, t.delivery_period, t.delivery_method, t.payment_method, t.currency_type, t.tax_included_info,
t.tax_rate, t.total_price, t.total_before_tax, t.total_tax, t.total_including_tax, t.customer_contact_id, t.customer_contact_name, t.customer_contact_phone, t.customer_contact_email, t.supplier_contact_id, t.supplier_contact_name, t.supplier_contact_phone, t.supplier_contact_email, t.project_id, t.template_id, t.oss_id, t.quote_status, t.flow_status, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
from crm_quote_info t
where t.quote_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">

@ -13,9 +13,11 @@
t.bank_number, t.registered_address, t.business_address, t.contact_person, t.contact_phone, t.contact_mobile,
t.contact_email, t.contact_fax, t.website, t.owner_id, t.detailed_address, t.oss_id, t.remark, t.active_flag, t.del_flag, t.create_dept,
u1.nick_name as ownerName,
u2.nick_name as createName,
t.create_by, t.create_time, t.update_by, t.update_time
from crm_supplier_info t
left join sys_user u1 on u1.user_id = t.owner_id
left join sys_user u2 on u2.user_id = t.create_by
${ew.getCustomSqlSegment}
</select>

@ -7,55 +7,57 @@
</resultMap>
<select id="selectCustomErpProjectPlanVoList" resultMap="ErpProjectPlanResult">
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_id,
t.remark,
t.active_flag,
t.del_flag,
t.create_dept,
t.create_by,
t.create_time,
t.update_by,
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_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,
u1.nick_name as managerName,
u2.nick_name as chargeName,
c.contract_name as contractName
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_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
${ew.getCustomSqlSegment}
</select>
<!-- 根据ID查询详情 -->
<select id="selectCustomErpProjectPlanVoById" resultMap="ErpProjectPlanResult">
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_id,
t.remark,
t.active_flag,
t.del_flag,
t.create_dept,
t.create_by,
t.create_time,
t.update_by,
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_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,
u1.nick_name as managerName,
@ -71,23 +73,23 @@
<!-- 批量查询 - 根据ID列表 -->
<select id="selectCustomErpProjectPlanVoByIds" resultMap="ErpProjectPlanResult">
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_id,
t.remark,
t.active_flag,
t.del_flag,
t.create_dept,
t.create_by,
t.create_time,
t.update_by,
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_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,
u1.nick_name as managerName,
@ -112,23 +114,23 @@
<!-- 分页查询(带自定义条件) -->
<select id="selectCustomErpProjectPlanVoPage" resultMap="ErpProjectPlanResult">
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_id,
t.remark,
t.active_flag,
t.del_flag,
t.create_dept,
t.create_by,
t.create_time,
t.update_by,
select t.project_plan_id,
t.tenant_id,
t.project_id,
t.manager_id,
t.charge_id,
t.payment_method,
t.project_plan_status,
t.flow_status,
t.sort_order,
t.contract_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,
u1.nick_name as managerName,

Loading…
Cancel
Save