Compare commits
3 Commits
077819a261
...
00df5b16a5
| Author | SHA1 | Date |
|---|---|---|
|
|
00df5b16a5 | |
|
|
fc0820d0fc | |
|
|
d9f34640f5 |
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.bonus.web.controller.enterprise;
|
||||||
|
|
||||||
|
import com.bonus.common.core.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.page.TableDataInfo;
|
||||||
|
import com.bonus.mainDataBase.domain.Performance;
|
||||||
|
import com.bonus.mainDataBase.service.PerformanceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业业绩控制器
|
||||||
|
* 处理前端关于业绩的增删改查请求
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/performance") // 接口统一前缀
|
||||||
|
public class PerformanceController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PerformanceService performanceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询业绩列表(带分页和条件筛选)
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(Performance performance) {
|
||||||
|
// 调用Service查询列表(实际项目中通常包含分页参数,由Service处理分页)
|
||||||
|
List<Performance> list = performanceService.selectPerformanceList(performance);
|
||||||
|
// 封装分页结果(TableDataInfo为通用分页响应对象,包含总条数、列表数据等)
|
||||||
|
return new TableDataInfo(list, list.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询业绩详情
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{performanceId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("performanceId") Long performanceId) {
|
||||||
|
// 调用Service查询详情
|
||||||
|
Performance performance = performanceService.selectPerformanceById(performanceId);
|
||||||
|
return AjaxResult.success(performance); // 封装成功响应,返回业绩数据
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增业绩
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public AjaxResult add(@Validated @RequestBody Performance performance) {
|
||||||
|
try {
|
||||||
|
// 调用Service新增,返回影响行数
|
||||||
|
int rows = performanceService.insertPerformance(performance);
|
||||||
|
return rows > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
// 捕获业务异常(如项目名称重复),返回错误信息
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改业绩
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/edit")
|
||||||
|
public AjaxResult edit(@Validated @RequestBody Performance performance) {
|
||||||
|
try {
|
||||||
|
// 调用Service修改
|
||||||
|
int rows = performanceService.updatePerformance(performance);
|
||||||
|
return rows > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除业绩
|
||||||
|
*/
|
||||||
|
@PostMapping("delete/{performanceId}")
|
||||||
|
public AjaxResult remove(@PathVariable Long performanceId) {
|
||||||
|
try {
|
||||||
|
int rows = performanceService.deletePerformanceById(performanceId);
|
||||||
|
return rows > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -59,6 +59,12 @@
|
||||||
<artifactId>bonus-system</artifactId>
|
<artifactId>bonus-system</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 数据处理模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bonus</groupId>
|
||||||
|
<artifactId>bonus-mainDatabase</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,125 @@
|
||||||
|
package com.bonus.mainDataBase.domain;
|
||||||
|
import com.bonus.common.core.domain.BaseEntity;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业业绩实体类
|
||||||
|
* 对应表:tb_enterprise_performance
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Performance extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业绩id(主键)
|
||||||
|
*/
|
||||||
|
private Long performanceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业id(关联企业表)
|
||||||
|
*/
|
||||||
|
private Long enterpriseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
private String proName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同签订时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date contractSigningTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同金额
|
||||||
|
*/
|
||||||
|
private String contractAmount; // 若需计算
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 建设地点
|
||||||
|
*/
|
||||||
|
private String constructionSite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 建设单位
|
||||||
|
*/
|
||||||
|
private String constructionUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 建设单位联系方式
|
||||||
|
*/
|
||||||
|
private String constructionPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开工时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 竣工时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date completionTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目经理
|
||||||
|
*/
|
||||||
|
private String projectManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目类型(字典表配置)
|
||||||
|
*/
|
||||||
|
private String proType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压等级(字典表配置)
|
||||||
|
*/
|
||||||
|
private String voltageLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目概况
|
||||||
|
*/
|
||||||
|
private String projectOverview; // 数据库为text类型,对应Java String
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long createUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人姓名
|
||||||
|
*/
|
||||||
|
private String createUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人姓名
|
||||||
|
*/
|
||||||
|
private String updateUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除状态(0:未删除,1:删除)
|
||||||
|
*/
|
||||||
|
private String delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.bonus.mainDataBase.mapper;
|
||||||
|
|
||||||
|
import com.bonus.mainDataBase.domain.Performance;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业业绩数据访问层接口
|
||||||
|
* 对应表:tb_enterprise_performance
|
||||||
|
*/
|
||||||
|
public interface PerformanceMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业业绩列表(带条件筛选)
|
||||||
|
* @param enterprisePerformance 筛选条件(包含项目名称、企业ID等)
|
||||||
|
* @return 业绩列表
|
||||||
|
*/
|
||||||
|
List<Performance> selectperformanceList(Performance enterprisePerformance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据业绩ID查询详情
|
||||||
|
* @param performanceId 业绩主键ID
|
||||||
|
* @return 企业业绩对象
|
||||||
|
*/
|
||||||
|
Performance selectperformanceById(Long performanceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验项目名称唯一性
|
||||||
|
* @param enterprisePerformance 包含项目名称和业绩ID(编辑时用于排除自身)
|
||||||
|
* @return 存在数量(0:不存在,1:存在)
|
||||||
|
*/
|
||||||
|
int checkProNameUnique(Performance enterprisePerformance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增企业业绩
|
||||||
|
* @param enterprisePerformance 企业业绩对象
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insertperformance(Performance enterprisePerformance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑企业业绩
|
||||||
|
* @param enterprisePerformance 企业业绩对象(包含更新字段和主键)
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int updateperformance(Performance enterprisePerformance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除企业业绩(更新del_flag为1)
|
||||||
|
* @param performanceId 业绩主键ID
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int deleteperformanceById(Long performanceId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.bonus.mainDataBase.service;
|
||||||
|
|
||||||
|
import com.bonus.mainDataBase.domain.Performance;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业业绩服务层接口
|
||||||
|
*/
|
||||||
|
public interface PerformanceService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业业绩列表(带条件筛选)
|
||||||
|
* @param performance 筛选条件
|
||||||
|
* @return 业绩列表
|
||||||
|
*/
|
||||||
|
List<Performance> selectPerformanceList(Performance performance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询业绩详情
|
||||||
|
* @param performanceId 业绩ID
|
||||||
|
* @return 业绩对象
|
||||||
|
*/
|
||||||
|
Performance selectPerformanceById(Long performanceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增业绩
|
||||||
|
* @param performance 业绩对象
|
||||||
|
* @return 结果(1:成功,0:失败)
|
||||||
|
*/
|
||||||
|
int insertPerformance(Performance performance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改业绩
|
||||||
|
* @param performance 业绩对象
|
||||||
|
* @return 结果(1:成功,0:失败)
|
||||||
|
*/
|
||||||
|
int updatePerformance(Performance performance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除业绩
|
||||||
|
* @param performanceId 业绩ID
|
||||||
|
* @return 结果(1:成功,0:失败)
|
||||||
|
*/
|
||||||
|
int deletePerformanceById(Long performanceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验项目名称是否唯一
|
||||||
|
* @param performance 业绩对象(含项目名称和ID)
|
||||||
|
* @return 结果(true:唯一,false:不唯一)
|
||||||
|
*/
|
||||||
|
boolean checkProNameUnique(Performance performance);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.bonus.mainDataBase.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.mainDataBase.domain.Performance;
|
||||||
|
import com.bonus.mainDataBase.mapper.PerformanceMapper;
|
||||||
|
import com.bonus.mainDataBase.service.PerformanceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业业绩服务层实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PerformanceServiceImpl implements PerformanceService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PerformanceMapper performanceMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询业绩列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Performance> selectPerformanceList(Performance performance) {
|
||||||
|
// 调用Mapper查询,返回结果
|
||||||
|
return performanceMapper.selectperformanceList(performance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询业绩详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Performance selectPerformanceById(Long performanceId) {
|
||||||
|
// 校验ID是否为空
|
||||||
|
if (performanceId == null || performanceId <= 0) {
|
||||||
|
throw new IllegalArgumentException("业绩ID不能为空或无效");
|
||||||
|
}
|
||||||
|
return performanceMapper.selectperformanceById(performanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增业绩
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional // 事务控制:确保新增操作要么全成,要么全失败
|
||||||
|
public int insertPerformance(Performance performance) {
|
||||||
|
// 1. 校验项目名称唯一性
|
||||||
|
if (!checkProNameUnique(performance)) {
|
||||||
|
throw new RuntimeException("项目名称已存在,请更换");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 补充默认值(如创建人、创建时间,若前端未传)
|
||||||
|
// 示例:若需自动填充创建人,可从上下文获取当前登录用户ID和名称
|
||||||
|
// performance.setCreateUserId(getCurrentUserId());
|
||||||
|
// performance.setCreateUserName(getCurrentUserName());
|
||||||
|
|
||||||
|
// 3. 调用Mapper执行新增
|
||||||
|
return performanceMapper.insertperformance(performance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改业绩
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int updatePerformance(Performance performance) {
|
||||||
|
// 1. 校验ID是否存在
|
||||||
|
Performance oldPerformance = selectPerformanceById(performance.getPerformanceId());
|
||||||
|
if (oldPerformance == null) {
|
||||||
|
throw new RuntimeException("业绩信息不存在或已删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 校验项目名称唯一性(排除自身)
|
||||||
|
if (!checkProNameUnique(performance)) {
|
||||||
|
throw new RuntimeException("项目名称已存在,请更换");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 补充修改人信息(如从上下文获取)
|
||||||
|
// performance.setUpdateUserId(getCurrentUserId());
|
||||||
|
// performance.setUpdateUserName(getCurrentUserName());
|
||||||
|
|
||||||
|
// 4. 调用Mapper执行更新
|
||||||
|
return performanceMapper.updateperformance(performance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除业绩
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int deletePerformanceById(Long performanceId) {
|
||||||
|
// 1. 校验ID是否存在
|
||||||
|
Performance performance = selectPerformanceById(performanceId);
|
||||||
|
if (performance == null) {
|
||||||
|
throw new RuntimeException("业绩信息不存在或已删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 调用Mapper执行逻辑删除
|
||||||
|
return performanceMapper.deleteperformanceById(performanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验项目名称是否唯一
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkProNameUnique(Performance performance) {
|
||||||
|
// 调用Mapper查询同名记录数量
|
||||||
|
int count = performanceMapper.checkProNameUnique(performance);
|
||||||
|
// count == 0 表示唯一
|
||||||
|
return count == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
<?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.bonus.mainDataBase.mapper.PerformanceMapper">
|
||||||
|
|
||||||
|
<!-- 结果集映射 -->
|
||||||
|
<resultMap type="Performance" id="performanceResult">
|
||||||
|
<id property="performanceId" column="performance_id" />
|
||||||
|
<result property="enterpriseId" column="enterprise_id" />
|
||||||
|
<result property="proName" column="pro_name" />
|
||||||
|
<result property="contractSigningTime" column="contract_signing_time" />
|
||||||
|
<result property="contractAmount" column="contract_amount" />
|
||||||
|
<result property="constructionSite" column="construction_site" />
|
||||||
|
<result property="constructionUnit" column="construction_unit" />
|
||||||
|
<result property="constructionPhone" column="construction_phone" />
|
||||||
|
<result property="startTime" column="start_time" />
|
||||||
|
<result property="completionTime" column="completion_time" />
|
||||||
|
<result property="projectManager" column="project_manager" />
|
||||||
|
<result property="proType" column="pro_type" />
|
||||||
|
<result property="voltageLevel" column="voltage_level" />
|
||||||
|
<result property="projectOverview" column="project_overview" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createUserId" column="create_user_id" />
|
||||||
|
<result property="createUserName" column="create_user_name" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateUserId" column="update_user_id" />
|
||||||
|
<result property="updateUserName" column="update_user_name" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 基础查询SQL片段 -->
|
||||||
|
<sql id="selectperformance">
|
||||||
|
select
|
||||||
|
performance_id, enterprise_id, pro_name, contract_signing_time,
|
||||||
|
contract_amount, construction_site, construction_unit, construction_phone,
|
||||||
|
start_time, completion_time, project_manager, pro_type, voltage_level,
|
||||||
|
project_overview, create_time, create_user_id, create_user_name,
|
||||||
|
update_time, update_user_id, update_user_name, del_flag
|
||||||
|
from tb_enterprise_performance
|
||||||
|
where del_flag = '0'
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 1. 列表查询 -->
|
||||||
|
<select id="selectperformanceList" parameterType="Performance" resultMap="performanceResult">
|
||||||
|
<include refid="selectperformance"/>
|
||||||
|
|
||||||
|
<!-- 企业ID筛选 -->
|
||||||
|
<if test="enterpriseId != null and enterpriseId != 0">
|
||||||
|
AND enterprise_id = #{enterpriseId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 项目名称模糊查询 -->
|
||||||
|
<if test="proName != null and proName != ''">
|
||||||
|
AND pro_name like concat('%', #{proName}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 项目类型筛选 -->
|
||||||
|
<if test="proType != null and proType != ''">
|
||||||
|
AND pro_type = #{proType}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 电压等级筛选 -->
|
||||||
|
<if test="voltageLevel != null and voltageLevel != ''">
|
||||||
|
AND voltage_level = #{voltageLevel}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 项目经理模糊查询 -->
|
||||||
|
<if test="projectManager != null and projectManager != ''">
|
||||||
|
AND project_manager like concat('%', #{projectManager}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 合同签订时间范围查询(假设传入的是字符串格式,如'2024-01-01') -->
|
||||||
|
<if test="contractSigningTime != null and contractSigningTime != ''">
|
||||||
|
AND contract_signing_time = #{contractSigningTime}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 2. 详情查询(根据业绩ID) -->
|
||||||
|
<select id="selectperformanceById" parameterType="Long" resultMap="performanceResult">
|
||||||
|
<include refid="selectperformance"/>
|
||||||
|
AND performance_id = #{performanceId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 3. 校验项目名称唯一性(用于新增/编辑时去重) -->
|
||||||
|
<select id="checkProNameUnique" parameterType="Performance" resultType="Integer">
|
||||||
|
select count(1) from tb_enterprise_performance
|
||||||
|
where del_flag = '0'
|
||||||
|
and pro_name = #{proName}
|
||||||
|
<if test="performanceId != null and performanceId != 0">
|
||||||
|
AND performance_id != #{performanceId} -- 编辑时排除自身
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 4. 新增业绩 -->
|
||||||
|
<insert id="insertperformance" parameterType="Performance" useGeneratedKeys="true" keyProperty="performanceId">
|
||||||
|
insert into tb_enterprise_performance(
|
||||||
|
enterprise_id, pro_name, contract_signing_time, contract_amount,
|
||||||
|
construction_site, construction_unit, construction_phone, start_time,
|
||||||
|
completion_time, project_manager, pro_type, voltage_level, project_overview,
|
||||||
|
create_user_id, create_user_name, create_time
|
||||||
|
)values(
|
||||||
|
#{enterpriseId}, #{proName}, #{contractSigningTime}, #{contractAmount},
|
||||||
|
#{constructionSite}, #{constructionUnit}, #{constructionPhone}, #{startTime},
|
||||||
|
#{completionTime}, #{projectManager}, #{proType}, #{voltageLevel}, #{projectOverview},
|
||||||
|
#{createUserId}, #{createUserName}, sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 5. 编辑业绩 -->
|
||||||
|
<update id="updateperformance" parameterType="Performance">
|
||||||
|
update tb_enterprise_performance
|
||||||
|
<set>
|
||||||
|
<if test="enterpriseId != null and enterpriseId != 0">enterprise_id = #{enterpriseId},</if>
|
||||||
|
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
|
||||||
|
<if test="contractSigningTime != null ">contract_signing_time = #{contractSigningTime},</if>
|
||||||
|
<if test="contractAmount != null and contractAmount != ''">contract_amount = #{contractAmount},</if>
|
||||||
|
<if test="constructionSite != null and constructionSite != ''">construction_site = #{constructionSite},</if>
|
||||||
|
<if test="constructionUnit != null and constructionUnit != ''">construction_unit = #{constructionUnit},</if>
|
||||||
|
<if test="constructionPhone != null and constructionPhone != ''">construction_phone = #{constructionPhone},</if>
|
||||||
|
<if test="startTime != null">start_time = #{startTime},</if>
|
||||||
|
<if test="completionTime != null">completion_time = #{completionTime},</if>
|
||||||
|
<if test="projectManager != null and projectManager != ''">project_manager = #{projectManager},</if>
|
||||||
|
<if test="proType != null and proType != ''">pro_type = #{proType},</if>
|
||||||
|
<if test="voltageLevel != null and voltageLevel != ''">voltage_level = #{voltageLevel},</if>
|
||||||
|
<if test="projectOverview != null and projectOverview != ''">project_overview = #{projectOverview},</if>
|
||||||
|
<if test="updateUserId != null and updateUserId != 0">update_user_id = #{updateUserId},</if>
|
||||||
|
<if test="updateUserName != null and updateUserName != ''">update_user_name = #{updateUserName},</if>
|
||||||
|
update_time = sysdate() -- 自动更新修改时间
|
||||||
|
</set>
|
||||||
|
where performance_id = #{performanceId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 6. 删除业绩(逻辑删除) -->
|
||||||
|
<delete id="deleteperformanceById" parameterType="Long">
|
||||||
|
update tb_enterprise_performance
|
||||||
|
set del_flag = '1', -- 标记为删除
|
||||||
|
update_time = sysdate()
|
||||||
|
where performance_id = #{performanceId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue