Ver código fonte

用户档案新增与修改

anderx 1 ano atrás
pai
commit
6c8d45cd2a

+ 86 - 0
src/main/java/com/goafanti/common/dao/UserArchivesMapper.java

@@ -0,0 +1,86 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.UserArchives;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+
+import java.util.List;
+
+/**
+ * 客户档案表(UserArchives)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-07-12 11:52:01
+ */
+public interface UserArchivesMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    UserArchives queryById(Integer id);
+
+    
+
+    /**
+     * 查询指定行数据
+     *
+     * @param userArchives 查询条件
+     * @param pageable         分页对象
+     * @return 对象列表
+     */
+    List<UserArchives> findUserArchivesList(UserArchives userArchives, @Param("pageable") Pageable pageable);
+
+    /**
+     * 统计总行数
+     *
+     * @param userArchives 查询条件
+     * @return 总行数
+     */
+    int findUserArchivesCount(UserArchives userArchives);
+
+    /**
+     * 新增数据
+     *
+     * @param userArchives 实例对象
+     * @return 影响行数
+     */
+    int insert(UserArchives userArchives);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<UserArchives> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<UserArchives> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<UserArchives> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<UserArchives> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param userArchives 实例对象
+     * @return 影响行数
+     */
+    int update(UserArchives userArchives);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+}
+

+ 199 - 0
src/main/java/com/goafanti/common/mapper/UserArchivesMapper.xml

