From 45c3b7aacf3d20e1915e597152ad30a3b40377a2 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期一, 28 七月 2025 13:11:34 +0800
Subject: [PATCH] 修改小程序考试,新增项目管理
---
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ItemServiceImpl.java | 84 ++++++++++
multi-system/src/main/java/com/gkhy/exam/system/domain/ExExamRecord.java | 12 -
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java | 1
multi-system/src/main/java/com/gkhy/exam/system/service/ItemService.java | 19 ++
multi-system/src/main/java/com/gkhy/exam/system/mapper/ItemMapper.java | 23 ++
multi-system/src/main/java/com/gkhy/exam/system/domain/ItemUser.java | 37 ++++
multi-system/src/main/resources/mapper/system/ExExamRecordMapper.xml | 5
multi-system/src/main/resources/mapper/system/ProductItemMapper.xml | 16 +
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java | 22 ++
multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java | 8 +
multi-system/src/main/resources/mapper/system/ItemMapper.xml | 71 ++++++++
multi-system/src/main/java/com/gkhy/exam/system/domain/Item.java | 54 ++++++
multi-system/src/main/java/com/gkhy/exam/system/domain/req/ItemReq.java | 9 +
multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java | 59 +++++++
multi-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml | 2
15 files changed, 407 insertions(+), 15 deletions(-)
diff --git a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java
index 2f6dde6..e3bf6c3 100644
--- a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java
+++ b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java
@@ -37,6 +37,9 @@
@Autowired
private ProductItemService productItemService;
+ @Autowired
+ private ItemService itemService;
+
/**
* 质量目标列表
@@ -394,6 +397,62 @@
return productItemService.deletedProductItem(itemId);
}
+ /**
+ * 项目列表
+ * @param item
+ * @return
+ */
+ @ApiOperation(value = "项目列表(分页)")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
+ @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
+ })
+ @GetMapping("/item/list")
+ public CommonResult listitem(Item item){
+ return CommonResult.success(itemService.selectItemList(item));
+ }
+
+
+ @ApiOperation(value = "项目列表")
+ @GetMapping("/item/listAll")
+ public CommonResult allListItem(ItemReq itemReq){
+ return itemService.selectItemListAll(itemReq);
+ }
+
+
+ /**
+ * 项目新增
+ * @param item
+ * @return
+ */
+ @ApiOperation(value = "项目新增")
+ @PostMapping("/item/insert")
+ public CommonResult insertItem(@RequestBody Item item){
+ return itemService.insertItem(item);
+ }
+
+ /**
+ * 项目修改
+ * @param item
+ * @return
+ */
+ @ApiOperation(value = "项目修改")
+ @PostMapping("/item/update")
+ public CommonResult updateItem(@RequestBody Item item){
+ return itemService.updateItem(item);
+ }
+
+ /**
+ * 项目删除
+ * @param itemId
+ * @return
+ */
+ @ApiOperation(value = "项目删除")
+ @GetMapping("/item/deleted")
+ public CommonResult deletedItem(@RequestParam("itemId") Integer itemId){
+ return itemService.deletedItem(itemId);
+ }
+
}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/ExExamRecord.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/ExExamRecord.java
index 5e58c40..a9e40ea 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/domain/ExExamRecord.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/ExExamRecord.java
@@ -46,7 +46,7 @@
@NotNull(message = "学员id不能为空")
@ApiModelProperty(value = "学员id",required = true)
@TableField("student_id")
- private Long studentId;
+ private String studentId;
@NotBlank(message = "计划名称不能为空")
@ApiModelProperty(value = "计划名称",required = true)
@@ -63,22 +63,18 @@
@TableField("level")
private Integer level;
- @NotNull(message = "要求课时不能为空")
- @ApiModelProperty(value = "要求课时(分)",required = true)
+ @ApiModelProperty(value = "要求课时(分)")
@TableField("period")
private Integer period;
- @NotNull(message = "实际课时不能为空")
- @ApiModelProperty(value = "实际课时(分)",required = true)
+ @ApiModelProperty(value = "实际课时(分)")
@TableField("actual_period")
private Integer actualPeriod;
- @NotNull(message = "考试成绩不能为空")
@ApiModelProperty("考试成绩")
@TableField("score")
private Integer score;
- @NotNull(message = "是否合格不能为空")
@ApiModelProperty("是否合格,0不合格 1合格 默认0")
@TableField("passed")
private Integer passed;
@@ -110,7 +106,7 @@
@ApiModelProperty("学生对象")
@TableField(exist = false)
- private ExStudent student;
+ private List<ExStudent> students;
@ApiModelProperty("培训记录文件")
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/Item.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/Item.java
new file mode 100644
index 0000000..b298981
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/Item.java
@@ -0,0 +1,54 @@
+package com.gkhy.exam.system.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.gkhy.exam.common.domain.entity.SysUser;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+
+@Data
+@TableName("item")
+@ApiModel(value = "Item对象", description = "项目类")
+public class Item implements Serializable {
+
+ @ApiModelProperty("主键")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @ApiModelProperty(value = "企业id")
+ @TableField("company_id")
+ private Long companyId;
+
+ @ApiModelProperty(value = "项目名称")
+ @TableField("item_name")
+ private String itemName;
+
+ @TableField("del_flag")
+ private Integer delFlag;
+
+ @TableField("create_by")
+ private String createBy;
+
+ @TableField("create_time")
+ private LocalDateTime createTime;
+
+ @TableField("update_by")
+ private String updateBy;
+
+ @TableField("update_time")
+ private LocalDateTime updateTime;
+
+ @TableField(exist = false)
+ private List<ItemUser> users;
+
+
+
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/ItemUser.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/ItemUser.java
new file mode 100644
index 0000000..a2ca65a
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/ItemUser.java
@@ -0,0 +1,37 @@
+package com.gkhy.exam.system.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@TableName("item_user")
+@ApiModel(value = "ItemUser对象", description = "项目类")
+public class ItemUser implements Serializable {
+
+
+ @ApiModelProperty("主键")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @ApiModelProperty(value = "项目id")
+ @TableField("item_id")
+ private Integer itemId;
+
+ @ApiModelProperty(value = "用户id")
+ @TableField("user_id")
+ private Long userId;
+
+ @ApiModelProperty(value = "用户姓名")
+ @TableField("user_name")
+ private String userName;
+
+ @TableField("del_flag")
+ private Integer delFlag;
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java
index 69d1714..8a77d27 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java
@@ -31,6 +31,14 @@
@TableField(exist = false)
private String companyName;
+ @ApiModelProperty(value = "项目id")
+ @TableField("item_id")
+ private Integer itemId;
+ @TableField(exist = false)
+ private String itemName;
+ @TableField(exist = false)
+ private Long userId;
+
@ApiModelProperty(value = "文件编号")
@TableField("number")
private String number;
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/req/ItemReq.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/req/ItemReq.java
new file mode 100644
index 0000000..de4a898
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/req/ItemReq.java
@@ -0,0 +1,9 @@
+package com.gkhy.exam.system.domain.req;
+
+import lombok.Data;
+
+@Data
+public class ItemReq {
+ private Integer companyId;
+ private Integer userId;
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/mapper/ItemMapper.java b/multi-system/src/main/java/com/gkhy/exam/system/mapper/ItemMapper.java
new file mode 100644
index 0000000..cee1506
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/mapper/ItemMapper.java
@@ -0,0 +1,23 @@
+package com.gkhy.exam.system.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gkhy.exam.system.domain.Item;
+import com.gkhy.exam.system.domain.ItemUser;
+import com.gkhy.exam.system.domain.req.ItemReq;
+import org.apache.ibatis.annotations.Param;
+import org.mapstruct.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface ItemMapper extends BaseMapper<Item> {
+ List<Item> selectItemList(Item item);
+
+ void insertItemUser(@Param("users") List<ItemUser> users);
+
+ void deleteItemUser(@Param("id") Integer id);
+
+ List<Item> selectItemListAll(ItemReq itemReq);
+
+ List<ItemUser> selectItemUser(@Param("itemId") Integer id);
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/ItemService.java b/multi-system/src/main/java/com/gkhy/exam/system/service/ItemService.java
new file mode 100644
index 0000000..0c00839
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/ItemService.java
@@ -0,0 +1,19 @@
+package com.gkhy.exam.system.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gkhy.exam.common.api.CommonPage;
+import com.gkhy.exam.common.api.CommonResult;
+import com.gkhy.exam.system.domain.Item;
+import com.gkhy.exam.system.domain.req.ItemReq;
+
+public interface ItemService extends IService<Item> {
+ CommonPage selectItemList(Item item);
+
+ CommonResult insertItem(Item item);
+
+ CommonResult updateItem(Item item);
+
+ CommonResult deletedItem(Integer itemId);
+
+ CommonResult selectItemListAll(ItemReq itemReq);
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
index 114bc30..a95b013 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
@@ -8,13 +8,17 @@
import com.gkhy.exam.common.utils.PageUtils;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.ExExamRecord;
+import com.gkhy.exam.system.domain.ExStudent;
import com.gkhy.exam.system.domain.RecordFile;
import com.gkhy.exam.system.mapper.ExExamRecordMapper;
+import com.gkhy.exam.system.mapper.ExStudentMapper;
import com.gkhy.exam.system.service.ExExamRecordService;
import org.ehcache.core.util.CollectionUtil;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -29,6 +33,10 @@
public class ExExamRecordServiceImpl extends ServiceImpl<ExExamRecordMapper, ExExamRecord> implements ExExamRecordService {
+ @Autowired
+ private ExStudentMapper studentMapper;
+
+
@Override
public CommonPage selectExamRecordList(ExExamRecord examRecord) {
SysUser user= SecurityUtils.getLoginUser().getUser();
@@ -40,6 +48,13 @@
for (ExExamRecord exExamRecord : recordList) {
List<RecordFile> recordFiles = baseMapper.selectFiles(exExamRecord.getId());
exExamRecord.setFiles(recordFiles);
+ List<ExStudent> exStudents = new ArrayList<>();
+ String[] split = exExamRecord.getStudentId().split(",");
+ for (String studentId : split) {
+ ExStudent exStudent = studentMapper.selectStudentById(Long.valueOf(studentId));
+ exStudents.add(exStudent);
+ }
+ exExamRecord.setStudents(exStudents);
}
return CommonPage.restPage(recordList);
}
@@ -49,6 +64,13 @@
ExExamRecord exExamRecord = baseMapper.selectExamRecordById(recordId);
List<RecordFile> recordFiles = baseMapper.selectFiles(exExamRecord.getId());
exExamRecord.setFiles(recordFiles);
+ List<ExStudent> exStudents = new ArrayList<>();
+ String[] split = exExamRecord.getStudentId().split(",");
+ for (String studentId : split) {
+ ExStudent exStudent = studentMapper.selectStudentById(Long.valueOf(studentId));
+ exStudents.add(exStudent);
+ }
+ exExamRecord.setStudents(exStudents);
return exExamRecord;
}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ItemServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ItemServiceImpl.java
new file mode 100644
index 0000000..6262a91
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ItemServiceImpl.java
@@ -0,0 +1,84 @@
+package com.gkhy.exam.system.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gkhy.exam.common.api.CommonPage;
+import com.gkhy.exam.common.api.CommonResult;
+import com.gkhy.exam.common.domain.entity.SysUser;
+import com.gkhy.exam.common.utils.PageUtils;
+import com.gkhy.exam.common.utils.SecurityUtils;
+import com.gkhy.exam.system.domain.Item;
+import com.gkhy.exam.system.domain.ItemUser;
+import com.gkhy.exam.system.domain.req.ItemReq;
+import com.gkhy.exam.system.mapper.ItemMapper;
+import com.gkhy.exam.system.service.ItemService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+
+@Service
+public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements ItemService {
+ @Autowired
+ private ItemMapper itemMapper;
+
+ @Override
+ public CommonPage selectItemList(Item item) {
+ PageUtils.startPage();
+ List<Item> items = itemMapper.selectItemList(item);
+ for (Item item1 : items) {
+ List<ItemUser> itemUsers = itemMapper.selectItemUser(item1.getId());
+ item1.setUsers(itemUsers);
+ }
+ return CommonPage.restPage(items);
+ }
+
+ @Override
+ public CommonResult insertItem(Item item) {
+ item.setCreateBy(SecurityUtils.getUsername());
+ item.setCreateTime(LocalDateTime.now());
+ itemMapper.insert(item);
+ List<ItemUser> users = item.getUsers();
+ for (ItemUser user : users) {
+ user.setItemId(item.getId());
+ }
+ itemMapper.insertItemUser(users);
+ return CommonResult.success();
+ }
+
+ @Override
+ public CommonResult updateItem(Item item) {
+ item.setUpdateBy(SecurityUtils.getUsername());
+ item.setUpdateTime(LocalDateTime.now());
+ itemMapper.updateById(item);
+ List<ItemUser> users = item.getUsers();
+ itemMapper.deleteItemUser(item.getId());
+ for (ItemUser user : users) {
+ user.setItemId(item.getId());
+ }
+ itemMapper.insertItemUser(users);
+ return CommonResult.success();
+ }
+
+ @Override
+ public CommonResult deletedItem(Integer itemId) {
+ Item item = new Item();
+ item.setId(itemId);
+ item.setUpdateBy(SecurityUtils.getUsername());
+ item.setUpdateTime(LocalDateTime.now());
+ item.setDelFlag(2);
+ itemMapper.updateById(item);
+ return CommonResult.success();
+ }
+
+ @Override
+ public CommonResult selectItemListAll(ItemReq itemReq) {
+ List<Item> items = itemMapper.selectItemListAll(itemReq);
+ for (Item item1 : items) {
+ List<ItemUser> itemUsers = itemMapper.selectItemUser(item1.getId());
+ item1.setUsers(itemUsers);
+ }
+ return CommonResult.success(items);
+ }
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java
index eaf3996..5aec97b 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java
@@ -27,6 +27,7 @@
if (productItem.getCompanyId()==null){
throw new ApiException("非管理员操作,企业id不可为空");
}
+ productItem.setUserId(SecurityUtils.getUserId());
}
PageUtils.startPage();
List<ProductItem> productItems = productItemMapper.selectProductItemList(productItem);
diff --git a/multi-system/src/main/resources/mapper/system/ExExamRecordMapper.xml b/multi-system/src/main/resources/mapper/system/ExExamRecordMapper.xml
index 4aba8f6..415f199 100644
--- a/multi-system/src/main/resources/mapper/system/ExExamRecordMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/ExExamRecordMapper.xml
@@ -19,7 +19,6 @@
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="companyName" column="company_name" />
- <association property="student" javaType="com.gkhy.exam.system.domain.ExStudent" resultMap="exStudentResult" />
</resultMap>
<resultMap id="exStudentResult" type="com.gkhy.exam.system.domain.ExStudent">
@@ -31,11 +30,9 @@
<sql id="selectExamRecordVo">
select a.id, a.company_id, a.student_id, a.plan_name, a.course_name,a.level,a.period,a.actual_period,a.score,
- a.passed, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as company_name,
- c.name as student_name,c.id_no as student_idno,c.phone as student_phone
+ a.passed, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as company_name
from ex_exam_record a
left join sys_company b on b.id=a.company_id
- left join ex_student c on c.id=a.student_id
</sql>
<insert id="insertFile">
INSERT INTO `record_file`
diff --git a/multi-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml b/multi-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
index d38ff0b..6b69ff5 100644
--- a/multi-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/ExPaperStudentMapper.xml
@@ -123,7 +123,7 @@
</select>
<select id="selectPaperStudentList" resultMap="SimplePaperStudentResult">
- select a.*,e.name as create_name,b.phone as student_phone,b.name as student_name,c.name as paper_name,c.code as paper_code,c.limited,c.limit_time,c.deadline,d.name as category_name
+ select a.*,c.create_by as create_name,b.phone as student_phone,b.name as student_name,c.name as paper_name,c.code as paper_code,c.limited,c.limit_time,c.deadline,d.name as category_name
<if test="studentId!=null">
,(select question_id from ex_student_answer where paper_id=a.paper_id and student_id=#{studentId} order by id desc limit 1) as question_id
</if>
diff --git a/multi-system/src/main/resources/mapper/system/ItemMapper.xml b/multi-system/src/main/resources/mapper/system/ItemMapper.xml
new file mode 100644
index 0000000..3d6341e
--- /dev/null
+++ b/multi-system/src/main/resources/mapper/system/ItemMapper.xml
@@ -0,0 +1,71 @@
+<?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.gkhy.exam.system.mapper.ItemMapper">
+ <insert id="insertItemUser">
+ INSERT INTO `item_user` ( `item_id`, `user_id`, `user_name`)
+ VALUES
+ <foreach collection="users" item="item" separator=",">
+ ( #{item.itemId}, #{item.userId}, #{item.userName} )
+ </foreach>
+
+ </insert>
+ <delete id="deleteItemUser">
+ delete from item_user where item_id =#{id}
+ </delete>
+
+
+ <select id="selectItemList" resultType="com.gkhy.exam.system.domain.Item">
+ SELECT
+ `id`,
+ `company_id`,
+ `item_name`,
+ `del_flag`,
+ `create_by`,
+ `create_time`,
+ `update_by`,
+ `update_time`
+ FROM
+ `item`
+ where del_flag = 1
+ <if test="companyId!=null">
+ and company_id = #{companyId}
+ </if>
+ </select>
+ <select id="selectItemListAll" resultType="com.gkhy.exam.system.domain.Item">
+ SELECT
+ i.`id`,
+ i.`company_id`,
+ i.`item_name`,
+ i.`del_flag`,
+ i.`create_by`,
+ i.`create_time`,
+ i.`update_by`,
+ i.`update_time`
+ FROM
+ `item` i
+ LEFT JOIN item_user iu ON i.id = iu.item_id
+ WHERE
+ i.del_flag = 1
+ <if test="companyId!=null">
+ and i.company_id = #{companyId}
+ </if>
+ <if test="userId!=null">
+ and iu.user_id = #{userId}
+ </if>
+ GROUP BY
+ i.id
+
+ </select>
+ <select id="selectItemUser" resultType="com.gkhy.exam.system.domain.ItemUser">
+ SELECT
+ iu.`id`,
+ iu.`item_id`,
+ iu.`user_id`,
+ su.`name` as user_name,
+ iu.`del_flag`
+ FROM
+ `item_user` iu
+ left join sys_user su on iu.user_id = su.id
+ where item_id = #{itemId}
+ </select>
+</mapper>
diff --git a/multi-system/src/main/resources/mapper/system/ProductItemMapper.xml b/multi-system/src/main/resources/mapper/system/ProductItemMapper.xml
index ee68552..a020fd6 100644
--- a/multi-system/src/main/resources/mapper/system/ProductItemMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/ProductItemMapper.xml
@@ -11,6 +11,8 @@
pi.`catalogue_id`,
CONCAT(c.`number`, ' ', c.`mess`) AS catalogue_name,
pi.`company_id`,
+ pi.`item_id`,
+ i.item_name,
sc.`name` as company_name,
pi.`number`,
pi.`erdact`,
@@ -24,16 +26,26 @@
pi.`update_time`
FROM
product_item pi
- LEFT JOIN sys_company sc on pi.company_id = sc.id
- left join catalogue c on pi.catalogue_id = c.id
+ LEFT JOIN sys_company sc on pi.company_id = sc.id
+ left join catalogue c on pi.catalogue_id = c.id
+ LEFT JOIN item i ON pi.item_id = i.id
+ LEFT JOIN item_user iu ON i.id = iu.item_id
WHERE
pi.del_flag = 1 and pi.type = #{type}
<if test="companyId!=null and companyId!=''">
and pi.company_id =#{companyId}
</if>
+ <if test="userId!=null">
+ and iu.user_id = #{userId}
+ </if>
+ <if test="itemId!=null">
+ and pi.item_id = #{itemId}
+ </if>
<if test="catalogueId!=null and catalogueId!=''">
and pi.catalogue_id = #{catalogueId}
</if>
+ GROUP BY
+ pi.id
ORDER BY
pi.create_time ASC
</select>
--
Gitblit v1.9.2