| | |
| | | @Autowired |
| | | private ProductItemService productItemService; |
| | | |
| | | @Autowired |
| | | private ItemService itemService; |
| | | |
| | | |
| | | /** |
| | | * 质量目标列表 |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @NotNull(message = "学员id不能为空") |
| | | @ApiModelProperty(value = "学员id",required = true) |
| | | @TableField("student_id") |
| | | private Long studentId; |
| | | private String studentId; |
| | | |
| | | @NotBlank(message = "计划名称不能为空") |
| | | @ApiModelProperty(value = "计划名称",required = true) |
| | |
| | | @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; |
| | |
| | | |
| | | @ApiModelProperty("学生对象") |
| | | @TableField(exist = false) |
| | | private ExStudent student; |
| | | private List<ExStudent> students; |
| | | |
| | | |
| | | @ApiModelProperty("培训记录文件") |
对比新文件 |
| | |
| | | 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; |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | 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; |
| | | } |
| | |
| | | @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; |
对比新文件 |
| | |
| | | package com.gkhy.exam.system.domain.req; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ItemReq { |
| | | private Integer companyId; |
| | | private Integer userId; |
| | | } |
对比新文件 |
| | |
| | | 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); |
| | | } |
对比新文件 |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | public class ExExamRecordServiceImpl extends ServiceImpl<ExExamRecordMapper, ExExamRecord> implements ExExamRecordService { |
| | | |
| | | |
| | | @Autowired |
| | | private ExStudentMapper studentMapper; |
| | | |
| | | |
| | | @Override |
| | | public CommonPage selectExamRecordList(ExExamRecord examRecord) { |
| | | SysUser user= SecurityUtils.getLoginUser().getUser(); |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
对比新文件 |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | if (productItem.getCompanyId()==null){ |
| | | throw new ApiException("非管理员操作,企业id不可为空"); |
| | | } |
| | | productItem.setUserId(SecurityUtils.getUserId()); |
| | | } |
| | | PageUtils.startPage(); |
| | | List<ProductItem> productItems = productItemMapper.selectProductItemList(productItem); |
| | |
| | | <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"> |
| | |
| | | |
| | | <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` |
| | |
| | | </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> |
对比新文件 |
| | |
| | | <?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> |
| | |
| | | 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`, |
| | |
| | | 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> |