Compare commits

...

2 Commits

Author SHA1 Message Date
ll
e624f971de Merge remote-tracking branch 'origin/main' 2026-03-03 18:07:21 +08:00
ll
18f7808b67 羊只档案数据分离 2026-03-03 18:07:05 +08:00
6 changed files with 28 additions and 0 deletions

View File

@@ -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));
}

View File

@@ -189,4 +189,11 @@ public class BasSheep extends BaseEntity
private Long isDelete;
/** 用户编号 */
private Long userId;
/** 部门编号 */
private Long deptId;
}

View File

@@ -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;
}

View File

@@ -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);
@@ -100,6 +103,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. 验证并处理自定义参数 (驼峰转下划线、安全检查)

View File

@@ -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>

View File

@@ -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>
@@ -268,6 +269,7 @@
</if>
</foreach>
</if>
${params.dataScope}
</where>
ORDER BY id ASC
</select>