| service/src/main/java/com/ruoyi/cwgl/controller/CustomerManagementController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service/src/main/java/com/ruoyi/cwgl/domain/CustomerManagement.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service/src/main/java/com/ruoyi/cwgl/mapper/CustomerManagementMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service/src/main/java/com/ruoyi/cwgl/service/ICustomerManagementService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service/src/main/java/com/ruoyi/cwgl/service/impl/CustomerManagementServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service/src/main/resources/mapper/cwgl/CustomerManagementMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
service/src/main/java/com/ruoyi/cwgl/controller/CustomerManagementController.java
New file @@ -0,0 +1,108 @@ package com.ruoyi.cwgl.controller; import java.util.List; 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.utils.file.DownloadExportUtil; 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.cwgl.domain.CustomerManagement; import com.ruoyi.cwgl.service.ICustomerManagementService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 客户管理Controller * * @author ruoyi * @date 2025-12-15 */ @RestController @RequestMapping("/cwgl/customerManagement") public class CustomerManagementController extends BaseController { @Autowired private ICustomerManagementService customerManagementService; /** * 查询客户管理列表 */ @PreAuthorize("@ss.hasPermi('cwgl:customerManagement:list')") @GetMapping("/list") public TableDataInfo list(CustomerManagement customerManagement) { startPage(); List<CustomerManagement> list = customerManagementService.selectCustomerManagementList(customerManagement); return getDataTable(list); } /** * 导出客户管理列表 * @param customerManagement 查询条件对象 */ @PreAuthorize("@ss.hasPermi('cwgl:customerManagement:export')") @Log(title = "客户管理", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(CustomerManagement customerManagement,String exportKey) { customerManagementService.export(customerManagement,exportKey); return AjaxResult.success("导出请求成功,请稍后点击下载...!"); } /** * 获取客户管理详细信息 */ @PreAuthorize("@ss.hasPermi('cwgl:customerManagement:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Integer id) { return AjaxResult.success(customerManagementService.selectCustomerManagementById(id)); } /** * 新增客户管理 */ @PreAuthorize("@ss.hasPermi('cwgl:customerManagement:add')") @Log(title = "客户管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CustomerManagement customerManagement) { return toAjax(customerManagementService.insertCustomerManagement(customerManagement)); } /** * 修改客户管理 */ @PreAuthorize("@ss.hasPermi('cwgl:customerManagement:edit')") @Log(title = "客户管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody CustomerManagement customerManagement) { return toAjax(customerManagementService.updateCustomerManagement(customerManagement)); } /** * 删除客户管理 */ @PreAuthorize("@ss.hasPermi('cwgl:customerManagement:remove')") @Log(title = "客户管理", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Integer[] ids) { return toAjax(customerManagementService.deleteCustomerManagementByIds(ids)); } } service/src/main/java/com/ruoyi/cwgl/domain/CustomerManagement.java
New file @@ -0,0 +1,115 @@ package com.ruoyi.cwgl.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.baomidou.mybatisplus.annotation.TableField; import java.util.Date; import lombok.Data; /** * 客户管理对象 customer_management * * @author ruoyi * @date 2025-12-15 */ @Data public class CustomerManagement{ /** ID */ @TableField("id") private Integer id; /** 客户全称 */ @Excel(name = "客户全称") @TableField("customer_full_name") private String customerFullName; /** 客户简称 */ @Excel(name = "客户简称") @TableField("customer_short_name") private String customerShortName; /** 客户类型 */ @Excel(name = "客户类型") @TableField("customer_type") private String customerType; /** 联系人姓名 */ @Excel(name = "联系人姓名") @TableField("contact_person") private String contactPerson; /** 地址 */ @Excel(name = "地址") @TableField("address") private String address; /** 联系人电话 */ @Excel(name = "联系人电话") @TableField("contact_phone") private String contactPhone; /** 客户编码 */ @Excel(name = "客户编码") @TableField("customer_code") private String customerCode; /** 状态 */ @Excel(name = "状态") @TableField("status") private Integer status; /** 备注 */ @Excel(name = "备注") @TableField("remark") private String remark; /** 创建人 */ @TableField("create_by") private String createBy; /** 更新人 */ @TableField("update_by") private String updateBy; /** 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField("create_time") private Date createTime; /** 更新时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField("update_time") private Date updateTime; /** 删除标记(0:正常;1:删除) */ @Excel(name = "删除标记(0:正常;1:删除)") @TableField("deleted") private Integer deleted; } service/src/main/java/com/ruoyi/cwgl/mapper/CustomerManagementMapper.java
New file @@ -0,0 +1,87 @@ package com.ruoyi.cwgl.mapper; import java.util.List; import com.ruoyi.cwgl.domain.CustomerManagement; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * 客户管理Mapper接口 * * @author ruoyi * @date 2025-12-15 */ public interface CustomerManagementMapper extends BaseMapper<CustomerManagement> { /** * 查询客户管理 * * @param id 客户管理ID * @return 客户管理 */ public CustomerManagement selectCustomerManagementById(Integer id); /** * 查询客户管理 记录数 * * @param customerManagement 客户管理 * @return 客户管理集合 */ public int selectCustomerManagementCount(CustomerManagement customerManagement); /** * 查询客户管理列表 * * @param customerManagement 客户管理 * @return 客户管理集合 */ public List<CustomerManagement> selectCustomerManagementList(CustomerManagement customerManagement); /** * 新增客户管理 * * @param customerManagement 客户管理 * @return 结果 */ public int insertCustomerManagement(CustomerManagement customerManagement); /** * 新增客户管理[批量] * * @param customerManagements 客户管理 * @return 结果 */ public int insertCustomerManagementBatch(List<CustomerManagement> customerManagements); /** * 修改客户管理 * * @param customerManagement 客户管理 * @return 结果 */ public int updateCustomerManagement(CustomerManagement customerManagement); /** * 修改客户管理[批量] * * @param customerManagements 客户管理 * @return 结果 */ public int updateCustomerManagementBatch(List<CustomerManagement> customerManagements); /** * 删除客户管理 * * @param id 客户管理ID * @return 结果 */ public int deleteCustomerManagementById(Integer id); /** * 批量删除客户管理 * * @param ids 需要删除的数据ID * @return 结果 */ public int deleteCustomerManagementByIds(Integer[] ids); } service/src/main/java/com/ruoyi/cwgl/service/ICustomerManagementService.java
New file @@ -0,0 +1,102 @@ package com.ruoyi.cwgl.service; import java.util.List; import com.ruoyi.cwgl.domain.CustomerManagement; import com.baomidou.mybatisplus.extension.service.IService; /** * 客户管理Service接口 * * @author ruoyi * @date 2025-12-15 */ public interface ICustomerManagementService extends IService<CustomerManagement> { /** * 查询客户管理 * * @param id 客户管理ID * @return 客户管理 */ public CustomerManagement selectCustomerManagementById(Integer id); /** * 查询客户管理 记录数 * * @param customerManagement 客户管理 * @return 客户管理集合 */ public int selectCustomerManagementCount(CustomerManagement customerManagement); /** * 查询客户管理列表 * * @param customerManagement 客户管理 * @return 客户管理集合 */ public List<CustomerManagement> selectCustomerManagementList(CustomerManagement customerManagement); /** * 查询客户管理列表 异步 导出 * * @param customerManagement 客户管理 * @param exportKey 导出功能的唯一标识 * @return 客户管理集合 */ public void export(CustomerManagement customerManagement, String exportKey) ; /** * 新增客户管理 * * @param customerManagement 客户管理 * @return 结果 */ public int insertCustomerManagement(CustomerManagement customerManagement); /** * 新增客户管理[批量] * * @param customerManagements 客户管理 * @return 结果 */ public int insertCustomerManagementBatch(List<CustomerManagement> customerManagements); /** * 修改客户管理 * * @param customerManagement 客户管理 * @return 结果 */ public int updateCustomerManagement(CustomerManagement customerManagement); /** * 修改客户管理[批量] * * @param customerManagements 客户管理 * @return 结果 */ public int updateCustomerManagementBatch(List<CustomerManagement> customerManagements); /** * 批量删除客户管理 * * @param ids 需要删除的数据ID * @return 结果 */ public int deleteCustomerManagementByIds(String ids); /** * 批量删除客户管理 * * @param ids 需要删除的数据ID * @return 结果 */ public int deleteCustomerManagementByIds(Integer[] ids); /** * 删除客户管理信息 * * @param id 客户管理ID * @return 结果 */ public int deleteCustomerManagementById(Integer id); } service/src/main/java/com/ruoyi/cwgl/service/impl/CustomerManagementServiceImpl.java
New file @@ -0,0 +1,182 @@ package com.ruoyi.cwgl.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; import javax.annotation.Resource; import org.springframework.transaction.annotation.Transactional; import org.springframework.stereotype.Service; import org.springframework.scheduling.annotation.Async; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.core.service.BaseService; import com.ruoyi.cwgl.mapper.CustomerManagementMapper; import com.ruoyi.cwgl.domain.CustomerManagement; import com.ruoyi.cwgl.service.ICustomerManagementService; import com.ruoyi.common.core.text.Convert; /** * 客户管理Service业务层处理 * * @author ruoyi * @date 2025-12-15 */ @Service @Transactional(rollbackFor = Exception.class) public class CustomerManagementServiceImpl extends BaseService<CustomerManagementMapper, CustomerManagement> implements ICustomerManagementService { protected final Logger logger = LoggerFactory.getLogger(getClass()); @Resource private CustomerManagementMapper customerManagementMapper; /** * 查询客户管理 * * @param id 客户管理ID * @return 客户管理 */ @DataSource(DataSourceType.SLAVE) @Override public CustomerManagement selectCustomerManagementById(Integer id) { return customerManagementMapper.selectCustomerManagementById(id); } /** * 查询客户管理 记录数 * * @param customerManagement 客户管理 * @return 客户管理集合 */ @DataSource(DataSourceType.SLAVE) @Override public int selectCustomerManagementCount(CustomerManagement customerManagement) { return customerManagementMapper.selectCustomerManagementCount(customerManagement); } /** * 查询客户管理列表 * * @param customerManagement 客户管理 * @return 客户管理 */ @DataSource(DataSourceType.SLAVE) @Override public List<CustomerManagement> selectCustomerManagementList(CustomerManagement customerManagement) { return customerManagementMapper.selectCustomerManagementList(customerManagement); } /** * 查询客户管理列表 异步 导出 * * @param customerManagement 客户管理 * @param exportKey 导出功能的唯一标识 * @return 客户管理集合 */ @DataSource(DataSourceType.SLAVE) @Async @Override public void export(CustomerManagement customerManagement,String exportKey) { super.export(CustomerManagement.class,exportKey,"customerManagementData",(pageNum)->{ PageUtils.startPage(pageNum, Constants.EXPORT_PATE_SIZE); return selectCustomerManagementList(customerManagement); }); } /** * 新增客户管理 * * @param customerManagement 客户管理 * @return 结果 */ @Override public int insertCustomerManagement(CustomerManagement customerManagement) { customerManagement.setCreateTime(DateUtils.getNowDate()); return customerManagementMapper.insertCustomerManagement(customerManagement); } /** * 新增客户管理[批量] * * @param customerManagements 客户管理 * @return 结果 */ @Override public int insertCustomerManagementBatch(List<CustomerManagement> customerManagements) { int rows = customerManagementMapper.insertCustomerManagementBatch(customerManagements); return rows; } /** * 修改客户管理 * * @param customerManagement 客户管理 * @return 结果 */ @Override public int updateCustomerManagement(CustomerManagement customerManagement) { customerManagement.setUpdateTime(DateUtils.getNowDate()); return customerManagementMapper.updateCustomerManagement(customerManagement); } /** * 修改客户管理[批量] * * @param customerManagements 客户管理 * @return 结果 */ @Override public int updateCustomerManagementBatch(List<CustomerManagement> customerManagements){ return customerManagementMapper.updateCustomerManagementBatch(customerManagements); } /** * 删除客户管理对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteCustomerManagementByIds(String ids) { return deleteCustomerManagementByIds(Convert.toIntArray(ids)); } /** * 删除客户管理对象 * * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteCustomerManagementByIds(Integer[] ids) { return customerManagementMapper.deleteCustomerManagementByIds(ids); } /** * 删除客户管理信息 * * @param id 客户管理ID * @return 结果 */ @Override public int deleteCustomerManagementById(Integer id) { return customerManagementMapper.deleteCustomerManagementById(id); } } service/src/main/resources/mapper/cwgl/CustomerManagementMapper.xml
New file @@ -0,0 +1,170 @@ <?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.cwgl.mapper.CustomerManagementMapper"> <resultMap type="com.ruoyi.cwgl.domain.CustomerManagement" id="CustomerManagementResult"> <result property="id" column="id" /> <result property="customerFullName" column="customer_full_name" /> <result property="customerShortName" column="customer_short_name" /> <result property="customerType" column="customer_type" /> <result property="contactPerson" column="contact_person" /> <result property="address" column="address" /> <result property="contactPhone" column="contact_phone" /> <result property="customerCode" column="customer_code" /> <result property="status" column="status" /> <result property="remark" column="remark" /> <result property="createBy" column="create_by" /> <result property="updateBy" column="update_by" /> <result property="createTime" column="create_time" /> <result property="updateTime" column="update_time" /> <result property="deleted" column="deleted" /> </resultMap> <sql id="selectCustomerManagementVo"> select thisTab.id, thisTab.customer_full_name, thisTab.customer_short_name, thisTab.customer_type, thisTab.contact_person, thisTab.address, thisTab.contact_phone, thisTab.customer_code, thisTab.status, thisTab.remark, thisTab.create_by, thisTab.update_by, thisTab.create_time, thisTab.update_time, thisTab.deleted from customer_management AS thisTab </sql> <sql id="selectCustomerManagementVoCount"> select count(0) from customer_management as thisTab </sql> <sql id="whereCondition"> <if test="customerFullName != null and customerFullName != ''"> and thisTab.customer_full_name like concat('%', #{customerFullName}, '%')</if> <if test="customerShortName != null and customerShortName != ''"> and thisTab.customer_short_name like concat('%', #{customerShortName}, '%')</if> <if test="customerType != null and customerType != ''"> and thisTab.customer_type = #{customerType}</if> <if test="contactPerson != null and contactPerson != ''"> and thisTab.contact_person = #{contactPerson}</if> <if test="address != null and address != ''"> and thisTab.address = #{address}</if> <if test="contactPhone != null and contactPhone != ''"> and thisTab.contact_phone = #{contactPhone}</if> <if test="customerCode != null and customerCode != ''"> and thisTab.customer_code = #{customerCode}</if> <if test="status != null "> and thisTab.status = #{status}</if> <if test="deleted != null "> and thisTab.deleted = #{deleted}</if> </sql> <!--查询--> <select id="selectCustomerManagementById" parameterType="Integer" resultMap="CustomerManagementResult"> <include refid="selectCustomerManagementVo"/> where id = #{id} </select> <select id="selectCustomerManagementCount" parameterType="com.ruoyi.cwgl.domain.CustomerManagement" resultType="int"> <include refid="selectCustomerManagementVoCount"/> <where> <include refid="whereCondition"/> </where> </select> <select id="selectCustomerManagementList" parameterType="com.ruoyi.cwgl.domain.CustomerManagement" resultMap="CustomerManagementResult"> <include refid="selectCustomerManagementVo"/> <where> <include refid="whereCondition"/> </where> order by thisTab.id desc </select> <!-- 新增 --> <insert id="insertCustomerManagement" parameterType="com.ruoyi.cwgl.domain.CustomerManagement" useGeneratedKeys="true" keyProperty="id"> insert into customer_management <trim prefix="(" suffix=")" suffixOverrides=","> <if test="customerFullName != null and customerFullName != ''">customer_full_name,</if> <if test="customerShortName != null">customer_short_name,</if> <if test="customerType != null">customer_type,</if> <if test="contactPerson != null">contact_person,</if> <if test="address != null">address,</if> <if test="contactPhone != null">contact_phone,</if> <if test="customerCode != null">customer_code,</if> <if test="status != null">status,</if> <if test="remark != null">remark,</if> <if test="createBy != null">create_by,</if> <if test="updateBy != null">update_by,</if> <if test="createTime != null">create_time,</if> <if test="updateTime != null">update_time,</if> <if test="deleted != null">deleted,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="customerFullName != null and customerFullName != ''">#{customerFullName},</if> <if test="customerShortName != null">#{customerShortName},</if> <if test="customerType != null">#{customerType},</if> <if test="contactPerson != null">#{contactPerson},</if> <if test="address != null">#{address},</if> <if test="contactPhone != null">#{contactPhone},</if> <if test="customerCode != null">#{customerCode},</if> <if test="status != null">#{status},</if> <if test="remark != null">#{remark},</if> <if test="createBy != null">#{createBy},</if> <if test="updateBy != null">#{updateBy},</if> <if test="createTime != null">#{createTime},</if> <if test="updateTime != null">#{updateTime},</if> <if test="deleted != null">#{deleted},</if> </trim> </insert> <insert id="insertCustomerManagementBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id"> insert into customer_management <trim prefix="(" suffix=") values" suffixOverrides=","> id,customer_full_name,customer_short_name,customer_type,contact_person,address,contact_phone,customer_code,status,remark,create_by,update_by,create_time,update_time,deleted, </trim> <foreach item="item" index="index" collection="list" separator=","> <trim prefix="(" suffix=") " suffixOverrides=","> #{item.id},#{item.customerFullName},#{item.customerShortName},#{item.customerType},#{item.contactPerson},#{item.address},#{item.contactPhone},#{item.customerCode},#{item.status},#{item.remark},#{item.createBy},#{item.updateBy},#{item.createTime},#{item.updateTime},#{item.deleted}, </trim> </foreach> </insert> <!-- 修改 --> <update id="updateCustomerManagement" parameterType="com.ruoyi.cwgl.domain.CustomerManagement"> update customer_management <trim prefix="SET" suffixOverrides=","> <if test="customerFullName != null and customerFullName != ''">customer_full_name = #{customerFullName},</if> <if test="customerShortName != null">customer_short_name = #{customerShortName},</if> <if test="customerType != null">customer_type = #{customerType},</if> <if test="contactPerson != null">contact_person = #{contactPerson},</if> <if test="address != null">address = #{address},</if> <if test="contactPhone != null">contact_phone = #{contactPhone},</if> <if test="customerCode != null">customer_code = #{customerCode},</if> <if test="status != null">status = #{status},</if> <if test="remark != null">remark = #{remark},</if> <if test="createBy != null">create_by = #{createBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if> <if test="createTime != null">create_time = #{createTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if> <if test="deleted != null">deleted = #{deleted},</if> </trim> where id = #{id} </update> <!-- 修改 --> <update id="updateCustomerManagementBatch" parameterType="java.util.List"> <foreach collection="list" item="item" index="index" separator=";"> update customer_management <trim prefix="SET" suffixOverrides=","> <if test="item.customerFullName != null and item.customerFullName != ''">customer_full_name = #{item.customerFullName},</if> <if test="item.customerShortName != null">customer_short_name = #{item.customerShortName},</if> <if test="item.customerType != null">customer_type = #{item.customerType},</if> <if test="item.contactPerson != null">contact_person = #{item.contactPerson},</if> <if test="item.address != null">address = #{item.address},</if> <if test="item.contactPhone != null">contact_phone = #{item.contactPhone},</if> <if test="item.customerCode != null">customer_code = #{item.customerCode},</if> <if test="item.status != null">status = #{item.status},</if> <if test="item.remark != null">remark = #{item.remark},</if> <if test="item.createBy != null">create_by = #{item.createBy},</if> <if test="item.updateBy != null">update_by = #{item.updateBy},</if> <if test="item.createTime != null">create_time = #{item.createTime},</if> <if test="item.updateTime != null">update_time = #{item.updateTime},</if> <if test="item.deleted != null">deleted = #{item.deleted},</if> </trim> where id = #{item.id} </foreach> </update> <!--删除--> <delete id="deleteCustomerManagementById" parameterType="Integer"> delete from customer_management where id = #{id} </delete> <delete id="deleteCustomerManagementByIds" parameterType="Integer"> delete from customer_management where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> </mapper>