@@ -0,0 +1,199 @@
+<?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.goafanti.common.dao.UserArchivesMapper">
+
+    <resultMap type="com.goafanti.common.model.UserArchives" id="UserArchivesMap">
+        <result property="id" column="id" jdbcType="INTEGER"/>
+        <result property="uid" column="uid" jdbcType="INTEGER"/>
+        <result property="patentCount" column="patent_count" jdbcType="INTEGER"/>
+        <result property="inventionPatentCount" column="invention_patent_count" jdbcType="INTEGER"/>
+        <result property="utilityModelCount" column="utility_model_count" jdbcType="INTEGER"/>
+        <result property="appearancePatentCount" column="appearance_patent_count" jdbcType="INTEGER"/>
+        <result property="softwareWorksCount" column="software_works_count" jdbcType="INTEGER"/>
+        <result property="other" column="other" jdbcType="INTEGER"/>
+        <result property="financialData" column="financial_data" jdbcType="VARCHAR"/>
+        <result property="earlyCommunication" column="early_communication" jdbcType="VARCHAR"/>
+        <result property="interviewIdeas" column="interview_ideas" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="UserArchivesMap">
+        select
+id, uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other, financial_data, early_communication, interview_ideas, create_time
+        from user_archives
+        where id = #{id}
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="findUserArchivesList" resultMap="UserArchivesMap">
+        select
+id, uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other, financial_data, early_communication, interview_ideas, create_time
+        from user_archives
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="uid != null">
+                and uid = #{uid}
+            </if>
+            <if test="patentCount != null">
+                and patent_count = #{patentCount}
+            </if>
+            <if test="inventionPatentCount != null">
+                and invention_patent_count = #{inventionPatentCount}
+            </if>
+            <if test="utilityModelCount != null">
+                and utility_model_count = #{utilityModelCount}
+            </if>
+            <if test="appearancePatentCount != null">
+                and appearance_patent_count = #{appearancePatentCount}
+            </if>
+            <if test="softwareWorksCount != null">
+                and software_works_count = #{softwareWorksCount}
+            </if>
+            <if test="other != null">
+                and other = #{other}
+            </if>
+            <if test="financialData != null and financialData != ''">
+                and financial_data = #{financialData}
+            </if>
+            <if test="earlyCommunication != null and earlyCommunication != ''">
+                and early_communication = #{earlyCommunication}
+            </if>
+            <if test="interviewIdeas != null and interviewIdeas != ''">
+                and interview_ideas = #{interviewIdeas}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+        </where>
+        limit #{pageable.offset}, #{pageable.pageSize}
+    </select>
+
+    <!--统计总行数-->
+    <select id="findUserArchivesCount" resultType="java.lang.Integer">
+        select count(1)
+        from user_archives
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="uid != null">
+                and uid = #{uid}
+            </if>
+            <if test="patentCount != null">
+                and patent_count = #{patentCount}
+            </if>
+            <if test="inventionPatentCount != null">
+                and invention_patent_count = #{inventionPatentCount}
+            </if>
+            <if test="utilityModelCount != null">
+                and utility_model_count = #{utilityModelCount}
+            </if>
+            <if test="appearancePatentCount != null">
+                and appearance_patent_count = #{appearancePatentCount}
+            </if>
+            <if test="softwareWorksCount != null">
+                and software_works_count = #{softwareWorksCount}
+            </if>
+            <if test="other != null">
+                and other = #{other}
+            </if>
+            <if test="financialData != null and financialData != ''">
+                and financial_data = #{financialData}
+            </if>
+            <if test="earlyCommunication != null and earlyCommunication != ''">
+                and early_communication = #{earlyCommunication}
+            </if>
+            <if test="interviewIdeas != null and interviewIdeas != ''">
+                and interview_ideas = #{interviewIdeas}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
+        insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other, financial_data, early_communication, interview_ideas, create_time)
+        values (#{uid}, #{patentCount}, #{inventionPatentCount}, #{utilityModelCount}, #{appearancePatentCount}, #{softwareWorksCount}, #{other}, #{financialData}, #{earlyCommunication}, #{interviewIdeas}, #{createTime})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other, financial_data, early_communication, interview_ideas, create_time)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.uid}, #{entity.patentCount}, #{entity.inventionPatentCount}, #{entity.utilityModelCount}, #{entity.appearancePatentCount}, #{entity.softwareWorksCount}, #{entity.other}, #{entity.financialData}, #{entity.earlyCommunication}, #{entity.interviewIdeas}, #{entity.createTime})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other, financial_data, early_communication, interview_ideas, create_time)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.uid}, #{entity.patentCount}, #{entity.inventionPatentCount}, #{entity.utilityModelCount}, #{entity.appearancePatentCount}, #{entity.softwareWorksCount}, #{entity.other}, #{entity.financialData}, #{entity.earlyCommunication}, #{entity.interviewIdeas}, #{entity.createTime})
+        </foreach>
+        on duplicate key update
+uid = values(uid),
+patent_count = values(patent_count),
+invention_patent_count = values(invention_patent_count),
+utility_model_count = values(utility_model_count),
+appearance_patent_count = values(appearance_patent_count),
+software_works_count = values(software_works_count),
+other = values(other),
+financial_data = values(financial_data),
+early_communication = values(early_communication),
+interview_ideas = values(interview_ideas),
+create_time = values(create_time)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update user_archives
+        <set>
+            <if test="uid != null">
+                uid = #{uid},
+            </if>
+            <if test="patentCount != null">
+                patent_count = #{patentCount},
+            </if>
+            <if test="inventionPatentCount != null">
+                invention_patent_count = #{inventionPatentCount},
+            </if>
+            <if test="utilityModelCount != null">
+                utility_model_count = #{utilityModelCount},
+            </if>
+            <if test="appearancePatentCount != null">
+                appearance_patent_count = #{appearancePatentCount},
+            </if>
+            <if test="softwareWorksCount != null">
+                software_works_count = #{softwareWorksCount},
+            </if>
+            <if test="other != null">
+                other = #{other},
+            </if>
+            <if test="financialData != null and financialData != ''">
+                financial_data = #{financialData},
+            </if>
+            <if test="earlyCommunication != null and earlyCommunication != ''">
+                early_communication = #{earlyCommunication},
+            </if>
+            <if test="interviewIdeas != null and interviewIdeas != ''">
+                interview_ideas = #{interviewIdeas},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete from user_archives where id = #{id}
+    </delete>
+
+</mapper>
+

+ 158 - 0
src/main/java/com/goafanti/common/model/UserArchives.java

@@ -0,0 +1,158 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 客户档案表(UserArchives)实体类
+ *
+ * @author makejava
+ * @since 2024-07-12 11:52:01
+ */
+public class UserArchives implements Serializable {
+    private static final long serialVersionUID = -77412612272854895L;
+
+    private Integer id;
+
+    private Integer uid;
+/**
+     * 专利数
+     */
+    private Integer patentCount;
+/**
+     * 发明专利数
+     */
+    private Integer inventionPatentCount;
+/**
+     * 实用新型数
+     */
+    private Integer utilityModelCount;
+/**
+     * 外观专利数
+     */
+    private Integer appearancePatentCount;
+/**
+     * 软著数
+     */
+    private Integer softwareWorksCount;
+/**
+     * 其他数
+     */
+    private Integer other;
+/**
+     * 财务数据
+     */
+    private String financialData;
+/**
+     * 前期沟通
+     */
+    private String earlyCommunication;
+/**
+     * 面谈思路
+     */
+    private String interviewIdeas;
+/**
+     * 创建时间
+     */
+    private Date createTime;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getUid() {
+        return uid;
+    }
+
+    public void setUid(Integer uid) {
+        this.uid = uid;
+    }
+
+    public Integer getPatentCount() {
+        return patentCount;
+    }
+
+    public void setPatentCount(Integer patentCount) {
+        this.patentCount = patentCount;
+    }
+
+    public Integer getInventionPatentCount() {
+        return inventionPatentCount;
+    }
+
+    public void setInventionPatentCount(Integer inventionPatentCount) {
+        this.inventionPatentCount = inventionPatentCount;
+    }
+
+    public Integer getUtilityModelCount() {
+        return utilityModelCount;
+    }
+
+    public void setUtilityModelCount(Integer utilityModelCount) {
+        this.utilityModelCount = utilityModelCount;
+    }
+
+    public Integer getAppearancePatentCount() {
+        return appearancePatentCount;
+    }
+
+    public void setAppearancePatentCount(Integer appearancePatentCount) {
+        this.appearancePatentCount = appearancePatentCount;
+    }
+
+    public Integer getSoftwareWorksCount() {
+        return softwareWorksCount;
+    }
+
+    public void setSoftwareWorksCount(Integer softwareWorksCount) {
+        this.softwareWorksCount = softwareWorksCount;
+    }
+
+    public Integer getOther() {
+        return other;
+    }
+
+    public void setOther(Integer other) {
+        this.other = other;
+    }
+
+    public String getFinancialData() {
+        return financialData;
+    }
+
+    public void setFinancialData(String financialData) {
+        this.financialData = financialData;
+    }
+
+    public String getEarlyCommunication() {
+        return earlyCommunication;
+    }
+
+    public void setEarlyCommunication(String earlyCommunication) {
+        this.earlyCommunication = earlyCommunication;
+    }
+
+    public String getInterviewIdeas() {
+        return interviewIdeas;
+    }
+
+    public void setInterviewIdeas(String interviewIdeas) {
+        this.interviewIdeas = interviewIdeas;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+}
+

+ 87 - 0
src/main/java/com/goafanti/customer/controller/UserArchivesController.java

@@ -0,0 +1,87 @@
+package com.goafanti.customer.controller;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.model.UserArchives;
+import com.goafanti.customer.service.UserArchivesService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 客户档案表(UserArchives)表控制层
+ *
+ * @author makejava
+ * @since 2024-07-12 11:52:01
+ */
+@RestController
+@RequestMapping("/api/admin/userArchives")
+public class UserArchivesController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private UserArchivesService userArchivesService;
+
+
+    /**
+     * 新增数据
+     *
+     * @param userArchives 实体
+     * @return 新增结果
+     */
+    @PostMapping("/add")
+    public Result add(UserArchives userArchives) {
+        return new Result<>().data(this.userArchivesService.insert(userArchives));
+    }
+    
+    
+    /**
+     * 通过主键查询单条数据
+     *
+     * @param id 主键
+     * @return 单条数据
+     */
+    @GetMapping("/get")
+    public Result<UserArchives> queryById( Integer id) {
+        return new Result<>().data(this.userArchivesService.queryById(id));
+    }
+
+
+
+    /**
+     * 编辑数据
+     *
+     * @param userArchives 实体
+     * @return 编辑结果
+     */
+    @PostMapping("/update")
+    public Result edit(UserArchives userArchives) {
+        return new Result<>().data(this.userArchivesService.update(userArchives));
+    }
+
+    /**
+     * 删除数据
+     *
+     * @param id 主键
+     * @return 删除是否成功
+     */
+    @GetMapping("/delete")
+    public Result deleteById(Integer id) {
+        return new Result<>().data(this.userArchivesService.deleteById(id));
+    }
+    
+        /**
+     * 列表查询
+     * @param in 参数
+     * @return
+     */
+    @GetMapping("/list")
+    public Result<UserArchives> list(UserArchives in, Integer pageNo, Integer pageSize) {
+        return new Result<>().data(this.userArchivesService.list(in,  pageNo,  pageSize));
+    }
+
+}
+

+ 48 - 0
src/main/java/com/goafanti/customer/service/UserArchivesService.java

@@ -0,0 +1,48 @@
+package com.goafanti.customer.service;
+
+import com.goafanti.common.model.UserArchives;
+
+/**
+ * 客户档案表(UserArchives)表服务接口
+ *
+ * @author makejava
+ * @since 2024-07-12 11:52:01
+ */
+public interface UserArchivesService {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    UserArchives queryById(Integer id);
+
+    
+
+    /**
+     * 新增数据
+     *
+     * @param userArchives 实例对象
+     * @return 实例对象
+     */
+    UserArchives insert(UserArchives userArchives);
+
+    /**
+     * 修改数据
+     *
+     * @param userArchives 实例对象
+     * @return 实例对象
+     */
+    UserArchives update(UserArchives userArchives);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    boolean deleteById(Integer id);
+
+    Object list(UserArchives in, Integer pageNo, Integer pageSize);
+}

+ 82 - 0
src/main/java/com/goafanti/customer/service/impl/UserArchivesServiceImpl.java

@@ -0,0 +1,82 @@
+package com.goafanti.customer.service.impl;
+
+import com.goafanti.common.dao.UserArchivesMapper;
+import com.goafanti.common.model.UserArchives;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.customer.service.UserArchivesService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 客户档案表(UserArchives)表服务实现类
+ *
+ * @author makejava
+ * @since 2024-07-12 11:52:01
+ */
+@Service("userArchivesService")
+public class UserArchivesServiceImpl extends BaseMybatisDao< UserArchivesMapper> implements UserArchivesService {
+    @Resource
+    private UserArchivesMapper userArchivesMapper;
+    
+    
+    
+    @Override
+    public Pagination<UserArchives> list(UserArchives userArchives, Integer pageNo, Integer pageSize) {
+		Map<String, Object> params = new HashMap<>();
+        params.put("in",userArchives); 
+		return (Pagination<UserArchives>) findPage("findUserArchivesList",
+				"findUserArchivesCount", params, pageNo, pageSize);
+	}
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    @Override
+    public UserArchives queryById(Integer id) {
+        return this.userArchivesMapper.queryById(id);
+    }
+
+
+
+    /**
+     * 新增数据
+     *
+     * @param userArchives 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public UserArchives insert(UserArchives userArchives) {
+        this.userArchivesMapper.insert(userArchives);
+        return userArchives;
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param userArchives 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public UserArchives update(UserArchives userArchives) {
+        this.userArchivesMapper.update(userArchives);
+        return this.queryById(userArchives.getId());
+    }
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    @Override
+    public boolean deleteById(Integer id) {
+        return this.userArchivesMapper.deleteById(id) > 0;
+    }
+}