feat(publicity): 公示页支持/执行意向 (匿名提交 + 管理审核)

- 新增 biz_publicity_support_intent / biz_publicity_execution_intent 两张独立表
  (与已登录视角的 biz_support_intent / biz_execution_intent 解耦, 避免匿名数据污染强绑表)
- 后端 BizPublicityIntentController: 公开提交 + 公开查重 (按 project_id+phone+source) + 管理 CRUD
  已登录直接取 user_id, 未登录但 phone 命中 sys_user 仍自动关联 user_id (不回强制登录)
- /business/publicity/** 加 Spring Security permitAll
- 前端 PublicityDetail.vue: 右侧 2 个意向按钮 (已登录/匿名都弹 dialog 填 5 字段),
  已提交状态用 hasPublicityIntent 按 phonenumber 持久化查回
- 重写 manager/SupportIntent.vue + manager/ExecIntent.vue: 列表/筛选/CSV导出/状态变更/批量删除
This commit is contained in:
郭庆泰
2026-08-17 01:15:16 +08:00
parent a1c54842e2
commit b41cf77cac
16 changed files with 1168 additions and 42 deletions
@@ -0,0 +1,208 @@
package com.ruoyi.business.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.business.domain.BizProject;
import com.ruoyi.business.domain.BizPublicityExecutionIntent;
import com.ruoyi.business.domain.BizPublicitySupportIntent;
import com.ruoyi.business.service.IBizProjectService;
import com.ruoyi.business.service.IBizPublicityExecutionIntentService;
import com.ruoyi.business.service.IBizPublicitySupportIntentService;
import com.ruoyi.system.mapper.SysUserMapper;
/**
* 公示页意向 Controller (匿名 + 管理后台共用)
*
* 公开端点 (公开门户 + 匿名访客可调):
* - POST /business/publicity/supportIntent 提交支持意向
* - POST /business/publicity/executionIntent 提交执行意向
* - GET /business/publicity/hasIntent 查"是否已提交" (按 projectId + phone + type)
*
* 管理端点 (manager / admin 后台列表, 复用通用 /list /{id} / POST / PUT / DELETE):
* - /business/publicitySupportIntent/...
* - /business/publicityExecutionIntent/...
*/
@RestController
public class BizPublicityIntentController extends BaseController {
@Autowired private IBizProjectService bizProjectService;
@Autowired private IBizPublicitySupportIntentService supportIntentService;
@Autowired private IBizPublicityExecutionIntentService executionIntentService;
@Autowired private SysUserMapper sysUserMapper;
private static final String SOURCE_PUBLICITY = "publicity";
// ============== 公开端点: 提交 ==============
/**
* 提交支持意向 (公开)
* POST /business/publicity/supportIntent
* body: { projectId, name, phone, workUnit, department?, position? }
* 已登录自动回填 user_id
*/
@Log(title = "公示页-支持意向", businessType = BusinessType.INSERT)
@PostMapping("/business/publicity/supportIntent")
public AjaxResult submitSupportIntent(@RequestBody BizPublicitySupportIntent intent) {
return doSubmit(intent, supportIntentService);
}
/**
* 提交执行意向 (公开)
*/
@Log(title = "公示页-执行意向", businessType = BusinessType.INSERT)
@PostMapping("/business/publicity/executionIntent")
public AjaxResult submitExecutionIntent(@RequestBody BizPublicityExecutionIntent intent) {
return doSubmit(intent, executionIntentService);
}
/** 通用提交逻辑 (支持 + 执行 同构) */
private <T> AjaxResult doSubmit(T rawIntent, Object service) {
// 取通用字段
Long projectId = null;
String name = null, phone = null, workUnit = null, department = null, position = null;
if (rawIntent instanceof BizPublicitySupportIntent) {
BizPublicitySupportIntent i = (BizPublicitySupportIntent) rawIntent;
projectId = i.getProjectId(); name = i.getName(); phone = i.getPhone();
workUnit = i.getWorkUnit(); department = i.getDepartment(); position = i.getPosition();
} else if (rawIntent instanceof BizPublicityExecutionIntent) {
BizPublicityExecutionIntent i = (BizPublicityExecutionIntent) rawIntent;
projectId = i.getProjectId(); name = i.getName(); phone = i.getPhone();
workUnit = i.getWorkUnit(); department = i.getDepartment(); position = i.getPosition();
}
if (projectId == null) return error("projectId 不能为空");
if (name == null || name.trim().isEmpty()) return error("姓名不能为空");
if (phone == null || phone.trim().isEmpty()) return error("手机号不能为空");
if (workUnit == null || workUnit.trim().isEmpty()) return error("工作单位不能为空");
// 反查项目 no/name 写冗余
BizProject proj = bizProjectService.getById(String.valueOf(projectId));
if (proj == null) return error("项目不存在");
// 查重 (按 project_id + phone + source)
Object dup;
if (service instanceof IBizPublicitySupportIntentService) {
dup = ((IBizPublicitySupportIntentService) service).findDuplicate(projectId, phone, SOURCE_PUBLICITY);
} else {
dup = ((IBizPublicityExecutionIntentService) service).findDuplicate(projectId, phone, SOURCE_PUBLICITY);
}
if (dup != null) return error("您已提交过该意向");
// 回填 user_id + createBy:
// 1) 已登录直接取当前用户
// 2) 未登录但 phone 能匹配到 sys_user → 仍回填 userId (账号自动关联, 不需要登录)
// 3) 完全匿名 → 两者都为空
String createBy = null;
Long userId = null;
try {
if (SecurityUtils.getUsername() != null && !"anonymous".equals(SecurityUtils.getUsername())) {
createBy = SecurityUtils.getUsername();
userId = SecurityUtils.getUserId();
}
} catch (Exception ignore) { /* 匿名 */ }
if (userId == null && phone != null && !phone.isEmpty()) {
try {
com.ruoyi.common.core.domain.entity.SysUser u = sysUserMapper.checkPhoneUnique(phone);
if (u != null && u.getUserId() != null) {
userId = u.getUserId();
// 匿名场景下也补一下 createBy (虽然表里没强制要求, 但便于审计)
if (createBy == null) createBy = u.getUserName();
}
} catch (Exception ignore) { /* 表不存在等 */ }
}
// 写入
int n;
if (rawIntent instanceof BizPublicitySupportIntent) {
BizPublicitySupportIntent i = (BizPublicitySupportIntent) rawIntent;
i.setProjectNo(proj.getProjectNo());
i.setProjectName(proj.getProjectName());
i.setSource(SOURCE_PUBLICITY);
i.setIntentStatus("待审核");
i.setUserId(userId);
i.setCreateBy(createBy);
n = supportIntentService.insert(i);
return n > 0 ? success(i) : error("提交失败");
} else {
BizPublicityExecutionIntent i = (BizPublicityExecutionIntent) rawIntent;
i.setProjectNo(proj.getProjectNo());
i.setProjectName(proj.getProjectName());
i.setSource(SOURCE_PUBLICITY);
i.setIntentStatus("待审核");
i.setUserId(userId);
i.setCreateBy(createBy);
n = executionIntentService.insert(i);
return n > 0 ? success(i) : error("提交失败");
}
}
/**
* 持久化"已提交"查询 (公开)
* GET /business/publicity/hasIntent?projectId=&phone=&type=support|execution
* 按 (project_id, phone, source='publicity') 查重
*/
@GetMapping("/business/publicity/hasIntent")
public AjaxResult hasIntent(@RequestParam("projectId") Long projectId,
@RequestParam("phone") String phone,
@RequestParam("type") String type) {
if (projectId == null || phone == null || phone.isEmpty()) return success(false);
boolean exists;
if ("execution".equalsIgnoreCase(type)) {
exists = executionIntentService.findDuplicate(projectId, phone, SOURCE_PUBLICITY) != null;
} else {
// 默认 support
exists = supportIntentService.findDuplicate(projectId, phone, SOURCE_PUBLICITY) != null;
}
return success(exists);
}
// ============== 管理端点: 列表 + CRUD (manager / admin 后台) ==============
/** 支持意向列表 (分页, 与现有 /business/supportIntent/list 一致格式) */
@GetMapping("/business/publicitySupportIntent/list")
public TableDataInfo listSupport(BizPublicitySupportIntent intent) {
startPage();
List<BizPublicitySupportIntent> list = supportIntentService.selectList(intent);
return getDataTable(list);
}
@GetMapping("/business/publicitySupportIntent/{intentId}")
public AjaxResult getSupport(@PathVariable("intentId") Long intentId) {
return success(supportIntentService.getById(intentId));
}
@Log(title = "公示页-支持意向", businessType = BusinessType.UPDATE)
@PutMapping("/business/publicitySupportIntent")
public AjaxResult editSupport(@RequestBody BizPublicitySupportIntent intent) {
try { intent.setUpdateBy(SecurityUtils.getUsername()); } catch (Exception ignore) {}
return toAjax(supportIntentService.updateByPrimaryKey(intent));
}
@Log(title = "公示页-支持意向", businessType = BusinessType.DELETE)
@DeleteMapping("/business/publicitySupportIntent/{ids}")
public AjaxResult removeSupport(@PathVariable Long[] ids) {
return toAjax(supportIntentService.deleteByPrimaryKeys(ids));
}
/** 执行意向列表 */
@GetMapping("/business/publicityExecutionIntent/list")
public TableDataInfo listExecution(BizPublicityExecutionIntent intent) {
startPage();
List<BizPublicityExecutionIntent> list = executionIntentService.selectList(intent);
return getDataTable(list);
}
@GetMapping("/business/publicityExecutionIntent/{intentId}")
public AjaxResult getExecution(@PathVariable("intentId") Long intentId) {
return success(executionIntentService.getById(intentId));
}
@Log(title = "公示页-执行意向", businessType = BusinessType.UPDATE)
@PutMapping("/business/publicityExecutionIntent")
public AjaxResult editExecution(@RequestBody BizPublicityExecutionIntent intent) {
try { intent.setUpdateBy(SecurityUtils.getUsername()); } catch (Exception ignore) {}
return toAjax(executionIntentService.updateByPrimaryKey(intent));
}
@Log(title = "公示页-执行意向", businessType = BusinessType.DELETE)
@DeleteMapping("/business/publicityExecutionIntent/{ids}")
public AjaxResult removeExecution(@PathVariable Long[] ids) {
return toAjax(executionIntentService.deleteByPrimaryKeys(ids));
}
}
@@ -0,0 +1,86 @@
package com.ruoyi.business.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 公示页-执行意向 (匿名快照, 与 sys_user 解耦)
* 数据源: /publicity/:projectId 页面 "表达执行意向" 按钮
* 与 biz_execution_intent (旧表, 已登录专家报名流程) 语义不同, 物理表独立
*/
public class BizPublicityExecutionIntent extends BaseEntity {
private static final long serialVersionUID = 1L;
/** intent_id */
private Long intentId;
/** project_id (biz_project.project_id) */
@Excel(name = "project_id")
private Long projectId;
/** project_no (冗余) */
@Excel(name = "project_no")
private String projectNo;
/** project_name (冗余) */
@Excel(name = "project_name")
private String projectName;
/** user_id (已登录时回填 sys_user.user_id, 未登录 NULL) */
@Excel(name = "user_id")
private Long userId;
/** name */
@Excel(name = "name")
private String name;
/** phone */
@Excel(name = "phone")
private String phone;
/** work_unit 工作单位名称 */
@Excel(name = "work_unit")
private String workUnit;
/** department 部门 */
@Excel(name = "department")
private String department;
/** position 职务 */
@Excel(name = "position")
private String position;
/** source 来源 publicity=公示页 */
@Excel(name = "source")
private String source;
/** intent_status 状态 (待审核/已采纳/已拒绝) */
@Excel(name = "intent_status")
private String intentStatus;
/** remark 备注 */
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public Long getIntentId() { return intentId; }
public void setIntentId(Long intentId) { this.intentId = intentId; }
public Long getProjectId() { return projectId; }
public void setProjectId(Long projectId) { this.projectId = projectId; }
public String getProjectNo() { return projectNo; }
public void setProjectNo(String projectNo) { this.projectNo = projectNo; }
public String getProjectName() { return projectName; }
public void setProjectName(String projectName) { this.projectName = projectName; }
public Long getUserId() { return userId; }
public void setUserId(Long userId) { this.userId = userId; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getPhone() { return phone; }
public void setPhone(String phone) { this.phone = phone; }
public String getWorkUnit() { return workUnit; }
public void setWorkUnit(String workUnit) { this.workUnit = workUnit; }
public String getDepartment() { return department; }
public void setDepartment(String department) { this.department = department; }
public String getPosition() { return position; }
public void setPosition(String position) { this.position = position; }
public String getSource() { return source; }
public void setSource(String source) { this.source = source; }
public String getIntentStatus() { return intentStatus; }
public void setIntentStatus(String intentStatus) { this.intentStatus = intentStatus; }
public String getRemark() { return remark; }
public void setRemark(String remark) { this.remark = remark; }
public Date getCreateTime() { return createTime; }
public void setCreateTime(Date createTime) { this.createTime = createTime; }
public Date getUpdateTime() { return updateTime; }
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
}
@@ -0,0 +1,86 @@
package com.ruoyi.business.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 公示页-支持意向 (匿名快照, 与 sys_user 解耦)
* 数据源: /publicity/:projectId 页面 "表达支持意向" 按钮
* 与 biz_support_intent (旧表, 已登录用户流程) 语义不同, 物理表独立
*/
public class BizPublicitySupportIntent extends BaseEntity {
private static final long serialVersionUID = 1L;
/** intent_id */
private Long intentId;
/** project_id (biz_project.project_id) */
@Excel(name = "project_id")
private Long projectId;
/** project_no (冗余) */
@Excel(name = "project_no")
private String projectNo;
/** project_name (冗余) */
@Excel(name = "project_name")
private String projectName;
/** user_id (已登录时回填 sys_user.user_id, 未登录 NULL) */
@Excel(name = "user_id")
private Long userId;
/** name */
@Excel(name = "name")
private String name;
/** phone */
@Excel(name = "phone")
private String phone;
/** work_unit 工作单位名称 */
@Excel(name = "work_unit")
private String workUnit;
/** department 部门 */
@Excel(name = "department")
private String department;
/** position 职务 */
@Excel(name = "position")
private String position;
/** source 来源 publicity=公示页 */
@Excel(name = "source")
private String source;
/** intent_status 状态 (待审核/已采纳/已拒绝) */
@Excel(name = "intent_status")
private String intentStatus;
/** remark 备注 */
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public Long getIntentId() { return intentId; }
public void setIntentId(Long intentId) { this.intentId = intentId; }
public Long getProjectId() { return projectId; }
public void setProjectId(Long projectId) { this.projectId = projectId; }
public String getProjectNo() { return projectNo; }
public void setProjectNo(String projectNo) { this.projectNo = projectNo; }
public String getProjectName() { return projectName; }
public void setProjectName(String projectName) { this.projectName = projectName; }
public Long getUserId() { return userId; }
public void setUserId(Long userId) { this.userId = userId; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getPhone() { return phone; }
public void setPhone(String phone) { this.phone = phone; }
public String getWorkUnit() { return workUnit; }
public void setWorkUnit(String workUnit) { this.workUnit = workUnit; }
public String getDepartment() { return department; }
public void setDepartment(String department) { this.department = department; }
public String getPosition() { return position; }
public void setPosition(String position) { this.position = position; }
public String getSource() { return source; }
public void setSource(String source) { this.source = source; }
public String getIntentStatus() { return intentStatus; }
public void setIntentStatus(String intentStatus) { this.intentStatus = intentStatus; }
public String getRemark() { return remark; }
public void setRemark(String remark) { this.remark = remark; }
public Date getCreateTime() { return createTime; }
public void setCreateTime(Date createTime) { this.createTime = createTime; }
public Date getUpdateTime() { return updateTime; }
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
}
@@ -0,0 +1,18 @@
package com.ruoyi.business.mapper;
import java.util.List;
import com.ruoyi.business.domain.BizPublicityExecutionIntent;
/**
* 公示页-执行意向 Mapper
*/
public interface BizPublicityExecutionIntentMapper {
BizPublicityExecutionIntent selectByPrimaryKey(Long intentId);
List<BizPublicityExecutionIntent> selectList(BizPublicityExecutionIntent entity);
/** 查重: 按 (project_id, phone, source) 已存在则返回记录, 否则 null */
BizPublicityExecutionIntent selectDuplicate(BizPublicityExecutionIntent entity);
int insert(BizPublicityExecutionIntent entity);
int updateByPrimaryKey(BizPublicityExecutionIntent entity);
int deleteByPrimaryKey(Long intentId);
int deleteByPrimaryKeys(Long[] intentIds);
}
@@ -0,0 +1,18 @@
package com.ruoyi.business.mapper;
import java.util.List;
import com.ruoyi.business.domain.BizPublicitySupportIntent;
/**
* 公示页-支持意向 Mapper
*/
public interface BizPublicitySupportIntentMapper {
BizPublicitySupportIntent selectByPrimaryKey(Long intentId);
List<BizPublicitySupportIntent> selectList(BizPublicitySupportIntent entity);
/** 查重: 按 (project_id, phone, source) 已存在则返回记录, 否则 null */
BizPublicitySupportIntent selectDuplicate(BizPublicitySupportIntent entity);
int insert(BizPublicitySupportIntent entity);
int updateByPrimaryKey(BizPublicitySupportIntent entity);
int deleteByPrimaryKey(Long intentId);
int deleteByPrimaryKeys(Long[] intentIds);
}
@@ -0,0 +1,15 @@
package com.ruoyi.business.service;
import java.util.List;
import com.ruoyi.business.domain.BizPublicityExecutionIntent;
public interface IBizPublicityExecutionIntentService {
BizPublicityExecutionIntent getById(Long intentId);
List<BizPublicityExecutionIntent> selectList(BizPublicityExecutionIntent entity);
/** 按 (projectId, phone, source) 查重 */
BizPublicityExecutionIntent findDuplicate(Long projectId, String phone, String source);
int insert(BizPublicityExecutionIntent entity);
int updateByPrimaryKey(BizPublicityExecutionIntent entity);
int deleteByPrimaryKey(Long intentId);
int deleteByPrimaryKeys(Long[] intentIds);
}
@@ -0,0 +1,15 @@
package com.ruoyi.business.service;
import java.util.List;
import com.ruoyi.business.domain.BizPublicitySupportIntent;
public interface IBizPublicitySupportIntentService {
BizPublicitySupportIntent getById(Long intentId);
List<BizPublicitySupportIntent> selectList(BizPublicitySupportIntent entity);
/** 按 (projectId, phone, source) 查重, 已存在返回记录 */
BizPublicitySupportIntent findDuplicate(Long projectId, String phone, String source);
int insert(BizPublicitySupportIntent entity);
int updateByPrimaryKey(BizPublicitySupportIntent entity);
int deleteByPrimaryKey(Long intentId);
int deleteByPrimaryKeys(Long[] intentIds);
}
@@ -0,0 +1,26 @@
package com.ruoyi.business.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.domain.BizPublicityExecutionIntent;
import com.ruoyi.business.mapper.BizPublicityExecutionIntentMapper;
import com.ruoyi.business.service.IBizPublicityExecutionIntentService;
@Service
public class BizPublicityExecutionIntentServiceImpl implements IBizPublicityExecutionIntentService {
@Autowired
private BizPublicityExecutionIntentMapper mapper;
@Override public BizPublicityExecutionIntent getById(Long intentId) { return mapper.selectByPrimaryKey(intentId); }
@Override public List<BizPublicityExecutionIntent> selectList(BizPublicityExecutionIntent entity) { return mapper.selectList(entity); }
@Override public BizPublicityExecutionIntent findDuplicate(Long projectId, String phone, String source) {
BizPublicityExecutionIntent q = new BizPublicityExecutionIntent();
q.setProjectId(projectId); q.setPhone(phone); q.setSource(source);
return mapper.selectDuplicate(q);
}
@Override public int insert(BizPublicityExecutionIntent entity) { return mapper.insert(entity); }
@Override public int updateByPrimaryKey(BizPublicityExecutionIntent entity) { return mapper.updateByPrimaryKey(entity); }
@Override public int deleteByPrimaryKey(Long intentId) { return mapper.deleteByPrimaryKey(intentId); }
@Override public int deleteByPrimaryKeys(Long[] intentIds) { return mapper.deleteByPrimaryKeys(intentIds); }
}
@@ -0,0 +1,26 @@
package com.ruoyi.business.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.domain.BizPublicitySupportIntent;
import com.ruoyi.business.mapper.BizPublicitySupportIntentMapper;
import com.ruoyi.business.service.IBizPublicitySupportIntentService;
@Service
public class BizPublicitySupportIntentServiceImpl implements IBizPublicitySupportIntentService {
@Autowired
private BizPublicitySupportIntentMapper mapper;
@Override public BizPublicitySupportIntent getById(Long intentId) { return mapper.selectByPrimaryKey(intentId); }
@Override public List<BizPublicitySupportIntent> selectList(BizPublicitySupportIntent entity) { return mapper.selectList(entity); }
@Override public BizPublicitySupportIntent findDuplicate(Long projectId, String phone, String source) {
BizPublicitySupportIntent q = new BizPublicitySupportIntent();
q.setProjectId(projectId); q.setPhone(phone); q.setSource(source);
return mapper.selectDuplicate(q);
}
@Override public int insert(BizPublicitySupportIntent entity) { return mapper.insert(entity); }
@Override public int updateByPrimaryKey(BizPublicitySupportIntent entity) { return mapper.updateByPrimaryKey(entity); }
@Override public int deleteByPrimaryKey(Long intentId) { return mapper.deleteByPrimaryKey(intentId); }
@Override public int deleteByPrimaryKeys(Long[] intentIds) { return mapper.deleteByPrimaryKeys(intentIds); }
}
@@ -0,0 +1,114 @@
<?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.ruoyi.business.mapper.BizPublicityExecutionIntentMapper">
<resultMap type="BizPublicityExecutionIntent" id="BizPublicityExecutionIntentResult">
<id property="intentId" column="intent_id" />
<result property="projectId" column="project_id" />
<result property="projectNo" column="project_no" />
<result property="projectName" column="project_name" />
<result property="userId" column="user_id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="workUnit" column="work_unit" />
<result property="department" column="department" />
<result property="position" column="position" />
<result property="source" column="source" />
<result property="intentStatus" column="intent_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectFields">
select intent_id, project_id, project_no, project_name, user_id, name, phone, work_unit, department, position, source, intent_status, remark, create_by, create_time, update_by, update_time
from biz_publicity_execution_intent
</sql>
<select id="selectByPrimaryKey" resultMap="BizPublicityExecutionIntentResult" parameterType="Long">
<include refid="selectFields"/>
where intent_id = #{intentId}
</select>
<select id="selectList" resultMap="BizPublicityExecutionIntentResult" parameterType="BizPublicityExecutionIntent">
<include refid="selectFields"/>
<where>
<if test="projectId != null"> and project_id = #{projectId}</if>
<if test="projectNo != null and projectNo != ''"> and project_no = #{projectNo}</if>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="workUnit != null and workUnit != ''"> and work_unit like concat('%', #{workUnit}, '%')</if>
<if test="intentStatus != null and intentStatus != ''"> and intent_status = #{intentStatus}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
</where>
order by intent_id desc
</select>
<!-- 查重 -->
<select id="selectDuplicate" resultMap="BizPublicityExecutionIntentResult" parameterType="BizPublicityExecutionIntent">
<include refid="selectFields"/>
where project_id = #{projectId}
and phone = #{phone}
and source = #{source}
limit 1
</select>
<insert id="insert" parameterType="BizPublicityExecutionIntent" useGeneratedKeys="true" keyProperty="intentId">
insert into biz_publicity_execution_intent
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="intentId != null">intent_id,</if>
<if test="projectId != null">project_id,</if>
<if test="projectNo != null and projectNo != ''">project_no,</if>
<if test="projectName != null and projectName != ''">project_name,</if>
<if test="userId != null">user_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="workUnit != null and workUnit != ''">work_unit,</if>
<if test="department != null and department != ''">department,</if>
<if test="position != null and position != ''">position,</if>
<if test="source != null and source != ''">source,</if>
<if test="intentStatus != null and intentStatus != ''">intent_status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="intentId != null">#{intentId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="projectNo != null and projectNo != ''">#{projectNo},</if>
<if test="projectName != null and projectName != ''">#{projectName},</if>
<if test="userId != null">#{userId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="workUnit != null and workUnit != ''">#{workUnit},</if>
<if test="department != null and department != ''">#{department},</if>
<if test="position != null and position != ''">#{position},</if>
<if test="source != null and source != ''">#{source},</if>
<if test="intentStatus != null and intentStatus != ''">#{intentStatus},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate(),
</trim>
</insert>
<update id="updateByPrimaryKey" parameterType="BizPublicityExecutionIntent">
update biz_publicity_execution_intent
<trim prefix="SET" suffixOverrides=",">
<if test="intentStatus != null and intentStatus != ''">intent_status = #{intentStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="workUnit != null and workUnit != ''">work_unit = #{workUnit},</if>
<if test="department != null">department = #{department},</if>
<if test="position != null">position = #{position},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate(),
</trim>
where intent_id = #{intentId}
</update>
<delete id="deleteByPrimaryKey" parameterType="Long">
delete from biz_publicity_execution_intent where intent_id = #{intentId}
</delete>
<delete id="deleteByPrimaryKeys" parameterType="Long">
delete from biz_publicity_execution_intent where intent_id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,114 @@
<?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.ruoyi.business.mapper.BizPublicitySupportIntentMapper">
<resultMap type="BizPublicitySupportIntent" id="BizPublicitySupportIntentResult">
<id property="intentId" column="intent_id" />
<result property="projectId" column="project_id" />
<result property="projectNo" column="project_no" />
<result property="projectName" column="project_name" />
<result property="userId" column="user_id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="workUnit" column="work_unit" />
<result property="department" column="department" />
<result property="position" column="position" />
<result property="source" column="source" />
<result property="intentStatus" column="intent_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectFields">
select intent_id, project_id, project_no, project_name, user_id, name, phone, work_unit, department, position, source, intent_status, remark, create_by, create_time, update_by, update_time
from biz_publicity_support_intent
</sql>
<select id="selectByPrimaryKey" resultMap="BizPublicitySupportIntentResult" parameterType="Long">
<include refid="selectFields"/>
where intent_id = #{intentId}
</select>
<select id="selectList" resultMap="BizPublicitySupportIntentResult" parameterType="BizPublicitySupportIntent">
<include refid="selectFields"/>
<where>
<if test="projectId != null"> and project_id = #{projectId}</if>
<if test="projectNo != null and projectNo != ''"> and project_no = #{projectNo}</if>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="workUnit != null and workUnit != ''"> and work_unit like concat('%', #{workUnit}, '%')</if>
<if test="intentStatus != null and intentStatus != ''"> and intent_status = #{intentStatus}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
</where>
order by intent_id desc
</select>
<!-- 查重: 同一项目同一手机号同一来源只能提交一次 -->
<select id="selectDuplicate" resultMap="BizPublicitySupportIntentResult" parameterType="BizPublicitySupportIntent">
<include refid="selectFields"/>
where project_id = #{projectId}
and phone = #{phone}
and source = #{source}
limit 1
</select>
<insert id="insert" parameterType="BizPublicitySupportIntent" useGeneratedKeys="true" keyProperty="intentId">
insert into biz_publicity_support_intent
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="intentId != null">intent_id,</if>
<if test="projectId != null">project_id,</if>
<if test="projectNo != null and projectNo != ''">project_no,</if>
<if test="projectName != null and projectName != ''">project_name,</if>
<if test="userId != null">user_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="workUnit != null and workUnit != ''">work_unit,</if>
<if test="department != null and department != ''">department,</if>
<if test="position != null and position != ''">position,</if>
<if test="source != null and source != ''">source,</if>
<if test="intentStatus != null and intentStatus != ''">intent_status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="intentId != null">#{intentId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="projectNo != null and projectNo != ''">#{projectNo},</if>
<if test="projectName != null and projectName != ''">#{projectName},</if>
<if test="userId != null">#{userId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="workUnit != null and workUnit != ''">#{workUnit},</if>
<if test="department != null and department != ''">#{department},</if>
<if test="position != null and position != ''">#{position},</if>
<if test="source != null and source != ''">#{source},</if>
<if test="intentStatus != null and intentStatus != ''">#{intentStatus},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate(),
</trim>
</insert>
<update id="updateByPrimaryKey" parameterType="BizPublicitySupportIntent">
update biz_publicity_support_intent
<trim prefix="SET" suffixOverrides=",">
<if test="intentStatus != null and intentStatus != ''">intent_status = #{intentStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="workUnit != null and workUnit != ''">work_unit = #{workUnit},</if>
<if test="department != null">department = #{department},</if>
<if test="position != null">position = #{position},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate(),
</trim>
where intent_id = #{intentId}
</update>
<delete id="deleteByPrimaryKey" parameterType="Long">
delete from biz_publicity_support_intent where intent_id = #{intentId}
</delete>
<delete id="deleteByPrimaryKeys" parameterType="Long">
delete from biz_publicity_support_intent where intent_id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>