Compare commits

..

9 Commits

Author SHA1 Message Date
3bff858643 feat(sys | login): 多租户模式支持
+ 两个业务通过用户ID分配数据源
2026-01-28 13:07:58 +08:00
9c678c84bf refactor(Druid - DataSource): 系统表与业务表分库读写 | 支持动态数据源切换
+ 使用AbstractRoutingDataSource实现动态数据源
+ 数据库 sys 与 业务表划分为两部分独立数据库以实现多数据分区
+ 添加过滤器在请求时识别请求类型通过determineCurrentLookupKey决定最终数据源
+ ContextHolder 存储数据源标识确保全局统一
+ 修改了FeedList模块的缓存初始化时机确保在第一次请求时初始化而非构造时
2026-01-28 13:07:58 +08:00
c9cefa3d33 生物安全多羊只耳号查询 2026-01-27 23:40:51 +08:00
62947ca5e8 Merge remote-tracking branch 'origin/main' 2026-01-27 15:36:24 +08:00
7890c4d792 修改 2026-01-27 15:36:01 +08:00
zyk
219ac30e28 Merge remote-tracking branch 'origin/main' 2026-01-27 15:19:48 +08:00
zyk
ced5b0b09a 繁育多个页面的多耳号输入 2026-01-27 15:19:38 +08:00
5bcfadfd85 Merge remote-tracking branch 'origin/main' 2026-01-22 19:59:01 +08:00
02b8eefc8d app后端接口,生物安全查询修改 2026-01-22 19:58:46 +08:00
93 changed files with 1999 additions and 159 deletions

View File

@@ -190,7 +190,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi.version}</version>
<version>4.1.2</version>
</dependency>
<!-- POI 相关依赖 -->

View File

@@ -0,0 +1,24 @@
package com.zhyc.Event;
import lombok.Data;
@Data
public class FarmLoginEvent {
private final String farmCode;
private final Long userId;
public FarmLoginEvent(String farmCode, Long userId) {
this.farmCode = farmCode;
this.userId = userId;
}
public String getFarmCode() {
return farmCode;
}
public Long getUserId() {
return userId;
}
}

View File

@@ -0,0 +1,49 @@
package com.zhyc.Routing.Filter;
import com.zhyc.framework.config.routing.DataSourceKeys;
import com.zhyc.framework.datasource.DynamicDataSourceContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.bytedeco.opencv.presets.opencv_core;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
@Slf4j
@Order(value = -100)
public class DataSourceRoutingFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
String uri = request.getRequestURI();
String username = request.getRemoteUser();
log.debug("username:{}",username);
try {
if (uri.startsWith("/app") || uri.startsWith("/base") || uri.startsWith("/biosafety") || uri.startsWith("/common")
|| uri.startsWith("/dairyProducts") || uri.startsWith("/enums") || uri.startsWith("/feed") || uri.startsWith("/frozen") || uri.startsWith("/produce")
|| uri.startsWith("sale") || uri.startsWith("/stock") || uri.startsWith("/work") || uri.startsWith("/sheepfold_management")) {
log.debug("业务请求 : BUSINESS : {}", uri);
if (username.equals("admin")) {
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.FARM_1);
}else if (username.equals("ry")) {
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.FARM_2);
}
} else {
log.debug("系统请求 SYSTEM : {}", uri);
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.SYSTEM);
}
filterChain.doFilter(request, response);
} finally {
// 业务结束后清楚数据源-防止线程复用导致错误
DynamicDataSourceContextHolder.clearDataSourceType();
}
}
}

View File

@@ -0,0 +1,17 @@
package com.zhyc.web.mvc;
import com.zhyc.Routing.Filter.DataSourceRoutingFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MvcConfig {
@Bean
public FilterRegistrationBean<DataSourceRoutingFilter> myFilter() {
FilterRegistrationBean<DataSourceRoutingFilter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(new DataSourceRoutingFilter());
registrationBean.addUrlPatterns("/*");
return registrationBean;
}
}

View File

@@ -9,16 +9,19 @@ spring:
# url: jdbc:mysql://localhost:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: 123456
url: jdbc:mysql://118.182.97.76:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://118.182.97.76:3306/zhyc_sys?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: zhyc
password: yszh123
# 从库数据源
slave:
farm01:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
url: jdbc:mysql://118.182.97.76:3306/zhyc_sheep01?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: zhyc
password: yszh123
farm02:
url: jdbc:mysql://118.182.97.76:3306/zhyc_sheep02?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: zhyc
password: yszh123
# 初始连接数
initialSize: 5
# 最小连接池数量

View File

