产品管理

This commit is contained in:
zy 2024-06-08 13:49:53 +08:00
parent 03e0bdd29c
commit 97168560b7
7 changed files with 781 additions and 1 deletions

View File

@ -0,0 +1,103 @@
package cn.source.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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 cn.source.common.annotation.Log;
import cn.source.common.core.controller.BaseController;
import cn.source.common.core.domain.AjaxResult;
import cn.source.common.enums.BusinessType;
import cn.source.system.domain.CmsProduct;
import cn.source.system.service.ICmsProductService;
import cn.source.common.utils.poi.ExcelUtil;
import cn.source.common.core.page.TableDataInfo;
/**
* 产品管理Controller
*
* @author sourcebyte.vip
* @date 2024-06-08
*/
@RestController
@RequestMapping("/system/product")
public class CmsProductController extends BaseController
{
@Autowired
private ICmsProductService cmsProductService;
/**
* 查询产品管理列表
*/
@PreAuthorize("@ss.hasPermi('system:product:list')")
@GetMapping("/list")
public TableDataInfo list(CmsProduct cmsProduct)
{
startPage();
List<CmsProduct> list = cmsProductService.selectCmsProductList(cmsProduct);
return getDataTable(list);
}
/**
* 获取产品管理详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(cmsProductService.selectCmsProductById(id));
}
/**
* 新增产品管理
*/
@PreAuthorize("@ss.hasPermi('system:product:add')")
@Log(title = "产品管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CmsProduct cmsProduct)
{
return toAjax(cmsProductService.insertCmsProduct(cmsProduct));
}
/**
* 修改产品管理
*/
@PreAuthorize("@ss.hasPermi('system:product:edit')")
@Log(title = "产品管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CmsProduct cmsProduct)
{
return toAjax(cmsProductService.updateCmsProduct(cmsProduct));
}
/**
* 删除产品管理
*/
@PreAuthorize("@ss.hasPermi('system:product:remove')")
@Log(title = "产品管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(cmsProductService.deleteCmsProductByIds(ids));
}
/**
* 导出产品管理列表
*/
@PreAuthorize("@ss.hasPermi('system:product:export')")
@Log(title = "产品管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CmsProduct cmsProduct)
{
List<CmsProduct> list = cmsProductService.selectCmsProductList(cmsProduct);
ExcelUtil<CmsProduct> util = new ExcelUtil<CmsProduct>(CmsProduct.class);
util.exportExcel(response, list, "产品管理数据");
}
}

View File

@ -0,0 +1,294 @@
package cn.source.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import cn.source.common.annotation.Excel;
import cn.source.common.core.domain.BaseEntity;
/**
* 产品管理对象 cms_product
*
* @author sourcebyte.vip
* @date 2024-06-08
*/
public class CmsProduct extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
/** 行业 */
@Excel(name = "行业")
private String productIndustry;
/** 标签 */
@Excel(name = "标签")
private String productTag;
/** 大标题 */
@Excel(name = "大标题")
private String productBigTitle;
/** 小标题 */
@Excel(name = "小标题")
private String productSmallTitle;
/** 图标 */
@Excel(name = "图标")
private String productIcon;
/** 主图 */
@Excel(name = "主图")
private String productThImg;
/** 背景图 */
@Excel(name = "背景图")
private String productBgImg;
/** 描述 */
@Excel(name = "描述")
private String productDesc;
/** 详情 */
@Excel(name = "详情")
private String productContent;
/** 链接 */
@Excel(name = "链接")
private String prodcutUrl;
/** 在建 */
@Excel(name = "在建")
private String isBuild;
/** 开源 */
@Excel(name = "开源")
private String isOpen;
/** 展示 */
@Excel(name = "展示")
private String isShow;
/** 热点 */
@Excel(name = "热点")
private String isHot;
/** 联系人 */
@Excel(name = "联系人")
private String contact;
/** 联系电话 */
@Excel(name = "联系电话")
private String contactCode;
/** 排序 */
@Excel(name = "排序")
private Integer sortNo;
/** 状态 */
@Excel(name = "状态")
private String status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setProductIndustry(String productIndustry)
{
this.productIndustry = productIndustry;
}
public String getProductIndustry()
{
return productIndustry;
}
public void setProductTag(String productTag)
{
this.productTag = productTag;
}
public String getProductTag()
{
return productTag;
}
public void setProductBigTitle(String productBigTitle)
{
this.productBigTitle = productBigTitle;
}
public String getProductBigTitle()
{
return productBigTitle;
}
public void setProductSmallTitle(String productSmallTitle)
{
this.productSmallTitle = productSmallTitle;
}
public String getProductSmallTitle()
{
return productSmallTitle;
}
public void setProductIcon(String productIcon)
{
this.productIcon = productIcon;
}
public String getProductIcon()
{
return productIcon;
}
public void setProductThImg(String productThImg)
{
this.productThImg = productThImg;
}
public String getProductThImg()
{
return productThImg;
}
public void setProductBgImg(String productBgImg)
{
this.productBgImg = productBgImg;
}
public String getProductBgImg()
{
return productBgImg;
}
public void setProductDesc(String productDesc)
{
this.productDesc = productDesc;
}
public String getProductDesc()
{
return productDesc;
}
public void setProductContent(String productContent)
{
this.productContent = productContent;
}
public String getProductContent()
{
return productContent;
}
public void setProdcutUrl(String prodcutUrl)
{
this.prodcutUrl = prodcutUrl;
}
public String getProdcutUrl()
{
return prodcutUrl;
}
public void setIsBuild(String isBuild)
{
this.isBuild = isBuild;
}
public String getIsBuild()
{
return isBuild;
}
public void setIsOpen(String isOpen)
{
this.isOpen = isOpen;
}
public String getIsOpen()
{
return isOpen;
}
public void setIsShow(String isShow)
{
this.isShow = isShow;
}
public String getIsShow()
{
return isShow;
}
public void setIsHot(String isHot)
{
this.isHot = isHot;
}
public String getIsHot()
{
return isHot;
}
public void setContact(String contact)
{
this.contact = contact;
}
public String getContact()
{
return contact;
}
public void setContactCode(String contactCode)
{
this.contactCode = contactCode;
}
public String getContactCode()
{
return contactCode;
}
public void setSortNo(Integer sortNo)
{
this.sortNo = sortNo;
}
public Integer getSortNo()
{
return sortNo;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("productIndustry", getProductIndustry())
.append("productTag", getProductTag())
.append("productBigTitle", getProductBigTitle())
.append("productSmallTitle", getProductSmallTitle())
.append("productIcon", getProductIcon())
.append("productThImg", getProductThImg())
.append("productBgImg", getProductBgImg())
.append("productDesc", getProductDesc())
.append("productContent", getProductContent())
.append("prodcutUrl", getProdcutUrl())
.append("isBuild", getIsBuild())
.append("isOpen", getIsOpen())
.append("isShow", getIsShow())
.append("isHot", getIsHot())
.append("contact", getContact())
.append("contactCode", getContactCode())
.append("sortNo", getSortNo())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package cn.source.system.mapper;
import java.util.List;
import cn.source.system.domain.CmsProduct;
/**
* 产品管理Mapper接口
*
* @author sourcebyte.vip
* @date 2024-06-08
*/
public interface CmsProductMapper
{
/**
* 查询产品管理
*
* @param id 产品管理主键
* @return 产品管理
*/
public CmsProduct selectCmsProductById(Long id);
/**
* 查询产品管理列表
*
* @param cmsProduct 产品管理
* @return 产品管理集合
*/
public List<CmsProduct> selectCmsProductList(CmsProduct cmsProduct);
/**
* 新增产品管理
*
* @param cmsProduct 产品管理
* @return 结果
*/
public int insertCmsProduct(CmsProduct cmsProduct);
/**
* 修改产品管理
*
* @param cmsProduct 产品管理
* @return 结果
*/
public int updateCmsProduct(CmsProduct cmsProduct);
/**
* 删除产品管理
*
* @param id 产品管理主键
* @return 结果
*/
public int deleteCmsProductById(Long id);
/**
* 批量删除产品管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCmsProductByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package cn.source.system.service;
import java.util.List;
import cn.source.system.domain.CmsProduct;
/**
* 产品管理Service接口
*
* @author sourcebyte.vip
* @date 2024-06-08
*/
public interface ICmsProductService
{
/**
* 查询产品管理
*
* @param id 产品管理主键
* @return 产品管理
*/
public CmsProduct selectCmsProductById(Long id);
/**
* 查询产品管理列表
*
* @param cmsProduct 产品管理
* @return 产品管理集合
*/
public List<CmsProduct> selectCmsProductList(CmsProduct cmsProduct);
/**
* 新增产品管理
*
* @param cmsProduct 产品管理
* @return 结果
*/
public int insertCmsProduct(CmsProduct cmsProduct);
/**
* 修改产品管理
*
* @param cmsProduct 产品管理
* @return 结果
*/
public int updateCmsProduct(CmsProduct cmsProduct);
/**
* 批量删除产品管理
*
* @param ids 需要删除的产品管理主键集合
* @return 结果
*/
public int deleteCmsProductByIds(Long[] ids);
/**
* 删除产品管理信息
*
* @param id 产品管理主键
* @return 结果
*/
public int deleteCmsProductById(Long id);
}

View File

@ -0,0 +1,96 @@
package cn.source.system.service.impl;
import java.util.List;
import cn.source.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.source.system.mapper.CmsProductMapper;
import cn.source.system.domain.CmsProduct;
import cn.source.system.service.ICmsProductService;
/**
* 产品管理Service业务层处理
*
* @author sourcebyte.vip
* @date 2024-06-08
*/
@Service
public class CmsProductServiceImpl implements ICmsProductService
{
@Autowired
private CmsProductMapper cmsProductMapper;
/**
* 查询产品管理
*
* @param id 产品管理主键
* @return 产品管理
*/
@Override
public CmsProduct selectCmsProductById(Long id)
{
return cmsProductMapper.selectCmsProductById(id);
}
/**
* 查询产品管理列表
*
* @param cmsProduct 产品管理
* @return 产品管理
*/
@Override
public List<CmsProduct> selectCmsProductList(CmsProduct cmsProduct)
{
return cmsProductMapper.selectCmsProductList(cmsProduct);
}
/**
* 新增产品管理
*
* @param cmsProduct 产品管理
* @return 结果
*/
@Override
public int insertCmsProduct(CmsProduct cmsProduct)
{
cmsProduct.setCreateTime(DateUtils.getNowDate());
return cmsProductMapper.insertCmsProduct(cmsProduct);
}
/**
* 修改产品管理
*
* @param cmsProduct 产品管理
* @return 结果
*/
@Override
public int updateCmsProduct(CmsProduct cmsProduct)
{
cmsProduct.setUpdateTime(DateUtils.getNowDate());
return cmsProductMapper.updateCmsProduct(cmsProduct);
}
/**
* 批量删除产品管理
*
* @param ids 需要删除的产品管理主键
* @return 结果
*/
@Override
public int deleteCmsProductByIds(Long[] ids)
{
return cmsProductMapper.deleteCmsProductByIds(ids);
}
/**
* 删除产品管理信息
*
* @param id 产品管理主键
* @return 结果
*/
@Override
public int deleteCmsProductById(Long id)
{
return cmsProductMapper.deleteCmsProductById(id);
}
}

View File

@ -0,0 +1,161 @@
<?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="cn.source.system.mapper.CmsProductMapper">
<resultMap type="CmsProduct" id="CmsProductResult">
<result property="id" column="id" />
<result property="productIndustry" column="product_industry" />
<result property="productTag" column="product_tag" />
<result property="productBigTitle" column="product_big_title" />
<result property="productSmallTitle" column="product_small_title" />
<result property="productIcon" column="product_icon" />
<result property="productThImg" column="product_th_img" />
<result property="productBgImg" column="product_bg_img" />
<result property="productDesc" column="product_desc" />
<result property="productContent" column="product_content" />
<result property="prodcutUrl" column="prodcut_url" />
<result property="isBuild" column="is_build" />
<result property="isOpen" column="is_open" />
<result property="isShow" column="is_show" />
<result property="isHot" column="is_hot" />
<result property="contact" column="contact" />
<result property="contactCode" column="contact_code" />
<result property="sortNo" column="sort_no" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectCmsProductVo">
select id, product_industry, product_tag, product_big_title, product_small_title, product_icon, product_th_img, product_bg_img, product_desc, product_content, prodcut_url, is_build, is_open, is_show, is_hot, contact, contact_code, sort_no, status, create_time, create_by, update_time, update_by, remark from cms_product
</sql>
<select id="selectCmsProductList" parameterType="CmsProduct" resultMap="CmsProductResult">
<include refid="selectCmsProductVo"/>
<where>
<if test="productIndustry != null and productIndustry != ''"> and product_industry = #{productIndustry}</if>
<if test="productTag != null and productTag != ''"> and product_tag = #{productTag}</if>
<if test="productBigTitle != null and productBigTitle != ''"> and product_big_title = #{productBigTitle}</if>
<if test="productSmallTitle != null and productSmallTitle != ''"> and product_small_title = #{productSmallTitle}</if>
<if test="productIcon != null and productIcon != ''"> and product_icon = #{productIcon}</if>
<if test="productThImg != null and productThImg != ''"> and product_th_img = #{productThImg}</if>
<if test="productBgImg != null and productBgImg != ''"> and product_bg_img = #{productBgImg}</if>
<if test="productDesc != null and productDesc != ''"> and product_desc = #{productDesc}</if>
<if test="productContent != null and productContent != ''"> and product_content = #{productContent}</if>
<if test="prodcutUrl != null and prodcutUrl != ''"> and prodcut_url = #{prodcutUrl}</if>
<if test="isBuild != null and isBuild != ''"> and is_build = #{isBuild}</if>
<if test="isOpen != null and isOpen != ''"> and is_open = #{isOpen}</if>
<if test="isShow != null and isShow != ''"> and is_show = #{isShow}</if>
<if test="isHot != null and isHot != ''"> and is_hot = #{isHot}</if>
<if test="contact != null and contact != ''"> and contact = #{contact}</if>
<if test="contactCode != null and contactCode != ''"> and contact_code = #{contactCode}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectCmsProductById" parameterType="Long" resultMap="CmsProductResult">
<include refid="selectCmsProductVo"/>
where id = #{id}
</select>
<insert id="insertCmsProduct" parameterType="CmsProduct" useGeneratedKeys="true" keyProperty="id">
insert into cms_product
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="productIndustry != null and productIndustry != ''">product_industry,</if>
<if test="productTag != null and productTag != ''">product_tag,</if>
<if test="productBigTitle != null and productBigTitle != ''">product_big_title,</if>
<if test="productSmallTitle != null and productSmallTitle != ''">product_small_title,</if>
<if test="productIcon != null">product_icon,</if>
<if test="productThImg != null">product_th_img,</if>
<if test="productBgImg != null">product_bg_img,</if>
<if test="productDesc != null">product_desc,</if>
<if test="productContent != null">product_content,</if>
<if test="prodcutUrl != null">prodcut_url,</if>
<if test="isBuild != null and isBuild != ''">is_build,</if>
<if test="isOpen != null and isOpen != ''">is_open,</if>
<if test="isShow != null and isShow != ''">is_show,</if>
<if test="isHot != null and isHot != ''">is_hot,</if>
<if test="contact != null">contact,</if>
<if test="contactCode != null">contact_code,</if>
<if test="sortNo != null">sort_no,</if>
<if test="status != null and status != ''">status,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productIndustry != null and productIndustry != ''">#{productIndustry},</if>
<if test="productTag != null and productTag != ''">#{productTag},</if>
<if test="productBigTitle != null and productBigTitle != ''">#{productBigTitle},</if>
<if test="productSmallTitle != null and productSmallTitle != ''">#{productSmallTitle},</if>
<if test="productIcon != null">#{productIcon},</if>
<if test="productThImg != null">#{productThImg},</if>
<if test="productBgImg != null">#{productBgImg},</if>
<if test="productDesc != null">#{productDesc},</if>
<if test="productContent != null">#{productContent},</if>
<if test="prodcutUrl != null">#{prodcutUrl},</if>
<if test="isBuild != null and isBuild != ''">#{isBuild},</if>
<if test="isOpen != null and isOpen != ''">#{isOpen},</if>
<if test="isShow != null and isShow != ''">#{isShow},</if>
<if test="isHot != null and isHot != ''">#{isHot},</if>
<if test="contact != null">#{contact},</if>
<if test="contactCode != null">#{contactCode},</if>
<if test="sortNo != null">#{sortNo},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateCmsProduct" parameterType="CmsProduct">
update cms_product
<trim prefix="SET" suffixOverrides=",">
<if test="productIndustry != null and productIndustry != ''">product_industry = #{productIndustry},</if>
<if test="productTag != null and productTag != ''">product_tag = #{productTag},</if>
<if test="productBigTitle != null and productBigTitle != ''">product_big_title = #{productBigTitle},</if>
<if test="productSmallTitle != null and productSmallTitle != ''">product_small_title = #{productSmallTitle},</if>
<if test="productIcon != null">product_icon = #{productIcon},</if>
<if test="productThImg != null">product_th_img = #{productThImg},</if>
<if test="productBgImg != null">product_bg_img = #{productBgImg},</if>
<if test="productDesc != null">product_desc = #{productDesc},</if>
<if test="productContent != null">product_content = #{productContent},</if>
<if test="prodcutUrl != null">prodcut_url = #{prodcutUrl},</if>
<if test="isBuild != null and isBuild != ''">is_build = #{isBuild},</if>
<if test="isOpen != null and isOpen != ''">is_open = #{isOpen},</if>
<if test="isShow != null and isShow != ''">is_show = #{isShow},</if>
<if test="isHot != null and isHot != ''">is_hot = #{isHot},</if>
<if test="contact != null">contact = #{contact},</if>
<if test="contactCode != null">contact_code = #{contactCode},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCmsProductById" parameterType="Long">
delete from cms_product where id = #{id}
</delete>
<delete id="deleteCmsProductByIds" parameterType="String">
delete from cms_product where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -109,7 +109,7 @@
</el-form>
</el-row>
<el-table :height="tableHeight" v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
<el-table ref="list" :height="tableHeight" v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="#" type="index" width="50" align="center">
<template scope="scope">
@ -477,6 +477,10 @@ export default {
this.single = selection.length!==1
this.multiple = !selection.length
},
// 单击行选中数据
handleRowClick(row, column, event) {
this.$refs.list.toggleRowSelection(row);
},
/** 新增按钮操作 */
handleAdd() {
this.reset();