子模块引入

This commit is contained in:
piaobo 2025-07-09 14:31:05 +08:00
parent 828687d20b
commit 69fb8678e3
12 changed files with 521 additions and 154 deletions

View File

@ -217,6 +217,11 @@
<artifactId>zhyc-common</artifactId> <artifactId>zhyc-common</artifactId>
<version>${zhyc.version}</version> <version>${zhyc.version}</version>
</dependency> </dependency>
<dependency>
<groupId>zhyc</groupId>
<artifactId>zhyc-module</artifactId>
<version>${zhyc.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

67
ry.bat
View File

@ -1,67 +0,0 @@
@echo off
rem jar平级目录
set AppName=zhyc-admin.jar
rem JVM参数
set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
ECHO.
ECHO. [1] 启动%AppName%
ECHO. [2] 关闭%AppName%
ECHO. [3] 重启%AppName%
ECHO. [4] 启动状态 %AppName%
ECHO. [5] 退 出
ECHO.
ECHO.请输入选择项目的序号:
set /p ID=
IF "%id%"=="1" GOTO start
IF "%id%"=="2" GOTO stop
IF "%id%"=="3" GOTO restart
IF "%id%"=="4" GOTO status
IF "%id%"=="5" EXIT
PAUSE
:start
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a
set image_name=%%b
)
if defined pid (
echo %%is running
PAUSE
)
start javaw %JVM_OPTS% -jar %AppName%
echo starting……
echo Start %AppName% success...
goto:eof
rem 函数stop通过jps命令查找pid并结束进程
:stop
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a
set image_name=%%b
)
if not defined pid (echo process %AppName% does not exists) else (
echo prepare to kill %image_name%
echo start kill %pid% ...
rem 根据进程IDkill进程
taskkill /f /pid %pid%
)
goto:eof
:restart
call :stop
call :start
goto:eof
:status
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a
set image_name=%%b
)
if not defined pid (echo process %AppName% is dead ) else (
echo %image_name% is running
)
goto:eof

86
ry.sh
View File

@ -1,86 +0,0 @@
#!/bin/sh
# ./ry.sh start 启动 stop 停止 restart 重启 status 状态
AppName=zhyc-admin.jar
# JVM参数
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
APP_HOME=`pwd`
LOG_PATH=$APP_HOME/logs/$AppName.log
if [ "$1" = "" ];
then
echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m"
exit 1
fi
if [ "$AppName" = "" ];
then
echo -e "\033[0;31m 未输入应用名 \033[0m"
exit 1
fi
function start()
{
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
if [ x"$PID" != x"" ]; then
echo "$AppName is running..."
else
nohup java $JVM_OPTS -jar $AppName > /dev/null 2>&1 &
echo "Start $AppName success..."
fi
}
function stop()
{
echo "Stop $AppName"
PID=""
query(){
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
}
query
if [ x"$PID" != x"" ]; then
kill -TERM $PID
echo "$AppName (pid:$PID) exiting..."
while [ x"$PID" != x"" ]
do
sleep 1
query
done
echo "$AppName exited."
else
echo "$AppName already stopped."
fi
}
function restart()
{
stop
sleep 2
start
}
function status()
{
PID=`ps -ef |grep java|grep $AppName|grep -v grep|wc -l`
if [ $PID != 0 ];then
echo "$AppName is running..."
else
echo "$AppName is not running..."
fi
}
case $1 in
start)
start;;
stop)
stop;;
restart)
restart;;
status)
status;;
*)
esac

View File