@@ -9,6 +9,8 @@ import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
@@ -19,23 +21,34 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
import com.alibaba.druid.util.Utils;
import com.zhyc.common.enums.DataSourceType;
import com.zhyc.common.utils.spring.SpringUtils;
import com.zhyc.framework.config.properties.DruidProperties;
import com.zhyc.framework.datasource.DynamicDataSource;
/**
* druid 配置多数据源
*
*
* @author ruoyi
*/
@Configuration
public class DruidConfig
{
public class DruidConfig {
@Bean
@ConfigurationProperties("spring.datasource.druid.master")
public DataSource masterDataSource(DruidProperties druidProperties)
{
public DataSource masterDataSource(DruidProperties druidProperties) {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@Bean
@ConfigurationProperties("spring.datasource.druid.farm01")
public DataSource farm1DataSource(DruidProperties druidProperties) {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@Bean
@ConfigurationProperties("spring.datasource.druid.farm02")
public DataSource farm2DataSource(DruidProperties druidProperties) {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@@ -43,49 +56,49 @@ public class DruidConfig
@Bean
@ConfigurationProperties("spring.datasource.druid.slave")
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
public DataSource slaveDataSource(DruidProperties druidProperties)
{
public DataSource slaveDataSource(DruidProperties druidProperties) {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@Bean(name = "dynamicDataSource")
@Primary
public DynamicDataSource dataSource(DataSource masterDataSource)
{
public DataSource dynamicDataSource(
@Qualifier("masterDataSource") DataSource systemDataSource,
@Qualifier("farm1DataSource") DataSource farm1DataSource,
@Qualifier("farm2DataSource") DataSource farm2DataSource) {
// 存储数据源路由
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
return new DynamicDataSource(masterDataSource, targetDataSources);
targetDataSources.put("system", systemDataSource);
targetDataSources.put("farm01", farm1DataSource);
targetDataSources.put("farm02", farm2DataSource);
return new DynamicDataSource(systemDataSource, targetDataSources);
}
/**
* 设置数据源
*
*
* @param targetDataSources 备选数据源集合
* @param sourceName 数据源名称
* @param beanName bean名称
* @param sourceName 数据源名称
* @param beanName bean名称
*/
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
{
try
{
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName) {
try {
DataSource dataSource = SpringUtils.getBean(beanName);
targetDataSources.put(sourceName, dataSource);
}
catch (Exception e)
{
} catch (Exception e) {
}
}
/**
* 去除监控页面底部的广告
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({"rawtypes", "unchecked"})
@Bean
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
{
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) {
// 获取web监控页面的参数
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
// 提取common.js的配置路径
@@ -93,16 +106,14 @@ public class DruidConfig
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
final String filePath = "support/http/resources/js/common.js";
// 创建filter进行过滤
Filter filter = new Filter()
{
Filter filter = new Filter() {
@Override
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
{
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
throws IOException, ServletException {
chain.doFilter(request, response);
// 重置缓冲区,响应头不会被重置
response.resetBuffer();
@@ -113,9 +124,9 @@ public class DruidConfig
text = text.replaceAll("powered.*?shrek.wang</a>", "");
response.getWriter().write(text);
}
@Override
public void destroy()
{
public void destroy() {
}
};
FilterRegistrationBean registrationBean = new FilterRegistrationBean();

View File

@@ -111,10 +111,12 @@ public class SecurityConfig
.authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
requests.antMatchers("/app/**").permitAll()
.antMatchers("/login", "/register", "/captchaImage").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})

View File

@@ -0,0 +1,8 @@
package com.zhyc.framework.config.routing;
public interface DataSourceKeys {
String SYSTEM = "system";
String FARM_1 = "farm01";
String FARM_2 = "farm02";
}

View File

@@ -1,6 +1,8 @@
package com.zhyc.framework.web.service;
import javax.annotation.Resource;
import com.zhyc.framework.datasource.DynamicDataSourceContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;

View File

@@ -14,8 +14,8 @@ import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.framework.security.context.AuthenticationContextHolder;
/**
* 登录密码方法
*
* 系统密码服务类,用于处理登录密码验证相关的业务逻辑,包括密码错误次数限制、账户锁定等功能
*
* @author ruoyi
*/
@Component
@@ -31,8 +31,8 @@ public class SysPasswordService
private int lockTime;
/**
* 登录账户密码错误次数缓存键名
*
* 构建登录账户密码错误次数缓存键名
*
* @param username 用户名
* @return 缓存键key
*/
@@ -41,12 +41,21 @@ public class SysPasswordService
return CacheConstants.PWD_ERR_CNT_KEY + username;
}
/**
* 验证用户登录信息,包括密码匹配验证和错误次数限制检查
*
* @param user 待验证的系统用户对象
* @throws UserPasswordRetryLimitExceedException 当密码错误次数超过限制时抛出异常
* @throws UserPasswordNotMatchException 当密码不匹配时抛出异常
*/
public void validate(SysUser user)
{
// 获取当前认证的用户名和密码
Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext();
String username = usernamePasswordAuthenticationToken.getName();
String password = usernamePasswordAuthenticationToken.getCredentials().toString();
// 从Redis缓存中获取该用户的密码错误次数
Integer retryCount = redisCache.getCacheObject(getCacheKey(username));
if (retryCount == null)
@@ -54,28 +63,44 @@ public class SysPasswordService
retryCount = 0;
}
// 检查是否达到最大重试次数限制
if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
{
throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
}
// 验证密码是否匹配
if (!matches(user, password))
{
// 密码不匹配时,增加错误次数并更新缓存
retryCount = retryCount + 1;
redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
throw new UserPasswordNotMatchException();
}
else
{
// 密码匹配成功,清除登录记录缓存
clearLoginRecordCache(username);
}
}
/**
* 验证原始密码与用户存储密码是否匹配
*
* @param user 系统用户对象
* @param rawPassword 原始密码字符串
* @return 密码匹配返回true否则返回false
*/
public boolean matches(SysUser user, String rawPassword)
{
return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
}
/**
* 清除指定登录名的登录记录缓存
*
* @param loginName 登录用户名
*/
public void clearLoginRecordCache(String loginName)
{
if (redisCache.hasKey(getCacheKey(loginName)))

View File

@@ -54,7 +54,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
throw new ServiceException(MessageUtils.message("user.blocked"));
}
passwordService.validate(user);
// passwordService.validate(user);
return createLoginUser(user);
}

View File

@@ -155,6 +155,52 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- Spring Boot Web 核心依赖(提供接口能力) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Tesseract-OCR Java 封装(无需手动操作命令行,简化开发) -->
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>4.5.4</version>
</dependency>
<!-- 文件上传相关依赖Spring Boot 内置,指定版本兼容) -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<!-- 可选lombok 简化实体类代码(无需手写 getter/setter -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<!-- Spring Boot 测试核心依赖(包含 @SpringBootTest 等注解) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <!-- 仅在测试环境生效,不打包到生产环境,不可省略 -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,106 @@
package com.zhyc.module.app.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.app.domain.AppErrorLog;
import com.zhyc.module.app.service.IAppErrorLogService;
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;
/**
* App错误日志Controller
*
* @author ruoyi
* @date 2026-01-19
*/
@RestController
@RequestMapping("/app/error")
public class AppErrorLogController extends BaseController
{
@Autowired
private IAppErrorLogService appErrorLogService;
/**
* 查询App错误日志列表
*/
// @PreAuthorize("@ss.hasPermi('app:app:list')")
@GetMapping("/list")
public TableDataInfo list(AppErrorLog appErrorLog)
{
startPage();
List<AppErrorLog> list = appErrorLogService.selectAppErrorLogList(appErrorLog);
return getDataTable(list);
}
/**
* 导出App错误日志列表
*/
// @PreAuthorize("@ss.hasPermi('app:app:export')")
@Log(title = "App错误日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppErrorLog appErrorLog)
{
List<AppErrorLog> list = appErrorLogService.selectAppErrorLogList(appErrorLog);
ExcelUtil<AppErrorLog> util = new ExcelUtil<AppErrorLog>(AppErrorLog.class);
util.exportExcel(response, list, "App错误日志数据");
}
/**
* 获取App错误日志详细信息
*/
// @PreAuthorize("@ss.hasPermi('app:app:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(appErrorLogService.selectAppErrorLogById(id));
}
/**
* 新增App错误日志
*/
// @PreAuthorize("@ss.hasPermi('app:app:add')")
@Log(title = "App错误日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AppErrorLog appErrorLog)
{
return toAjax(appErrorLogService.insertAppErrorLog(appErrorLog));
}
/**
* 修改App错误日志
*/
// @PreAuthorize("@ss.hasPermi('app:app:edit')")
@Log(title = "App错误日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AppErrorLog appErrorLog)
{
return toAjax(appErrorLogService.updateAppErrorLog(appErrorLog));
}
/**
* 删除App错误日志
*/
// @PreAuthorize("@ss.hasPermi('app:app:remove')")
@Log(title = "App错误日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(appErrorLogService.deleteAppErrorLogByIds(ids));
}
}

View File

@@ -0,0 +1,106 @@
package com.zhyc.module.app.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.app.domain.AppSettings;
import com.zhyc.module.app.service.IAppSettingsService;
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 2026-01-20
*/
@RestController
@RequestMapping("/app/settings")
public class AppSettingsController extends BaseController
{
@Autowired
private IAppSettingsService appSettingsService;
/**
* 查询应用设置列表
*/
// @PreAuthorize("@ss.hasPermi('app:settings:list')")
@GetMapping("/list")
public TableDataInfo list(AppSettings appSettings)
{
startPage();
List<AppSettings> list = appSettingsService.selectAppSettingsList(appSettings);
return getDataTable(list);
}
/**
* 导出应用设置列表
*/
// @PreAuthorize("@ss.hasPermi('app:settings:export')")
@Log(title = "应用设置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppSettings appSettings)
{
List<AppSettings> list = appSettingsService.selectAppSettingsList(appSettings);
ExcelUtil<AppSettings> util = new ExcelUtil<AppSettings>(AppSettings.class);
util.exportExcel(response, list, "应用设置数据");
}
/**
* 获取应用设置详细信息
*/
// @PreAuthorize("@ss.hasPermi('app:settings:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(appSettingsService.selectAppSettingsById(id));
}
/**
* 新增应用设置
*/
// @PreAuthorize("@ss.hasPermi('app:settings:add')")
@Log(title = "应用设置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AppSettings appSettings)
{
return toAjax(appSettingsService.insertAppSettings(appSettings));
}
/**
* 修改应用设置
*/
// @PreAuthorize("@ss.hasPermi('app:settings:edit')")
@Log(title = "应用设置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AppSettings appSettings)
{
return toAjax(appSettingsService.updateAppSettings(appSettings));
}
/**
* 删除应用设置
*/
// @PreAuthorize("@ss.hasPermi('app:settings:remove')")
@Log(title = "应用设置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(appSettingsService.deleteAppSettingsByIds(ids));
}
}

View File

@@ -0,0 +1,96 @@
package com.zhyc.module.app.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
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;
/**
* App错误日志对象 app_error_log
*
* @author ruoyi
* @date 2026-01-19
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppErrorLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID自增 */
private Long id;
/** 设备唯一标识 */
@Excel(name = "设备唯一标识")
private String deviceId;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** App版本号 */
@Excel(name = "App版本号")
private String appVersion;
/** App版本号 */
@Excel(name = "App版本号")
private Long appCode;
/** 平台类型 */
@Excel(name = "平台类型")
private String platform;
/** 操作系统版本 */
@Excel(name = "操作系统版本")
private String osVersion;
/** 错误类型分类 */
@Excel(name = "错误类型分类")
private String errorType;
/** 错误代码 */
@Excel(name = "错误代码")
private String errorCode;
/** 错误描述信息 */
@Excel(name = "错误描述信息")
private String errorMessage;
/** 错误堆栈跟踪 */
@Excel(name = "错误堆栈跟踪")
private String stackTrace;
/** 页面路径 */
@Excel(name = "页面路径")
private String pageUrl;
/** API接口地址 */
@Excel(name = "API接口地址")
private String apiUrl;
/** API调用参数 */
@Excel(name = "API调用参数")
private String apiParams;
/** 网络类型 */
@Excel(name = "网络类型")
private String networkType;
/** 屏幕宽度 */
@Excel(name = "屏幕宽度")
private Long screenWidth;
/** 屏幕高度 */
@Excel(name = "屏幕高度")
private Long screenHeight;
/** 自定义扩展数据JSON格式 */
@Excel(name = "自定义扩展数据JSON格式")
private String customData;
}

View File

@@ -0,0 +1,71 @@
package com.zhyc.module.app.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
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;
/**
* 应用设置对象 app_settings
*
* @author ruoyi
* @date 2026-01-20
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AppSettings extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 用户ID0为全局 */
@Excel(name = "用户ID0为全局")
private Long userId;
/** 设置键名 */
@Excel(name = "设置键名")
private String settingKey;
/** 设置 */
@Excel(name = "设置")
private String settingValue;
/** 值类型 */
@Excel(name = "值类型")
private String settingType;
/** 设置分组 */
@Excel(name = "设置分组")
private String settingGroup;
/** 设置描述 */
@Excel(name = "设置描述")
private String settingDesc;
/** 适用平台 */
@Excel(name = "适用平台")
private String platform;
/** 适用版本范围 */
@Excel(name = "适用版本范围")
private String versionRange;
/** 状态 */
@Excel(name = "状态")
private Integer status;
/** 逻辑位 */
@Excel(name = "逻辑位")
private Integer logical;
/** 自定义扩展数据JSON格式 */
@Excel(name = "自定义扩展数据JSON格式")
private String customData;
}

View File

@@ -0,0 +1,64 @@
package com.zhyc.module.app.mapper;
import java.util.List;
import com.zhyc.module.app.domain.AppErrorLog;
import org.apache.ibatis.annotations.Mapper;
/**
* App错误日志Mapper接口
*
* @author ruoyi
* @date 2026-01-19
*/
@Mapper
public interface AppErrorLogMapper
{
/**
* 查询App错误日志
*
* @param id App错误日志主键
* @return App错误日志
*/
public AppErrorLog selectAppErrorLogById(Long id);
/**
* 查询App错误日志列表
*
* @param appErrorLog App错误日志
* @return App错误日志集合
*/
public List<AppErrorLog> selectAppErrorLogList(AppErrorLog appErrorLog);
/**
* 新增App错误日志
*
* @param appErrorLog App错误日志
* @return 结果
*/
public int insertAppErrorLog(AppErrorLog appErrorLog);
/**
* 修改App错误日志
*
* @param appErrorLog App错误日志
* @return 结果
*/
public int updateAppErrorLog(AppErrorLog appErrorLog);
/**
* 删除App错误日志
*
* @param id App错误日志主键
* @return 结果
*/
public int deleteAppErrorLogById(Long id);
/**
* 批量删除App错误日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAppErrorLogByIds(Long[] ids);
}

View File

@@ -0,0 +1,62 @@
package com.zhyc.module.app.mapper;
import com.zhyc.module.app.domain.AppSettings;
import java.util.List;
/**
* 应用设置Mapper接口
*
* @author ruoyi
* @date 2026-01-20
*/
public interface AppSettingsMapper
{
/**
* 查询应用设置
*
* @param id 应用设置主键
* @return 应用设置
*/
public AppSettings selectAppSettingsById(Long id);
/**
* 查询应用设置列表
*
* @param appSettings 应用设置
* @return 应用设置集合
*/
public List<AppSettings> selectAppSettingsList(AppSettings appSettings);
/**
* 新增应用设置
*
* @param appSettings 应用设置
* @return 结果
*/
public int insertAppSettings(AppSettings appSettings);
/**
* 修改应用设置
*
* @param appSettings 应用设置
* @return 结果
*/
public int updateAppSettings(AppSettings appSettings);
/**
* 删除应用设置
*
* @param id 应用设置主键
* @return 结果
*/
public int deleteAppSettingsById(Long id);
/**
* 批量删除应用设置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAppSettingsByIds(Long[] ids);
}

View File

@@ -0,0 +1,62 @@
package com.zhyc.module.app.service;
import com.zhyc.module.app.domain.AppErrorLog;
import java.util.List;
/**
* App错误日志Service接口
*
* @author ruoyi
* @date 2026-01-19
*/
public interface IAppErrorLogService
{
/**
* 查询App错误日志
*
* @param id App错误日志主键
* @return App错误日志
*/
public AppErrorLog selectAppErrorLogById(Long id);
/**
* 查询App错误日志列表
*
* @param appErrorLog App错误日志
* @return App错误日志集合
*/
public List<AppErrorLog> selectAppErrorLogList(AppErrorLog appErrorLog);
/**
* 新增App错误日志
*
* @param appErrorLog App错误日志
* @return 结果
*/
public int insertAppErrorLog(AppErrorLog appErrorLog);
/**
* 修改App错误日志
*
* @param appErrorLog App错误日志
* @return 结果
*/
public int updateAppErrorLog(AppErrorLog appErrorLog);
/**
* 批量删除App错误日志
*
* @param ids 需要删除的App错误日志主键集合
* @return 结果
*/
public int deleteAppErrorLogByIds(Long[] ids);
/**
* 删除App错误日志信息
*
* @param id App错误日志主键
* @return 结果
*/
public int deleteAppErrorLogById(Long id);
}

View File

@@ -0,0 +1,63 @@
package com.zhyc.module.app.service;
import com.zhyc.module.app.domain.AppSettings;
import java.util.List;
/**
* 应用设置Service接口
*
* @author ruoyi
* @date 2026-01-20
*/
public interface IAppSettingsService
{
/**
* 查询应用设置
*
* @param id 应用设置主键
* @return 应用设置
*/
public AppSettings selectAppSettingsById(Long id);
/**
* 查询应用设置列表
*
* @param appSettings 应用设置
* @return 应用设置集合
*/
public List<AppSettings> selectAppSettingsList(AppSettings appSettings);
/**
* 新增应用设置
*
* @param appSettings 应用设置
* @return 结果
*/
public int insertAppSettings(AppSettings appSettings);
/**
* 修改应用设置
*
* @param appSettings 应用设置
* @return 结果
*/
public int updateAppSettings(AppSettings appSettings);
/**
* 批量删除应用设置
*
* @param ids 需要删除的应用设置主键集合
* @return 结果
*/
public int deleteAppSettingsByIds(Long[] ids);
/**
* 删除应用设置信息
*
* @param id 应用设置主键
* @return 结果
*/
public int deleteAppSettingsById(Long id);
}

View File

@@ -0,0 +1,97 @@
package com.zhyc.module.app.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.app.domain.AppErrorLog;
import com.zhyc.module.app.mapper.AppErrorLogMapper;
import com.zhyc.module.app.service.IAppErrorLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* App错误日志Service业务层处理
*
* @author ruoyi
* @date 2026-01-19
*/
@Service
public class AppErrorLogServiceImpl implements IAppErrorLogService
{
@Autowired
private AppErrorLogMapper appErrorLogMapper;
/**
* 查询App错误日志
*
* @param id App错误日志主键
* @return App错误日志
*/
@Override
public AppErrorLog selectAppErrorLogById(Long id)
{
return appErrorLogMapper.selectAppErrorLogById(id);
}
/**
* 查询App错误日志列表
*
* @param appErrorLog App错误日志
* @return App错误日志
*/
@Override
public List<AppErrorLog> selectAppErrorLogList(AppErrorLog appErrorLog)
{
return appErrorLogMapper.selectAppErrorLogList(appErrorLog);
}
/**
* 新增App错误日志
*
* @param appErrorLog App错误日志
* @return 结果
*/
@Override
public int insertAppErrorLog(AppErrorLog appErrorLog)
{
appErrorLog.setCreateTime(DateUtils.getNowDate());
return appErrorLogMapper.insertAppErrorLog(appErrorLog);
}
/**
* 修改App错误日志
*
* @param appErrorLog App错误日志
* @return 结果
*/
@Override
public int updateAppErrorLog(AppErrorLog appErrorLog)
{
return appErrorLogMapper.updateAppErrorLog(appErrorLog);
}
/**
* 批量删除App错误日志
*
* @param ids 需要删除的App错误日志主键
* @return 结果
*/
@Override
public int deleteAppErrorLogByIds(Long[] ids)
{
return appErrorLogMapper.deleteAppErrorLogByIds(ids);
}
/**
* 删除App错误日志信息
*
* @param id App错误日志主键
* @return 结果
*/
@Override
public int deleteAppErrorLogById(Long id)
{
return appErrorLogMapper.deleteAppErrorLogById(id);
}
}

View File

@@ -0,0 +1,96 @@
package com.zhyc.module.app.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.app.domain.AppSettings;
import com.zhyc.module.app.mapper.AppSettingsMapper;
import com.zhyc.module.app.service.IAppSettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 应用设置Service业务层处理
*
* @author ruoyi
* @date 2026-01-20
*/
@Service
public class AppSettingsServiceImpl implements IAppSettingsService
{
@Autowired
private AppSettingsMapper appSettingsMapper;
/**
* 查询应用设置
*
* @param id 应用设置主键
* @return 应用设置
*/
@Override
public AppSettings selectAppSettingsById(Long id)
{
return appSettingsMapper.selectAppSettingsById(id);
}
/**
* 查询应用设置列表
*
* @param appSettings 应用设置
* @return 应用设置
*/
@Override
public List<AppSettings> selectAppSettingsList(AppSettings appSettings)
{
return appSettingsMapper.selectAppSettingsList(appSettings);
}
/**
* 新增应用设置
*
* @param appSettings 应用设置
* @return 结果
*/
@Override
public int insertAppSettings(AppSettings appSettings)
{
appSettings.setCreateTime(DateUtils.getNowDate());
return appSettingsMapper.insertAppSettings(appSettings);
}
/**
* 修改应用设置
*
* @param appSettings 应用设置
* @return 结果
*/
@Override
public int updateAppSettings(AppSettings appSettings)
{
appSettings.setUpdateTime(DateUtils.getNowDate());
return appSettingsMapper.updateAppSettings(appSettings);
}
/**
* 批量删除应用设置
*
* @param ids 需要删除的应用设置主键
* @return 结果
*/
@Override
public int deleteAppSettingsByIds(Long[] ids)
{
return appSettingsMapper.deleteAppSettingsByIds(ids);
}
/**
* 删除应用设置信息
*
* @param id 应用设置主键
* @return 结果
*/
@Override
public int deleteAppSettingsById(Long id)
{
return appSettingsMapper.deleteAppSettingsById(id);
}
}

View File

@@ -46,6 +46,17 @@ public class BasSheepController extends BaseController {
return getDataTable(list);
}
@GetMapping("/earNumbers")
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
try {
List<String> earNumbers =basSheepService.searchEarNumbers(query);
return success(earNumbers);
} catch (Exception e) {
logger.error("搜索耳号异常", e);
return error("搜索耳号失败:" + e.getMessage());
}
}
/**
* 导出羊只基本信息列表
*/

View File

@@ -70,6 +70,15 @@ public interface BasSheepMapper
BasSheep selectBasSheepByManageTags(String manageTags);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
List<String> searchEarNumbers(@Param("query") String query);
List<BasSheep> selectBasSheepBySheepfold(String id);
// 根据牧场ID获取羊只列表

View File

@@ -28,6 +28,13 @@ public interface IBasSheepService
*/
public List<BasSheep> selectBasSheepList(BasSheep basSheep);
/**
* 羊只查询耳号信息
*
* @param earNumbers 耳号
* @return 结果
*/
public List<String> searchEarNumbers(String earNumbers);
/**
* 新增羊只基本信息
*

View File

@@ -44,6 +44,16 @@ public class BasSheepServiceImpl implements IBasSheepService
return basSheepMapper.selectBasSheepList(basSheep);
}
/**
* 搜索羊只 earNumbers
*
* @param query
* @return
*/
@Override
public List<String> searchEarNumbers(String query) {
return basSheepMapper.searchEarNumbers(query);
}
/**
* 新增羊只基本信息
*

View File

@@ -35,6 +35,8 @@ public class Deworm extends BaseEntity
@Excel(name = "羊只耳号")
private String sheepNo;
private String[] sheepNos;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
@Excel(name = "品种")
private String variety;
@@ -75,10 +77,7 @@ public class Deworm extends BaseEntity
@Excel(name = "备注")
private String comment;
// public void setGender(String gender) {
// this.gender = gender;
// this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
// }
// 排序查询
private String orderByColumn;
private String isAsc;

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.biosafety.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhyc.module.enums.Gender;
import lombok.AllArgsConstructor;
@@ -38,6 +40,9 @@ public class Diagnosis extends BaseEntity
@Excel(name = "羊只耳号")
private String sheepNo;
private String[] sheepNos;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
private Long sheepId;
@@ -97,12 +102,23 @@ public class Diagnosis extends BaseEntity
private Long sheepfoldId;
public void setGender(String gender) {
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
public void setGender(String gender) {
this.gender = gender;
if (gender != null && !gender.trim().isEmpty()) {
try {
Integer genderCode = Integer.valueOf(gender.trim());
this.genderName = Gender.getDescByCode(genderCode);
} catch (NumberFormatException e) {
// 如果转换失败,设置为空或默认值
this.genderName = null;
}
} else {
this.genderName = null;
}
}
}

View File

@@ -31,13 +31,15 @@ public class Health extends BaseEntity
/** 羊只id */
@Excel(name = "羊只id")
private Long sheepId;
private Integer[] sheepIds;
/** 羊只id */
@Excel(name = "羊只耳号")
private String sheepNo;
private String[] sheepNos;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
@Excel(name = "品种")
private String variety;
@@ -70,11 +72,23 @@ public class Health extends BaseEntity
// 药品使用
private List<SwMedicineUsageDetails> usageDetails;
public void setGender(String gender) {
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
public void setGender(String gender) {
this.gender = gender;
if (gender != null && !gender.trim().isEmpty()) {
try {
Integer genderCode = Integer.valueOf(gender.trim());
this.genderName = Gender.getDescByCode(genderCode);
} catch (NumberFormatException e) {
// 如果转换失败,设置为空或默认值
this.genderName = null;
}
} else {
this.genderName = null;
}
}
}

View File

@@ -37,6 +37,9 @@ public class Immunity extends BaseEntity
@Excel(name = "羊只耳号")
private String sheepNo;
private String[] sheepNos;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
@Excel(name = "品种")
@@ -77,12 +80,24 @@ public class Immunity extends BaseEntity
// 药品使用
private List<SwMedicineUsageDetails> usageDetails;
public void setGender(String gender) {
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
public void setGender(String gender) {
this.gender = gender;
if (gender != null && !gender.trim().isEmpty()) {
try {
Integer genderCode = Integer.valueOf(gender.trim());
this.genderName = Gender.getDescByCode(genderCode);
} catch (NumberFormatException e) {
// 如果转换失败,设置为空或默认值
this.genderName = null;
}
} else {
this.genderName = null;
}
}
}

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.biosafety.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhyc.module.enums.Gender;
import lombok.AllArgsConstructor;
@@ -37,6 +39,9 @@ public class QuarantineReport extends BaseEntity
@Excel(name = "羊只耳号")
private String sheepNo;
private String[] sheepNos;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
@Excel(name = "羊只类别")
private String sheepType;

View File

@@ -38,6 +38,11 @@ public class SwMedicineUsage extends BaseEntity
/** 耳号 */
@Excel(name = "耳号",width = 20, needMerge = true)
private String sheepNo;
private String[] sheepNos;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
private Integer sheepId;
/** 使用时间 */
@JsonFormat(pattern = "yyyy-MM-dd")

View File

@@ -33,6 +33,9 @@ public class Treatment extends BaseEntity
@Excel(name = "羊只耳号")
private String sheepNo;
private String[] sheepNos;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
private Long sheepId;
// 用于批量新增

View File

@@ -1,6 +1,7 @@
package com.zhyc.module.biosafety.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils;
@@ -61,13 +62,13 @@ public class DewormServiceImpl implements IDewormService
{
String[] sheepNos = null;
if (deworm.getSheepNo() != null && !deworm.getSheepNo().isEmpty()) {
if (deworm.getSheepNo().contains(",")) {
sheepNos = deworm.getSheepNo().split(",");
} else {
sheepNos = new String[]{deworm.getSheepNo()};
if (deworm.getSheepNo().contains(" ")) {
sheepNos = deworm.getSheepNo().split(" ");
deworm.setSheepNos(sheepNos);
deworm.setSheepNo(null);
}
}
deworm.setSheepNos(sheepNos);
return dewormMapper.selectDewormList(deworm);
}

View File

@@ -64,10 +64,8 @@ public class DiagnosisServiceImpl implements IDiagnosisService
{
String[] sheepNos = null;
if (diagnosis.getSheepNo() != null && !diagnosis.getSheepNo().isEmpty()) {
if (diagnosis.getSheepNo().contains(",")) {
sheepNos = diagnosis.getSheepNo().split(",");
} else {
sheepNos = new String[]{diagnosis.getSheepNo()};
if (diagnosis.getSheepNo().contains(" ")) {
sheepNos = diagnosis.getSheepNo().split(" ");
}
}
diagnosis.setSheepNos(sheepNos);

View File

@@ -66,10 +66,8 @@ public class HealthServiceImpl implements IHealthService
{
String[] sheepNos = null;
if (health.getSheepNo() != null && !health.getSheepNo().isEmpty()) {
if (health.getSheepNo().contains(",")) {
sheepNos = health.getSheepNo().split(",");
} else {
sheepNos = new String[]{health.getSheepNo()};
if (health.getSheepNo().contains(" ")) {
sheepNos = health.getSheepNo().split(" ");
}
}
health.setSheepNos(sheepNos);

View File

@@ -65,10 +65,8 @@ public class ImmunityServiceImpl implements IImmunityService
{
String[] sheepNos = null;
if (immunity.getSheepNo() != null && !immunity.getSheepNo().isEmpty()) {
if (immunity.getSheepNo().contains(",")) {
sheepNos = immunity.getSheepNo().split(",");
} else {
sheepNos = new String[]{immunity.getSheepNo()};
if (immunity.getSheepNo().contains(" ")) {
sheepNos = immunity.getSheepNo().split(" ");
}
}
immunity.setSheepNos(sheepNos);

View File

@@ -50,10 +50,8 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
{
String[] sheepNos = null;
if (quarantineReport.getSheepNo() != null && !quarantineReport.getSheepNo().isEmpty()) {
if (quarantineReport.getSheepNo().contains(",")) {
sheepNos = quarantineReport.getSheepNo().split(",");
} else {
sheepNos = new String[]{quarantineReport.getSheepNo()};
if (quarantineReport.getSheepNo().contains(" ")) {
sheepNos = quarantineReport.getSheepNo().split(" ");
}
}
quarantineReport.setSheepNos(sheepNos);

View File

@@ -46,6 +46,14 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
@Override
public List<SwMedicineUsage> selectSwMedicineUsageList(SwMedicineUsage swMedicineUsage)
{
String[] sheepNos = null;
if (swMedicineUsage.getSheepNo() != null && !swMedicineUsage.getSheepNo().isEmpty()) {
if (swMedicineUsage.getSheepNo().contains(" ")) {
sheepNos = swMedicineUsage.getSheepNo().split(" ");
swMedicineUsage.setSheepNos(sheepNos);
swMedicineUsage.setSheepNo(null);
}
}
return swMedicineUsageMapper.selectSwMedicineUsageList(swMedicineUsage);
}

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.feed.service.impl.SgFeedListServiceImpl;
@@ -39,7 +40,7 @@ public class SgFeedListController extends BaseController {
private final ISgFeedListService sgFeedListService;
public static boolean refresh = true;
public static final AtomicBoolean refresh = new AtomicBoolean(true);
@Autowired
public SgFeedListController(ISgFeedListService sgFeedListService) {
@@ -57,9 +58,8 @@ public class SgFeedListController extends BaseController {
刷新缓存
当配方管理表出现更新 或 饲喂计划表出现增删改时会将refresh置为true 通知此处进行刷新
*/
if (refresh) {
sgFeedListService.SyncFeedList();
refresh = false;
if (refresh.compareAndSet(true, false)) {
sgFeedListService.syncFeedListSafely();
}
startPage();
List<SgFeedList> list = sgFeedListService.selectSgFeedListList(sgFeedList);

View File

@@ -83,7 +83,7 @@ public class SgFeedPlanController extends BaseController {
// 计算其他字段值
setPlan(sgFeedPlan);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
SgFeedListController.refresh.set(true);
return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan));
}
@@ -97,7 +97,7 @@ public class SgFeedPlanController extends BaseController {
// 根据修改后的值重新计算
setPlan(sgFeedPlan);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
SgFeedListController.refresh.set(true);
return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan));
}
@@ -109,7 +109,7 @@ public class SgFeedPlanController extends BaseController {
@DeleteMapping("/{createDates}")
public AjaxResult remove(@PathVariable Date[] createDates) {
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
SgFeedListController.refresh.set(true);
return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates));
}

View File

@@ -93,8 +93,7 @@ public class SgFormulaManagementController extends BaseController {
@PostMapping
@Transactional(rollbackFor = Exception.class)
public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) {
if (null == sgFormulaManagement)
throw new RuntimeException("ERROR: 数据为空");
if (null == sgFormulaManagement) throw new RuntimeException("ERROR: 数据为空");
if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) {
SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId());
if (exist != null) {
@@ -145,7 +144,7 @@ public class SgFormulaManagementController extends BaseController {
}
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
SgFeedListController.refresh.set(true);
return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement));
}
@@ -172,7 +171,7 @@ public class SgFormulaManagementController extends BaseController {
sgFormulaManagement.setBatchId(batchId);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
SgFeedListController.refresh.set(true);
return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement));
}
}

View File

@@ -59,5 +59,7 @@ public interface ISgFeedListService {
*/
int deleteSgFeedListById(Long id);
void syncFeedListSafely();
void SyncFeedList();
}

View File

@@ -11,6 +11,10 @@ import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFeedListMapper;
import com.zhyc.module.feed.domain.SgFeedList;
import com.zhyc.module.feed.service.ISgFeedListService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import static com.zhyc.module.feed.controller.SgFeedListController.refresh;
/**
* 配料清单Service业务层处理
@@ -30,7 +34,15 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
this.sgFeedListMapper = sgFeedListMapper;
this.sgFormulaManagementService = sgFormulaManagementService;
this.sgFeedPlanService = sgFeedPlanService;
// 构造时将数据库初始数据写入缓存
// 第一次请求时更新缓存
refresh.set(true);
}
/**
* 在数据源已切换后调用
*/
public synchronized void initCacheIfNecessary() {
// 初次访问时将数据库初始数据写入缓存
List<SgFeedList> feedListsFromDataBase = this.selectSgFeedListList(new SgFeedList());
for (SgFeedList sgFeedListItem : feedListsFromDataBase) {
String key = sgFeedListItem.getFormulaId() + "_" + sgFeedListItem.getFormulaBatchId() + "_" + sgFeedListItem.getDeployDate();
@@ -157,6 +169,16 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
}
}
public void syncFeedListSafely() {
try {
SyncFeedList();
} catch (Exception e) {
refresh.set(true); // 初始化失败,下次还能重试
throw e;
}
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void SyncFeedList() {
HashMap<String, SgFeedList> cacheTemp = new HashMap<>(sgFeedListMap);
// 清空旧缓存

View File

@@ -70,6 +70,7 @@ public class ScBreedPlanController extends BaseController
return success(scBreedPlanService.selectScBreedPlanById(id));
}
/**
* 新增配种计划
*/

View File

@@ -1,5 +1,7 @@
package com.zhyc.module.produce.breed.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
@@ -299,4 +301,52 @@ public class ScDryMilkController extends BaseController
return error("删除失败: " + e.getMessage());
}
}
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:quary')")
@GetMapping("/search_ear_numbers")
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
try {
List<String> earNumbers = scDryMilkService.searchEarNumbers(query);
return success(earNumbers);
} catch (Exception e) {
logger.error("搜索耳号异常", e);
return error("搜索耳号失败:" + e.getMessage());
}
}
/**
* 批量验证耳号
*/
@GetMapping("/validateBatchEarTags")
public AjaxResult validateBatchEarTags(@RequestParam("manageTags") String manageTags) {
try {
if (manageTags == null || manageTags.trim().isEmpty()) {
return error("耳号不能为空");
}
// 支持多种分隔符
String[] earTagArray = manageTags.split("[\\s,]+");
List<Map<String, Object>> results = new ArrayList<>();
for (String earTag : earTagArray) {
String cleanTag = earTag.trim();
if (cleanTag.isEmpty()) continue;
Map<String, Object> result = new HashMap<>();
result.put("earTag", cleanTag);
Long sheepId = scDryMilkService.selectSheepIdByManageTags(cleanTag);
result.put("exists", sheepId != null);
result.put("sheepId", sheepId);
results.add(result);
}
return success(results);
} catch (Exception e) {
logger.error("批量验证耳号失败", e);
return error("验证失败: " + e.getMessage());
}
}
}

View File

@@ -5,14 +5,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse;
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 org.springframework.web.bind.annotation.*;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
@@ -62,7 +55,17 @@ public class ScLambingRecordController extends BaseController {
return error("查询配种信息失败:" + e.getMessage());
}
}
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')")
@GetMapping("/search_ear_numbers")
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
try {
List<String> earNumbers = scLambingRecordService.searchEarNumbers(query);
return success(earNumbers);
} catch (Exception e) {
logger.error("搜索耳号异常", e);
return error("搜索耳号失败:" + e.getMessage());
}
}
/**
* 导出产羔记录列表
*/

View File

@@ -5,14 +5,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse;
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 org.springframework.web.bind.annotation.*;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
@@ -131,4 +124,19 @@ public class ScMiscarriageRecordController extends BaseController
{
return toAjax(scMiscarriageRecordService.deleteScMiscarriageRecordByIds(ids));
}
/**
* 模糊查询母羊耳号列表
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
@GetMapping("/search_ear_numbers")
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
try {
List<String> earNumbers = scMiscarriageRecordService.searchEarNumbers(query);
return success(earNumbers);
} catch (Exception e) {
logger.error("搜索耳号异常", e);
return error("搜索耳号失败:" + e.getMessage());
}
}
}

View File

@@ -356,4 +356,18 @@ public class ScPregnancyRecordController extends BaseController
return error("调试测试失败: " + e.getMessage());
}
}
/**
* 模糊查询母羊耳号列表
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
@GetMapping("/search_ear_numbers")
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
try {
List<String> earNumbers = scPregnancyRecordService.searchEarNumbers(query);
return success(earNumbers);
} catch (Exception e) {
logger.error("搜索耳号异常", e);
return error("搜索耳号失败:" + e.getMessage());
}
}
}

View File

@@ -5,14 +5,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse;
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 org.springframework.web.bind.annotation.*;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
@@ -245,4 +238,19 @@ public class ScSheepDeathController extends BaseController
return error("删除失败: " + e.getMessage());
}
}
/**
* 模糊查询母羊耳号列表
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
@GetMapping("/search_ear_numbers")
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
try {
List<String> earNumbers = scSheepDeathService.searchEarNumbers(query);
return success(earNumbers);
} catch (Exception e) {
logger.error("搜索耳号异常", e);
return error("搜索耳号失败:" + e.getMessage());
}
}
}

View File

@@ -6,14 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
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 org.springframework.web.bind.annotation.*;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
@@ -159,4 +152,20 @@ public class ScWeanRecordController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(scWeanRecordService.deleteScWeanRecordByIds(ids));
}
/**
* 模糊查询母羊耳号列表
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
@GetMapping("/search_ear_numbers")
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
try {
List<String> earNumbers = scWeanRecordService.searchEarNumbers(query);
return success(earNumbers);
} catch (Exception e) {
logger.error("搜索耳号异常", e);
return error("搜索耳号失败:" + e.getMessage());
}
}
}

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.produce.breed.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -67,5 +69,15 @@ public class ScDryMilk extends BaseEntity
@Excel(name = "事件类型")
private String eventType;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
public List<String> getAllEarNumbers() {
return allEarNumbers;
}
public void setAllEarNumbers(List<String> allEarNumbers) {
this.allEarNumbers = allEarNumbers;
}
}

View File

@@ -121,6 +121,17 @@ public class ScLambingRecord extends BaseEntity
@Excel(name = "未留养母羔数量")
private Integer unretainedFemaleCount;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
public List<String> getAllEarNumbers() {
return allEarNumbers;
}
public void setAllEarNumbers(List<String> allEarNumbers) {
this.allEarNumbers = allEarNumbers;
}
/** 羔羊信息列表(从羊只信息表查询) */
private List<SheepLambInfo> lambInfoList;

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.produce.breed.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -305,4 +307,15 @@ public class ScMiscarriageRecord extends BaseEntity
.append("variety", getVariety())
.toString();
}
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
public List<String> getAllEarNumbers() {
return allEarNumbers;
}
public void setAllEarNumbers(List<String> allEarNumbers) {
this.allEarNumbers = allEarNumbers;
}
}

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.produce.breed.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -119,4 +121,14 @@ public class ScPregnancyRecord extends BaseEntity
/** 配后天数 */
@Excel(name = "配后天数")
private Integer daysAfterMating;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
public List<String> getAllEarNumbers() {
return allEarNumbers;
}
public void setAllEarNumbers(List<String> allEarNumbers) {
this.allEarNumbers = allEarNumbers;
}
}

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.produce.breed.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -353,4 +355,15 @@ public class ScSheepDeath extends BaseEntity
.append("isDelete", getIsDelete())
.toString();
}
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
public List<String> getAllEarNumbers() {
return allEarNumbers;
}
public void setAllEarNumbers(List<String> allEarNumbers) {
this.allEarNumbers = allEarNumbers;
}
}

View File

@@ -2,6 +2,8 @@ package com.zhyc.module.produce.breed.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
@@ -94,5 +96,15 @@ public class ScWeanRecord extends BaseEntity {
@Excel(name = "繁育状态")
private String breedingStatus;
/** 全部羊耳号列表(用于多耳号查询) */
private List<String> allEarNumbers;
public List<String> getAllEarNumbers() {
return allEarNumbers;
}
public void setAllEarNumbers(List<String> allEarNumbers) {
this.allEarNumbers = allEarNumbers;
}
}

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
import java.util.List;
import com.zhyc.module.produce.breed.domain.ScDryMilk;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 干奶记录Mapper接口
@@ -68,4 +69,12 @@ public interface ScDryMilkMapper
* @return 结果
*/
public int deleteScDryMilkByIds(Long[] ids);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
List<String> searchEarNumbers(@Param("query") String query);
}

View File

@@ -85,4 +85,6 @@ public interface ScLambingRecordMapper
* @return 后代总数
*/
Long countOffspringByRamId(String ramManageTags);
List<String> searchEarNumbers(@Param("query") String query);
}

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
import java.util.List;
import java.util.Map;
import com.zhyc.module.produce.breed.domain.ScMiscarriageRecord;
import org.apache.ibatis.annotations.Param;
/**
* 流产记录Mapper接口
@@ -67,4 +68,12 @@ public interface ScMiscarriageRecordMapper
* @return 羊只信息
*/
public Map<String, Object> selectSheepByManageTags(String manageTags);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
List<String> searchEarNumbers(@Param("query") String query);
}

