Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -84,6 +84,11 @@ public class BasSheepController extends BaseController {
|
||||
@Log(title = "羊只基本信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BasSheep basSheep) {
|
||||
|
||||
// 新增下面这两行:从当前登录态中获取部门ID和用户ID,并赋值给即将保存的实体
|
||||
basSheep.setDeptId(getDeptId());
|
||||
basSheep.setUserId(getUserId());
|
||||
|
||||
return toAjax(basSheepService.insertBasSheep(basSheep));
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,10 @@ public class BasSheepGroupController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BasSheepGroup basSheepGroup)
|
||||
{
|
||||
// 👇 新增这两行赋值语句
|
||||
basSheepGroup.setDeptId(getDeptId());
|
||||
basSheepGroup.setUserId(getUserId());
|
||||
|
||||
return toAjax(basSheepGroupService.insertBasSheepGroup(basSheepGroup));
|
||||
}
|
||||
|
||||
|
||||
@@ -166,6 +166,10 @@ public class DaSheepfoldController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DaSheepfold daSheepfold)
|
||||
{
|
||||
// 👇 新增这两行赋值语句
|
||||
daSheepfold.setDeptId(getDeptId());
|
||||
daSheepfold.setUserId(getUserId());
|
||||
|
||||
return toAjax(daSheepfoldService.insertDaSheepfold(daSheepfold));
|
||||
}
|
||||
|
||||
|
||||
@@ -209,62 +209,34 @@ public class SheepFileController extends BaseController
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
// 构建查询条件对象
|
||||
SheepFile sheepFile = new SheepFile();
|
||||
Map<String, Object> customParams = new HashMap<>();
|
||||
|
||||
// 解析所有请求参数
|
||||
Map<String, String[]> parameterMap = request.getParameterMap();
|
||||
|
||||
// 1. 更直接地获取前端参数
|
||||
String exportIdsStr = request.getParameter("exportIds");
|
||||
String visibleColumnsStr = request.getParameter("visibleColumns");
|
||||
|
||||
// 2. 遍历其他条件
|
||||
for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String[] values = entry.getValue();
|
||||
|
||||
if (values != null && values.length > 0 && StringUtils.isNotBlank(values[0])) {
|
||||
String value = values[0];
|
||||
|
||||
// 使用若依框架的工具方法处理参数
|
||||
switch (key) {
|
||||
// --- 单值参数 ---
|
||||
case "bsManageTags":
|
||||
sheepFile.setBsManageTags(convertToString(value));
|
||||
break;
|
||||
case "electronicTags":
|
||||
sheepFile.setElectronicTags(convertToString(value));
|
||||
break;
|
||||
case "drRanch":
|
||||
sheepFile.setDrRanch(convertToString(value));
|
||||
break;
|
||||
case "variety":
|
||||
sheepFile.setVariety(convertToString(value));
|
||||
break;
|
||||
case "name":
|
||||
sheepFile.setName(convertToString(value));
|
||||
break;
|
||||
case "gender":
|
||||
sheepFile.setGender(Convert.toLong(value));
|
||||
break;
|
||||
case "statusId":
|
||||
sheepFile.setStatusId(Convert.toLong(value));
|
||||
break;
|
||||
case "breed":
|
||||
sheepFile.setBreed(convertToString(value));
|
||||
break;
|
||||
|
||||
// --- 新增:处理多选数组参数 ---
|
||||
// request.getParameterMap 中的值本身就是 String[],可以直接使用
|
||||
case "allEarNumbers":
|
||||
sheepFile.setAllEarNumbers(new ArrayList<>(Arrays.asList(values)));
|
||||
break;
|
||||
case "allEleEarNumbers":
|
||||
sheepFile.setAllEleEarNumbers(new ArrayList<>(Arrays.asList(values)));
|
||||
break;
|
||||
case "allBreedingStatus":
|
||||
sheepFile.setAllBreedingStatus(new ArrayList<>(Arrays.asList(values)));
|
||||
break;
|
||||
case "allSheepTypes":
|
||||
sheepFile.setAllSheepTypes(new ArrayList<>(Arrays.asList(values)));
|
||||
break;
|
||||
case "bsManageTags": sheepFile.setBsManageTags(convertToString(value)); break;
|
||||
case "electronicTags": sheepFile.setElectronicTags(convertToString(value)); break;
|
||||
case "drRanch": sheepFile.setDrRanch(convertToString(value)); break;
|
||||
case "variety": sheepFile.setVariety(convertToString(value)); break;
|
||||
case "name": sheepFile.setName(convertToString(value)); break;
|
||||
case "gender": sheepFile.setGender(Convert.toLong(value)); break;
|
||||
case "statusId": sheepFile.setStatusId(Convert.toLong(value)); break;
|
||||
case "breed": sheepFile.setBreed(convertToString(value)); break;
|
||||
case "allEarNumbers": sheepFile.setAllEarNumbers(new ArrayList<>(Arrays.asList(values))); break;
|
||||
case "allEleEarNumbers": sheepFile.setAllEleEarNumbers(new ArrayList<>(Arrays.asList(values))); break;
|
||||
case "allBreedingStatus": sheepFile.setAllBreedingStatus(new ArrayList<>(Arrays.asList(values))); break;
|
||||
case "allSheepTypes": sheepFile.setAllSheepTypes(new ArrayList<>(Arrays.asList(values))); break;
|
||||
case "allGenders":
|
||||
List<Long> genderList = new ArrayList<>();
|
||||
for(String v : values){
|
||||
@@ -273,24 +245,50 @@ public class SheepFileController extends BaseController
|
||||
}
|
||||
sheepFile.setAllGenders(genderList);
|
||||
break;
|
||||
|
||||
case "pageNum":
|
||||
case "pageSize":
|
||||
// 忽略分页参数
|
||||
break;
|
||||
case "pageNum": case "pageSize": case "exportIds": case "visibleColumns":
|
||||
break; // 忽略这些非数据库实体的字段
|
||||
default:
|
||||
// 自定义参数
|
||||
customParams.put(key, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 调用Service获取数据
|
||||
// 3. 获取数据并执行行过滤
|
||||
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile);
|
||||
if (StringUtils.isNotBlank(exportIdsStr)) {
|
||||
List<String> exportIdList = Arrays.asList(exportIdsStr.split(","));
|
||||
list = list.stream()
|
||||
.filter(item -> exportIdList.contains(String.valueOf(item.getId())))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
}
|
||||
|
||||
// 使用若依框架的Excel工具类导出
|
||||
// 4. 执行列过滤
|
||||
ExcelUtil<SheepFile> util = new ExcelUtil<>(SheepFile.class);
|
||||
|
||||
if (StringUtils.isNotBlank(visibleColumnsStr)) {
|
||||
// 清理字符串可能的空格并转为List
|
||||
List<String> visibleColumns = Arrays.asList(visibleColumnsStr.split("\\s*,\\s*"));
|
||||
List<String> colsToHide = new ArrayList<>();
|
||||
|
||||
Class<?> clazz = SheepFile.class;
|
||||
while (clazz != null) {
|
||||
for (java.lang.reflect.Field field : clazz.getDeclaredFields()) {
|
||||
if (field.isAnnotationPresent(com.zhyc.common.annotation.Excel.class)) {
|
||||
if (!visibleColumns.contains(field.getName())) {
|
||||
colsToHide.add(field.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
|
||||
// 【核心修复】一次性把所有的字段数组传进去,规避若依底层循环覆盖的 Bug
|
||||
if (!colsToHide.isEmpty()) {
|
||||
util.hideColumn(colsToHide.toArray(new String[0]));
|
||||
}
|
||||
}
|
||||
|
||||
util.exportExcel(response, list, "羊只档案数据");
|
||||
}
|
||||
|
||||
|
||||
@@ -189,4 +189,11 @@ public class BasSheep extends BaseEntity
|
||||
private Long isDelete;
|
||||
|
||||
|
||||
/** 用户编号 */
|
||||
private Long userId;
|
||||
|
||||
/** 部门编号 */
|
||||
private Long deptId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -42,4 +42,24 @@ public class BasSheepGroup extends TreeEntity
|
||||
|
||||
private Integer isLeaf;
|
||||
|
||||
// 新增数据隔离字段
|
||||
/** 用户编号 */
|
||||
private Long userId;
|
||||
|
||||
/** 部门编号 */
|
||||
private Long deptId;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -121,4 +121,26 @@ public class DaSheepfold extends BaseEntity
|
||||
private Integer totalSheepCount;
|
||||
|
||||
|
||||
// 👇 新增数据隔离字段
|
||||
/** 用户编号 */
|
||||
private Long userId;
|
||||
|
||||
/** 部门编号 */
|
||||
private Long deptId;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,4 +319,10 @@ public class SheepFile extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
/** 用户编号 */
|
||||
private Long userId;
|
||||
|
||||
/** 部门编号 */
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.exception.ServiceException;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.base.domain.BasSheepGroup;
|
||||
@@ -45,6 +46,7 @@ public class BasSheepGroupServiceImpl implements IBasSheepGroupService
|
||||
// {
|
||||
// return basSheepGroupMapper.selectBasSheepGroupList(basSheepGroup);
|
||||
// }
|
||||
@DataScope(deptAlias = "g", userAlias = "g")
|
||||
@Override
|
||||
public List<BasSheepGroup> selectBasSheepGroupList(BasSheepGroup basSheepGroup) {
|
||||
List<BasSheepGroup> groups = basSheepGroupMapper.selectBasSheepGroupList(basSheepGroup);
|
||||
@@ -122,6 +124,7 @@ public class BasSheepGroupServiceImpl implements IBasSheepGroupService
|
||||
return basSheepGroupMapper.deleteBasSheepGroupByGroupId(groupId);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "g", userAlias = "g")
|
||||
@Override
|
||||
public List<BasSheepGroup> selectLeafNodes() {
|
||||
List<BasSheepGroup> leafNodes = basSheepGroupMapper.selectLeafNodes();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
@@ -50,6 +51,7 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
* @param daSheepfold 羊舍管理
|
||||
* @return 羊舍管理
|
||||
*/
|
||||
@DataScope(deptAlias = "ds", userAlias = "ds")
|
||||
@Override
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold)
|
||||
{
|
||||
@@ -60,6 +62,7 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
@DataScope(deptAlias = "ds", userAlias = "ds")
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold) {
|
||||
return daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
// 新增这一行导入
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.base.domain.BreedRamFile;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||
@@ -38,6 +40,7 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
/**
|
||||
* 查询羊只档案列表
|
||||
*/
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<SheepFile> selectSheepFileList(SheepFile sheepFile) {
|
||||
return sheepFileMapper.selectSheepFileList(sheepFile);
|
||||
@@ -56,26 +59,31 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
return sheepFileMapper.selectSheepByManageTags(tags);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<Map<String, Object>> countBySheepType() {
|
||||
return sheepFileMapper.countBySheepType();
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<Map<String, Object>> countByBreedStatus() {
|
||||
return sheepFileMapper.countByBreedStatus();
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<Map<String, Object>> countByVariety() {
|
||||
return sheepFileMapper.countByVariety();
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<Map<String, Object>> countParityOfLactation() {
|
||||
return sheepFileMapper.countParityOfLactation();
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public Long countInGroup() { return sheepFileMapper.countInGroup(); }
|
||||
|
||||
@@ -100,6 +108,7 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
* 必须调用 Mapper 中对应的 XML 方法 (selectSheepFileListByCondition)
|
||||
* 并且传递 sheepFile 对象以启用 <foreach> 列表查询
|
||||
*/
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<SheepFile> selectSheepFileListByCondition(Map<String, Object> params, SheepFile sheepFile) {
|
||||
// 1. 验证并处理自定义参数 (驼峰转下划线、安全检查)
|
||||
|
||||
@@ -84,6 +84,9 @@ public class DdSaleController extends BaseController {
|
||||
@Log(title = "销售主单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DdSale ddSale) {
|
||||
// 适配数据分离
|
||||
ddSale.setDeptId(getDeptId());
|
||||
ddSale.setUserId(getUserId());
|
||||
return toAjax(ddSaleService.insertDdSale(ddSale));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@ import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
@@ -15,6 +19,8 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
* @author HashMap
|
||||
* @date 2025-12-01
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class DdSale extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -59,119 +65,11 @@ public class DdSale extends BaseEntity
|
||||
@Excel(name = "技术员")
|
||||
private String tech;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/** 销售明细信息 */
|
||||
private List<DdSaleItem> ddSaleItemList;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setSaleDate(Date saleDate)
|
||||
{
|
||||
this.saleDate = saleDate;
|
||||
}
|
||||
|
||||
public Date getSaleDate()
|
||||
{
|
||||
return saleDate;
|
||||
}
|
||||
|
||||
public void setCustName(String custName)
|
||||
{
|
||||
this.custName = custName;
|
||||
}
|
||||
|
||||
public String getCustName()
|
||||
{
|
||||
return custName;
|
||||
}
|
||||
|
||||
public void setCustPhone(String custPhone)
|
||||
{
|
||||
this.custPhone = custPhone;
|
||||
}
|
||||
|
||||
public String getCustPhone()
|
||||
{
|
||||
return custPhone;
|
||||
}
|
||||
|
||||
public void setCustAddr(String custAddr)
|
||||
{
|
||||
this.custAddr = custAddr;
|
||||
}
|
||||
|
||||
public String getCustAddr()
|
||||
{
|
||||
return custAddr;
|
||||
}
|
||||
|
||||
public void setSalesper(String salesper)
|
||||
{
|
||||
this.salesper = salesper;
|
||||
}
|
||||
|
||||
public String getSalesper()
|
||||
{
|
||||
return salesper;
|
||||
}
|
||||
|
||||
public void setQuaranNo(String quaranNo)
|
||||
{
|
||||
this.quaranNo = quaranNo;
|
||||
}
|
||||
|
||||
public String getQuaranNo()
|
||||
{
|
||||
return quaranNo;
|
||||
}
|
||||
|
||||
public void setApprNo(String apprNo)
|
||||
{
|
||||
this.apprNo = apprNo;
|
||||
}
|
||||
|
||||
public String getApprNo()
|
||||
{
|
||||
return apprNo;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setTech(String tech)
|
||||
{
|
||||
this.tech = tech;
|
||||
}
|
||||
|
||||
public String getTech()
|
||||
{
|
||||
return tech;
|
||||
}
|
||||
|
||||
public List<DdSaleItem> getDdSaleItemList()
|
||||
{
|
||||
return ddSaleItemList;
|
||||
}
|
||||
|
||||
public void setDdSaleItemList(List<DdSaleItem> ddSaleItemList)
|
||||
{
|
||||
this.ddSaleItemList = ddSaleItemList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.frozen.service.impl;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.frozen.domain.DdFe;
|
||||
import com.zhyc.module.frozen.domain.DdFs;
|
||||
@@ -58,6 +59,7 @@ public class DdSaleServiceImpl implements IDdSaleService {
|
||||
* @return 销售主单
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "dd_sl_alias" , userAlias = "dd_sl_alias")
|
||||
public List<DdSale> selectDdSaleList(DdSale ddSale) {
|
||||
return ddSaleMapper.selectDdSaleList(ddSale);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
${params.dataScope}
|
||||
</where>ORDER BY g.group_id <!-- 确保正确排序 -->
|
||||
</select>
|
||||
|
||||
@@ -68,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE child.parent_id = g.group_id) > 0 THEN 0 ELSE 1 END) AS is_leaf
|
||||
FROM bas_sheep_group g
|
||||
WHERE g.status = '0'
|
||||
${params.dataScope}
|
||||
HAVING is_leaf = 1
|
||||
</select>
|
||||
|
||||
@@ -87,6 +89,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
@@ -97,6 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -251,6 +251,8 @@
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="manageTags != null">#{manageTags},</if>
|
||||
@@ -292,6 +294,8 @@
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
<where>
|
||||
<if test="ranchId != null ">and ds.ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldTypeId != null ">and ds.sheepfold_type_id = #{sheepfoldTypeId}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
-- 按羊舍维度分组(牧场+羊舍类型+羊舍编号 唯一标识一个羊舍)
|
||||
GROUP BY ds.ranch_id, ds.sheepfold_type_id, ds.sheepfold_no
|
||||
@@ -92,6 +93,7 @@
|
||||
<if test="ranchId != null ">and ds.ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldTypeId != null ">and ds.sheepfold_type_id = #{sheepfoldTypeId}</if>
|
||||
<if test="sheepfoldNo != null and sheepfoldNo != '' ">and ds.sheepfold_no = #{sheepfoldNo}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
GROUP BY ds.id,ds.ranch_id,ds.sheepfold_name,ds.sheepfold_type_id,ds.sheepfold_no,ds.row_no,ds.columns,ds.comment
|
||||
ORDER BY SUBSTRING_INDEX(ds.row_no, '-', 1), CAST(ds.columns AS UNSIGNED)
|
||||
@@ -112,6 +114,8 @@
|
||||
<if test="rowNo != null">row_no,</if>
|
||||
<if test="columns != null">columns,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ranchId != null">#{ranchId},</if>
|
||||
@@ -121,6 +125,8 @@
|
||||
<if test="rowNo != null">#{rowNo},</if>
|
||||
<if test="columns != null">#{columns},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
<if test="gender != null "> and gender = #{gender}</if>
|
||||
<if test="statusId != null "> and status_id = #{statusId}</if>
|
||||
<if test="breed != null and breed != ''"> and breed = #{breed}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
@@ -116,36 +117,49 @@
|
||||
</select>
|
||||
|
||||
<select id="countInGroup" resultType="java.lang.Long">
|
||||
SELECT COUNT(*) FROM sheep_file WHERE status_id = 1 AND (is_delete = 0 OR is_delete IS NULL)
|
||||
SELECT COUNT(*)
|
||||
FROM sheep_file sf
|
||||
WHERE sf.status_id = 1
|
||||
AND (sf.is_delete = 0 OR sf.is_delete IS NULL)
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="countBySheepType" resultType="java.util.Map">
|
||||
SELECT name AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1 AND (is_delete = 0 OR is_delete IS NULL)
|
||||
GROUP BY name
|
||||
SELECT sf.name AS name, COUNT(*) AS value
|
||||
FROM sheep_file sf
|
||||
WHERE sf.status_id = 1
|
||||
AND (sf.is_delete = 0 OR sf.is_delete IS NULL)
|
||||
${params.dataScope}
|
||||
GROUP BY sf.name
|
||||
</select>
|
||||
|
||||
<select id="countByBreedStatus" resultType="java.util.Map">
|
||||
SELECT breed AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1 AND (is_delete = 0 OR is_delete IS NULL)
|
||||
GROUP BY breed
|
||||
SELECT sf.breed AS name, COUNT(*) AS value
|
||||
FROM sheep_file sf
|
||||
WHERE sf.status_id = 1
|
||||
AND (sf.is_delete = 0 OR sf.is_delete IS NULL)
|
||||
${params.dataScope}
|
||||
GROUP BY sf.breed
|
||||
</select>
|
||||
|
||||
<select id="countByVariety" resultType="java.util.Map">
|
||||
SELECT variety AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1 AND (is_delete = 0 OR is_delete IS NULL)
|
||||
GROUP BY variety
|
||||
SELECT sf.variety AS name, COUNT(*) AS value
|
||||
FROM sheep_file sf
|
||||
WHERE sf.status_id = 1
|
||||
AND (sf.is_delete = 0 OR sf.is_delete IS NULL)
|
||||
${params.dataScope}
|
||||
GROUP BY sf.variety
|
||||
</select>
|
||||
|
||||
<select id="countParityOfLactation" resultType="java.util.Map">
|
||||
SELECT parity AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1 AND name = '泌乳羊' AND (is_delete = 0 OR is_delete IS NULL)
|
||||
GROUP BY parity
|
||||
ORDER BY parity
|
||||
SELECT sf.parity AS name, COUNT(*) AS value
|
||||
FROM sheep_file sf
|
||||
WHERE sf.status_id = 1
|
||||
AND sf.name = '泌乳羊'
|
||||
AND (sf.is_delete = 0 OR sf.is_delete IS NULL)
|
||||
${params.dataScope}
|
||||
GROUP BY sf.parity
|
||||
ORDER BY sf.parity
|
||||
</select>
|
||||
|
||||
<select id="selectFieldValues" parameterType="String" resultType="String">
|
||||
@@ -268,6 +282,7 @@
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDdSaleVo">
|
||||
select id, sale_date, cust_name, cust_phone, cust_addr, salesper, quaran_no, appr_no, price, tech, remark, create_by, create_time from dd_sl
|
||||
select id, sale_date, cust_name, cust_phone, cust_addr, salesper, quaran_no, appr_no, price, tech, remark, create_by, create_time from dd_sl dd_sl_alias
|
||||
</sql>
|
||||
|
||||
<select id="selectDdSaleList" parameterType="DdSale" resultMap="DdSaleResult">
|
||||
@@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="apprNo != null and apprNo != ''"> and appr_no = #{apprNo}</if>
|
||||
<if test="price != null "> and price = #{price}</if>
|
||||
<if test="tech != null and tech != ''"> and tech = #{tech}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -83,6 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null">remark,</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="saleDate != null">#{saleDate},</if>
|
||||
@@ -97,6 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null">#{remark},</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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user