Forráskód Böngészése

Merge branch 'master' of http://62.234.61.92:3000/wjm/mec-cloud_IntelligentManufacturing_CLIENT

lph 1 éve
szülő
commit
04c0a16930

+ 122 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductionController.java

@@ -0,0 +1,122 @@
+package com.zkqy.business.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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.zkqy.common.annotation.Log;
+import com.zkqy.common.core.controller.BaseController;
+import com.zkqy.common.core.domain.AjaxResult;
+import com.zkqy.common.enums.BusinessType;
+import com.zkqy.business.domain.Production;
+import com.zkqy.business.service.IProductionService;
+import com.zkqy.common.utils.poi.ExcelUtil;
+import com.zkqy.common.core.page.TableDataInfo;
+
+/**
+ * 产品Controller
+ *
+ * @author zkqy
+ * @date 2024-05-13
+ */
+@RestController
+@RequestMapping("/system/production")
+@Api(value = "/system/production", description = "产品-接口")
+public class ProductionController extends BaseController
+{
+    @Autowired
+    private IProductionService productionService;
+
+/**
+ * 查询产品列表
+ */
+//@PreAuthorize("@ss.hasPermi('system:production:list')")
+@GetMapping("/list")
+@ApiOperation(value = "查询产品列表")
+    public TableDataInfo list(Production production)
+    {
+        startPage();
+        List<Production> list = productionService.selectProductionList(production);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出产品列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:production:export')")
+    @Log(title = "产品", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ApiOperation(value = "导出产品列表")
+    public void export(HttpServletResponse response, Production production)
+    {
+        List<Production> list = productionService.selectProductionList(production);
+        ExcelUtil<Production> util = new ExcelUtil<Production>(Production.class);
+        util.exportExcel(response, list, "产品数据");
+    }
+
+    /**
+     * 获取产品详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:production:query')")
+    @GetMapping(value = "/{id}")
+    @ApiOperation(value = "获取产品详细信息")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(productionService.selectProductionById(id));
+    }
+
+    /**
+     * 新增产品
+     */
+    @PreAuthorize("@ss.hasPermi('system:production:add')")
+    @Log(title = "产品", businessType = BusinessType.INSERT)
+    @PostMapping
+    @ApiOperation(value = "新增产品")
+    public AjaxResult add(@RequestBody Production production)
+    {
+        return toAjax(productionService.insertProduction(production));
+    }
+
+    /**
+     * 修改产品
+     */
+    @PreAuthorize("@ss.hasPermi('system:production:edit')")
+    @Log(title = "产品", businessType = BusinessType.UPDATE)
+    @PutMapping
+    @ApiOperation(value = "修改产品")
+    public AjaxResult edit(@RequestBody Production production)
+    {
+        return toAjax(productionService.updateProduction(production));
+    }
+
+    /**
+     * 删除产品
+     */
+    @PreAuthorize("@ss.hasPermi('system:production:remove')")
+    @Log(title = "产品", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    @ApiOperation(value = "删除产品")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(productionService.deleteProductionByIds(ids));
+    }
+
+    /**
+     * 销售单产品列表(根据品名排序)
+     */
+    @GetMapping("/getSaleOrderProductionList")
+    public AjaxResult getSaleOrderProductionList()
+    {
+        return success(productionService.selectSaleOrderProductionList(new Production()));
+    }
+}

+ 219 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/Production.java

@@ -0,0 +1,219 @@
+package com.zkqy.business.domain;
+
+import com.zkqy.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.zkqy.common.annotation.Excel;
+
+/**
+ * 产品对象 production
+ * 
+ * @author zkqy
+ * @date 2024-05-13
+ */
+public class Production extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long id;
+
+    /** 产品编码 */
+    @Excel(name = "产品编码")
+    private String productNo;
+
+    /** 品名 */
+    @Excel(name = "品名")
+    private String productName;
+
+    /** 产品规格 */
+    @Excel(name = "产品规格")
+    private String productSpecifications;
+
+    /** 产品色泽 */
+    @Excel(name = "产品色泽")
+    private String productColor;
+
+    /** 产品分类 */
+    @Excel(name = "产品分类")
+    private String productType;
+
+    /** 产品描述 */
+    @Excel(name = "产品描述")
+    private String productDescribe;
+
+    /** 产品单位(未使用) */
+    @Excel(name = "产品单位(未使用)")
+    private String productUnit;
+
+    /** 产品种类编号(未使用) */
+    @Excel(name = "产品种类编号", readConverterExp = "未=使用")
+    private Long productTypeNo;
+
+    /** 创建者id */
+    private Long createById;
+
+    /** 更新者id */
+    private Long updateById;
+
+    /** 删除标志(0代表存在 2代表删除) */
+    private String delFlag;
+
+    /** 任务编码 */
+    private String taskProcessKey;
+
+    /** 任务节点编码 */
+    private String taskNodeKey;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setProductNo(String productNo) 
+    {
+        this.productNo = productNo;
+    }
+
+    public String getProductNo() 
+    {
+        return productNo;
+    }
+    public void setProductName(String productName) 
+    {
+        this.productName = productName;
+    }
+
+    public String getProductName() 
+    {
+        return productName;
+    }
+    public void setProductSpecifications(String productSpecifications) 
+    {
+        this.productSpecifications = productSpecifications;
+    }
+
+    public String getProductSpecifications() 
+    {
+        return productSpecifications;
+    }
+    public void setProductColor(String productColor) 
+    {
+        this.productColor = productColor;
+    }
+
+    public String getProductColor() 
+    {
+        return productColor;
+    }
+    public void setProductType(String productType) 
+    {
+        this.productType = productType;
+    }
+
+    public String getProductType() 
+    {
+        return productType;
+    }
+    public void setProductDescribe(String productDescribe) 
+    {
+        this.productDescribe = productDescribe;
+    }
+
+    public String getProductDescribe() 
+    {
+        return productDescribe;
+    }
+    public void setProductUnit(String productUnit) 
+    {
+        this.productUnit = productUnit;
+    }
+
+    public String getProductUnit() 
+    {
+        return productUnit;
+    }
+    public void setProductTypeNo(Long productTypeNo) 
+    {
+        this.productTypeNo = productTypeNo;
+    }
+
+    public Long getProductTypeNo() 
+    {
+        return productTypeNo;
+    }
+    public void setCreateById(Long createById) 
+    {
+        this.createById = createById;
+    }
+
+    public Long getCreateById() 
+    {
+        return createById;
+    }
+    public void setUpdateById(Long updateById) 
+    {
+        this.updateById = updateById;
+    }
+
+    public Long getUpdateById() 
+    {
+        return updateById;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+    public void setTaskProcessKey(String taskProcessKey) 
+    {
+        this.taskProcessKey = taskProcessKey;
+    }
+
+    public String getTaskProcessKey() 
+    {
+        return taskProcessKey;
+    }
+    public void setTaskNodeKey(String taskNodeKey) 
+    {
+        this.taskNodeKey = taskNodeKey;
+    }
+
+    public String getTaskNodeKey() 
+    {
+        return taskNodeKey;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("productNo", getProductNo())
+            .append("productName", getProductName())
+            .append("productSpecifications", getProductSpecifications())
+            .append("productColor", getProductColor())
+            .append("productType", getProductType())
+            .append("productDescribe", getProductDescribe())
+            .append("productUnit", getProductUnit())
+            .append("productTypeNo", getProductTypeNo())
+            .append("remark", getRemark())
+            .append("createById", getCreateById())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateById", getUpdateById())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("delFlag", getDelFlag())
+            .append("taskProcessKey", getTaskProcessKey())
+            .append("taskNodeKey", getTaskNodeKey())
+            .toString();
+    }
+}

+ 70 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductionMapper.java

@@ -0,0 +1,70 @@
+package com.zkqy.business.mapper;
+
+import java.util.List;
+import com.zkqy.business.domain.Production;
+
+/**
+ * 产品Mapper接口
+ * 
+ * @author zkqy
+ * @date 2024-05-13
+ */
+public interface ProductionMapper 
+{
+    /**
+     * 查询产品
+     * 
+     * @param id 产品主键
+     * @return 产品
+     */
+    public Production selectProductionById(Long id);
+
+    /**
+     * 查询产品列表
+     * 
+     * @param production 产品
+     * @return 产品集合
+     */
+    public List<Production> selectProductionList(Production production);
+
+    /**
+     * 新增产品
+     * 
+     * @param production 产品
+     * @return 结果
+     */
+    public int insertProduction(Production production);
+
+    /**
+     * 修改产品
+     * 
+     * @param production 产品
+     * @return 结果
+     */
+    public int updateProduction(Production production);
+
+    /**
+     * 删除产品
+     * 
+     * @param id 产品主键
+     * @return 结果
+     */
+    public int deleteProductionById(Long id);
+
+    /**
+     * 批量删除产品
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteProductionByIds(Long[] ids);
+
+
+    /**
+     * 销售单查询产品列表(根据品名排序)
+     *
+     * @param production 产品
+     * @return 产品集合
+     */
+    List<Production> selectSaleOrderProductionList(Production production);
+}

+ 70 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductionService.java

@@ -0,0 +1,70 @@
+package com.zkqy.business.service;
+
+import java.util.List;
+import com.zkqy.business.domain.Production;
+
+/**
+ * 产品Service接口
+ * 
+ * @author zkqy
+ * @date 2024-05-13
+ */
+public interface IProductionService 
+{
+    /**
+     * 查询产品
+     * 
+     * @param id 产品主键
+     * @return 产品
+     */
+    public Production selectProductionById(Long id);
+
+    /**
+     * 查询产品列表
+     * 
+     * @param production 产品
+     * @return 产品集合
+     */
+    public List<Production> selectProductionList(Production production);
+
+    /**
+     * 新增产品
+     * 
+     * @param production 产品
+     * @return 结果
+     */
+    public int insertProduction(Production production);
+
+    /**
+     * 修改产品
+     * 
+     * @param production 产品
+     * @return 结果
+     */
+    public int updateProduction(Production production);
+
+    /**
+     * 批量删除产品
+     * 
+     * @param ids 需要删除的产品主键集合
+     * @return 结果
+     */
+    public int deleteProductionByIds(Long[] ids);
+
+    /**
+     * 删除产品信息
+     * 
+     * @param id 产品主键
+     * @return 结果
+     */
+    public int deleteProductionById(Long id);
+
+    /**
+     * 销售单查询产品列表(根据品名排序)
+     *
+     * @param production 产品
+     * @return 产品集合
+     */
+    List<Production> selectSaleOrderProductionList(Production production);
+
+}

+ 101 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductionServiceImpl.java

@@ -0,0 +1,101 @@
+package com.zkqy.business.service.impl;
+
+import java.util.List;
+import com.zkqy.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.zkqy.business.mapper.ProductionMapper;
+import com.zkqy.business.domain.Production;
+import com.zkqy.business.service.IProductionService;
+
+/**
+ * 产品Service业务层处理
+ * 
+ * @author zkqy
+ * @date 2024-05-13
+ */
+@Service
+public class ProductionServiceImpl implements IProductionService 
+{
+    @Autowired
+    private ProductionMapper productionMapper;
+
+    /**
+     * 查询产品
+     * 
+     * @param id 产品主键
+     * @return 产品
+     */
+    @Override
+    public Production selectProductionById(Long id)
+    {
+        return productionMapper.selectProductionById(id);
+    }
+
+    /**
+     * 查询产品列表
+     * 
+     * @param production 产品
+     * @return 产品
+     */
+    @Override
+    public List<Production> selectProductionList(Production production)
+    {
+        return productionMapper.selectProductionList(production);
+    }
+
+    /**
+     * 新增产品
+     * 
+     * @param production 产品
+     * @return 结果
+     */
+    @Override
+    public int insertProduction(Production production)
+    {
+        production.setCreateTime(DateUtils.getNowDate());
+        return productionMapper.insertProduction(production);
+    }
+
+    /**
+     * 修改产品
+     * 
+     * @param production 产品
+     * @return 结果
+     */
+    @Override
+    public int updateProduction(Production production)
+    {
+        production.setUpdateTime(DateUtils.getNowDate());
+        return productionMapper.updateProduction(production);
+    }
+
+    /**
+     * 批量删除产品
+     * 
+     * @param ids 需要删除的产品主键
+     * @return 结果
+     */
+    @Override
+    public int deleteProductionByIds(Long[] ids)
+    {
+        return productionMapper.deleteProductionByIds(ids);
+    }
+
+    /**
+     * 删除产品信息
+     * 
+     * @param id 产品主键
+     * @return 结果
+     */
+    @Override
+    public int deleteProductionById(Long id)
+    {
+        return productionMapper.deleteProductionById(id);
+    }
+
+    @Override
+    public List<Production> selectSaleOrderProductionList(Production production) {
+        return productionMapper.selectSaleOrderProductionList(production);
+    }
+}

+ 146 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductionMapper.xml

@@ -0,0 +1,146 @@
+<?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.zkqy.business.mapper.ProductionMapper">
+    
+    <resultMap type="com.zkqy.business.domain.Production" id="ProductionResult">
+        <result property="id"    column="id"    />
+        <result property="productNo"    column="product_no"    />
+        <result property="productName"    column="product_name"    />
+        <result property="productSpecifications"    column="product_specifications"    />
+        <result property="productColor"    column="product_color"    />
+        <result property="productType"    column="product_type"    />
+        <result property="productDescribe"    column="product_describe"    />
+        <result property="productUnit"    column="product_unit"    />
+        <result property="productTypeNo"    column="product_type_no"    />
+        <result property="remark"    column="remark"    />
+        <result property="createById"    column="create_by_id"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateById"    column="update_by_id"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="taskProcessKey"    column="task_process_key"    />
+        <result property="taskNodeKey"    column="task_node_key"    />
+    </resultMap>
+
+    <sql id="selectProductionVo">
+        select id, product_no, product_name, product_specifications, product_color, product_type, product_describe, product_unit, product_type_no, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key from {DBNAME}.production
+    </sql>
+
+    <select id="selectProductionList" parameterType="com.zkqy.business.domain.Production" resultMap="ProductionResult">
+        <include refid="selectProductionVo"/>
+        <where>  
+            <if test="productNo != null  and productNo != ''"> and product_no = #{productNo}</if>
+            <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
+            <if test="productSpecifications != null  and productSpecifications != ''"> and product_specifications = #{productSpecifications}</if>
+            <if test="productColor != null  and productColor != ''"> and product_color = #{productColor}</if>
+            <if test="productType != null  and productType != ''"> and product_type = #{productType}</if>
+            <if test="productDescribe != null  and productDescribe != ''"> and product_describe = #{productDescribe}</if>
+            <if test="productUnit != null  and productUnit != ''"> and product_unit = #{productUnit}</if>
+            <if test="productTypeNo != null "> and product_type_no = #{productTypeNo}</if>
+        </where>
+    </select>
+    
+    <select id="selectProductionById" parameterType="Long" resultMap="ProductionResult">
+        <include refid="selectProductionVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertProduction" parameterType="com.zkqy.business.domain.Production" useGeneratedKeys="true" keyProperty="id">
+        insert into production
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="productNo != null">product_no,</if>
+            <if test="productName != null">product_name,</if>
+            <if test="productSpecifications != null">product_specifications,</if>
+            <if test="productColor != null">product_color,</if>
+            <if test="productType != null">product_type,</if>
+            <if test="productDescribe != null">product_describe,</if>
+            <if test="productUnit != null">product_unit,</if>
+            <if test="productTypeNo != null">product_type_no,</if>
+            <if test="remark != null">remark,</if>
+            <if test="createById != null">create_by_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateById != null">update_by_id,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="taskProcessKey != null">task_process_key,</if>
+            <if test="taskNodeKey != null">task_node_key,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="productNo != null">#{productNo},</if>
+            <if test="productName != null">#{productName},</if>
+            <if test="productSpecifications != null">#{productSpecifications},</if>
+            <if test="productColor != null">#{productColor},</if>
+            <if test="productType != null">#{productType},</if>
+            <if test="productDescribe != null">#{productDescribe},</if>
+            <if test="productUnit != null">#{productUnit},</if>
+            <if test="productTypeNo != null">#{productTypeNo},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="createById != null">#{createById},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateById != null">#{updateById},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="taskProcessKey != null">#{taskProcessKey},</if>
+            <if test="taskNodeKey != null">#{taskNodeKey},</if>
+         </trim>
+    </insert>
+
+    <update id="updateProduction" parameterType="com.zkqy.business.domain.Production">
+        update production
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="productNo != null">product_no = #{productNo},</if>
+            <if test="productName != null">product_name = #{productName},</if>
+            <if test="productSpecifications != null">product_specifications = #{productSpecifications},</if>
+            <if test="productColor != null">product_color = #{productColor},</if>
+            <if test="productType != null">product_type = #{productType},</if>
+            <if test="productDescribe != null">product_describe = #{productDescribe},</if>
+            <if test="productUnit != null">product_unit = #{productUnit},</if>
+            <if test="productTypeNo != null">product_type_no = #{productTypeNo},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="createById != null">create_by_id = #{createById},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateById != null">update_by_id = #{updateById},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="taskProcessKey != null">task_process_key = #{taskProcessKey},</if>
+            <if test="taskNodeKey != null">task_node_key = #{taskNodeKey},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteProductionById" parameterType="Long">
+        delete from production where id = #{id}
+    </delete>
+
+    <delete id="deleteProductionByIds" parameterType="String">
+        delete from production where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="selectSaleOrderProductionList" parameterType="com.zkqy.business.domain.Production" resultMap="ProductionResult">
+        <include refid="selectProductionVo"/>
+        where del_flag = '0'
+            <if test="productNo != null  and productNo != ''"> and product_no = #{productNo}</if>
+            <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
+            <if test="productSpecifications != null  and productSpecifications != ''"> and product_specifications = #{productSpecifications}</if>
+            <if test="productColor != null  and productColor != ''"> and product_color = #{productColor}</if>
+            <if test="productType != null  and productType != ''"> and product_type = #{productType}</if>
+            <if test="productDescribe != null  and productDescribe != ''"> and product_describe = #{productDescribe}</if>
+            <if test="productUnit != null  and productUnit != ''"> and product_unit = #{productUnit}</if>
+            <if test="productTypeNo != null "> and product_type_no = #{productTypeNo}</if>
+             order by product_name asc
+    </select>
+
+</mapper>