View File

@@ -100,4 +100,12 @@ public interface ScPregnancyRecordMapper
*/
Long countPregnantEwesByRamIdAndBreedType(@Param("ramManageTags") String ramManageTags,
@Param("breedType") Integer breedType);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
List<String> searchEarNumbers(@Param("query") String query);
}

View File

@@ -86,4 +86,12 @@ public interface ScSheepDeathMapper
* @return 更新结果
*/
public int updateSheepStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
List<String> searchEarNumbers(@Param("query") String query);
}

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
import java.util.List;
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 断奶记录Mapper接口
@@ -75,4 +76,12 @@ public interface ScWeanRecordMapper {
* @return 结果
*/
public int updateBasSheepWeaningInfo(ScWeanRecord scWeanRecord);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
List<String> searchEarNumbers(@Param("query") String query);
}

View File

@@ -60,4 +60,12 @@ public interface IScDryMilkService
* @return 结果
*/
public int deleteScDryMilkById(Long id);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
public List<String> searchEarNumbers(String query);
}

View File

@@ -58,4 +58,6 @@ public interface IScLambingRecordService {
* 查询羔羊详情
*/
public List<ScLambDetail> selectLambDetailByLambingRecordId(Long lambingRecordId);
public List<String> searchEarNumbers(String query);
}

