Browse Source

新增项目联系人代码

zjc 1 year ago
parent
commit
cff379ea7f

+ 105 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectContactsController.java

@@ -0,0 +1,105 @@
+package com.ruoyi.web.controller.invest;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.system.domain.invest.TProjectContacts;
+import com.ruoyi.system.service.invest.ITProjectContactsService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 项目联系人Controller
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+@RestController
+@RequestMapping("/invest/contacts")
+public class TProjectContactsController extends BaseController
+{
+    @Autowired
+    private ITProjectContactsService tProjectContactsService;
+
+    /**
+     * 查询项目联系人列表
+     */
+    @PreAuthorize("@ss.hasPermi('invest:contacts:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TProjectContacts tProjectContacts)
+    {
+        startPage();
+        List<TProjectContacts> list = tProjectContactsService.selectTProjectContactsList(tProjectContacts);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出项目联系人列表
+     */
+    @PreAuthorize("@ss.hasPermi('invest:contacts:export')")
+    @Log(title = "项目联系人", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TProjectContacts tProjectContacts)
+    {
+        List<TProjectContacts> list = tProjectContactsService.selectTProjectContactsList(tProjectContacts);
+        ExcelUtil<TProjectContacts> util = new ExcelUtil<TProjectContacts>(TProjectContacts.class);
+        util.exportExcel(response, list, "项目联系人数据");
+    }
+
+    /**
+     * 获取项目联系人详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('invest:contacts:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") String id)
+    {
+        return success(tProjectContactsService.selectTProjectContactsById(id));
+    }
+
+    /**
+     * 新增项目联系人
+     */
+    @PreAuthorize("@ss.hasPermi('invest:contacts:add')")
+    @Log(title = "项目联系人", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TProjectContacts tProjectContacts)
+    {
+        return toAjax(tProjectContactsService.insertTProjectContacts(tProjectContacts));
+    }
+
+    /**
+     * 修改项目联系人
+     */
+    @PreAuthorize("@ss.hasPermi('invest:contacts:edit')")
+    @Log(title = "项目联系人", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TProjectContacts tProjectContacts)
+    {
+        return toAjax(tProjectContactsService.updateTProjectContacts(tProjectContacts));
+    }
+
+    /**
+     * 删除项目联系人
+     */
+    @PreAuthorize("@ss.hasPermi('invest:contacts:remove')")
+    @Log(title = "项目联系人", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids)
+    {
+        return toAjax(tProjectContactsService.deleteTProjectContactsByIds(ids));
+    }
+}

+ 97 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/invest/TProjectContacts.java

@@ -0,0 +1,97 @@
+package com.ruoyi.system.domain.invest;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 项目联系人对象 t_project_contacts
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+public class TProjectContacts extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键ID */
+    private String id;
+
+    /** 联系人姓名 */
+    @Excel(name = "联系人姓名")
+    private String name;
+
+    /** 职位 */
+    @Excel(name = "职位")
+    private String position;
+
+    /** 联系电话/微信 */
+    @Excel(name = "联系电话/微信")
+    private String contact;
+
+    /** 状态 */
+    private String delFlag;
+
+    public void setId(String id) 
+    {
+        this.id = id;
+    }
+
+    public String getId() 
+    {
+        return id;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setPosition(String position) 
+    {
+        this.position = position;
+    }
+
+    public String getPosition() 
+    {
+        return position;
+    }
+    public void setContact(String contact) 
+    {
+        this.contact = contact;
+    }
+
+    public String getContact() 
+    {
+        return contact;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("name", getName())
+            .append("position", getPosition())
+            .append("contact", getContact())
+            .append("remark", getRemark())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 62 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/invest/TProjectContactsMapper.java

@@ -0,0 +1,62 @@
+package com.ruoyi.system.mapper.invest;
+
+import com.ruoyi.system.domain.invest.TProjectContacts;
+
+import java.util.List;
+
+/**
+ * 项目联系人Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+public interface TProjectContactsMapper 
+{
+    /**
+     * 查询项目联系人
+     * 
+     * @param id 项目联系人主键
+     * @return 项目联系人
+     */
+    public TProjectContacts selectTProjectContactsById(String id);
+
+    /**
+     * 查询项目联系人列表
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 项目联系人集合
+     */
+    public List<TProjectContacts> selectTProjectContactsList(TProjectContacts tProjectContacts);
+
+    /**
+     * 新增项目联系人
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 结果
+     */
+    public int insertTProjectContacts(TProjectContacts tProjectContacts);
+
+    /**
+     * 修改项目联系人
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 结果
+     */
+    public int updateTProjectContacts(TProjectContacts tProjectContacts);
+
+    /**
+     * 删除项目联系人
+     * 
+     * @param id 项目联系人主键
+     * @return 结果
+     */
+    public int deleteTProjectContactsById(String id);
+
+    /**
+     * 批量删除项目联系人
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTProjectContactsByIds(String[] ids);
+}

+ 62 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/invest/ITProjectContactsService.java

@@ -0,0 +1,62 @@
+package com.ruoyi.system.service.invest;
+
+import com.ruoyi.system.domain.invest.TProjectContacts;
+
+import java.util.List;
+
+/**
+ * 项目联系人Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+public interface ITProjectContactsService 
+{
+    /**
+     * 查询项目联系人
+     * 
+     * @param id 项目联系人主键
+     * @return 项目联系人
+     */
+    public TProjectContacts selectTProjectContactsById(String id);
+
+    /**
+     * 查询项目联系人列表
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 项目联系人集合
+     */
+    public List<TProjectContacts> selectTProjectContactsList(TProjectContacts tProjectContacts);
+
+    /**
+     * 新增项目联系人
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 结果
+     */
+    public int insertTProjectContacts(TProjectContacts tProjectContacts);
+
+    /**
+     * 修改项目联系人
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 结果
+     */
+    public int updateTProjectContacts(TProjectContacts tProjectContacts);
+
+    /**
+     * 批量删除项目联系人
+     * 
+     * @param ids 需要删除的项目联系人主键集合
+     * @return 结果
+     */
+    public int deleteTProjectContactsByIds(String[] ids);
+
+    /**
+     * 删除项目联系人信息
+     * 
+     * @param id 项目联系人主键
+     * @return 结果
+     */
+    public int deleteTProjectContactsById(String id);
+}

+ 98 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/invest/impl/TProjectContactsServiceImpl.java

@@ -0,0 +1,98 @@
+package com.ruoyi.system.service.invest.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.system.domain.invest.TProjectContacts;
+import com.ruoyi.system.mapper.invest.TProjectContactsMapper;
+import com.ruoyi.system.service.invest.ITProjectContactsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 项目联系人Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+@Service
+public class TProjectContactsServiceImpl implements ITProjectContactsService
+{
+    @Autowired
+    private TProjectContactsMapper tProjectContactsMapper;
+
+    /**
+     * 查询项目联系人
+     * 
+     * @param id 项目联系人主键
+     * @return 项目联系人
+     */
+    @Override
+    public TProjectContacts selectTProjectContactsById(String id)
+    {
+        return tProjectContactsMapper.selectTProjectContactsById(id);
+    }
+
+    /**
+     * 查询项目联系人列表
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 项目联系人
+     */
+    @Override
+    public List<TProjectContacts> selectTProjectContactsList(TProjectContacts tProjectContacts)
+    {
+        return tProjectContactsMapper.selectTProjectContactsList(tProjectContacts);
+    }
+
+    /**
+     * 新增项目联系人
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 结果
+     */
+    @Override
+    public int insertTProjectContacts(TProjectContacts tProjectContacts)
+    {
+        tProjectContacts.setCreateTime(DateUtils.getNowDate());
+        tProjectContacts.setId(IdUtils.fastSimpleUUID());
+        return tProjectContactsMapper.insertTProjectContacts(tProjectContacts);
+    }
+
+    /**
+     * 修改项目联系人
+     * 
+     * @param tProjectContacts 项目联系人
+     * @return 结果
+     */
+    @Override
+    public int updateTProjectContacts(TProjectContacts tProjectContacts)
+    {
+        tProjectContacts.setUpdateTime(DateUtils.getNowDate());
+        return tProjectContactsMapper.updateTProjectContacts(tProjectContacts);
+    }
+
+    /**
+     * 批量删除项目联系人
+     * 
+     * @param ids 需要删除的项目联系人主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTProjectContactsByIds(String[] ids)
+    {
+        return tProjectContactsMapper.deleteTProjectContactsByIds(ids);
+    }
+
+    /**
+     * 删除项目联系人信息
+     * 
+     * @param id 项目联系人主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTProjectContactsById(String id)
+    {
+        return tProjectContactsMapper.deleteTProjectContactsById(id);
+    }
+}

+ 92 - 0
ruoyi-system/src/main/resources/mapper/invest/TProjectContactsMapper.xml

@@ -0,0 +1,92 @@
+<?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.system.mapper.invest.TProjectContactsMapper">
+    
+    <resultMap type="TProjectContacts" id="TProjectContactsResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="position"    column="position"    />
+        <result property="contact"    column="contact"    />
+        <result property="remark"    column="remark"    />
+        <result property="delFlag"    column="del_flag"    />
+        <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="selectTProjectContactsVo">
+        select id, name, position, contact, remark, del_flag, create_by, create_time, update_by, update_time from t_project_contacts
+    </sql>
+
+    <select id="selectTProjectContactsList" parameterType="TProjectContacts" resultMap="TProjectContactsResult">
+        <include refid="selectTProjectContactsVo"/>
+        <where>  
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="position != null  and position != ''"> and position like concat('%', #{position}, '%')</if>
+            <if test="contact != null  and contact != ''"> and contact like concat('%', #{contact}, '%')</if>
+        </where>
+    </select>
+    
+    <select id="selectTProjectContactsById" parameterType="String" resultMap="TProjectContactsResult">
+        <include refid="selectTProjectContactsVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertTProjectContacts" parameterType="TProjectContacts">
+        insert into t_project_contacts
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="name != null">name,</if>
+            <if test="position != null">position,</if>
+            <if test="contact != null">contact,</if>
+            <if test="remark != null">remark,</if>
+            <if test="delFlag != null">del_flag,</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>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="name != null">#{name},</if>
+            <if test="position != null">#{position},</if>
+            <if test="contact != null">#{contact},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="delFlag != null">#{delFlag},</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>
+         </trim>
+    </insert>
+
+    <update id="updateTProjectContacts" parameterType="TProjectContacts">
+        update t_project_contacts
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="position != null">position = #{position},</if>
+            <if test="contact != null">contact = #{contact},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</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>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTProjectContactsById" parameterType="String">
+        delete from t_project_contacts where id = #{id}
+    </delete>
+
+    <delete id="deleteTProjectContactsByIds" parameterType="String">
+        delete from t_project_contacts where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>