Ver código fonte

新增渠道信息代码

zjc 1 ano atrás
pai
commit
fd5b66101b

+ 105 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectChannelController.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.TProjectChannel;
+import com.ruoyi.system.service.invest.ITProjectChannelService;
+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/channel")
+public class TProjectChannelController extends BaseController
+{
+    @Autowired
+    private ITProjectChannelService tProjectChannelService;
+
+    /**
+     * 查询渠道信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('invest:channel:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TProjectChannel tProjectChannel)
+    {
+        startPage();
+        List<TProjectChannel> list = tProjectChannelService.selectTProjectChannelList(tProjectChannel);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出渠道信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('invest:channel:export')")
+    @Log(title = "渠道信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TProjectChannel tProjectChannel)
+    {
+        List<TProjectChannel> list = tProjectChannelService.selectTProjectChannelList(tProjectChannel);
+        ExcelUtil<TProjectChannel> util = new ExcelUtil<TProjectChannel>(TProjectChannel.class);
+        util.exportExcel(response, list, "渠道信息数据");
+    }
+
+    /**
+     * 获取渠道信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('invest:channel:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") String id)
+    {
+        return success(tProjectChannelService.selectTProjectChannelById(id));
+    }
+
+    /**
+     * 新增渠道信息
+     */
+    @PreAuthorize("@ss.hasPermi('invest:channel:add')")
+    @Log(title = "渠道信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TProjectChannel tProjectChannel)
+    {
+        return toAjax(tProjectChannelService.insertTProjectChannel(tProjectChannel));
+    }
+
+    /**
+     * 修改渠道信息
+     */
+    @PreAuthorize("@ss.hasPermi('invest:channel:edit')")
+    @Log(title = "渠道信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TProjectChannel tProjectChannel)
+    {
+        return toAjax(tProjectChannelService.updateTProjectChannel(tProjectChannel));
+    }
+
+    /**
+     * 删除渠道信息
+     */
+    @PreAuthorize("@ss.hasPermi('invest:channel:remove')")
+    @Log(title = "渠道信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids)
+    {
+        return toAjax(tProjectChannelService.deleteTProjectChannelByIds(ids));
+    }
+}

+ 1 - 1
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm

@@ -4,6 +4,7 @@ import java.util.List;
 #foreach ($column in $columns)
 #if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
 #break
 #end
 #end
@@ -12,7 +13,6 @@ import org.springframework.stereotype.Service;
 #if($table.sub)
 import java.util.ArrayList;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.uuid.IdUtils;
 import org.springframework.transaction.annotation.Transactional;
 import ${packageName}.domain.${subClassName};
 #end

+ 191 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/invest/TProjectChannel.java

@@ -0,0 +1,191 @@
+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_channel
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+public class TProjectChannel extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键ID */
+    private String id;
+
+    /** 渠道名称 */
+    @Excel(name = "渠道名称")
+    private String channelName;
+
+    /** 渠道编号 */
+    @Excel(name = "渠道编号")
+    private String channelCode;
+
+    /** 类别 */
+    @Excel(name = "类别")
+    private String channelType;
+
+    /** 简介 */
+    private String channelBlurb;
+
+    /** 联系人 */
+    @Excel(name = "联系人")
+    private String contacts;
+
+    /** 联系电话 */
+    @Excel(name = "联系电话")
+    private String telephone;
+
+    /** 地址 */
+    private String address;
+
+    /** 渠道负责人 */
+    @Excel(name = "渠道负责人")
+    private String channelHead;
+
+    /** 状态 */
+    @Excel(name = "状态")
+    private String status;
+
+    /** 备注 */
+    private String mark;
+
+    /** 是否删除 */
+    private String delFlag;
+
+    public void setId(String id) 
+    {
+        this.id = id;
+    }
+
+    public String getId() 
+    {
+        return id;
+    }
+    public void setChannelName(String channelName) 
+    {
+        this.channelName = channelName;
+    }
+
+    public String getChannelName() 
+    {
+        return channelName;
+    }
+    public void setChannelCode(String channelCode) 
+    {
+        this.channelCode = channelCode;
+    }
+
+    public String getChannelCode() 
+    {
+        return channelCode;
+    }
+    public void setChannelType(String channelType) 
+    {
+        this.channelType = channelType;
+    }
+
+    public String getChannelType() 
+    {
+        return channelType;
+    }
+    public void setChannelBlurb(String channelBlurb) 
+    {
+        this.channelBlurb = channelBlurb;
+    }
+
+    public String getChannelBlurb() 
+    {
+        return channelBlurb;
+    }
+    public void setContacts(String contacts) 
+    {
+        this.contacts = contacts;
+    }
+
+    public String getContacts() 
+    {
+        return contacts;
+    }
+    public void setTelephone(String telephone) 
+    {
+        this.telephone = telephone;
+    }
+
+    public String getTelephone() 
+    {
+        return telephone;
+    }
+    public void setAddress(String address) 
+    {
+        this.address = address;
+    }
+
+    public String getAddress() 
+    {
+        return address;
+    }
+    public void setChannelHead(String channelHead) 
+    {
+        this.channelHead = channelHead;
+    }
+
+    public String getChannelHead() 
+    {
+        return channelHead;
+    }
+    public void setStatus(String status) 
+    {
+        this.status = status;
+    }
+
+    public String getStatus() 
+    {
+        return status;
+    }
+    public void setMark(String mark) 
+    {
+        this.mark = mark;
+    }
+
+    public String getMark() 
+    {
+        return mark;
+    }
+    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("channelName", getChannelName())
+            .append("channelCode", getChannelCode())
+            .append("channelType", getChannelType())
+            .append("channelBlurb", getChannelBlurb())
+            .append("contacts", getContacts())
+            .append("telephone", getTelephone())
+            .append("address", getAddress())
+            .append("channelHead", getChannelHead())
+            .append("status", getStatus())
+            .append("mark", getMark())
+            .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/TProjectChannelMapper.java

@@ -0,0 +1,62 @@
+package com.ruoyi.system.mapper.invest;
+
+import com.ruoyi.system.domain.invest.TProjectChannel;
+
+import java.util.List;
+
+/**
+ * 渠道信息Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+public interface TProjectChannelMapper 
+{
+    /**
+     * 查询渠道信息
+     * 
+     * @param id 渠道信息主键
+     * @return 渠道信息
+     */
+    public TProjectChannel selectTProjectChannelById(String id);
+
+    /**
+     * 查询渠道信息列表
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 渠道信息集合
+     */
+    public List<TProjectChannel> selectTProjectChannelList(TProjectChannel tProjectChannel);
+
+    /**
+     * 新增渠道信息
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 结果
+     */
+    public int insertTProjectChannel(TProjectChannel tProjectChannel);
+
+    /**
+     * 修改渠道信息
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 结果
+     */
+    public int updateTProjectChannel(TProjectChannel tProjectChannel);
+
+    /**
+     * 删除渠道信息
+     * 
+     * @param id 渠道信息主键
+     * @return 结果
+     */
+    public int deleteTProjectChannelById(String id);
+
+    /**
+     * 批量删除渠道信息
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTProjectChannelByIds(String[] ids);
+}

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

@@ -0,0 +1,62 @@
+package com.ruoyi.system.service.invest;
+
+import com.ruoyi.system.domain.invest.TProjectChannel;
+
+import java.util.List;
+
+/**
+ * 渠道信息Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+public interface ITProjectChannelService 
+{
+    /**
+     * 查询渠道信息
+     * 
+     * @param id 渠道信息主键
+     * @return 渠道信息
+     */
+    public TProjectChannel selectTProjectChannelById(String id);
+
+    /**
+     * 查询渠道信息列表
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 渠道信息集合
+     */
+    public List<TProjectChannel> selectTProjectChannelList(TProjectChannel tProjectChannel);
+
+    /**
+     * 新增渠道信息
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 结果
+     */
+    public int insertTProjectChannel(TProjectChannel tProjectChannel);
+
+    /**
+     * 修改渠道信息
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 结果
+     */
+    public int updateTProjectChannel(TProjectChannel tProjectChannel);
+
+    /**
+     * 批量删除渠道信息
+     * 
+     * @param ids 需要删除的渠道信息主键集合
+     * @return 结果
+     */
+    public int deleteTProjectChannelByIds(String[] ids);
+
+    /**
+     * 删除渠道信息信息
+     * 
+     * @param id 渠道信息主键
+     * @return 结果
+     */
+    public int deleteTProjectChannelById(String id);
+}

+ 98 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/invest/impl/TProjectChannelServiceImpl.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.TProjectChannel;
+import com.ruoyi.system.mapper.invest.TProjectChannelMapper;
+import com.ruoyi.system.service.invest.ITProjectChannelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 渠道信息Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-02-22
+ */
+@Service
+public class TProjectChannelServiceImpl implements ITProjectChannelService
+{
+    @Autowired
+    private TProjectChannelMapper tProjectChannelMapper;
+
+    /**
+     * 查询渠道信息
+     * 
+     * @param id 渠道信息主键
+     * @return 渠道信息
+     */
+    @Override
+    public TProjectChannel selectTProjectChannelById(String id)
+    {
+        return tProjectChannelMapper.selectTProjectChannelById(id);
+    }
+
+    /**
+     * 查询渠道信息列表
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 渠道信息
+     */
+    @Override
+    public List<TProjectChannel> selectTProjectChannelList(TProjectChannel tProjectChannel)
+    {
+        return tProjectChannelMapper.selectTProjectChannelList(tProjectChannel);
+    }
+
+    /**
+     * 新增渠道信息
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 结果
+     */
+    @Override
+    public int insertTProjectChannel(TProjectChannel tProjectChannel)
+    {
+        tProjectChannel.setCreateTime(DateUtils.getNowDate());
+        tProjectChannel.setId(IdUtils.fastSimpleUUID());
+        return tProjectChannelMapper.insertTProjectChannel(tProjectChannel);
+    }
+
+    /**
+     * 修改渠道信息
+     * 
+     * @param tProjectChannel 渠道信息
+     * @return 结果
+     */
+    @Override
+    public int updateTProjectChannel(TProjectChannel tProjectChannel)
+    {
+        tProjectChannel.setUpdateTime(DateUtils.getNowDate());
+        return tProjectChannelMapper.updateTProjectChannel(tProjectChannel);
+    }
+
+    /**
+     * 批量删除渠道信息
+     * 
+     * @param ids 需要删除的渠道信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTProjectChannelByIds(String[] ids)
+    {
+        return tProjectChannelMapper.deleteTProjectChannelByIds(ids);
+    }
+
+    /**
+     * 删除渠道信息信息
+     * 
+     * @param id 渠道信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTProjectChannelById(String id)
+    {
+        return tProjectChannelMapper.deleteTProjectChannelById(id);
+    }
+}

+ 120 - 0
ruoyi-system/src/main/resources/mapper/invest/TProjectChannelMapper.xml

@@ -0,0 +1,120 @@
+<?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.TProjectChannelMapper">
+    
+    <resultMap type="TProjectChannel" id="TProjectChannelResult">
+        <result property="id"    column="id"    />
+        <result property="channelName"    column="channel_name"    />
+        <result property="channelCode"    column="channel_code"    />
+        <result property="channelType"    column="channel_type"    />
+        <result property="channelBlurb"    column="channel_blurb"    />
+        <result property="contacts"    column="contacts"    />
+        <result property="telephone"    column="telephone"    />
+        <result property="address"    column="address"    />
+        <result property="channelHead"    column="channel_head"    />
+        <result property="status"    column="status"    />
+        <result property="mark"    column="mark"    />
+        <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="selectTProjectChannelVo">
+        select id, channel_name, channel_code, channel_type, channel_blurb, contacts, telephone, address, channel_head, status, mark, del_flag, create_by, create_time, update_by, update_time from t_project_channel
+    </sql>
+
+    <select id="selectTProjectChannelList" parameterType="TProjectChannel" resultMap="TProjectChannelResult">
+        <include refid="selectTProjectChannelVo"/>
+        <where>  
+            <if test="channelName != null  and channelName != ''"> and channel_name like concat('%', #{channelName}, '%')</if>
+            <if test="channelCode != null  and channelCode != ''"> and channel_code = #{channelCode}</if>
+            <if test="channelType != null  and channelType != ''"> and channel_type = #{channelType}</if>
+            <if test="contacts != null  and contacts != ''"> and contacts = #{contacts}</if>
+            <if test="telephone != null  and telephone != ''"> and telephone = #{telephone}</if>
+            <if test="channelHead != null  and channelHead != ''"> and channel_head = #{channelHead}</if>
+            <if test="status != null  and status != ''"> and status = #{status}</if>
+        </where>
+    </select>
+    
+    <select id="selectTProjectChannelById" parameterType="String" resultMap="TProjectChannelResult">
+        <include refid="selectTProjectChannelVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertTProjectChannel" parameterType="TProjectChannel">
+        insert into t_project_channel
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="channelName != null">channel_name,</if>
+            <if test="channelCode != null">channel_code,</if>
+            <if test="channelType != null">channel_type,</if>
+            <if test="channelBlurb != null">channel_blurb,</if>
+            <if test="contacts != null">contacts,</if>
+            <if test="telephone != null">telephone,</if>
+            <if test="address != null">address,</if>
+            <if test="channelHead != null">channel_head,</if>
+            <if test="status != null">status,</if>
+            <if test="mark != null">mark,</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="channelName != null">#{channelName},</if>
+            <if test="channelCode != null">#{channelCode},</if>
+            <if test="channelType != null">#{channelType},</if>
+            <if test="channelBlurb != null">#{channelBlurb},</if>
+            <if test="contacts != null">#{contacts},</if>
+            <if test="telephone != null">#{telephone},</if>
+            <if test="address != null">#{address},</if>
+            <if test="channelHead != null">#{channelHead},</if>
+            <if test="status != null">#{status},</if>
+            <if test="mark != null">#{mark},</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="updateTProjectChannel" parameterType="TProjectChannel">
+        update t_project_channel
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="channelName != null">channel_name = #{channelName},</if>
+            <if test="channelCode != null">channel_code = #{channelCode},</if>
+            <if test="channelType != null">channel_type = #{channelType},</if>
+            <if test="channelBlurb != null">channel_blurb = #{channelBlurb},</if>
+            <if test="contacts != null">contacts = #{contacts},</if>
+            <if test="telephone != null">telephone = #{telephone},</if>
+            <if test="address != null">address = #{address},</if>
+            <if test="channelHead != null">channel_head = #{channelHead},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="mark != null">mark = #{mark},</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="deleteTProjectChannelById" parameterType="String">
+        delete from t_project_channel where id = #{id}
+    </delete>
+
+    <delete id="deleteTProjectChannelByIds" parameterType="String">
+        delete from t_project_channel where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>