View File

@@ -67,4 +67,11 @@ public interface IScMiscarriageRecordService
* @return 羊只信息
*/
public Map<String, Object> selectSheepByManageTags(String manageTags);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
public List<String> searchEarNumbers(String query);
}

View File

@@ -75,4 +75,11 @@ public interface IScPregnancyRecordService
* @return 配种信息
*/
public Map<String, Object> getBreedInfoByManageTags(String manageTags);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
public List<String> searchEarNumbers(String query);
}

View File

@@ -67,4 +67,12 @@ public interface IScSheepDeathService
* @return 结果
*/
public int deleteScSheepDeathById(Long id);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
public List<String> searchEarNumbers(String query);
}

View File

@@ -66,4 +66,12 @@ public interface IScWeanRecordService {
* @return 羊只ID
*/
public Long selectSheepIdByEarNumber(String earNumber);
/**
* 模糊查询母羊耳号列表
*
* @param query 查询关键字
* @return 耳号列表
*/
public List<String> searchEarNumbers(String query);
}

View File

@@ -138,4 +138,12 @@ public class ScDryMilkServiceImpl implements IScDryMilkService
{
return scDryMilkMapper.deleteScDryMilkById(id);
}
// ScLambingRecordServiceImpl.java 添加方法
@Override
public List<String> searchEarNumbers(String query) {
return scDryMilkMapper.searchEarNumbers(query);
}
}