@ -61,6 +61,13 @@
<artifactId>zhyc-generator</artifactId> <artifactId>zhyc-generator</artifactId>
</dependency> </dependency>
<!-- 业务模块 -->
<dependency>
<groupId>zhyc</groupId>
<artifactId>zhyc-module</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -3,6 +3,7 @@ package com.zhyc;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/** /**
* 启动程序 * 启动程序

View File

@ -2,14 +2,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>zhyc</groupId> <groupId>zhyc</groupId>
<artifactId>zhyc</artifactId> <artifactId>zhyc</artifactId>
<version>3.8.9</version> <version>3.8.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>zhyc-module</artifactId> <artifactId>zhyc-module</artifactId>
<dependencies>
<dependency>
<groupId>zhyc</groupId>
<artifactId>zhyc-common</artifactId>
</dependency>
</dependencies>
</project> </project>

View File

@ -0,0 +1,105 @@
package com.zhyc.module.produce.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.produce.domain.ScCastrate;
import com.zhyc.module.produce.service.IScCastrateService;
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.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 去势Controller
*
* @author ruoyi
* @date 2025-07-09
*/
@RestController
@RequestMapping("/produce/castrate")
public class ScCastrateController extends BaseController
{
@Autowired
private IScCastrateService scCastrateService;
/**
* 查询去势列表
*/
@PreAuthorize("@ss.hasPermi('produce:castrate:list')")
@GetMapping("/list")
public TableDataInfo list(ScCastrate scCastrate)
{
startPage();
List<ScCastrate> list = scCastrateService.selectScCastrateList(scCastrate);
return getDataTable(list);
}
/**
* 导出去势列表
*/
@PreAuthorize("@ss.hasPermi('produce:castrate:export')")
@Log(title = "去势", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScCastrate scCastrate)
{
List<ScCastrate> list = scCastrateService.selectScCastrateList(scCastrate);
ExcelUtil<ScCastrate> util = new ExcelUtil<ScCastrate>(ScCastrate.class);
util.exportExcel(response, list, "去势数据");
}
/**
* 获取去势详细信息
*/
@PreAuthorize("@ss.hasPermi('produce:castrate:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(scCastrateService.selectScCastrateById(id));
}
/**
* 新增去势
*/
@PreAuthorize("@ss.hasPermi('produce:castrate:add')")
@Log(title = "去势", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScCastrate scCastrate)
{
return toAjax(scCastrateService.insertScCastrate(scCastrate));
}
/**
* 修改去势
*/
@PreAuthorize("@ss.hasPermi('produce:castrate:edit')")
@Log(title = "去势", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScCastrate scCastrate)
{
return toAjax(scCastrateService.updateScCastrate(scCastrate));
}
/**
* 删除去势
*/
@PreAuthorize("@ss.hasPermi('produce:castrate:remove')")
@Log(title = "去势", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(scCastrateService.deleteScCastrateByIds(ids));
}
}

View File

