feat(人力和系统微服务): 补传代码
1.人力微服务的失业金领取相关代码
2.系统管理微服务数据字典相关代码
| New file |
| | |
| | | package cc.mrbird.febs.common.core.entity.system; |
| | | |
| | | import cc.mrbird.febs.common.core.annotation.FieldInfo; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.Version; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * name:Dic |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典数据表映射实体 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:33 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Data |
| | | @TableName("t_dic") |
| | | public class Dic implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2822776169454641834L; |
| | | @FieldInfo(name = "dicId", type = "bigint", explain = "字典Id") |
| | | @TableId(value = "dicId") |
| | | private Long dicId = 0L; |
| | | |
| | | @FieldInfo(name = "dicName", type = "varchar", explain = "字典名称") |
| | | @TableField("dicName") |
| | | private String dicName = ""; |
| | | |
| | | @FieldInfo(name = "dicCode", type = "varchar", explain = "字典代码") |
| | | @TableField("dicCode") |
| | | private String dicCode = ""; |
| | | |
| | | @FieldInfo(name = "parentDic", type = "bigint", explain = "上级字典") |
| | | @TableField("parentDic") |
| | | private Long parentDic = 0L; |
| | | |
| | | @FieldInfo(name = "dicDescribe", type = "varchar", explain = "字典说明") |
| | | @TableField("dicDescribe") |
| | | private String dicDescribe = ""; |
| | | |
| | | @FieldInfo(name = "delFlag", type = "bit", explain = "记录删除标志。0-未删除 1-已删除,默认0") |
| | | @TableField("delFlag") |
| | | private Integer delFlag = 0; |
| | | |
| | | @FieldInfo(name = "version", type = "int", explain = "记录版本号,用来进行乐观锁控制") |
| | | @TableField("version") |
| | | @Version |
| | | private Integer version = 0; |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.common.core.entity.system; |
| | | |
| | | import cc.mrbird.febs.common.core.annotation.FieldInfo; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.Version; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * name:Dicitem |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典项数据表映射实体 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:37 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Data |
| | | @TableName("t_dicitem") |
| | | public class DicItem implements Serializable { |
| | | private static final long serialVersionUID = 8030932514131869344L; |
| | | @FieldInfo(name = "dicItemId", type = "bigint", explain = "字典项Id") |
| | | @TableId(value = "dicItemId") |
| | | private Long dicItemId = 0L; |
| | | |
| | | @FieldInfo(name = "dicItemName", type = "varchar", explain = "字典项名称") |
| | | @TableField("dicItemName") |
| | | private String dicItemName = ""; |
| | | |
| | | @FieldInfo(name = "dicItemCode", type = "varchar", explain = "字典项代码") |
| | | @TableField("dicItemCode") |
| | | private String dicItemCode = ""; |
| | | |
| | | @FieldInfo(name = "dicItemDescribe", type = "varchar", explain = "字典项说明") |
| | | @TableField("dicItemDescribe") |
| | | private String dicItemDescribe = ""; |
| | | |
| | | @FieldInfo(name = "orderIndex", type = "int", explain = "排序号") |
| | | @TableField("orderIndex") |
| | | private Integer orderIndex = 0; |
| | | |
| | | @FieldInfo(name = "dicId", type = "bigint", explain = "字典Id") |
| | | @TableField("dicId") |
| | | private Long dicId = 0L; |
| | | |
| | | @FieldInfo(name = "dicCode", type = "varchar", explain = "字典代码") |
| | | @TableField("dicCode") |
| | | private String dicCode = ""; |
| | | |
| | | @FieldInfo(name = "delFlag", type = "bit", explain = "记录删除标志。0-未删除 1-已删除,默认0") |
| | | @TableField("delFlag") |
| | | private Integer delFlag = 0; |
| | | |
| | | @FieldInfo(name = "version", type = "int", explain = "记录版本号,用来进行乐观锁控制") |
| | | @TableField("version") |
| | | @Version |
| | | private Integer version = 0; |
| | | |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.controller; |
| | | |
| | | import cc.mrbird.febs.server.hr.entity.EmpUnemployment; |
| | | import cc.mrbird.febs.server.hr.service.IEmpUnemploymentService; |
| | | import cc.mrbird.febs.common.core.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * name:EmpUnemployment |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:失业金领取表控制器 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-01 00:22:28 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Api(tags = "人员失业金领取信息录入接口") |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequestMapping("empUnemployment") |
| | | @RequiredArgsConstructor |
| | | public class EmpUnemploymentController { |
| | | |
| | | private final IEmpUnemploymentService empUnemploymentService; |
| | | |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('empUnemployment:list')") |
| | | public FebsResponse getAllEmpUnemployments(EmpUnemployment empUnemployment) { |
| | | return new FebsResponse().data(empUnemploymentService.findEmpUnemployments(empUnemployment)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('empUnemployment:list')") |
| | | public FebsResponse empUnemploymentList(QueryRequest request, EmpUnemployment empUnemployment) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empUnemploymentService.findEmpUnemployments(request, empUnemployment)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('empUnemployment:add')") |
| | | public void addEmpUnemployment(@Valid EmpUnemployment empUnemployment) throws FebsException { |
| | | try { |
| | | this.empUnemploymentService.createEmpUnemployment(empUnemployment); |
| | | } catch (Exception e) { |
| | | String message = "新增失业金领取表失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('empUnemployment:delete')") |
| | | public void deleteEmpUnemployment(EmpUnemployment empUnemployment) throws FebsException { |
| | | try { |
| | | this.empUnemploymentService.deleteEmpUnemployment(empUnemployment); |
| | | } catch (Exception e) { |
| | | String message = "删除失业金领取表失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping("{ids}") |
| | | @PreAuthorize("hasAuthority('empUnemployment:delete')") |
| | | public void logicDeleteEmpUnemployment(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.empUnemploymentService.logicDelEmpUnemployment(ids); |
| | | } catch (Exception e) { |
| | | String message = "逻辑删除失业金领取表失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('empUnemployment:update')") |
| | | public void updateEmpUnemployment(EmpUnemployment empUnemployment) throws FebsException { |
| | | try { |
| | | this.empUnemploymentService.updateEmpUnemployment(empUnemployment); |
| | | } catch (Exception e) { |
| | | String message = "修改失业金领取表失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.entity; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import cc.mrbird.febs.common.core.annotation.FieldInfo; |
| | | import cc.mrbird.febs.common.core.utils.DateDeSerializer; |
| | | import cc.mrbird.febs.common.core.utils.DateSerializer; |
| | | import cc.mrbird.febs.common.core.utils.DateTimeDeserializer; |
| | | import cc.mrbird.febs.common.core.utils.DateTimeSerializer; |
| | | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.Version; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * name:EmpUnemployment |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:失业金领取表数据表映射实体 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-01 00:22:28 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Data |
| | | @TableName("t_emp_unemployment") |
| | | public class EmpUnemployment implements Serializable { |
| | | |
| | | @FieldInfo(name = "unemploymentId", type = "bigint", explain = "失业金领取Id") |
| | | @TableId(value = "unemploymentId") |
| | | private Long unemploymentId = 0L; |
| | | |
| | | @FieldInfo(name = "empId", type = "bigint", explain = "员工Id") |
| | | @TableField("empId") |
| | | private Long empId = 0L; |
| | | |
| | | @FieldInfo(name = "empNumb", type = "varchar", explain = "员工编号") |
| | | @TableField("empNumb") |
| | | private String empNumb = ""; |
| | | |
| | | @FieldInfo(name = "empName", type = "varchar", explain = "员工姓名") |
| | | @TableField("empName") |
| | | private String empName = ""; |
| | | |
| | | @FieldInfo(name = "sex", type = "varchar", explain = "性别码") |
| | | @TableField("sex") |
| | | private String sex = ""; |
| | | |
| | | @FieldInfo(name = "certificateNumb", type = "varchar", explain = "证件号码") |
| | | @TableField("certificateNumb") |
| | | private String certificateNumb = ""; |
| | | |
| | | @FieldInfo(name = "deptId", type = "bigint", explain = "部门Id") |
| | | @TableField("deptId") |
| | | private Long deptId = 0L; |
| | | |
| | | @FieldInfo(name = "deptName", type = "varchar", explain = "部门名称") |
| | | @TableField("deptName") |
| | | private String deptName = ""; |
| | | |
| | | @FieldInfo(name = "JobId", type = "bigint", explain = "岗位Id") |
| | | @TableField("JobId") |
| | | private Long jobId = 0L; |
| | | |
| | | @FieldInfo(name = "jobName", type = "varchar", explain = "岗位名称") |
| | | @TableField("jobName") |
| | | private String jobName = ""; |
| | | |
| | | @FieldInfo(name = "applayDate", type = "date", explain = "申请日期") |
| | | @TableField("applayDate") |
| | | @JsonSerialize(using = DateSerializer.class) |
| | | @JsonDeserialize(using = DateDeSerializer.class) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date applayDate; |
| | | |
| | | @FieldInfo(name = "applayReason", type = "varchar", explain = "申报事由") |
| | | @TableField("applayReason") |
| | | private String applayReason = ""; |
| | | |
| | | @FieldInfo(name = "reporter", type = "varchar", explain = "报备人") |
| | | @TableField("reporter") |
| | | private String reporter = ""; |
| | | |
| | | @FieldInfo(name = "auditor", type = "varchar", explain = "审核人") |
| | | @TableField("auditor") |
| | | private String auditor = ""; |
| | | |
| | | @FieldInfo(name = "remark", type = "varchar", explain = "备注") |
| | | @TableField("remark") |
| | | private String remark = ""; |
| | | |
| | | |
| | | @FieldInfo(name = "createTime", type = "datetime", explain = "记录创建时间") |
| | | @TableField("createTime") |
| | | @JsonSerialize(using = DateTimeSerializer.class) |
| | | @JsonDeserialize(using = DateTimeDeserializer.class) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | @FieldInfo(name = "creator", type = "varchar", explain = "记录创建人") |
| | | @TableField("creator") |
| | | private String creator = ""; |
| | | |
| | | @FieldInfo(name = "modifyTime", type = "datetime", explain = "记录最后更新时间") |
| | | @TableField("modifyTime") |
| | | @JsonSerialize(using = DateTimeSerializer.class) |
| | | @JsonDeserialize(using = DateTimeDeserializer.class) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date modifyTime; |
| | | |
| | | @FieldInfo(name = "modifier", type = "varchar", explain = "记录最后更新人") |
| | | @TableField("modifier") |
| | | private String modifier = ""; |
| | | |
| | | @FieldInfo(name = "delFlag", type = "bit", explain = "记录删除标志。0-未删除 1-已删除,默认0") |
| | | @TableField("delFlag") |
| | | private Integer delFlag = 0; |
| | | |
| | | @FieldInfo(name = "version", type = "int", explain = "记录版本号,用来进行乐观锁控制") |
| | | @TableField("version") |
| | | @Version |
| | | private Integer version = 0; |
| | | |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.mapper; |
| | | |
| | | import cc.mrbird.febs.server.hr.entity.EmpUnemployment; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * name:EmpUnemployment |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:失业金领取表实体Mapper |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-01 00:22:28 |
| | | * @since JDK1.8 |
| | | */ |
| | | public interface EmpUnemploymentMapper extends BaseMapper<EmpUnemployment> { |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * date luoyibo |
| | | * @author: 2021-02-01 00:22:28 |
| | | * @param list 待删除Id |
| | | * @param operatorId 操作员Id |
| | | * @return void |
| | | */ |
| | | @Update("<script> " + |
| | | " UPDATE t_emp_unemployment SET delFlag = 1,\n" + |
| | | " modifyTime = NOW(),\n" + |
| | | " modifier = #{operatorId}, \n" + |
| | | " version = version+1 \n" + |
| | | " WHERE unemploymentId IN \n" + |
| | | " <foreach item=\"delId\" collection=\"list\" open=\"(\" close=\")\" separator=\",\">\n" + |
| | | " #{delId}\n" + |
| | | " </foreach>\n" + |
| | | "</script>") |
| | | void logicDeleteByIds(@Param("list") List<String> list,@Param("operatorId") String operatorId); |
| | | } |
| New file |
| | |
| | | <?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="cc.mrbird.febs.server.hr.mapper.EmpUnemploymentMapper"> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.service; |
| | | |
| | | import cc.mrbird.febs.server.hr.entity.EmpUnemployment; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * name:EmpUnemployment |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:失业金领取表服务接口 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-01 00:22:28 |
| | | * @since JDK1.8 |
| | | */ |
| | | public interface IEmpUnemploymentService extends IService<EmpUnemployment> { |
| | | /** |
| | | * 查询(分页) |
| | | * |
| | | * @param request QueryRequest |
| | | * @param empUnemployment empUnemployment |
| | | * @return IPage<EmpUnemployment> |
| | | */ |
| | | IPage<EmpUnemployment> findEmpUnemployments(QueryRequest request, EmpUnemployment empUnemployment); |
| | | |
| | | /** |
| | | * 查询(所有) |
| | | * |
| | | * @param empUnemployment empUnemployment |
| | | * @return List<EmpUnemployment> |
| | | */ |
| | | List<EmpUnemployment> findEmpUnemployments(EmpUnemployment empUnemployment); |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param empUnemployment empUnemployment |
| | | */ |
| | | void createEmpUnemployment(EmpUnemployment empUnemployment); |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param empUnemployment empUnemployment |
| | | */ |
| | | void updateEmpUnemployment(EmpUnemployment empUnemployment); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param empUnemployment empUnemployment |
| | | */ |
| | | void deleteEmpUnemployment(EmpUnemployment empUnemployment); |
| | | |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * date 2021-01-28 10:48 |
| | | * @author: luoyibo |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | */ |
| | | void logicDelEmpUnemployment(String ids); |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.hr.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.core.constant.ModuleCode; |
| | | import cc.mrbird.febs.server.hr.entity.EmpUnemployment; |
| | | import cc.mrbird.febs.server.hr.mapper.EmpUnemploymentMapper; |
| | | import cc.mrbird.febs.server.hr.service.IEmpUnemploymentService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.core.utils.SequenceUtil; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * name:EmpUnemployment |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:失业金领取表服务接口实现 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-01 00:22:28 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) |
| | | class EmpUnemploymentServiceImpl extends ServiceImpl<EmpUnemploymentMapper, EmpUnemployment> implements IEmpUnemploymentService { |
| | | |
| | | private final EmpUnemploymentMapper empUnemploymentMapper; |
| | | private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser()) |
| | | .map(u -> u.getUserId().toString()) |
| | | .orElse("1"); |
| | | |
| | | @Override |
| | | public IPage<EmpUnemployment> findEmpUnemployments(QueryRequest request, EmpUnemployment empUnemployment) { |
| | | LambdaQueryWrapper<EmpUnemployment> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(EmpUnemployment::getDelFlag, 0); |
| | | Page<EmpUnemployment> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.page(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<EmpUnemployment> findEmpUnemployments(EmpUnemployment empUnemployment) { |
| | | LambdaQueryWrapper<EmpUnemployment> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(EmpUnemployment::getDelFlag, 0); |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createEmpUnemployment(EmpUnemployment empUnemployment) { |
| | | empUnemployment.setUnemploymentId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | empUnemployment.setCreator(operatorId); |
| | | empUnemployment.setModifier(operatorId); |
| | | this.save(empUnemployment); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateEmpUnemployment(EmpUnemployment empUnemployment) { |
| | | EmpUnemployment dbData = this.getById(empUnemployment.getUnemploymentId()); |
| | | empUnemployment.setCreateTime(dbData.getCreateTime()); |
| | | empUnemployment.setCreator(dbData.getCreator()); |
| | | empUnemployment.setDelFlag(dbData.getDelFlag()); |
| | | empUnemployment.setModifyTime(new Date()); |
| | | empUnemployment.setModifier(operatorId); |
| | | this.saveOrUpdate(empUnemployment); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteEmpUnemployment(EmpUnemployment empUnemployment) { |
| | | LambdaQueryWrapper<EmpUnemployment> wrapper = new LambdaQueryWrapper<>(); |
| | | // TODO 设置删除条件 |
| | | this.remove(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 根据Id批量逻辑删除记录 |
| | | * <p> |
| | | * date 2021-01-28 10:48 |
| | | * |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | * @author: luoyibo |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void logicDelEmpUnemployment(String ids) { |
| | | String[] str = ids.split(","); |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | empUnemploymentMapper.logicDeleteByIds(list, operatorId); |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.controller; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.Dic; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.server.system.service.IDicService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * name:Dic |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典控制器 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:33 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequestMapping("dic") |
| | | @RequiredArgsConstructor |
| | | public class DicController { |
| | | |
| | | private final IDicService dicService; |
| | | |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('dic:list')") |
| | | public FebsResponse getAllDics(Dic dic) { |
| | | return new FebsResponse().data(dicService.findDics(dic)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('dic:list')") |
| | | public FebsResponse dicList(QueryRequest request, Dic dic) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.dicService.findDics(request, dic)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('dic:add')") |
| | | public void addDic(@Valid Dic dic) throws FebsException { |
| | | try { |
| | | this.dicService.createDic(dic); |
| | | } catch (Exception e) { |
| | | String message = "新增数据字典失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('dic:delete')") |
| | | public void deleteDic(Dic dic) throws FebsException { |
| | | try { |
| | | this.dicService.deleteDic(dic); |
| | | } catch (Exception e) { |
| | | String message = "删除数据字典失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping("{ids}") |
| | | @PreAuthorize("hasAuthority('dic:delete')") |
| | | public void logicDeleteDic(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.dicService.logicDelDic(ids); |
| | | } catch (Exception e) { |
| | | String message = "逻辑删除数据字典失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('dic:update')") |
| | | public void updateDic(Dic dic) throws FebsException { |
| | | try { |
| | | this.dicService.updateDic(dic); |
| | | } catch (Exception e) { |
| | | String message = "修改数据字典失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.controller; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.DicItem; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.server.system.service.IDicItemService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * name:Dicitem |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典项控制器 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:37 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequestMapping("dicItem") |
| | | @RequiredArgsConstructor |
| | | public class DiciIemController { |
| | | |
| | | private final IDicItemService dicitemService; |
| | | |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('dicitem:list')") |
| | | public FebsResponse getAllDicitems(DicItem dicitem) { |
| | | return new FebsResponse().data(dicitemService.findDicItems(dicitem)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('dicitem:list')") |
| | | public FebsResponse dicitemList(QueryRequest request, DicItem dicitem) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.dicitemService.findDicItems(request, dicitem)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('dicitem:add')") |
| | | public void addDicItem(@Valid DicItem dicitem) throws FebsException { |
| | | try { |
| | | this.dicitemService.createDicItem(dicitem); |
| | | } catch (Exception e) { |
| | | String message = "新增数据字典项失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('dicitem:delete')") |
| | | public void deleteDicItem(DicItem dicitem) throws FebsException { |
| | | try { |
| | | this.dicitemService.deleteDicItem(dicitem); |
| | | } catch (Exception e) { |
| | | String message = "删除数据字典项失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping("{ids}") |
| | | @PreAuthorize("hasAuthority('dicitem:delete')") |
| | | public void logicDeleteDicItem(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.dicitemService.logicDelDicItem(ids); |
| | | } catch (Exception e) { |
| | | String message = "逻辑删除数据字典项失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('dicitem:update')") |
| | | public void updateDicItem(DicItem dicitem) throws FebsException { |
| | | try { |
| | | this.dicitemService.updateDicItem(dicitem); |
| | | } catch (Exception e) { |
| | | String message = "修改数据字典项失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.mapper; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.system.DicItem; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * name:Dicitem |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典项实体Mapper |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:37 |
| | | * @since JDK1.8 |
| | | */ |
| | | public interface DicItemMapper extends BaseMapper<DicItem> { |
| | | /** |
| | | * 根据Id批量逻辑删除记录 |
| | | * <p> |
| | | * date luoyibo |
| | | * |
| | | * @param list 待删除Id |
| | | * @param operatorId 操作员Id |
| | | * @return void |
| | | * @author: 2021-02-02 11:29:37 |
| | | */ |
| | | @Update("<script> " + |
| | | " UPDATE t_dicitem SET delFlag = 1,\n" + |
| | | " modifyTime = NOW(),\n" + |
| | | " modifier = #{operatorId}, \n" + |
| | | " version = version+1 \n" + |
| | | " WHERE dicItemId IN \n" + |
| | | " <foreach item=\"delId\" collection=\"list\" open=\"(\" close=\")\" separator=\",\">\n" + |
| | | " #{delId} \n" + |
| | | " </foreach>\n" + |
| | | "</script>") |
| | | void logicDeleteByIds(@Param("list") List<String> list, @Param("operatorId") String operatorId); |
| | | } |
| New file |
| | |
| | | <?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="cc.mrbird.febs.server.system.mapper.DicItemMapper"> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.mapper; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.system.Dic; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * name:Dic |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典实体Mapper |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:33 |
| | | * @since JDK1.8 |
| | | */ |
| | | public interface DicMapper extends BaseMapper<Dic> { |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * date luoyibo |
| | | * @author: 2021-02-02 11:29:33 |
| | | * @param list 待删除Id |
| | | * @param operatorId 操作员Id |
| | | * @return void |
| | | */ |
| | | @Update("<script> " + |
| | | " UPDATE t_dic SET delFlag = 1,\n" + |
| | | " modifyTime = NOW(),\n" + |
| | | " modifier = , \n" + |
| | | " version = version+1 \n" + |
| | | " WHERE badId IN \n" + |
| | | " <foreach item=\"delId\" collection=\"list\" open=\"(\" close=\")\" separator=\",\">\n" + |
| | | " \n" + |
| | | " </foreach>\n" + |
| | | "</script>") |
| | | void logicDeleteByIds(@Param("list") List<String> list,@Param("operatorId") String operatorId); |
| | | } |
| New file |
| | |
| | | <?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="cc.mrbird.febs.server.system.mapper.DicMapper"> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.service; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.DicItem; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * name:DicItem |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典项服务接口 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:37 |
| | | * @since JDK1.8 |
| | | */ |
| | | public interface IDicItemService extends IService<DicItem> { |
| | | /** |
| | | * 查询(分页) |
| | | * |
| | | * @param request QueryRequest |
| | | * @param dicitem dicitem |
| | | * @return IPage<Dicitem> |
| | | */ |
| | | IPage<DicItem> findDicItems(QueryRequest request, DicItem dicitem); |
| | | |
| | | /** |
| | | * 查询(所有) |
| | | * |
| | | * @param dicitem dicitem |
| | | * @return List<Dicitem> |
| | | */ |
| | | List<DicItem> findDicItems(DicItem dicitem); |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param dicitem dicitem |
| | | */ |
| | | void createDicItem(DicItem dicitem); |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param dicitem dicitem |
| | | */ |
| | | void updateDicItem(DicItem dicitem); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param dicitem dicitem |
| | | */ |
| | | void deleteDicItem(DicItem dicitem); |
| | | |
| | | /** |
| | | * 根据Id批量逻辑删除记录 |
| | | * <p> |
| | | * date 2021-01-28 10:48 |
| | | * |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | * @author: luoyibo |
| | | */ |
| | | void logicDelDicItem(String ids); |
| | | |
| | | void setDicItemRedis(); |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.service; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.Dic; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * name:Dic |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典服务接口 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:33 |
| | | * @since JDK1.8 |
| | | */ |
| | | public interface IDicService extends IService<Dic> { |
| | | /** |
| | | * 查询(分页) |
| | | * |
| | | * @param request QueryRequest |
| | | * @param dic dic |
| | | * @return IPage<Dic> |
| | | */ |
| | | IPage<Dic> findDics(QueryRequest request, Dic dic); |
| | | |
| | | /** |
| | | * 查询(所有) |
| | | * |
| | | * @param dic dic |
| | | * @return List<Dic> |
| | | */ |
| | | List<Dic> findDics(Dic dic); |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param dic dic |
| | | */ |
| | | void createDic(Dic dic); |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param dic dic |
| | | */ |
| | | void updateDic(Dic dic); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param dic dic |
| | | */ |
| | | void deleteDic(Dic dic); |
| | | |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * date 2021-01-28 10:48 |
| | | * @author: luoyibo |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | */ |
| | | void logicDelDic(String ids); |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.core.constant.ModuleCode; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.DicItem; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.core.utils.SequenceUtil; |
| | | import cc.mrbird.febs.common.redis.service.RedisService; |
| | | import cc.mrbird.febs.server.system.mapper.DicItemMapper; |
| | | import cc.mrbird.febs.server.system.service.IDicItemService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * name:DicItem |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典项服务接口实现 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:37 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) |
| | | class DicItemServiceImpl extends ServiceImpl<DicItemMapper, DicItem> implements IDicItemService { |
| | | private final RedisService redisService; |
| | | private final DicItemMapper dicitemMapper; |
| | | private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser()) |
| | | .map(u -> u.getUserId().toString()) |
| | | .orElse("1"); |
| | | |
| | | @Override |
| | | public IPage<DicItem> findDicItems(QueryRequest request, DicItem dicitem) { |
| | | LambdaQueryWrapper<DicItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(DicItem::getDelFlag, 0); |
| | | Page<DicItem> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.page(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<DicItem> findDicItems(DicItem dicitem) { |
| | | LambdaQueryWrapper<DicItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(DicItem::getDelFlag, 0); |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createDicItem(DicItem dicitem) { |
| | | dicitem.setDicItemId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | // dicitem.setCreator(operatorId); |
| | | // dicitem.setModifier(operatorId); |
| | | this.save(dicitem); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateDicItem(DicItem dicitem) { |
| | | DicItem dbData = this.getById(dicitem.getDicItemId()); |
| | | // dicitem.setCreateTime(dbData.getCreateTime()); |
| | | // dicitem.setCreator(dbData.getCreator()); |
| | | dicitem.setDelFlag(dbData.getDelFlag()); |
| | | // dicitem.setModifyTime(new Date()); |
| | | // dicitem.setModifier(operatorId); |
| | | this.saveOrUpdate(dicitem); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteDicItem(DicItem dicitem) { |
| | | LambdaQueryWrapper<DicItem> wrapper = new LambdaQueryWrapper<>(); |
| | | // TODO 设置删除条件 |
| | | this.remove(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 根据Id批量逻辑删除记录 |
| | | * <p> |
| | | * date 2021-01-28 10:48 |
| | | * |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | * @author: luoyibo |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void logicDelDicItem(String ids) { |
| | | String[] str = ids.split(","); |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | dicitemMapper.logicDeleteByIds(list, operatorId); |
| | | } |
| | | |
| | | @Override |
| | | public void setDicItemRedis() { |
| | | LambdaQueryWrapper<DicItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(DicItem::getDelFlag, 0); |
| | | List<DicItem> dicItems = this.baseMapper.selectList(queryWrapper); |
| | | redisService.del("dicItems"); |
| | | redisService.set("dicItems", dicItems); |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.core.constant.ModuleCode; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.Dic; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.core.utils.SequenceUtil; |
| | | import cc.mrbird.febs.server.system.mapper.DicMapper; |
| | | import cc.mrbird.febs.server.system.service.IDicService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * name:Dic |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:数据字典服务接口实现 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-02-02 11:29:33 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) |
| | | class DicServiceImpl extends ServiceImpl<DicMapper, Dic> implements IDicService { |
| | | |
| | | private final DicMapper dicMapper; |
| | | private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser()) |
| | | .map(u -> u.getUserId().toString()) |
| | | .orElse("1"); |
| | | |
| | | @Override |
| | | public IPage<Dic> findDics(QueryRequest request, Dic dic) { |
| | | LambdaQueryWrapper<Dic> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Dic::getDelFlag, 0); |
| | | Page<Dic> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.page(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Dic> findDics(Dic dic) { |
| | | LambdaQueryWrapper<Dic> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Dic::getDelFlag, 0); |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createDic(Dic dic) { |
| | | dic.setDicId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | // dic.setCreator(operatorId); |
| | | // dic.setModifier(operatorId); |
| | | this.save(dic); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateDic(Dic dic) { |
| | | Dic dbData = this.getById(dic.getDicId()); |
| | | // dic.setCreateTime(dbData.getCreateTime()); |
| | | // dic.setCreator(dbData.getCreator()); |
| | | dic.setDelFlag(dbData.getDelFlag()); |
| | | // dic.setModifyTime(new Date()); |
| | | // dic.setModifier(operatorId); |
| | | this.saveOrUpdate(dic); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteDic(Dic dic) { |
| | | LambdaQueryWrapper<Dic> wrapper = new LambdaQueryWrapper<>(); |
| | | // TODO 设置删除条件 |
| | | this.remove(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 根据Id批量逻辑删除记录 |
| | | * <p> |
| | | * date 2021-01-28 10:48 |
| | | * |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | * @author: luoyibo |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void logicDelDic(String ids) { |
| | | String[] str = ids.split(","); |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | dicMapper.logicDeleteByIds(list, operatorId); |
| | | } |
| | | } |