This commit is contained in:
Vinjor 2025-11-24 14:07:13 +08:00
parent a3e8c72163
commit 3b000bfdd8
10 changed files with 723 additions and 0 deletions

View File

@ -0,0 +1,112 @@
package com.ruoyi.cus.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.cus.domain.CusMainSeas;
import com.ruoyi.cus.service.ICusMainSeasService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 公海客户信息Controller
*
* @author vinjor-m
* @date 2025-11-24
*/
@RestController
@RequestMapping("/cus/seas")
public class CusMainSeasController extends BaseController
{
@Autowired
private ICusMainSeasService cusMainSeasService;
/**
* 查询公海客户信息列表
*/
@PreAuthorize("@ss.hasPermi('cus:seas:list')")
@GetMapping("/list")
public AjaxResult list(CusMainSeas cusMainSeas,
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
{
Page<CusMainSeas> page = new Page<>(pageNum, pageSize);
IPage<CusMainSeas> list = cusMainSeasService.queryListPage(cusMainSeas,page);
return success(list);
}
/**
* 导出公海客户信息列表
*/
@PreAuthorize("@ss.hasPermi('cus:seas:export')")
@Log(title = "公海客户信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CusMainSeas cusMainSeas)
{
List<CusMainSeas> list = cusMainSeasService.list();
ExcelUtil<CusMainSeas> util = new ExcelUtil<CusMainSeas>(CusMainSeas.class);
util.exportExcel(response, list, "公海客户信息数据");
}
/**
* 获取公海客户信息详细信息
*/
@PreAuthorize("@ss.hasPermi('cus:seas:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(cusMainSeasService.getById(id));
}
/**
* 新增公海客户信息
*/
@PreAuthorize("@ss.hasPermi('cus:seas:add')")
@Log(title = "公海客户信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CusMainSeas cusMainSeas)
{
return toAjax(cusMainSeasService.save(cusMainSeas));
}
/**
* 修改公海客户信息
*/
@PreAuthorize("@ss.hasPermi('cus:seas:edit')")
@Log(title = "公海客户信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CusMainSeas cusMainSeas)
{
return toAjax(cusMainSeasService.updateById(cusMainSeas));
}
/**
* 删除公海客户信息
*/
@PreAuthorize("@ss.hasPermi('cus:seas:remove')")
@Log(title = "公海客户信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
List<String> list = new ArrayList<>(Arrays.asList(ids));
return toAjax(cusMainSeasService.removeByIds(list));
}
}

View File

@ -0,0 +1,79 @@
package com.ruoyi.cus.domain;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import com.ruoyi.common.core.domain.DlBaseEntity;
/**
* 公海客户信息对象 cus_main_seas
*
* @author vinjor-m
* @date 2025-11-24
*/
@TableName("cus_main_seas")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CusMainSeas extends DlBaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/** 是否星标客户(0 否|1 是) */
@Excel(name = "是否星标客户(0 否|1 是)")
private Integer ifStar;
/** 客户标签(多个英文逗号隔开) */
@Excel(name = "客户标签(多个英文逗号隔开)")
private String cusLabels;
/** 客户代码 */
@Excel(name = "客户代码")
private String cusCode;
/** 客户名称 */
@Excel(name = "客户名称")
private String fullName;
/** 客户简称 */
@Excel(name = "客户简称")
private String shortName;
/** 客户类型 */
@Excel(name = "客户类型")
private String cusType;
/** 国家/地区 */
@Excel(name = "国家/地区")
private String country;
/** 时区 */
@Excel(name = "时区")
private String zoneName;
/** 主营产品(多个英文逗号隔开) */
@Excel(name = "主营产品(多个英文逗号隔开)")
private String mainProds;
/** 企业网站 */
@Excel(name = "企业网站")
private String siteUrl;
/** 备注 */
@Excel(name = "备注")
private String remark;
/** 附件 */
@Excel(name = "附件")
private String files;
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.cus.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.cus.domain.CusMainSeas;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 公海客户信息Mapper接口
*
* @author vinjor-m
* @date 2025-11-24
*/
@Mapper
public interface CusMainSeasMapper extends BaseMapper<CusMainSeas>
{
IPage<CusMainSeas> queryListPage(@Param("entity") CusMainSeas entity, Page<CusMainSeas> page);
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.cus.service;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.cus.domain.CusMainSeas;
/**
* 公海客户信息Service接口
*
* @author vinjor-m
* @date 2025-11-24
*/
public interface ICusMainSeasService extends IService<CusMainSeas> {
IPage<CusMainSeas> queryListPage(CusMainSeas pageReqVO, Page<CusMainSeas> page);
}

View File

@ -0,0 +1,30 @@
package com.ruoyi.cus.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.cus.mapper.CusMainSeasMapper;
import com.ruoyi.cus.domain.CusMainSeas;
import com.ruoyi.cus.service.ICusMainSeasService;
/**
* 公海客户信息Service业务层处理
*
* @author vinjor-m
* @date 2025-11-24
*/
@Service
public class CusMainSeasServiceImpl extends ServiceImpl<CusMainSeasMapper,CusMainSeas> implements ICusMainSeasService
{
@Autowired
private CusMainSeasMapper cusMainSeasMapper;
@Override
public IPage<CusMainSeas> queryListPage(CusMainSeas pageReqVO, Page<CusMainSeas> page) {
return cusMainSeasMapper.queryListPage(pageReqVO, page);
}
}

View File

@ -0,0 +1,48 @@
<?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.cus.mapper.CusMainSeasMapper">
<resultMap type="CusMainSeas" id="CusMainSeasResult">
<result property="id" column="id" />
<result property="ifStar" column="if_star" />
<result property="cusLabels" column="cus_labels" />
<result property="cusCode" column="cus_code" />
<result property="fullName" column="full_name" />
<result property="shortName" column="short_name" />
<result property="cusType" column="cus_type" />
<result property="country" column="country" />
<result property="zoneName" column="zone_name" />
<result property="mainProds" column="main_prods" />
<result property="siteUrl" column="site_url" />
<result property="remark" column="remark" />
<result property="files" column="files" />
<result property="delFlag" column="del_flag" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="updater" column="updater" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectCusMainSeasVo">
select id, if_star, cus_labels, cus_code, full_name, short_name, cus_type, country, zone_name, main_prods, site_url, remark, files, del_flag, creator, create_time, updater, update_time from cus_main_seas
</sql>
<select id="queryListPage" parameterType="CusMainSeas" resultMap="CusMainSeasResult">
<include refid="selectCusMainSeasVo"/>
<where>
<if test="entity.cusLabels != null and entity.cusLabels != ''"> and cus_labels = #{entity.cusLabels}</if>
<if test="entity.cusCode != null and entity.cusCode != ''"> and cus_code = #{entity.cusCode}</if>
<if test="entity.fullName != null and entity.fullName != ''"> and full_name like concat('%', #{entity.fullName}, '%')</if>
<if test="entity.shortName != null and entity.shortName != ''"> and short_name like concat('%', #{entity.shortName}, '%')</if>
<if test="entity.cusType != null and entity.cusType != ''"> and cus_type = #{entity.cusType}</if>
<if test="entity.country != null and entity.country != ''"> and country = #{entity.country}</if>
<if test="entity.zoneName != null and entity.zoneName != ''"> and zone_name like concat('%', #{entity.zoneName}, '%')</if>
<if test="entity.mainProds != null and entity.mainProds != ''"> and main_prods = #{entity.mainProds}</if>
<if test="entity.siteUrl != null and entity.siteUrl != ''"> and site_url = #{entity.siteUrl}</if>
<if test="entity.remark != null and entity.remark != ''"> and remark = #{entity.remark}</if>
<if test="entity.files != null and entity.files != ''"> and files = #{entity.files}</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询公海客户信息列表
export function listSeas(query) {
return request({
url: '/cus/seas/list',
method: 'get',
params: query
})
}
// 查询公海客户信息详细
export function getSeas(id) {
return request({
url: '/cus/seas/' + id,
method: 'get'
})
}
// 新增公海客户信息
export function addSeas(data) {
return request({
url: '/cus/seas',
method: 'post',
data: data
})
}
// 修改公海客户信息
export function updateSeas(data) {
return request({
url: '/cus/seas',
method: 'put',
data: data
})
}
// 删除公海客户信息
export function delSeas(id) {
return request({
url: '/cus/seas/' + id,
method: 'delete'
})
}

View File

@ -342,6 +342,7 @@ export default {
}
},
mounted() {
this.selectList()
},
methods: {
selectList(row){

View File

@ -93,6 +93,9 @@ export default {
},
}
},
mounted() {
this.getList()
},
methods:{
/** 搜索按钮操作 */
handleQuery() {

View File

@ -0,0 +1,368 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="客户标签(多个英文逗号隔开)" prop="cusLabels">
<el-input
v-model="queryParams.cusLabels"
placeholder="请输入客户标签(多个英文逗号隔开)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户代码" prop="cusCode">
<el-input
v-model="queryParams.cusCode"
placeholder="请输入客户代码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="fullName">
<el-input
v-model="queryParams.fullName"
placeholder="请输入客户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户简称" prop="shortName">
<el-input
v-model="queryParams.shortName"
placeholder="请输入客户简称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="国家/地区" prop="country">
<el-input
v-model="queryParams.country"
placeholder="请输入国家/地区"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="时区" prop="zoneName">
<el-input
v-model="queryParams.zoneName"
placeholder="请输入时区"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="主营产品(多个英文逗号隔开)" prop="mainProds">
<el-input
v-model="queryParams.mainProds"
placeholder="请输入主营产品(多个英文逗号隔开)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="企业网站" prop="siteUrl">
<el-input
v-model="queryParams.siteUrl"
placeholder="请输入企业网站"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['cus:seas:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['cus:seas:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['cus:seas:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['cus:seas:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="seasList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="是否星标客户(0 否|1 是)" align="center" prop="ifStar" />
<el-table-column label="客户标签(多个英文逗号隔开)" align="center" prop="cusLabels" />
<el-table-column label="客户代码" align="center" prop="cusCode" />
<el-table-column label="客户名称" align="center" prop="fullName" />
<el-table-column label="客户简称" align="center" prop="shortName" />
<el-table-column label="客户类型" align="center" prop="cusType" />
<el-table-column label="国家/地区" align="center" prop="country" />
<el-table-column label="时区" align="center" prop="zoneName" />
<el-table-column label="主营产品(多个英文逗号隔开)" align="center" prop="mainProds" />
<el-table-column label="企业网站" align="center" prop="siteUrl" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="附件" align="center" prop="files" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['cus:seas:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['cus:seas:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改公海客户信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="是否星标客户(0 否|1 是)" prop="ifStar">
<el-input v-model="form.ifStar" placeholder="请输入是否星标客户(0 否|1 是)" />
</el-form-item>
<el-form-item label="客户标签(多个英文逗号隔开)" prop="cusLabels">
<el-input v-model="form.cusLabels" placeholder="请输入客户标签(多个英文逗号隔开)" />
</el-form-item>
<el-form-item label="客户代码" prop="cusCode">
<el-input v-model="form.cusCode" placeholder="请输入客户代码" />
</el-form-item>
<el-form-item label="客户名称" prop="fullName">
<el-input v-model="form.fullName" placeholder="请输入客户名称" />
</el-form-item>
<el-form-item label="客户简称" prop="shortName">
<el-input v-model="form.shortName" placeholder="请输入客户简称" />
</el-form-item>
<el-form-item label="国家/地区" prop="country">
<el-input v-model="form.country" placeholder="请输入国家/地区" />
</el-form-item>
<el-form-item label="时区" prop="zoneName">
<el-input v-model="form.zoneName" placeholder="请输入时区" />
</el-form-item>
<el-form-item label="主营产品(多个英文逗号隔开)" prop="mainProds">
<el-input v-model="form.mainProds" placeholder="请输入主营产品(多个英文逗号隔开)" />
</el-form-item>
<el-form-item label="企业网站" prop="siteUrl">
<el-input v-model="form.siteUrl" placeholder="请输入企业网站" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="附件" prop="files">
<el-input v-model="form.files" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listSeas, getSeas, delSeas, addSeas, updateSeas } from "@/api/cus/seas";
export default {
name: "Seas",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
seasList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
cusLabels: null,
cusCode: null,
fullName: null,
shortName: null,
cusType: null,
country: null,
zoneName: null,
mainProds: null,
siteUrl: null,
remark: null,
files: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询公海客户信息列表 */
getList() {
this.loading = true;
listSeas(this.queryParams).then(response => {
this.seasList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
ifStar: null,
cusLabels: null,
cusCode: null,
fullName: null,
shortName: null,
cusType: null,
country: null,
zoneName: null,
mainProds: null,
siteUrl: null,
remark: null,
files: null,
delFlag: null,
creator: null,
createTime: null,
updater: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加公海客户信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getSeas(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改公海客户信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateSeas(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addSeas(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除公海客户信息编号为"' + ids + '"的数据项?').then(function() {
return delSeas(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('cus/seas/export', {
...this.queryParams
}, `seas_${new Date().getTime()}.xlsx`)
}
}
};
</script>