View File

@@ -40,6 +40,10 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
return scLambingRecordMapper.getLatestBreedingByEarNumber(earNumber);
}
@Override
public List<String> searchEarNumbers(String query) {
return scLambingRecordMapper.searchEarNumbers(query);
}
/**
* 新增产羔记录(包含羔羊详情)
*/

View File

@@ -167,4 +167,9 @@ public class ScMiscarriageRecordServiceImpl implements IScMiscarriageRecordServi
// 验证通过
}
@Override
public List<String> searchEarNumbers(String query) {
return scMiscarriageRecordMapper.searchEarNumbers(query);
}
}

View File

@@ -271,4 +271,8 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
System.err.println("更新羊只怀孕状态失败: " + e.getMessage());
}
}
@Override
public List<String> searchEarNumbers(String query) {
return scPregnancyRecordMapper.searchEarNumbers(query);
}
}

View File

@@ -207,4 +207,9 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
return scSheepDeathMapper.deleteScSheepDeathById(id);
}
@Override
public List<String> searchEarNumbers(String query) {
return scSheepDeathMapper.searchEarNumbers(query);
}
}

View File

@@ -131,4 +131,9 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
public Long selectSheepIdByEarNumber(String earNumber) {
return scWeanRecordMapper.selectSheepIdByEarNumber(earNumber);
}
@Override
public List<String> searchEarNumbers(String query) {
return scWeanRecordMapper.searchEarNumbers(query);
}
}

