From 8b1f2dbdaa83f22bc5b5d38141e7eb226e624cb6 Mon Sep 17 00:00:00 2001 From: bluejay <253316343@qq.com> Date: 星期一, 14 四月 2025 19:57:59 +0800 Subject: [PATCH] 工厂管理-代码生成 --- aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java | 96 ++++++++++ aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java | 98 ++++++++++ aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml | 82 +++++++++ aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlant.java | 86 +++++++++ aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java | 61 ++++++ aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java | 63 +++++++ 6 files changed, 486 insertions(+), 0 deletions(-) diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java new file mode 100644 index 0000000..89d3526 --- /dev/null +++ b/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)); + } +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlant.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlant.java new file mode 100644 index 0000000..9e66f2e --- /dev/null +++ b/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(); + } +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java new file mode 100644 index 0000000..9171804 --- /dev/null +++ b/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); +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java new file mode 100644 index 0000000..cb7daa3 --- /dev/null +++ b/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); +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java new file mode 100644 index 0000000..47a5aac --- /dev/null +++ b/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); + } +} diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml new file mode 100644 index 0000000..a16e89e --- /dev/null +++ b/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> \ No newline at end of file -- Gitblit v1.9.3