bluejay
2025-04-14 8b1f2dbdaa83f22bc5b5d38141e7eb226e624cb6
工厂管理-代码生成
已添加6个文件
486 ■■■■■ 文件已修改
aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlant.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
package com.aps.core.controller.basicData;
import com.aps.common.core.utils.poi.ExcelUtil;
import com.aps.common.core.web.controller.BaseController;
import com.aps.common.core.web.domain.AjaxResult;
import com.aps.common.core.web.page.TableDataInfo;
import com.aps.common.log.annotation.Log;
import com.aps.common.log.enums.BusinessType;
import com.aps.common.security.annotation.RequiresPermissions;
import com.aps.core.domain.ApsPlant;
import com.aps.core.service.IApsPlantService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * å·¥åŽ‚ç®¡ç†Controller
 *
 * @author ruoyi
 * @date 2025-04-14
 */
@RestController
@RequestMapping("/aps_plant")
public class ApsPlantController extends BaseController
{
    @Autowired
    private IApsPlantService apsPlantService;
    /**
     * æŸ¥è¯¢å·¥åŽ‚ç®¡ç†åˆ—è¡¨
     */
    @RequiresPermissions("aps_plant:list")
    @GetMapping("/list")
    public TableDataInfo list(ApsPlant apsPlant)
    {
        startPage();
        List<ApsPlant> list = apsPlantService.selectApsPlantList(apsPlant);
        return getDataTable(list);
    }
    /**
     * å¯¼å‡ºå·¥åŽ‚ç®¡ç†åˆ—è¡¨
     */
    @RequiresPermissions("aps_plant:export")
    @Log(title = "工厂管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ApsPlant apsPlant)
    {
        List<ApsPlant> list = apsPlantService.selectApsPlantList(apsPlant);
        ExcelUtil<ApsPlant> util = new ExcelUtil<ApsPlant>(ApsPlant.class);
        util.exportExcel(response, list, "工厂管理数据");
    }
    /**
     * èŽ·å–å·¥åŽ‚ç®¡ç†è¯¦ç»†ä¿¡æ¯
     */
    @RequiresPermissions("aps_plant:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(apsPlantService.selectApsPlantById(id));
    }
    /**
     * æ–°å¢žå·¥åŽ‚ç®¡ç†
     */
    @RequiresPermissions("aps_plant:add")
    @Log(title = "工厂管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ApsPlant apsPlant)
    {
        return toAjax(apsPlantService.insertApsPlant(apsPlant));
    }
    /**
     * ä¿®æ”¹å·¥åŽ‚ç®¡ç†
     */
    @RequiresPermissions("aps_plant:edit")
    @Log(title = "工厂管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApsPlant apsPlant)
    {
        return toAjax(apsPlantService.updateApsPlant(apsPlant));
    }
    /**
     * åˆ é™¤å·¥åŽ‚ç®¡ç†
     */
    @RequiresPermissions("aps_plant:remove")
    @Log(title = "工厂管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(apsPlantService.deleteApsPlantByIds(ids));
    }
}
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlant.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,86 @@
package com.aps.core.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aps.common.core.annotation.Excel;
import com.aps.common.core.web.domain.BaseEntity;
/**
 * å·¥åŽ‚ç®¡ç†å¯¹è±¡ aps_plant
 *
 * @author ruoyi
 * @date 2025-04-14
 */
public class ApsPlant extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    /** id */
    private Long id;
    /** å·¥åŽ‚åç§° */
    @Excel(name = "工厂名称")
    private String plantName;
    /** å·¥åŽ‚ç¼–ç  */
    @Excel(name = "工厂编码")
    private String plantCode;
    /** å¯ç”¨çŠ¶æ€ */
    @Excel(name = "启用状态")
    private String status;
    public void setId(Long id)
    {
        this.id = id;
    }
    public Long getId()
    {
        return id;
    }
    public void setPlantName(String plantName)
    {
        this.plantName = plantName;
    }
    public String getPlantName()
    {
        return plantName;
    }
    public void setPlantCode(String plantCode)
    {
        this.plantCode = plantCode;
    }
    public String getPlantCode()
    {
        return plantCode;
    }
    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("plantName", getPlantName())
            .append("plantCode", getPlantCode())
            .append("status", getStatus())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.aps.core.mapper;
import java.util.List;
import com.aps.core.domain.ApsPlant;
import org.apache.ibatis.annotations.Mapper;
/**
 * å·¥åŽ‚ç®¡ç†Mapper接口
 *
 * @author ruoyi
 * @date 2025-04-14
 */
@Mapper
public interface ApsPlantMapper
{
    /**
     * æŸ¥è¯¢å·¥åŽ‚ç®¡ç†
     *
     * @param id å·¥åŽ‚ç®¡ç†ä¸»é”®
     * @return å·¥åŽ‚ç®¡ç†
     */
    public ApsPlant selectApsPlantById(Long id);
    /**
     * æŸ¥è¯¢å·¥åŽ‚ç®¡ç†åˆ—è¡¨
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return å·¥åŽ‚ç®¡ç†é›†åˆ
     */
    public List<ApsPlant> selectApsPlantList(ApsPlant apsPlant);
    /**
     * æ–°å¢žå·¥åŽ‚ç®¡ç†
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return ç»“æžœ
     */
    public int insertApsPlant(ApsPlant apsPlant);
    /**
     * ä¿®æ”¹å·¥åŽ‚ç®¡ç†
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return ç»“æžœ
     */
    public int updateApsPlant(ApsPlant apsPlant);
    /**
     * åˆ é™¤å·¥åŽ‚ç®¡ç†
     *
     * @param id å·¥åŽ‚ç®¡ç†ä¸»é”®
     * @return ç»“æžœ
     */
    public int deleteApsPlantById(Long id);
    /**
     * æ‰¹é‡åˆ é™¤å·¥åŽ‚ç®¡ç†
     *
     * @param ids éœ€è¦åˆ é™¤çš„æ•°æ®ä¸»é”®é›†åˆ
     * @return ç»“æžœ
     */
    public int deleteApsPlantByIds(Long[] ids);
}
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
package com.aps.core.service;
import java.util.List;
import com.aps.core.domain.ApsPlant;
/**
 * å·¥åŽ‚ç®¡ç†Service接口
 *
 * @author ruoyi
 * @date 2025-04-14
 */
public interface IApsPlantService
{
    /**
     * æŸ¥è¯¢å·¥åŽ‚ç®¡ç†
     *
     * @param id å·¥åŽ‚ç®¡ç†ä¸»é”®
     * @return å·¥åŽ‚ç®¡ç†
     */
    public ApsPlant selectApsPlantById(Long id);
    /**
     * æŸ¥è¯¢å·¥åŽ‚ç®¡ç†åˆ—è¡¨
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return å·¥åŽ‚ç®¡ç†é›†åˆ
     */
    public List<ApsPlant> selectApsPlantList(ApsPlant apsPlant);
    /**
     * æ–°å¢žå·¥åŽ‚ç®¡ç†
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return ç»“æžœ
     */
    public int insertApsPlant(ApsPlant apsPlant);
    /**
     * ä¿®æ”¹å·¥åŽ‚ç®¡ç†
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return ç»“æžœ
     */
    public int updateApsPlant(ApsPlant apsPlant);
    /**
     * æ‰¹é‡åˆ é™¤å·¥åŽ‚ç®¡ç†
     *
     * @param ids éœ€è¦åˆ é™¤çš„工厂管理主键集合
     * @return ç»“æžœ
     */
    public int deleteApsPlantByIds(Long[] ids);
    /**
     * åˆ é™¤å·¥åŽ‚ç®¡ç†ä¿¡æ¯
     *
     * @param id å·¥åŽ‚ç®¡ç†ä¸»é”®
     * @return ç»“æžœ
     */
    public int deleteApsPlantById(Long id);
}
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,96 @@
package com.aps.core.service.impl;
import java.util.List;
import com.aps.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aps.core.mapper.ApsPlantMapper;
import com.aps.core.domain.ApsPlant;
import com.aps.core.service.IApsPlantService;
/**
 * å·¥åŽ‚ç®¡ç†Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-14
 */
@Service
public class ApsPlantServiceImpl implements IApsPlantService
{
    @Autowired
    private ApsPlantMapper apsPlantMapper;
    /**
     * æŸ¥è¯¢å·¥åŽ‚ç®¡ç†
     *
     * @param id å·¥åŽ‚ç®¡ç†ä¸»é”®
     * @return å·¥åŽ‚ç®¡ç†
     */
    @Override
    public ApsPlant selectApsPlantById(Long id)
    {
        return apsPlantMapper.selectApsPlantById(id);
    }
    /**
     * æŸ¥è¯¢å·¥åŽ‚ç®¡ç†åˆ—è¡¨
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return å·¥åŽ‚ç®¡ç†
     */
    @Override
    public List<ApsPlant> selectApsPlantList(ApsPlant apsPlant)
    {
        return apsPlantMapper.selectApsPlantList(apsPlant);
    }
    /**
     * æ–°å¢žå·¥åŽ‚ç®¡ç†
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return ç»“æžœ
     */
    @Override
    public int insertApsPlant(ApsPlant apsPlant)
    {
        apsPlant.setCreateTime(DateUtils.getNowDate());
        return apsPlantMapper.insertApsPlant(apsPlant);
    }
    /**
     * ä¿®æ”¹å·¥åŽ‚ç®¡ç†
     *
     * @param apsPlant å·¥åŽ‚ç®¡ç†
     * @return ç»“æžœ
     */
    @Override
    public int updateApsPlant(ApsPlant apsPlant)
    {
        apsPlant.setUpdateTime(DateUtils.getNowDate());
        return apsPlantMapper.updateApsPlant(apsPlant);
    }
    /**
     * æ‰¹é‡åˆ é™¤å·¥åŽ‚ç®¡ç†
     *
     * @param ids éœ€è¦åˆ é™¤çš„工厂管理主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteApsPlantByIds(Long[] ids)
    {
        return apsPlantMapper.deleteApsPlantByIds(ids);
    }
    /**
     * åˆ é™¤å·¥åŽ‚ç®¡ç†ä¿¡æ¯
     *
     * @param id å·¥åŽ‚ç®¡ç†ä¸»é”®
     * @return ç»“æžœ
     */
    @Override
    public int deleteApsPlantById(Long id)
    {
        return apsPlantMapper.deleteApsPlantById(id);
    }
}
aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
<?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.aps.core.mapper.ApsPlantMapper">
    <resultMap type="ApsPlant" id="ApsPlantResult">
        <result property="id"    column="id"    />
        <result property="plantName"    column="plant_name"    />
        <result property="plantCode"    column="plant_code"    />
        <result property="status"    column="status"    />
        <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="selectApsPlantVo">
        select id, plant_name, plant_code, status, create_by, create_time, update_by, update_time from aps_plant
    </sql>
    <select id="selectApsPlantList" parameterType="ApsPlant" resultMap="ApsPlantResult">
        <include refid="selectApsPlantVo"/>
        <where>
            <if test="plantName != null  and plantName != ''"> and plant_name like concat('%', #{plantName}, '%')</if>
            <if test="plantCode != null  and plantCode != ''"> and plant_code like concat('%', #{plantCode}, '%')</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>
    <select id="selectApsPlantById" parameterType="Long" resultMap="ApsPlantResult">
        <include refid="selectApsPlantVo"/>
        where id = #{id}
    </select>
    <insert id="insertApsPlant" parameterType="ApsPlant" useGeneratedKeys="true" keyProperty="id">
        insert into aps_plant
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="plantName != null">plant_name,</if>
            <if test="plantCode != null">plant_code,</if>
            <if test="status != null">status,</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="plantName != null">#{plantName},</if>
            <if test="plantCode != null">#{plantCode},</if>
            <if test="status != null">#{status},</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="updateApsPlant" parameterType="ApsPlant">
        update aps_plant
        <trim prefix="SET" suffixOverrides=",">
            <if test="plantName != null">plant_name = #{plantName},</if>
            <if test="plantCode != null">plant_code = #{plantCode},</if>
            <if test="status != null">status = #{status},</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="deleteApsPlantById" parameterType="Long">
        delete from aps_plant where id = #{id}
    </delete>
    <delete id="deleteApsPlantByIds" parameterType="String">
        delete from aps_plant where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>