View File

@@ -0,0 +1,140 @@
<?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.app.mapper.AppErrorLogMapper">
<resultMap type="AppErrorLog" id="AppErrorLogResult">
<result property="id" column="id" />
<result property="deviceId" column="device_id" />
<result property="userId" column="user_id" />
<result property="appVersion" column="app_version" />
<result property="appCode" column="app_code" />
<result property="platform" column="platform" />
<result property="osVersion" column="os_version" />
<result property="errorType" column="error_type" />
<result property="errorCode" column="error_code" />
<result property="errorMessage" column="error_message" />
<result property="stackTrace" column="stack_trace" />
<result property="pageUrl" column="page_url" />
<result property="apiUrl" column="api_url" />
<result property="apiParams" column="api_params" />
<result property="networkType" column="network_type" />
<result property="screenWidth" column="screen_width" />
<result property="screenHeight" column="screen_height" />
<result property="customData" column="custom_data" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectAppErrorLogVo">
select id, device_id, user_id, app_version, app_code, platform, os_version, error_type, error_code, error_message, stack_trace, page_url, api_url, api_params, network_type, screen_width, screen_height, custom_data, create_time from app_error_log
</sql>
<select id="selectAppErrorLogList" parameterType="AppErrorLog" resultMap="AppErrorLogResult">
<include refid="selectAppErrorLogVo"/>
<where>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="appVersion != null and appVersion != ''"> and app_version = #{appVersion}</if>
<if test="appCode != null "> and app_code = #{appCode}</if>
<if test="platform != null and platform != ''"> and platform = #{platform}</if>
<if test="osVersion != null and osVersion != ''"> and os_version = #{osVersion}</if>
<if test="errorType != null and errorType != ''"> and error_type = #{errorType}</if>
<if test="errorCode != null and errorCode != ''"> and error_code = #{errorCode}</if>
<if test="errorMessage != null and errorMessage != ''"> and error_message = #{errorMessage}</if>
<if test="stackTrace != null and stackTrace != ''"> and stack_trace = #{stackTrace}</if>
<if test="pageUrl != null and pageUrl != ''"> and page_url = #{pageUrl}</if>
<if test="apiUrl != null and apiUrl != ''"> and api_url = #{apiUrl}</if>
<if test="apiParams != null and apiParams != ''"> and api_params = #{apiParams}</if>
<if test="networkType != null and networkType != ''"> and network_type = #{networkType}</if>
<if test="screenWidth != null "> and screen_width = #{screenWidth}</if>
<if test="screenHeight != null "> and screen_height = #{screenHeight}</if>
<if test="customData != null and customData != ''"> and custom_data = #{customData}</if>
</where>
</select>
<select id="selectAppErrorLogById" parameterType="Long" resultMap="AppErrorLogResult">
<include refid="selectAppErrorLogVo"/>
where id = #{id}
</select>
<insert id="insertAppErrorLog" parameterType="AppErrorLog" useGeneratedKeys="true" keyProperty="id">
insert into app_error_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceId != null">device_id,</if>
<if test="userId != null">user_id,</if>
<if test="appVersion != null and appVersion != ''">app_version,</if>
<if test="appCode != null">app_code,</if>
<if test="platform != null">platform,</if>
<if test="osVersion != null">os_version,</if>
<if test="errorType != null">error_type,</if>
<if test="errorCode != null">error_code,</if>
<if test="errorMessage != null">error_message,</if>
<if test="stackTrace != null">stack_trace,</if>
<if test="pageUrl != null">page_url,</if>
<if test="apiUrl != null">api_url,</if>
<if test="apiParams != null">api_params,</if>
<if test="networkType != null">network_type,</if>
<if test="screenWidth != null">screen_width,</if>
<if test="screenHeight != null">screen_height,</if>
<if test="customData != null">custom_data,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceId != null">#{deviceId},</if>
<if test="userId != null">#{userId},</if>
<if test="appVersion != null and appVersion != ''">#{appVersion},</if>
<if test="appCode != null">#{appCode},</if>
<if test="platform != null">#{platform},</if>
<if test="osVersion != null">#{osVersion},</if>
<if test="errorType != null">#{errorType},</if>
<if test="errorCode != null">#{errorCode},</if>
<if test="errorMessage != null">#{errorMessage},</if>
<if test="stackTrace != null">#{stackTrace},</if>
<if test="pageUrl != null">#{pageUrl},</if>
<if test="apiUrl != null">#{apiUrl},</if>
<if test="apiParams != null">#{apiParams},</if>
<if test="networkType != null">#{networkType},</if>
<if test="screenWidth != null">#{screenWidth},</if>
<if test="screenHeight != null">#{screenHeight},</if>
<if test="customData != null">#{customData},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateAppErrorLog" parameterType="AppErrorLog">
update app_error_log
<trim prefix="SET" suffixOverrides=",">
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="appVersion != null and appVersion != ''">app_version = #{appVersion},</if>
<if test="appCode != null">app_code = #{appCode},</if>
<if test="platform != null">platform = #{platform},</if>
<if test="osVersion != null">os_version = #{osVersion},</if>
<if test="errorType != null">error_type = #{errorType},</if>
<if test="errorCode != null">error_code = #{errorCode},</if>
<if test="errorMessage != null">error_message = #{errorMessage},</if>
<if test="stackTrace != null">stack_trace = #{stackTrace},</if>
<if test="pageUrl != null">page_url = #{pageUrl},</if>
<if test="apiUrl != null">api_url = #{apiUrl},</if>
<if test="apiParams != null">api_params = #{apiParams},</if>
<if test="networkType != null">network_type = #{networkType},</if>
<if test="screenWidth != null">screen_width = #{screenWidth},</if>
<if test="screenHeight != null">screen_height = #{screenHeight},</if>
<if test="customData != null">custom_data = #{customData},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppErrorLogById" parameterType="Long">
delete from app_error_log where id = #{id}
</delete>
<delete id="deleteAppErrorLogByIds" parameterType="String">
delete from app_error_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,114 @@
<?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.app.mapper.AppSettingsMapper">
<resultMap type="com.zhyc.module.app.domain.AppSettings" id="AppSettingsResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="settingKey" column="setting_key" />
<result property="settingValue" column="setting_value" />
<result property="settingType" column="setting_type" />
<result property="settingGroup" column="setting_group" />
<result property="settingDesc" column="setting_desc" />
<result property="platform" column="platform" />
<result property="versionRange" column="version_range" />
<result property="status" column="status" />
<result property="logical" column="logical" />
<result property="customData" column="custom_data" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectAppSettingsVo">
select id, user_id, setting_key, setting_value, setting_type, setting_group, setting_desc, platform, version_range, status, logical, custom_data, create_time, update_time from app_settings
</sql>
<select id="selectAppSettingsList" parameterType="AppSettings" resultMap="AppSettingsResult">
<include refid="selectAppSettingsVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="settingKey != null and settingKey != ''"> and setting_key = #{settingKey}</if>
<if test="settingValue != null and settingValue != ''"> and setting_value = #{settingValue}</if>
<if test="settingType != null and settingType != ''"> and setting_type = #{settingType}</if>
<if test="settingGroup != null and settingGroup != ''"> and setting_group = #{settingGroup}</if>
<if test="settingDesc != null and settingDesc != ''"> and setting_desc = #{settingDesc}</if>
<if test="platform != null and platform != ''"> and platform = #{platform}</if>
<if test="versionRange != null and versionRange != ''"> and version_range = #{versionRange}</if>
<if test="status != null "> and status = #{status}</if>
<if test="logical != null "> and logical = #{logical}</if>
<if test="customData != null and customData != ''"> and custom_data = #{customData}</if>
</where>
</select>
<select id="selectAppSettingsById" parameterType="Long" resultMap="AppSettingsResult">
<include refid="selectAppSettingsVo"/>
where id = #{id}
</select>
<insert id="insertAppSettings" parameterType="AppSettings" useGeneratedKeys="true" keyProperty="id">
insert into app_settings
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="settingKey != null and settingKey != ''">setting_key,</if>
<if test="settingValue != null">setting_value,</if>
<if test="settingType != null">setting_type,</if>
<if test="settingGroup != null">setting_group,</if>
<if test="settingDesc != null">setting_desc,</if>
<if test="platform != null">platform,</if>
<if test="versionRange != null">version_range,</if>
<if test="status != null">status,</if>
<if test="logical != null">logical,</if>
<if test="customData != null">custom_data,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="settingKey != null and settingKey != ''">#{settingKey},</if>
<if test="settingValue != null">#{settingValue},</if>
<if test="settingType != null">#{settingType},</if>
<if test="settingGroup != null">#{settingGroup},</if>
<if test="settingDesc != null">#{settingDesc},</if>
<if test="platform != null">#{platform},</if>
<if test="versionRange != null">#{versionRange},</if>
<if test="status != null">#{status},</if>
<if test="logical != null">#{logical},</if>
<if test="customData != null">#{customData},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateAppSettings" parameterType="AppSettings">
update app_settings
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="settingKey != null and settingKey != ''">setting_key = #{settingKey},</if>
<if test="settingValue != null">setting_value = #{settingValue},</if>
<if test="settingType != null">setting_type = #{settingType},</if>
<if test="settingGroup != null">setting_group = #{settingGroup},</if>
<if test="settingDesc != null">setting_desc = #{settingDesc},</if>
<if test="platform != null">platform = #{platform},</if>
<if test="versionRange != null">version_range = #{versionRange},</if>
<if test="status != null">status = #{status},</if>
<if test="logical != null">logical = #{logical},</if>
<if test="customData != null">custom_data = #{customData},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppSettingsById" parameterType="Long">
delete from app_settings where id = #{id}
</delete>
<delete id="deleteAppSettingsByIds" parameterType="String">
delete from app_settings where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -148,6 +148,15 @@
WHERE s.id = #{id}
</select>
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT manage_tags
FROM bas_sheep
WHERE manage_tags LIKE CONCAT(#{query}, '%')
AND is_delete = 0
ORDER by manage_tags
LIMIT 50
</select>
<select id="selectBasSheepByManageTags" parameterType="String" resultMap="BasSheepResult">
SELECT s.*,
bv.variety AS varietyName

View File

@@ -43,6 +43,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
<!-- 全部羊多耳号查询(母羊或公羊匹配即可) -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
bs.manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''">
and datetime between #{params.beginDatetime} and #{params.endDatetime}

View File

@@ -52,6 +52,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
<!-- 全部羊多耳号查询(母羊或公羊匹配即可) -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
bs.manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="diseasePid != null "> and disease_pid = #{diseasePid}</if>
<if test="diseaseId != null "> and disease_id = #{diseaseId}</if>

View File

@@ -50,7 +50,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
<!-- 全部羊多耳号查询(母羊或公羊匹配即可) -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
bs.manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
</where>

View File

@@ -48,7 +48,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
<!-- 全部羊多耳号查询(母羊或公羊匹配即可) -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
bs.manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
</where>

View File

@@ -54,6 +54,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
<!-- 全部羊多耳号查询(母羊或公羊匹配即可) -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
bs.manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="quarItem != null "> and quar_item = #{quarItem}</if>
<if test="sampleType != null "> and sample_type = #{sampleType}</if>
<if test="sampler != null and sampler != ''"> and sampler like concat('%',#{sampler},'%') </if>

View File

@@ -73,6 +73,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sheepNo != null and sheepNo != ''">
AND bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
<if test="sheepNos != null and sheepNos.length > 0">
AND (
<foreach collection="sheepNos" item="item" separator=" OR " open="" close="">
bs.manage_tags LIKE CONCAT('%', #{item}, '%')
</foreach>
)
</if>
<!-- 全部羊多耳号查询(母羊或公羊匹配即可) -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
bs.manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<!-- 4. 使用时间区间 -->
<if test="params.beginUseTime != null and params.endUseTime != null">

View File

@@ -62,6 +62,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
<!-- 全部羊多耳号查询(母羊或公羊匹配即可) -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
bs.manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="diseaseId != null "> and disease_id = #{diseaseId}</if>

View File

@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isGranular != null "> and is_granular = #{isGranular}</if>
</where>
</select>
<select id="selectSgMaterialByMaterialId" parameterType="String" resultMap="SgMaterialResult">
<include refid="selectSgMaterialVo"/>
where material_id = #{materialId}

View File

@@ -33,24 +33,41 @@
<select id="selectScDryMilkList" parameterType="ScDryMilk" resultMap="ScDryMilkResult">
<include refid="selectScDryMilkVo"/>
<where>
<if test="sheepId != null and sheepId != ''"> and d.sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''"> and s.bs_manage_tags like concat('%', #{manageTags}, '%')</if>
<if test="datetime != null "> and d.datetime = #{datetime}</if>
<if test="status != null "> and d.status = #{status}</if>
<if test="sheepfold != null "> and d.sheepfold = #{sheepfold}</if>
<if test="tecahnician != null and tecahnician != ''"> and d.tecahnician like concat('%', #{tecahnician}, '%')</if>
<if test="createBy != null and createBy != ''"> and d.create_by = #{createBy}</if>
<if test="createTime != null "> and d.create_time = #{createTime}</if>
<if test="variety != null and variety != ''"> and s.variety like concat('%', #{variety}, '%')</if>
<!-- 多耳号精确匹配查询 -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND s.bs_manage_tags IN
<foreach item="earNumber" collection="allEarNumbers" open="(" separator="," close=")">
#{earNumber}
</foreach>
</if>
<!-- 保留原单耳号模糊查询(仅当allEarNumbers为空时生效) -->
<if test="(allEarNumbers == null or allEarNumbers.size() == 0) and manageTags != null and manageTags != ''">
AND s.bs_manage_tags LIKE CONCAT('%', #{manageTags}, '%')
</if>
<if test="sheepId != null">AND d.sheep_id = #{sheepId}</if>
<if test="datetime != null">AND d.datetime = #{datetime}</if>
<if test="status != null">AND d.status = #{status}</if>
<if test="sheepfold != null">AND d.sheepfold = #{sheepfold}</if>
<if test="tecahnician != null and tecahnician != ''">
AND d.tecahnician LIKE CONCAT('%', #{tecahnician}, '%')
</if>
<if test="createBy != null and createBy != ''">AND d.create_by = #{createBy}</if>
<if test="createTime != null">AND d.create_time = #{createTime}</if>
<if test="variety != null and variety != ''">
AND s.variety LIKE CONCAT('%', #{variety}, '%')
</if>
</where>
order by d.create_time desc
</select>
<select id="selectScDryMilkById" parameterType="Long" resultMap="ScDryMilkResult">
<include refid="selectScDryMilkVo"/>
where d.id = #{id}
</select>
<!-- 根据耳号查询羊只ID -->
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
select id from sheep_file where bs_manage_tags = #{manageTags}
@@ -105,4 +122,14 @@
#{id}
</foreach>
</delete>
<!-- 当 gender=null 时,不会添加 gender 条件,即查询全部羊 -->
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT sf.bs_manage_tags
FROM sheep_file sf
WHERE sf.bs_manage_tags LIKE CONCAT(#{query}, '%')
AND sf.is_delete = 0
ORDER BY sf.bs_manage_tags
LIMIT 50
</select>
</mapper>

View File

@@ -105,7 +105,16 @@
<select id="selectScLambingRecordList" parameterType="ScLambingRecord" resultMap="ScLambingRecordDetailResult">
<include refid="selectScLambingRecordDetailVo"/>
<where>
<if test="femaleEarNumber != null and femaleEarNumber != ''"> and mother.bs_manage_tags LIKE CONCAT('%', #{femaleEarNumber}, '%')</if>
<!-- 全部羊多耳号查询 -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
<!-- 注意s 代表 sheep_file 表的别名,根据实际 SQL 别名修改 -->
mother.bs_manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="femaleBreed != null and femaleBreed != ''"> and mother.variety LIKE CONCAT('%', #{femaleBreed}, '%')</if>
<if test="farm != null and farm != ''"> and mother.dr_ranch LIKE CONCAT('%', #{farm}, '%')</if>
<if test="sheepId != null and sheepId != ''"> and lr.sheep_id = #{sheepId}</if>
@@ -229,5 +238,15 @@
FROM sc_breed_record br
JOIN sc_lambing_record lr ON br.ewe_id = lr.sheep_id
WHERE br.ram_id = #{ramManageTags} AND br.is_delete = 0
</select>
<!-- 模糊查询耳号列表 -->
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT sf.bs_manage_tags
FROM sheep_file sf
WHERE sf.bs_manage_tags LIKE CONCAT(#{query}, '%')
AND sf.is_delete = 0
ORDER BY sf.bs_manage_tags
LIMIT 50
</select>
</mapper>

View File

@@ -91,18 +91,12 @@
<where>
pr.is_delete = 0
<!-- 耳号搜索 - 支持多种匹配方式 -->
<if test="manageTags != null and manageTags != ''">
<bind name="searchTag" value="manageTags.trim()" />
AND (
<!-- 精确匹配 -->
sf.bs_manage_tags = #{searchTag}
<!-- 模糊匹配 -->
OR sf.bs_manage_tags LIKE CONCAT('%', #{searchTag}, '%')
<!-- 处理逗号分隔的多个耳号 -->
OR FIND_IN_SET(sf.bs_manage_tags, REPLACE(#{searchTag}, ' ', '')) > 0
<!-- 反向匹配:输入包含数据库中的耳号 -->
OR #{searchTag} LIKE CONCAT('%', sf.bs_manage_tags, '%')
<!-- 正确sf.bs_manage_tagssf是sheep_file的别名 -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (sf.bs_manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
@@ -242,4 +236,14 @@
AND br.breed_type = #{breedType}
AND pr.result IN ('有胎', '阳性', '怀孕')
</select>
<!-- 模糊查询耳号列表 -->
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT sf.bs_manage_tags
FROM sheep_file sf
WHERE sf.bs_manage_tags LIKE CONCAT(#{query}, '%')
AND sf.is_delete = 0
ORDER BY sf.bs_manage_tags
LIMIT 50
</select>
</mapper>

View File

@@ -25,12 +25,23 @@
</resultMap>
<sql id="selectScSheepDeathVo">
select id, sheep_id, manage_tags, event_type, death_date, disease_type_id, disease_subtype_id, disposal_direction, technician, handler, work_group, create_by, create_time, comment, update_by, update_time, is_delete from sc_sheep_death
select id, sheep_id, manage_tags, event_type, death_date, disease_type_id, disease_subtype_id, disposal_direction, technician, handler, work_group, create_by, create_time, comment, update_by, update_time, is_delete from sc_sheep_death d
left join sheep_file s on d.sheep_id = s.id
</sql>
<select id="selectScSheepDeathList" parameterType="ScSheepDeath" resultMap="ScSheepDeathResult">
<include refid="selectScSheepDeathVo"/>
<where>
<!-- 全部羊多耳号查询 -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (
<!-- 注意s 代表 sheep_file 表的别名,根据实际 SQL 别名修改 -->
s.bs_manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
<if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if>
@@ -163,4 +174,13 @@
AND is_delete = 0
</update>
<!-- 模糊查询耳号列表 -->
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT sf.bs_manage_tags
FROM sheep_file sf
WHERE sf.bs_manage_tags LIKE CONCAT(#{query}, '%')
AND sf.is_delete = 0
ORDER BY sf.bs_manage_tags
LIMIT 50
</select>
</mapper>

View File

@@ -44,6 +44,15 @@
<select id="selectScWeanRecordList" parameterType="ScWeanRecord" resultMap="ScWeanRecordResult">
<include refid="selectScWeanRecordVo"/>
<where>
<!-- 全部羊多耳号查询 -->
<!-- 正确sf.bs_manage_tagssf是sheep_file的别名 -->
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
AND (sf.bs_manage_tags IN
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
#{earNumber}
</foreach>
)
</if>
<if test="sheepId != null "> and wr.sheep_id = #{sheepId}</if>
<if test="earNumber != null and earNumber != ''"> and sf.bs_manage_tags like concat('%', #{earNumber}, '%')</if>
<if test="datetime != null "> and wr.datetime = #{datetime}</if>
@@ -142,4 +151,14 @@
#{id}
</foreach>
</delete>
<!-- 模糊查询耳号列表 -->
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT sf.bs_manage_tags
FROM sheep_file sf
WHERE sf.bs_manage_tags LIKE CONCAT(#{query}, '%')
AND sf.is_delete = 0
ORDER BY sf.bs_manage_tags
LIMIT 50
</select>
</mapper>

View File

@@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.stock.mapper.WzMaterialsManagementMapper">
<resultMap type="WzMaterialsManagement" id="WzMaterialsManagementResult">
<resultMap type="com.zhyc.module.stock.domain.WzMaterialsManagement" id="WzMaterialsManagementResult">
<result property="materialManagementCode" column="material_management_code" />
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />

View File

@@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.work.mapper.WorkOrderMapper">
<resultMap type="WorkOrder" id="WorkOrderResult">
<resultMap type="com.zhyc.module.work.domain.WorkOrder" id="WorkOrderResult">
<result property="id" column="id" />
<result property="orderNo" column="order_no" />
<result property="planId" column="plan_id" />