@ -0,0 +1,99 @@
package com.zhyc.module.produce.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 去势对象 sc_castrate
*
* @author ruoyi
* @date 2025-07-09
*/
public class ScCastrate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 羊只id */
@Excel(name = "羊只id")
private String sheepId;
/** 羊舍id */
@Excel(name = "羊舍id")
private Long sheepfold;
/** 备注 */
@Excel(name = "备注")
private String comment;
/** 技术员 */
@Excel(name = "技术员")
private String technician;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSheepId(String sheepId)
{
this.sheepId = sheepId;
}
public String getSheepId()
{
return sheepId;
}
public void setSheepfold(Long sheepfold)
{
this.sheepfold = sheepfold;
}
public Long getSheepfold()
{
return sheepfold;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
public void setTechnician(String technician)
{
this.technician = technician;
}
public String getTechnician()
{
return technician;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sheepId", getSheepId())
.append("sheepfold", getSheepfold())
.append("comment", getComment())
.append("technician", getTechnician())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.produce.mapper;
import java.util.List;
import com.zhyc.module.produce.domain.ScCastrate;
/**
* 去势Mapper接口
*
* @author ruoyi
* @date 2025-07-09
*/
public interface ScCastrateMapper
{
/**
* 查询去势
*
* @param id 去势主键
* @return 去势
*/
public ScCastrate selectScCastrateById(Long id);
/**
* 查询去势列表
*
* @param scCastrate 去势
* @return 去势集合
*/
public List<ScCastrate> selectScCastrateList(ScCastrate scCastrate);
/**
* 新增去势
*
* @param scCastrate 去势
* @return 结果
*/
public int insertScCastrate(ScCastrate scCastrate);
/**
* 修改去势
*
* @param scCastrate 去势
* @return 结果
*/
public int updateScCastrate(ScCastrate scCastrate);
/**
* 删除去势
*
* @param id 去势主键
* @return 结果
*/
public int deleteScCastrateById(Long id);
/**
* 批量删除去势
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScCastrateByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.produce.service;
import java.util.List;
import com.zhyc.module.produce.domain.ScCastrate;
/**
* 去势Service接口
*
* @author ruoyi
* @date 2025-07-09
*/
public interface IScCastrateService
{
/**
* 查询去势
*
* @param id 去势主键
* @return 去势
*/
public ScCastrate selectScCastrateById(Long id);
/**
* 查询去势列表
*
* @param scCastrate 去势
* @return 去势集合
*/
public List<ScCastrate> selectScCastrateList(ScCastrate scCastrate);
/**
* 新增去势
*
* @param scCastrate 去势
* @return 结果
*/
public int insertScCastrate(ScCastrate scCastrate);
/**
* 修改去势
*
* @param scCastrate 去势
* @return 结果
*/
public int updateScCastrate(ScCastrate scCastrate);
/**
* 批量删除去势
*
* @param ids 需要删除的去势主键集合
* @return 结果
*/
public int deleteScCastrateByIds(Long[] ids);
/**
* 删除去势信息
*
* @param id 去势主键
* @return 结果
*/
public int deleteScCastrateById(Long id);
}

View File

@ -0,0 +1,95 @@
package com.zhyc.module.produce.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.produce.domain.ScCastrate;
import com.zhyc.module.produce.mapper.ScCastrateMapper;
import com.zhyc.module.produce.service.IScCastrateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 去势Service业务层处理
*
* @author ruoyi
* @date 2025-07-09
*/
@Service
public class ScCastrateServiceImpl implements IScCastrateService
{
@Autowired
private ScCastrateMapper scCastrateMapper;
/**
* 查询去势
*
* @param id 去势主键
* @return 去势
*/
@Override
public ScCastrate selectScCastrateById(Long id)
{
return scCastrateMapper.selectScCastrateById(id);
}
/**
* 查询去势列表
*
* @param scCastrate 去势
* @return 去势
*/
@Override
public List<ScCastrate> selectScCastrateList(ScCastrate scCastrate)
{
return scCastrateMapper.selectScCastrateList(scCastrate);
}
/**
* 新增去势
*
* @param scCastrate 去势
* @return 结果
*/
@Override
public int insertScCastrate(ScCastrate scCastrate)
{
scCastrate.setCreateTime(DateUtils.getNowDate());
return scCastrateMapper.insertScCastrate(scCastrate);
}
/**
* 修改去势
*
* @param scCastrate 去势
* @return 结果
*/
@Override
public int updateScCastrate(ScCastrate scCastrate)
{
return scCastrateMapper.updateScCastrate(scCastrate);
}
/**
* 批量删除去势
*
* @param ids 需要删除的去势主键
* @return 结果
*/
@Override
public int deleteScCastrateByIds(Long[] ids)
{
return scCastrateMapper.deleteScCastrateByIds(ids);
}
/**
* 删除去势信息
*
* @param id 去势主键
* @return 结果
*/
@Override
public int deleteScCastrateById(Long id)
{
return scCastrateMapper.deleteScCastrateById(id);
}
}

View File

@ -0,0 +1,79 @@
<?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.zhyc.module.produce.mapper.ScCastrateMapper">
<resultMap type="ScCastrate" id="ScCastrateResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="sheepfold" column="sheepfold" />
<result property="comment" column="comment" />
<result property="technician" column="technician" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectScCastrateVo">
select id, sheep_id, sheepfold, comment, technician, create_by, create_time from sc_castrate
</sql>
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
<include refid="selectScCastrateVo"/>
<where>
<if test="sheepId != null and sheepId != ''"> and sheep_id like concat('%', #{sheepId}, '%')</if>
<if test="sheepfold != null "> and sheepfold like concat('%', #{sheepfold}, '%')</if>
<if test="technician != null and technician != ''"> and technician like concat('%', #{technician}, '%')</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
</select>
<select id="selectScCastrateById" parameterType="Long" resultMap="ScCastrateResult">
<include refid="selectScCastrateVo"/>
where id = #{id}
</select>
<insert id="insertScCastrate" parameterType="ScCastrate" useGeneratedKeys="true" keyProperty="id">
insert into sc_castrate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="sheepfold != null">sheepfold,</if>
<if test="comment != null">comment,</if>
<if test="technician != null">technician,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="sheepfold != null">#{sheepfold},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null">#{technician},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateScCastrate" parameterType="ScCastrate">
update sc_castrate
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="technician != null">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScCastrateById" parameterType="Long">
delete from sc_castrate where id = #{id}
</delete>
<delete id="deleteScCastrateByIds" parameterType="String">
delete from sc_castrate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>