奶品管理数据分离修改
This commit is contained in:
@@ -23,8 +23,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 鲜奶生产,成品检验记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-18
|
||||
*/
|
||||
@RestController
|
||||
@@ -77,6 +76,11 @@ public class NpFreshMilkInspController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody NpFreshMilkInsp npFreshMilkInsp)
|
||||
{
|
||||
// === 修改开始:注入当前用户和部门ID ===
|
||||
npFreshMilkInsp.setUserId(getUserId());
|
||||
npFreshMilkInsp.setDeptId(getDeptId());
|
||||
// === 修改结束 ===
|
||||
|
||||
return toAjax(npFreshMilkInspService.insertNpFreshMilkInsp(npFreshMilkInsp));
|
||||
}
|
||||
|
||||
@@ -96,7 +100,7 @@ public class NpFreshMilkInspController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:remove')")
|
||||
@Log(title = "鲜奶生产,成品检验记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(npFreshMilkInspService.deleteNpFreshMilkInspByIds(ids));
|
||||
|
||||
@@ -28,11 +28,10 @@ public class NpMilkProdClassesController extends BaseController {
|
||||
public TableDataInfo list(
|
||||
@RequestParam(required = false) Date datetimeStart,
|
||||
@RequestParam(required = false) Date datetimeEnd,
|
||||
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号数组
|
||||
@RequestParam(required = false) List<String> allEarNumbers,
|
||||
@RequestParam(required = false) String factory,
|
||||
@RequestParam(required = false) Integer classes) {
|
||||
startPage();
|
||||
// 修改处:将参数封装进实体,以便 Service 和 Mapper 统一处理
|
||||
NpMilkProdClasses params = new NpMilkProdClasses();
|
||||
params.setAllEarNumbers(allEarNumbers);
|
||||
params.setFactory(factory);
|
||||
@@ -43,9 +42,6 @@ public class NpMilkProdClassesController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改处:新增耳号模糊查询接口
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:list')")
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
@@ -64,6 +60,16 @@ public class NpMilkProdClassesController extends BaseController {
|
||||
try {
|
||||
ExcelUtil<NpMilkProdClasses> util = new ExcelUtil<>(NpMilkProdClasses.class);
|
||||
List<NpMilkProdClasses> list = util.importExcel(file.getInputStream());
|
||||
|
||||
// === 修改开始:循环注入当前用户和部门ID ===
|
||||
Long userId = getUserId();
|
||||
Long deptId = getDeptId();
|
||||
for (NpMilkProdClasses item : list) {
|
||||
item.setUserId(userId);
|
||||
item.setDeptId(deptId);
|
||||
}
|
||||
// === 修改结束 ===
|
||||
|
||||
int rows = npMilkProdClassesService.importMilkProdClasses(list);
|
||||
return success("成功导入 " + rows + " 行数据");
|
||||
} catch (Exception e) {
|
||||
@@ -77,7 +83,7 @@ public class NpMilkProdClassesController extends BaseController {
|
||||
public void export(HttpServletResponse response,
|
||||
@RequestParam(required = false) Date datetimeStart,
|
||||
@RequestParam(required = false) Date datetimeEnd,
|
||||
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号
|
||||
@RequestParam(required = false) List<String> allEarNumbers,
|
||||
@RequestParam(required = false) String factory,
|
||||
@RequestParam(required = false) Integer classes) {
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生乳检验记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@RestController
|
||||
@@ -78,6 +77,11 @@ public class NpRawMilkInspeController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody NpRawMilkInspe npRawMilkInspe)
|
||||
{
|
||||
// === 修改开始:注入当前用户和部门ID ===
|
||||
npRawMilkInspe.setUserId(getUserId());
|
||||
npRawMilkInspe.setDeptId(getDeptId());
|
||||
// === 修改结束 ===
|
||||
|
||||
return toAjax(npRawMilkInspeService.insertNpRawMilkInspe(npRawMilkInspe));
|
||||
}
|
||||
|
||||
@@ -97,7 +101,7 @@ public class NpRawMilkInspeController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rawMilkTest:rawMilkTest:remove')")
|
||||
@Log(title = "生乳检验记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(npRawMilkInspeService.deleteNpRawMilkInspeByIds(ids));
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 酸奶生产,成品检疫记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
@RestController
|
||||
@@ -78,6 +77,11 @@ public class NpYogurtInspController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody NpYogurtInsp npYogurtInsp)
|
||||
{
|
||||
// === 修改开始:注入当前用户和部门ID ===
|
||||
npYogurtInsp.setUserId(getUserId());
|
||||
npYogurtInsp.setDeptId(getDeptId());
|
||||
// === 修改结束 ===
|
||||
|
||||
return toAjax(npYogurtInspService.insertNpYogurtInsp(npYogurtInsp));
|
||||
}
|
||||
|
||||
@@ -97,7 +101,7 @@ public class NpYogurtInspController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:remove')")
|
||||
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(npYogurtInspService.deleteNpYogurtInspByIds(ids));
|
||||
|
||||
@@ -23,8 +23,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 干物质校正Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
@RestController
|
||||
@@ -77,6 +76,9 @@ public class XzDryMatterCorrectionController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody XzDryMatterCorrection xzDryMatterCorrection)
|
||||
{
|
||||
// 自动填充用户ID和部门ID
|
||||
xzDryMatterCorrection.setUserId(getUserId());
|
||||
xzDryMatterCorrection.setDeptId(getDeptId());
|
||||
return toAjax(xzDryMatterCorrectionService.insertXzDryMatterCorrection(xzDryMatterCorrection));
|
||||
}
|
||||
|
||||
@@ -96,7 +98,7 @@ public class XzDryMatterCorrectionController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('dryMatterCorrection:dryMatterCorrection:remove')")
|
||||
@Log(title = "干物质校正", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(xzDryMatterCorrectionService.deleteXzDryMatterCorrectionByIds(ids));
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 称重校正Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
@RestController
|
||||
@@ -78,6 +77,9 @@ public class XzWegihCorrectionController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody XzWegihCorrection xzWegihCorrection)
|
||||
{
|
||||
// 自动填充用户ID和部门ID
|
||||
xzWegihCorrection.setUserId(getUserId());
|
||||
xzWegihCorrection.setDeptId(getDeptId());
|
||||
return toAjax(xzWegihCorrectionService.insertXzWegihCorrection(xzWegihCorrection));
|
||||
}
|
||||
|
||||
@@ -97,7 +99,7 @@ public class XzWegihCorrectionController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('weightCorrection:weightCorrection:remove')")
|
||||
@Log(title = "称重校正", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(xzWegihCorrectionService.deleteXzWegihCorrectionByIds(ids));
|
||||
|
||||
@@ -10,8 +10,7 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 鲜奶生产,成品检验记录对象 np_fresh_milk_insp
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-18
|
||||
*/
|
||||
@Data
|
||||
@@ -85,4 +84,12 @@ public class NpFreshMilkInsp extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String commnet;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
|
||||
@@ -65,6 +65,14 @@ public class NpMilkInOutStore extends BaseEntity {
|
||||
@Excel(name = "爱特退回酸奶")
|
||||
private BigDecimal returnYogurt;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
// --- getters and setters ---
|
||||
public Integer getId() { return id; }
|
||||
public void setId(Integer id) { this.id = id; }
|
||||
@@ -125,4 +133,10 @@ public class NpMilkInOutStore extends BaseEntity {
|
||||
|
||||
public BigDecimal getReturnYogurt() { return returnYogurt; }
|
||||
public void setReturnYogurt(BigDecimal returnYogurt) { this.returnYogurt = returnYogurt; }
|
||||
|
||||
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; }
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.zhyc.module.dairyProducts.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List; // 引入 List
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
|
||||
@@ -40,11 +40,19 @@ public class NpMilkProdClasses implements Serializable {
|
||||
|
||||
private String sheepId;
|
||||
|
||||
// 修改处:新增字段用于多耳号查询
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
// Getters and Setters
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
// --- Getters and Setters ---
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
@@ -88,4 +96,10 @@ public class NpMilkProdClasses implements Serializable {
|
||||
|
||||
public String getSheepId() { return sheepId; }
|
||||
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
|
||||
|
||||
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; }
|
||||
}
|
||||
@@ -451,4 +451,12 @@ public class NpRawMilkInspe extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
@@ -10,8 +10,7 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 酸奶生产,成品检疫记录对象 np_yogurt_insp
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
@Data
|
||||
@@ -42,7 +41,7 @@ public class NpYogurtInsp extends BaseEntity
|
||||
private Double protein;
|
||||
|
||||
/** 非脂g/100g
|
||||
*/
|
||||
*/
|
||||
@Excel(name = "非脂g/100g")
|
||||
private Double nonFat;
|
||||
|
||||
@@ -86,4 +85,12 @@ public class NpYogurtInsp extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
@@ -32,4 +32,9 @@ public class XzDryMatterCorrection extends BaseEntity {
|
||||
@Excel(name = "干物质系数")
|
||||
private Double coefficient;
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -45,5 +45,9 @@ public class XzWegihCorrection extends BaseEntity
|
||||
@Excel(name = "称重系数")
|
||||
private Double coefficient;
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -8,16 +8,49 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface NpMilkInOutStoreMapper {
|
||||
/**
|
||||
* 动态列查询
|
||||
*/
|
||||
List<Map<String,Object>> selectWithColumns(
|
||||
@Param("start") Date start, @Param("end") Date end,
|
||||
@Param("feedSources") List<String> feedSources,
|
||||
@Param("saleDestinations") List<String> saleDestinations
|
||||
);
|
||||
int insertStore(NpMilkInOutStore store);
|
||||
void insertFeedRecord(@Param("storeId") Integer storeId, @Param("source") String source, @Param("amount") java.math.BigDecimal amount);
|
||||
void insertSaleRecord(@Param("storeId") Integer storeId, @Param("destination") String dest, @Param("amount") java.math.BigDecimal amount);
|
||||
|
||||
/**
|
||||
* 插入主表
|
||||
*/
|
||||
int insertStore(NpMilkInOutStore store);
|
||||
|
||||
/**
|
||||
* 插入饲喂子表(已修正:增加 userId 和 deptId 参数)
|
||||
*/
|
||||
void insertFeedRecord(
|
||||
@Param("storeId") Integer storeId,
|
||||
@Param("source") String source,
|
||||
@Param("amount") java.math.BigDecimal amount,
|
||||
@Param("userId") Long userId,
|
||||
@Param("deptId") Long deptId
|
||||
);
|
||||
|
||||
/**
|
||||
* 插入销售子表(已修正:增加 userId 和 deptId 参数)
|
||||
*/
|
||||
void insertSaleRecord(
|
||||
@Param("storeId") Integer storeId,
|
||||
@Param("destination") String dest,
|
||||
@Param("amount") java.math.BigDecimal amount,
|
||||
@Param("userId") Long userId,
|
||||
@Param("deptId") Long deptId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取饲喂来源列表(用于动态列头)
|
||||
*/
|
||||
List<String> selectFeedSources();
|
||||
|
||||
/**
|
||||
* 获取销售去向列表(用于动态列头)
|
||||
*/
|
||||
List<String> selectSaleDestinations();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpFreshMilkInspMapper;
|
||||
@@ -10,8 +11,7 @@ import com.zhyc.module.dairyProducts.service.INpFreshMilkInspService;
|
||||
|
||||
/**
|
||||
* 鲜奶生产,成品检验记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-18
|
||||
*/
|
||||
@Service
|
||||
@@ -22,8 +22,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 查询鲜奶生产,成品检验记录
|
||||
*
|
||||
* @param id 鲜奶生产,成品检验记录主键
|
||||
* * @param id 鲜奶生产,成品检验记录主键
|
||||
* @return 鲜奶生产,成品检验记录
|
||||
*/
|
||||
@Override
|
||||
@@ -34,11 +33,11 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 查询鲜奶生产,成品检验记录列表
|
||||
*
|
||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* @return 鲜奶生产,成品检验记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "a", userAlias = "a")
|
||||
public List<NpFreshMilkInsp> selectNpFreshMilkInspList(NpFreshMilkInsp npFreshMilkInsp)
|
||||
{
|
||||
return npFreshMilkInspMapper.selectNpFreshMilkInspList(npFreshMilkInsp);
|
||||
@@ -46,8 +45,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 新增鲜奶生产,成品检验记录
|
||||
*
|
||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -59,8 +57,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 修改鲜奶生产,成品检验记录
|
||||
*
|
||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -71,8 +68,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 批量删除鲜奶生产,成品检验记录
|
||||
*
|
||||
* @param ids 需要删除的鲜奶生产,成品检验记录主键
|
||||
* * @param ids 需要删除的鲜奶生产,成品检验记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -83,8 +79,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 删除鲜奶生产,成品检验记录信息
|
||||
*
|
||||
* @param id 鲜奶生产,成品检验记录主键
|
||||
* * @param id 鲜奶生产,成品检验记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper;
|
||||
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
|
||||
@@ -19,6 +21,7 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
||||
private NpMilkInOutStoreMapper mapper;
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Map<String, Object>> selectWithDynamicColumns(Date start, Date end) {
|
||||
List<String> feed = mapper.selectFeedSources();
|
||||
List<String> sale = mapper.selectSaleDestinations();
|
||||
@@ -58,25 +61,46 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
||||
|
||||
@Override
|
||||
public void batchInsertFromRows(List<Map<String, Object>> rows) throws Exception {
|
||||
// === 修改开始:获取当前用户和部门ID ===
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Long deptId = SecurityUtils.getDeptId();
|
||||
// === 修改结束 ===
|
||||
|
||||
for (Map<String,Object> row : rows) {
|
||||
// 提取主表字段
|
||||
NpMilkInOutStore store = new NpMilkInOutStore();
|
||||
// 这里假设 Excel 中的"日期"格式是标准的 yyyy-MM-dd,如果格式不对可能会报错,建议加 try-catch 或格式化处理
|
||||
store.setDatetime(java.sql.Date.valueOf(row.get("日期").toString()));
|
||||
store.setNum(Integer.valueOf(row.get("羊数").toString()));
|
||||
// ... 设置其它固定字段 ...
|
||||
|
||||
// 手动填充其它主表字段,这里省略了具体的 get 调用,请根据您的 Excel 列名自行补充
|
||||
// store.setColostSheep(...);
|
||||
|
||||
// === 修改开始:给主表实体注入用户和部门ID ===
|
||||
store.setUserId(userId);
|
||||
store.setDeptId(deptId);
|
||||
// === 修改结束 ===
|
||||
|
||||
mapper.insertStore(store);
|
||||
Integer sid = store.getId();
|
||||
|
||||
// 其余列为动态饲喂或销售,根据字典决定分类:
|
||||
for (Map.Entry<String,Object> ent: row.entrySet()) {
|
||||
String col = ent.getKey();
|
||||
// 跳过固定列
|
||||
if (col.equals("日期") || col.equals("羊数") || col.equals("id")) continue;
|
||||
if (ent.getValue() == null || "".equals(ent.getValue().toString())) continue;
|
||||
|
||||
BigDecimal amt = new BigDecimal(ent.getValue().toString());
|
||||
|
||||
if (mapper.selectFeedSources().contains(col)) {
|
||||
mapper.insertFeedRecord(sid, col, amt);
|
||||
// === 修改开始:插入饲喂子表时传入 userId 和 deptId ===
|
||||
mapper.insertFeedRecord(sid, col, amt, userId, deptId);
|
||||
} else if (mapper.selectSaleDestinations().contains(col)) {
|
||||
mapper.insertSaleRecord(sid, col, amt);
|
||||
// === 修改开始:插入销售子表时传入 userId 和 deptId ===
|
||||
mapper.insertSaleRecord(sid, col, amt, userId, deptId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpMilkProdClassesMapper;
|
||||
import com.zhyc.module.dairyProducts.service.INpMilkProdClassesService;
|
||||
@@ -16,6 +17,7 @@ public class NpMilkProdClassesServiceImpl implements INpMilkProdClassesService {
|
||||
private NpMilkProdClassesMapper mapper;
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "mpc", userAlias = "mpc")
|
||||
public List<NpMilkProdClasses> selectNpMilkProdClassesList(NpMilkProdClasses npMilkProdClasses, Date datetimeStart, Date datetimeEnd) {
|
||||
// 修改处:传递实体对象
|
||||
return mapper.selectNpMilkProdClassesList(npMilkProdClasses, datetimeStart, datetimeEnd);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpRawMilkInspeMapper;
|
||||
@@ -10,8 +11,7 @@ import com.zhyc.module.dairyProducts.service.INpRawMilkInspeService;
|
||||
|
||||
/**
|
||||
* 生乳检验记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Service
|
||||
@@ -22,8 +22,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 查询生乳检验记录
|
||||
*
|
||||
* @param id 生乳检验记录主键
|
||||
* * @param id 生乳检验记录主键
|
||||
* @return 生乳检验记录
|
||||
*/
|
||||
@Override
|
||||
@@ -34,11 +33,11 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 查询生乳检验记录列表
|
||||
*
|
||||
* @param npRawMilkInspe 生乳检验记录
|
||||
* * @param npRawMilkInspe 生乳检验记录
|
||||
* @return 生乳检验记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "a", userAlias = "a")
|
||||
public List<NpRawMilkInspe> selectNpRawMilkInspeList(NpRawMilkInspe npRawMilkInspe)
|
||||
{
|
||||
return npRawMilkInspeMapper.selectNpRawMilkInspeList(npRawMilkInspe);
|
||||
@@ -46,8 +45,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 新增生乳检验记录
|
||||
*
|
||||
* @param npRawMilkInspe 生乳检验记录
|
||||
* * @param npRawMilkInspe 生乳检验记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -59,8 +57,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 修改生乳检验记录
|
||||
*
|
||||
* @param npRawMilkInspe 生乳检验记录
|
||||
* * @param npRawMilkInspe 生乳检验记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -71,8 +68,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 批量删除生乳检验记录
|
||||
*
|
||||
* @param ids 需要删除的生乳检验记录主键
|
||||
* * @param ids 需要删除的生乳检验记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -83,8 +79,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 删除生乳检验记录信息
|
||||
*
|
||||
* @param id 生乳检验记录主键
|
||||
* * @param id 生乳检验记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.dairyProducts.domain.NpYogurtInsp;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpYogurtInspMapper;
|
||||
import com.zhyc.module.dairyProducts.service.INpYogurtInspService;
|
||||
@@ -10,8 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 酸奶生产,成品检疫记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
@Service
|
||||
@@ -22,8 +22,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 查询酸奶生产,成品检疫记录
|
||||
*
|
||||
* @param id 酸奶生产,成品检疫记录主键
|
||||
* * @param id 酸奶生产,成品检疫记录主键
|
||||
* @return 酸奶生产,成品检疫记录
|
||||
*/
|
||||
@Override
|
||||
@@ -34,11 +33,11 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 查询酸奶生产,成品检疫记录列表
|
||||
*
|
||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* @return 酸奶生产,成品检疫记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "a", userAlias = "a")
|
||||
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp)
|
||||
{
|
||||
return npYogurtInspMapper.selectNpYogurtInspList(npYogurtInsp);
|
||||
@@ -46,8 +45,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 新增酸奶生产,成品检疫记录
|
||||
*
|
||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -59,8 +57,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 修改酸奶生产,成品检疫记录
|
||||
*
|
||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -71,8 +68,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 批量删除酸奶生产,成品检疫记录
|
||||
*
|
||||
* @param ids 需要删除的酸奶生产,成品检疫记录主键
|
||||
* * @param ids 需要删除的酸奶生产,成品检疫记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -83,8 +79,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 删除酸奶生产,成品检疫记录信息
|
||||
*
|
||||
* @param id 酸奶生产,成品检疫记录主键
|
||||
* * @param id 酸奶生产,成品检疫记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -6,11 +6,11 @@ import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.dairyProducts.mapper.XzDryMatterCorrectionMapper;
|
||||
import com.zhyc.module.dairyProducts.domain.XzDryMatterCorrection;
|
||||
import com.zhyc.module.dairyProducts.service.IXzDryMatterCorrectionService;
|
||||
import com.zhyc.common.annotation.DataScope; // 引入数据权限注解
|
||||
|
||||
/**
|
||||
* 干物质校正Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
@Service
|
||||
@@ -21,8 +21,7 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
||||
|
||||
/**
|
||||
* 查询干物质校正
|
||||
*
|
||||
* @param id 干物质校正主键
|
||||
* * @param id 干物质校正主键
|
||||
* @return 干物质校正
|
||||
*/
|
||||
@Override
|
||||
@@ -33,11 +32,11 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
||||
|
||||
/**
|
||||
* 查询干物质校正列表
|
||||
*
|
||||
* @param xzDryMatterCorrection 干物质校正
|
||||
* * @param xzDryMatterCorrection 干物质校正
|
||||
* @return 干物质校正
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "d") // 添加数据权限注解
|
||||
public List<XzDryMatterCorrection> selectXzDryMatterCorrectionList(XzDryMatterCorrection xzDryMatterCorrection)
|
||||
{
|
||||
return xzDryMatterCorrectionMapper.selectXzDryMatterCorrectionList(xzDryMatterCorrection);
|
||||
@@ -102,8 +101,7 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
||||
|
||||
/**
|
||||
* 批量删除干物质校正
|
||||
*
|
||||
* @param ids 需要删除的干物质校正主键
|
||||
* * @param ids 需要删除的干物质校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -114,8 +112,7 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
||||
|
||||
/**
|
||||
* 删除干物质校正信息
|
||||
*
|
||||
* @param id 干物质校正主键
|
||||
* * @param id 干物质校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -8,13 +8,13 @@ import com.zhyc.common.exception.ServiceException;
|
||||
import com.zhyc.module.dairyProducts.domain.XzWegihCorrection;
|
||||
import com.zhyc.module.dairyProducts.mapper.XzWegihCorrectionMapper;
|
||||
import com.zhyc.module.dairyProducts.service.IXzWegihCorrectionService;
|
||||
import com.zhyc.common.annotation.DataScope; // 引入数据权限注解
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 称重校正Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
@Service
|
||||
@@ -25,8 +25,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
||||
|
||||
/**
|
||||
* 查询称重校正
|
||||
*
|
||||
* @param id 称重校正主键
|
||||
* * @param id 称重校正主键
|
||||
* @return 称重校正
|
||||
*/
|
||||
@Override
|
||||
@@ -37,11 +36,11 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
||||
|
||||
/**
|
||||
* 查询称重校正列表
|
||||
*
|
||||
* @param xzWegihCorrection 称重校正
|
||||
* * @param xzWegihCorrection 称重校正
|
||||
* @return 称重校正
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "w", userAlias = "w") // 添加数据权限注解
|
||||
public List<XzWegihCorrection> selectXzWegihCorrectionList(XzWegihCorrection xzWegihCorrection)
|
||||
{
|
||||
return xzWegihCorrectionMapper.selectXzWegihCorrectionList(xzWegihCorrection);
|
||||
@@ -106,8 +105,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
||||
|
||||
/**
|
||||
* 批量删除称重校正
|
||||
*
|
||||
* @param ids 需要删除的称重校正主键
|
||||
* * @param ids 需要删除的称重校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -118,8 +116,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
||||
|
||||
/**
|
||||
* 删除称重校正信息
|
||||
*
|
||||
* @param id 称重校正主键
|
||||
* * @param id 称重校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
bacterial_colony_1, bacterial_colony_2, bacterial_colony_3,
|
||||
bacterial_colony_4, bacterial_colony_5, coli, lactoferrin,
|
||||
ig, commnet, create_by, create_time
|
||||
FROM np_fresh_milk_insp
|
||||
FROM np_fresh_milk_insp a
|
||||
</sql>
|
||||
|
||||
<select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult">
|
||||
@@ -46,6 +46,8 @@
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND datetime <= #{params.endTime}
|
||||
</if>
|
||||
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -74,6 +76,8 @@
|
||||
<if test="commnet != null">commnet,</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="source != null">#{source},</if>
|
||||
@@ -93,6 +97,8 @@
|
||||
<if test="commnet != null">#{commnet},</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>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper">
|
||||
<select id="selectWithColumns" resultType="map">
|
||||
SELECT s.datetime, s.num, s.colost_sheep, s.commercial_intake, s.anti_intake,
|
||||
@@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="start != null"> s.datetime >= #{start}</if>
|
||||
<if test="end != null"> AND s.datetime <= #{end}</if>
|
||||
|
||||
${params.dataScope}
|
||||
</where>
|
||||
GROUP BY s.id
|
||||
ORDER BY s.datetime
|
||||
@@ -32,27 +34,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
INSERT INTO np_milk_in_out_store(datetime, num, colost_sheep, commercial_intake, anti_intake,
|
||||
colost_intake, intake_total, commercial_test, colost_test, transfer_commercial,
|
||||
transfer_anti, transfer_colost, transfer_total, loss, stock_commercial,
|
||||
stock_anti, colost, return_fresh, return_yogurt)
|
||||
stock_anti, colost, return_fresh, return_yogurt, user_id, dept_id)
|
||||
VALUES (
|
||||
#{datetime}, #{num}, #{colostSheep}, #{commercialIntake}, #{antiIntake},
|
||||
#{colostIntake}, #{intakeTotal}, #{commercialTest}, #{colostTest},
|
||||
#{transferCommercial}, #{transferAnti}, #{transferColost}, #{transferTotal},
|
||||
#{loss}, #{stockCommercial}, #{stockAnti}, #{colost}, #{returnFresh}, #{returnYogurt}
|
||||
#{loss}, #{stockCommercial}, #{stockAnti}, #{colost}, #{returnFresh}, #{returnYogurt}, #{userId}, #{deptId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertFeedRecord">
|
||||
INSERT INTO np_milk_feed_records(store_id, source_id, amount)
|
||||
INSERT INTO np_milk_feed_records(store_id, source_id, amount, user_id, dept_id)
|
||||
VALUES(#{storeId},
|
||||
(SELECT id FROM np_milk_feed WHERE source_name = #{source}),
|
||||
#{amount})
|
||||
#{amount}, #{userId}, #{deptId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertSaleRecord">
|
||||
INSERT INTO np_milk_sale_records(store_id, destination_id, amount)
|
||||
INSERT INTO np_milk_sale_records(store_id, destination_id, amount, user_id, dept_id)
|
||||
VALUES(#{storeId},
|
||||
(SELECT id FROM np_milk_sale WHERE destination_name = #{destination}),
|
||||
#{amount})
|
||||
#{amount}, #{userId}, #{deptId})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -54,6 +54,8 @@
|
||||
<if test="npMilkProdClasses.classes != null">
|
||||
AND mpc.classes = #{npMilkProdClasses.classes}
|
||||
</if>
|
||||
|
||||
${npMilkProdClasses.params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -93,8 +95,8 @@
|
||||
</select>
|
||||
|
||||
<insert id="insertNpMilkProdClasses" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO np_milk_prod_classes (datetime, sheep_id, classes, milk, corrected_milk)
|
||||
VALUES (#{datetime}, #{sheepId}, #{classes}, #{milk}, #{correctedMilk})
|
||||
INSERT INTO np_milk_prod_classes (datetime, sheep_id, classes, milk, corrected_milk, user_id, dept_id)
|
||||
VALUES (#{datetime}, #{sheepId}, #{classes}, #{milk}, #{correctedMilk}, #{userId}, #{deptId})
|
||||
</insert>
|
||||
|
||||
<select id="selectSheepIdByManageEarNo" resultType="java.lang.String">
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
select id, datetime, source, freeze, density, fat, protein, non_fat, dry_matter,
|
||||
impurity, lactose, ash_content, acidity, ph, bacterial_colony, lactoferrin,
|
||||
ig, somatic_cell, usea, fat_ratio, comment, create_by, create_time
|
||||
from np_raw_milk_inspe
|
||||
from np_raw_milk_inspe a
|
||||
</sql>
|
||||
|
||||
<select id="selectNpRawMilkInspeList" parameterType="NpRawMilkInspe" resultMap="NpRawMilkInspeResult">
|
||||
@@ -47,6 +47,8 @@
|
||||
and datetime <= #{params.endTime}
|
||||
</if>
|
||||
<if test="source != null and source != ''"> and source like concat('%', #{source}, '%')</if>
|
||||
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -80,6 +82,8 @@
|
||||
<if test="comment != null">comment,</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="datetime != null">#{datetime},</if>
|
||||
@@ -104,6 +108,8 @@
|
||||
<if test="comment != null">#{comment},</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>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
acidity, bacterial_colony_1, bacterial_clony_2,
|
||||
bacterial_clony_3, bacterial_clony_4, bacterial_clony_5,
|
||||
yeast, mould, lacto, comment, create_by, create_time
|
||||
from np_yogurt_insp
|
||||
from np_yogurt_insp a
|
||||
</sql>
|
||||
|
||||
<select id="selectNpYogurtInspList" parameterType="NpYogurtInsp" resultMap="NpYogurtInspResult">
|
||||
@@ -45,6 +45,8 @@
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
and datetime <= #{params.endTime}
|
||||
</if>
|
||||
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -73,6 +75,8 @@
|
||||
<if test="comment != null">comment,</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="source != null">#{source},</if>
|
||||
@@ -92,6 +96,8 @@
|
||||
<if test="comment != null">#{comment},</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>
|
||||
|
||||
@@ -105,7 +111,7 @@
|
||||
<if test="nonFat != null">non_fat = #{nonFat},</if>
|
||||
<if test="acidity != null">acidity = #{acidity},</if>
|
||||
<if test="bacterialColony1 != null">bacterial_colony_1 = #{bacterialColony1},</if>
|
||||
<if test="bacterialClony2 != null">bacterial_clony_2 = #{bacterialClony2},</if>
|
||||
<if test="bacterialClony2 != null">bacterial_colony_2 = #{bacterialClony2},</if>
|
||||
<if test="bacterialClony3 != null">bacterial_clony_3 = #{bacterialClony3},</if>
|
||||
<if test="bacterialClony4 != null">bacterial_clony_4 = #{bacterialClony4},</if>
|
||||
<if test="bacterialClony5 != null">bacterial_clony_5 = #{bacterialClony5},</if>
|
||||
|
||||
@@ -11,51 +11,56 @@
|
||||
<result property="content" column="content"/>
|
||||
<result property="standard" column="standard"/>
|
||||
<result property="coefficient" column="coefficient"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXzDryMatterCorrectionVo">
|
||||
SELECT
|
||||
id,
|
||||
datetime,
|
||||
factory,
|
||||
content,
|
||||
COALESCE(standard, 18) as standard,
|
||||
d.id,
|
||||
d.datetime,
|
||||
d.factory,
|
||||
d.content,
|
||||
COALESCE(d.standard, 18) as standard,
|
||||
CASE
|
||||
WHEN standard = 0 OR standard IS NULL THEN NULL
|
||||
ELSE ROUND(content / standard, 2)
|
||||
END AS coefficient
|
||||
FROM xz_dry_matter_correction
|
||||
WHEN d.standard = 0 OR d.standard IS NULL THEN NULL
|
||||
ELSE ROUND(d.content / d.standard, 2)
|
||||
END AS coefficient,
|
||||
d.user_id,
|
||||
d.dept_id
|
||||
FROM xz_dry_matter_correction d
|
||||
</sql>
|
||||
|
||||
<select id="selectXzDryMatterCorrectionList" parameterType="XzDryMatterCorrection" resultMap="XzDryMatterCorrectionResult">
|
||||
<include refid="selectXzDryMatterCorrectionVo"/>
|
||||
<where>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
AND DATE_FORMAT(datetime, '%Y-%m') >= #{params.beginTime}
|
||||
AND DATE_FORMAT(d.datetime, '%Y-%m') >= #{params.beginTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND DATE_FORMAT(datetime, '%Y-%m') <= #{params.endTime}
|
||||
AND DATE_FORMAT(d.datetime, '%Y-%m') <= #{params.endTime}
|
||||
</if>
|
||||
<if test="factory != null and factory != ''">
|
||||
AND factory = #{factory}
|
||||
AND d.factory = #{factory}
|
||||
</if>
|
||||
AND (standard IS NULL OR standard != 0)
|
||||
AND (d.standard IS NULL OR d.standard != 0)
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
ORDER BY d.datetime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectXzDryMatterCorrectionById" parameterType="Long" resultMap="XzDryMatterCorrectionResult">
|
||||
<include refid="selectXzDryMatterCorrectionVo"/>
|
||||
WHERE id = #{id}
|
||||
WHERE d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertXzDryMatterCorrection" parameterType="XzDryMatterCorrection" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO xz_dry_matter_correction
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
datetime, factory, content, standard
|
||||
datetime, factory, content, standard, user_id, dept_id
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
#{datetime}, #{factory}, #{content}, #{standard}
|
||||
#{datetime}, #{factory}, #{content}, #{standard}, #{userId}, #{deptId}
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -11,38 +11,44 @@
|
||||
<result property="actual" column="actual" />
|
||||
<result property="systemMilk" column="system_milk" />
|
||||
<result property="coefficient" column="coefficient" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXzWegihCorrectionVo">
|
||||
select
|
||||
id,
|
||||
datetime,
|
||||
factory,
|
||||
actual,
|
||||
system_milk,
|
||||
w.id,
|
||||
w.datetime,
|
||||
w.factory,
|
||||
w.actual,
|
||||
w.system_milk,
|
||||
CASE
|
||||
WHEN system_milk = 0 THEN 0
|
||||
ELSE ROUND(actual / system_milk, 4)
|
||||
END as coefficient
|
||||
from xz_wegih_correction
|
||||
WHEN w.system_milk = 0 THEN 0
|
||||
ELSE ROUND(w.actual / w.system_milk, 4)
|
||||
END as coefficient,
|
||||
w.user_id,
|
||||
w.dept_id
|
||||
from xz_wegih_correction w
|
||||
</sql>
|
||||
|
||||
<select id="selectXzWegihCorrectionList" parameterType="XzWegihCorrection" resultMap="XzWegihCorrectionResult">
|
||||
<include refid="selectXzWegihCorrectionVo"/>
|
||||
<where>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
and datetime >= #{params.beginTime}
|
||||
and w.datetime >= #{params.beginTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
and datetime <= #{params.endTime}
|
||||
and w.datetime <= #{params.endTime}
|
||||
</if>
|
||||
<if test="factory != null and factory != ''"> and factory = #{factory}</if>
|
||||
<if test="factory != null and factory != ''"> and w.factory = #{factory}</if>
|
||||
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectXzWegihCorrectionById" parameterType="Long" resultMap="XzWegihCorrectionResult">
|
||||
<include refid="selectXzWegihCorrectionVo"/>
|
||||
where id = #{id}
|
||||
where w.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertXzWegihCorrection" parameterType="XzWegihCorrection" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -52,12 +58,14 @@
|
||||
<if test="factory != null">factory,</if>
|
||||
<if test="actual != null">actual,</if>
|
||||
<if test="systemMilk != null">system_milk,</if>
|
||||
user_id, dept_id
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="factory != null">#{factory},</if>
|
||||
<if test="actual != null">#{actual},</if>
|
||||
<if test="systemMilk != null">#{systemMilk},</if>
|
||||
#{userId}, #{deptId}
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user