Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -46,6 +46,18 @@ 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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出羊只基本信息列表
|
||||
*/
|
||||
|
||||
@@ -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获取羊只列表
|
||||
|
||||
@@ -28,6 +28,13 @@ public interface IBasSheepService
|
||||
*/
|
||||
public List<BasSheep> selectBasSheepList(BasSheep basSheep);
|
||||
|
||||
/**
|
||||
* 羊只查询耳号信息
|
||||
*
|
||||
* @param earNumbers 耳号
|
||||
* @return 结果
|
||||
*/
|
||||
public List<String> searchEarNumbers(String earNumbers);
|
||||
/**
|
||||
* 新增羊只基本信息
|
||||
*
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
@@ -44,6 +46,17 @@ public class BasSheepServiceImpl implements IBasSheepService
|
||||
return basSheepMapper.selectBasSheepList(basSheep);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索羊只 earNumbers
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "b", userAlias = "b")
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return basSheepMapper.searchEarNumbers(query);
|
||||
}
|
||||
/**
|
||||
* 新增羊只基本信息
|
||||
*
|
||||
|
||||
@@ -78,7 +78,8 @@ public class DewormController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Deworm deworm)
|
||||
{
|
||||
System.out.println(deworm);
|
||||
deworm.setDeptId(getDeptId());
|
||||
deworm.setUserId(getUserId());
|
||||
return toAjax(dewormService.insertDeworm(deworm));
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ public class DiagnosisController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Diagnosis diagnosis)
|
||||
{
|
||||
diagnosis.setDeptId(getDeptId());
|
||||
diagnosis.setUserId(getUserId());
|
||||
return toAjax(diagnosisService.insertDiagnosis(diagnosis));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ public class DisinfectController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Disinfect disinfect)
|
||||
{
|
||||
disinfect.setDeptId(getDeptId());
|
||||
disinfect.setUserId(getUserId());
|
||||
return toAjax(disinfectService.insertDisinfect(disinfect));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ public class HealthController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Health health)
|
||||
{
|
||||
health.setDeptId(getDeptId());
|
||||
health.setUserId(getUserId());
|
||||
return toAjax(healthService.insertHealth(health));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ public class ImmunityController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Immunity immunity)
|
||||
{
|
||||
immunity.setDeptId(getDeptId());
|
||||
immunity.setUserId(getUserId());
|
||||
return toAjax(immunityService.insertImmunity(immunity));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ public class QuarantineReportController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody QuarantineReport quarantineReport)
|
||||
{
|
||||
quarantineReport.setDeptId(getDeptId());
|
||||
quarantineReport.setUserId(getUserId());
|
||||
return toAjax(quarantineReportService.insertQuarantineReport(quarantineReport));
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ public class SwMedicineUsageController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SwMedicineUsage swMedicineUsage)
|
||||
{
|
||||
swMedicineUsage.setDeptId(getDeptId());
|
||||
swMedicineUsage.setUserId(getUserId());
|
||||
return toAjax(swMedicineUsageService.insertSwMedicineUsage(swMedicineUsage));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ public class TreatmentController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Treatment treatment)
|
||||
{
|
||||
treatment.setDeptId(getDeptId());
|
||||
treatment.setUserId(getUserId());
|
||||
return toAjax(treatmentService.insertTreatment(treatment));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -52,7 +54,8 @@ public class Deworm extends BaseEntity
|
||||
@Excel(name = "胎次")
|
||||
private Long parity;
|
||||
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/** 药品使用记录 */
|
||||
@Excel(name = "药品使用记录")
|
||||
@@ -75,11 +78,9 @@ 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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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,26 @@ 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;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +61,9 @@ public class Disinfect extends BaseEntity
|
||||
/** 药品名称用于查询*/
|
||||
private String mediName;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -67,14 +69,29 @@ public class Health extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ public class Immunity extends BaseEntity
|
||||
@Excel(name = "羊只耳号")
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
|
||||
@Excel(name = "品种")
|
||||
|
||||
@@ -75,14 +78,29 @@ public class Immunity extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -93,6 +98,9 @@ public class QuarantineReport extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
||||
|
||||
@@ -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")
|
||||
@@ -48,6 +53,9 @@ public class SwMedicineUsage extends BaseEntity
|
||||
@Excel(name = "使用类型",width = 20, needMerge = true)
|
||||
private String useType;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/** 药品使用记录详情信息 */
|
||||
@Excel
|
||||
private List<SwMedicineUsageDetails> swMedicineUsageDetailsList;
|
||||
|
||||
@@ -33,6 +33,9 @@ public class Treatment extends BaseEntity
|
||||
@Excel(name = "羊只耳号")
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
|
||||
private Long sheepId;
|
||||
// 用于批量新增
|
||||
@@ -101,6 +104,9 @@ public class Treatment extends BaseEntity
|
||||
@Excel(name = "药品使用记录id")
|
||||
private Integer usageId;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -58,6 +60,7 @@ public class DewormServiceImpl implements IDewormService
|
||||
* @return 驱虫
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Deworm> selectDewormList(Deworm deworm)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
@@ -60,6 +61,7 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
||||
* @return 诊疗结果
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sd", userAlias = "sd")
|
||||
public List<Diagnosis> selectDiagnosisList(Diagnosis diagnosis)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -59,6 +61,7 @@ public class DisinfectServiceImpl implements IDisinfectService
|
||||
* @return 消毒记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sd", userAlias = "sd")
|
||||
public List<Disinfect> selectDisinfectList(Disinfect disinfect)
|
||||
{
|
||||
return disinfectMapper.selectDisinfectList(disinfect);
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -62,6 +63,7 @@ public class HealthServiceImpl implements IHealthService
|
||||
* @return 保健
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Health> selectHealthList(Health health)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -61,6 +63,7 @@ public class ImmunityServiceImpl implements IImmunityService
|
||||
* @return 免疫
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Immunity> selectImmunityList(Immunity immunity)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.biosafety.domain.QuarantineItems;
|
||||
import com.zhyc.module.biosafety.mapper.QuarantineItemsMapper;
|
||||
import com.zhyc.module.biosafety.service.IQuarantineItemsService;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -46,6 +48,7 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
|
||||
* @return 检疫记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sqr", userAlias = "sqr")
|
||||
public List<QuarantineReport> selectQuarantineReportList(QuarantineReport quarantineReport)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.biosafety.service.ISwMedicineUsageService;
|
||||
@@ -44,8 +46,17 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
|
||||
* @return 药品使用记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "smu", userAlias = "smu")
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -65,6 +67,7 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
* @return 治疗记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "t", userAlias = "t")
|
||||
public List<Treatment> selectTreatmentList(Treatment treatment)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -26,7 +26,9 @@ public class UserPostController {
|
||||
// 根据岗位编码获取用户
|
||||
@GetMapping("/getUser")
|
||||
public AjaxResult getUserPost(String postCode){
|
||||
List<User> list = userService.getUserListByCode(postCode);
|
||||
User user = new User();
|
||||
user.setPostCode(postCode);
|
||||
List<User> list = userService.getUserListByCode(user);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Dept extends BaseEntity {
|
||||
private Long deptId;
|
||||
private Long parentId;
|
||||
private String ancestors;
|
||||
private String deptName;
|
||||
private String orderNum;
|
||||
private String leader;
|
||||
private String phone;
|
||||
private String email;
|
||||
private String status;
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -8,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Post {
|
||||
public class Post extends BaseEntity {
|
||||
|
||||
/** 岗位序号 */
|
||||
@Excel(name = "岗位序号", cellType = Excel.ColumnType.NUMERIC)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -7,9 +8,10 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class User {
|
||||
public class User extends BaseEntity {
|
||||
// 用户id
|
||||
private String userId;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
// 用户名
|
||||
private String nickName;
|
||||
// 岗位名称
|
||||
@@ -17,4 +19,5 @@ public class User {
|
||||
// 岗位编码
|
||||
private String postCode;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zhyc.module.common.mapper;
|
||||
|
||||
import com.zhyc.module.common.domain.Dept;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeptMapper {
|
||||
/**
|
||||
* 根据部门ID查询其所属二级部门(排除根部门)
|
||||
*/
|
||||
Dept selectTopSecondLevelDept(Long deptId);
|
||||
}
|
||||
@@ -8,5 +8,5 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
|
||||
List<User> getUserListByCode(String postCode);
|
||||
List<User> getUserListByCode(User user);
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ import com.zhyc.module.common.domain.User;
|
||||
import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
List<User> getUserListByCode(String postCode);
|
||||
List<User> getUserListByCode(User postCode);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.zhyc.module.common.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.common.domain.Dept;
|
||||
import com.zhyc.module.common.domain.User;
|
||||
import com.zhyc.module.common.mapper.DeptMapper;
|
||||
import com.zhyc.module.common.mapper.UserMapper;
|
||||
import com.zhyc.module.common.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -12,9 +16,16 @@ import java.util.List;
|
||||
public class UserPostServiceImpl implements UserService {
|
||||
@Autowired
|
||||
UserMapper userMapper;
|
||||
@Autowired
|
||||
DeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
public List<User> getUserListByCode(String postCode) {
|
||||
return userMapper.getUserListByCode(postCode);
|
||||
public List<User> getUserListByCode(User user) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
|
||||
Dept secondLevel = deptMapper.selectTopSecondLevelDept(deptId);
|
||||
user.setDeptId(secondLevel.getDeptId());
|
||||
System.out.println(secondLevel);
|
||||
return userMapper.getUserListByCode(user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -148,6 +148,18 @@
|
||||
WHERE s.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="searchEarNumbers" resultType="java.lang.String">
|
||||
SELECT DISTINCT manage_tags
|
||||
FROM bas_sheep b
|
||||
<where>
|
||||
manage_tags LIKE CONCAT(#{query}, '%')
|
||||
AND is_delete = 0
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER by manage_tags
|
||||
LIMIT 50
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepByManageTags" parameterType="String" resultMap="BasSheepResult">
|
||||
SELECT s.*,
|
||||
bv.variety AS varietyName
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
|
||||
<resultMap type="DaRanch" id="DaRanchResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="ranch" column="ranch"/>
|
||||
<result property="sysRanch" column="sysRanch"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDaRanchVo">
|
||||
select id, ranch
|
||||
select id, sysRanch
|
||||
from da_ranch
|
||||
</sql>
|
||||
|
||||
<select id="selectDaRanchList" parameterType="DaRanch" resultMap="DaRanchResult">
|
||||
<include refid="selectDaRanchVo"/>
|
||||
<where>
|
||||
<if test="ranch != null and ranch != ''">and ranch = #{ranch}</if>
|
||||
<if test="sysRanch != null and sysRanch != ''">and sysRanch = #{sysRanch}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -29,17 +29,17 @@
|
||||
<insert id="insertDaRanch" parameterType="DaRanch" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into da_ranch
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ranch != null">ranch,</if>
|
||||
<if test="sysRanch != null">sysRanch,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ranch != null">#{ranch},</if>
|
||||
<if test="sysRanch != null">#{sysRanch},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDaRanch" parameterType="DaRanch">
|
||||
update da_ranch
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ranch != null">ranch = #{ranch},</if>
|
||||
<if test="sysRanch != null">sysRanch = #{sysRanch},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -43,11 +43,22 @@ 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>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
|
||||
<!-- 基准排序:日期永远第一序,降序 -->
|
||||
@@ -68,13 +79,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into sw_deworm
|
||||
(sheep_id, usage_id, variety, sheep_type, gender, month_age,
|
||||
parity, breed,datetime, technical, comment,
|
||||
update_by, update_time, create_by, create_time)
|
||||
update_by, update_time, create_by, create_time,user_id, dept_id)
|
||||
values
|
||||
<foreach collection="list" item="d" separator=",">
|
||||
(#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType},
|
||||
#{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime},
|
||||
#{d.technical}, #{d.comment},
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime},#{d.userId},#{d.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -52,12 +52,24 @@ 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>
|
||||
<if test="result != null "> and result = #{result}</if>
|
||||
<if test="treatDay != null "> and treat_day = #{treatDay}</if>
|
||||
<if test="sheepfoldId != null "> and sd.sheepfold_id = #{sheepfoldId}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
<choose>
|
||||
@@ -90,6 +102,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="treatId != null">#{treatId},</if>
|
||||
@@ -107,6 +121,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ds.sheepfold_name
|
||||
FROM sw_disinfect sd
|
||||
LEFT JOIN da_sheepfold ds ON ds.id = sd.sheepfold_id
|
||||
WHERE 1 = 1
|
||||
<where>1 = 1
|
||||
<if test="sheepfoldId != null"> AND sd.sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="datetime != null"> AND sd.datetime = #{datetime}</if>
|
||||
<if test="technician != null and technician != ''"> AND sd.technician = #{technician}</if>
|
||||
@@ -61,6 +61,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND sm.name like concat('%',#{mediName},'%')
|
||||
)
|
||||
</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
|
||||
</select>
|
||||
@@ -72,12 +74,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<insert id="insertDisinfect" parameterType="Disinfect" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_disinfect
|
||||
(sheepfold_id, datetime, technician, way, usage_id, ratio, comment, update_by, update_time, create_by, create_time)
|
||||
(sheepfold_id, datetime, technician, way, usage_id, ratio, comment, update_by, update_time, create_by, create_time, user_id,dept_id)
|
||||
values
|
||||
<foreach collection="list" item="d" separator=",">
|
||||
(#{d.sheepfoldId}, #{d.datetime}, #{d.technician}, #{d.way},
|
||||
#{d.usageId}, #{d.ratio}, #{d.comment},
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime},#{d.userId},#{d.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -50,9 +50,19 @@ 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>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
<!-- 基准排序:日期永远第一序,降序 -->
|
||||
ORDER BY datetime DESC
|
||||
@@ -72,13 +82,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into sw_health
|
||||
(sheep_id, usage_id, variety, sheep_type, gender, month_age,
|
||||
parity, breed,datetime, technical, comment,
|
||||
update_by, update_time, create_by, create_time)
|
||||
update_by, update_time, create_by, create_time,user_id,dept_id)
|
||||
values
|
||||
<foreach collection="list" item="d" separator=",">
|
||||
(#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType},
|
||||
#{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime},
|
||||
#{d.technical}, #{d.comment},
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime},#{d.userId},#{d.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -48,9 +48,19 @@ 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>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
<!-- 基准排序:日期永远第一序,降序 -->
|
||||
ORDER BY datetime DESC
|
||||
@@ -70,13 +80,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into sw_immunity
|
||||
(sheep_id, usage_id, variety, sheep_type, gender, month_age,
|
||||
parity, breed,datetime, technical, comment,
|
||||
update_by, update_time, create_by, create_time)
|
||||
update_by, update_time, create_by, create_time,user_id,dept_id)
|
||||
values
|
||||
<foreach collection="list" item="d" separator=",">
|
||||
(#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType},
|
||||
#{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime},
|
||||
#{d.technical}, #{d.comment},
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime},#{d.userId},#{d.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -61,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="result != null "> and result = #{result}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="sheepType != null and sheepType!= ''"> and sqr.sheep_type=#{sheepType}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
<choose>
|
||||
@@ -102,7 +113,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update_by,
|
||||
update_time,
|
||||
create_by,
|
||||
create_time
|
||||
create_time,
|
||||
user_id,
|
||||
dept_id
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
@@ -123,7 +136,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.updateBy},
|
||||
#{item.updateTime},
|
||||
#{item.createBy},
|
||||
#{item.createTime}
|
||||
#{item.createTime},
|
||||
#{item.userId},
|
||||
#{item.deptId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -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">
|
||||
@@ -93,6 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND sm.name LIKE CONCAT('%', #{name}, '%')
|
||||
)
|
||||
</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY smu.datetime DESC
|
||||
</select>
|
||||
@@ -144,6 +163,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
@@ -155,6 +176,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -62,11 +62,23 @@ 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>
|
||||
<if test="status != null and status !=''"> and status = #{status}</if>
|
||||
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
<choose>
|
||||
@@ -110,6 +122,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="userId != null">#{user_id},</if>
|
||||
<if test="deptId != null">#{dept_id},</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="diagId != null">#{diagId},</if>
|
||||
@@ -133,6 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -141,14 +157,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
(diag_id, sheep_id, variety, sheep_type, month_age, gender,
|
||||
parity, breed, lact_day, gest_day, datetime,
|
||||
disease_id, disease_pid, veterinary, usage_id,status ,
|
||||
comment, update_by, update_time, create_by, create_time)
|
||||
comment, update_by, update_time, create_by, create_time, user_id, dept_id)
|
||||
values
|
||||
<foreach collection="list" item="t" separator=",">
|
||||
(#{t.diagId}, #{t.sheepId}, #{t.variety}, #{t.sheepType},
|
||||
#{t.monthAge}, #{t.gender}, #{t.parity}, #{t.breed},
|
||||
#{t.lactDay}, #{t.gestDay}, #{t.datetime}, #{t.diseaseId},
|
||||
#{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.status}, #{t.comment},
|
||||
#{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime})
|
||||
#{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime},#{t.userId},#{t.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
33
zhyc-module/src/main/resources/mapper/common/DeptMapper.xml
Normal file
33
zhyc-module/src/main/resources/mapper/common/DeptMapper.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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.common.mapper.DeptMapper">
|
||||
|
||||
<resultMap type="Dept" id="DeptResult">
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="leader" column="leader" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectTopSecondLevelDept" resultMap="DeptResult" parameterType="Long">
|
||||
SELECT d2.*
|
||||
FROM sys_dept d1
|
||||
LEFT JOIN sys_dept d2
|
||||
ON d2.dept_id = CASE
|
||||
WHEN d1.ancestors = '0' OR d1.parent_id = 0 THEN d1.dept_id
|
||||
-- 二级部门:逗号只出现1次,返回自身ID
|
||||
WHEN LENGTH(d1.ancestors) - LENGTH(REPLACE(d1.ancestors, ',', '')) = 1
|
||||
THEN d1.dept_id
|
||||
-- 三级及以上:取第3个值(索引2)即二级部门ID
|
||||
ELSE CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(d1.ancestors, ',', 3), ',', -1) AS UNSIGNED)
|
||||
END
|
||||
WHERE d1.dept_id = #{deptId}
|
||||
AND d2.dept_id IS NOT NULL
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -12,14 +12,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<select id="getUserListByCode" resultMap="UserResult">
|
||||
SELECT u.user_id, nick_name , post_name , post_code
|
||||
FROM sys_role r
|
||||
JOIN sys_user_role ur ON r.role_id = ur.role_id
|
||||
JOIN sys_user u ON ur.user_id = u.user_id
|
||||
JOIN sys_user_post up ON u.user_id = up.user_id
|
||||
JOIN sys_post p ON up.post_id = p.post_id
|
||||
WHERE p.post_code LIKE CONCAT('%', #{postCode}, '%')
|
||||
AND r.status = 0 and r.del_flag = 0;
|
||||
</select>
|
||||
<choose>
|
||||
<!-- deptId = 0:查询所有用户,不限制部门 -->
|
||||
<when test="deptId == 0">
|
||||
SELECT DISTINCT u.user_id, u.nick_name, p.post_name, p.post_code
|
||||
FROM sys_user u
|
||||
JOIN sys_user_post up ON u.user_id = up.user_id
|
||||
JOIN sys_post p ON up.post_id = p.post_id
|
||||
WHERE p.post_code LIKE CONCAT('%', #{postCode}, '%')
|
||||
AND u.status = 0
|
||||
AND u.del_flag = 0
|
||||
</when>
|
||||
|
||||
<!-- deptId != 0:递归查询该部门及所有子部门 -->
|
||||
<otherwise>
|
||||
WITH RECURSIVE dept_tree AS (
|
||||
SELECT dept_id FROM sys_dept WHERE dept_id = #{deptId}
|
||||
UNION ALL
|
||||
SELECT d.dept_id
|
||||
FROM sys_dept d
|
||||
INNER JOIN dept_tree dt ON d.parent_id = dt.dept_id
|
||||
)
|
||||
SELECT DISTINCT u.user_id, u.nick_name, p.post_name, p.post_code
|
||||
FROM dept_tree dt
|
||||
JOIN sys_user u ON u.dept_id = dt.dept_id
|
||||
JOIN sys_user_post up ON u.user_id = up.user_id
|
||||
JOIN sys_post p ON up.post_id = p.post_id
|
||||
WHERE p.post_code LIKE CONCAT('%', #{postCode}, '%')
|
||||
AND u.status = 0
|
||||
AND u.del_flag = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -29,7 +29,7 @@
|
||||
<result property="matingDate" column="mating_date" />
|
||||
<result property="expectedDate" column="expected_date" />
|
||||
<result property="lastEventDate" column="last_event_date" />
|
||||
<result property="ranchName" column="ranch" />
|
||||
<result property="ranchName" column="sysRanch" />
|
||||
<result property="daysAfterMating" column="days_after_mating" />
|
||||
</resultMap>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
sf.breed,
|
||||
sf.expected_date,
|
||||
sf.lambing_date as last_event_date,
|
||||
sf.dr_ranch as ranch,
|
||||
sf.dr_ranch as sysRanch,
|
||||
-- 关联配种信息
|
||||
ram_sf.bs_manage_tags as father_manage_tags,
|
||||
ram_sf.variety as father_variety,
|
||||
|
||||
Reference in New Issue
Block a user