| New file |
| | |
| | | package cc.mrbird.febs.common.core.entity.system; |
| | | |
| | | 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:SysConfig |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:参数配置表数据表映射实体 |
| | | * |
| | | * @author Alan |
| | | * @date 2021-02-20 09:40:38 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Data |
| | | @TableName("sys_config") |
| | | public class SysConfig implements Serializable{ |
| | | |
| | | @FieldInfo(name = "config_id",type = "bigint",explain = "参数主键") |
| | | @TableId(value = "config_id") |
| | | private Long configId=0L; |
| | | |
| | | @FieldInfo(name = "delFlag",type = "bit",explain = "记录删除标志。0-未删除 1-已删除,默认0") |
| | | @TableField("delFlag") |
| | | private Integer delFlag=0; |
| | | |
| | | @FieldInfo(name = "config_name",type = "varchar",explain = "参数名称") |
| | | @TableField("config_name") |
| | | private String configName=""; |
| | | |
| | | @FieldInfo(name = "config_key",type = "varchar",explain = "参数键名") |
| | | @TableField("config_key") |
| | | private String configKey=""; |
| | | |
| | | @FieldInfo(name = "config_value",type = "varchar",explain = "参数键值") |
| | | @TableField("config_value") |
| | | private String configValue=""; |
| | | |
| | | @FieldInfo(name = "config_type",type = "char",explain = "系统内置(Y是 N否)") |
| | | @TableField("config_type") |
| | | private String configType=""; |
| | | |
| | | @FieldInfo(name = "create_by",type = "varchar",explain = "创建者") |
| | | @TableField("create_by") |
| | | private String createBy=""; |
| | | |
| | | @FieldInfo(name = "create_time",type = "datetime",explain = "创建时间") |
| | | @TableField("create_time") |
| | | @JsonSerialize(using = DateTimeSerializer.class) |
| | | @JsonDeserialize(using = DateTimeDeserializer.class) |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | @FieldInfo(name = "update_by",type = "varchar",explain = "更新者") |
| | | @TableField("update_by") |
| | | private String updateBy=""; |
| | | |
| | | @FieldInfo(name = "update_time",type = "datetime",explain = "更新时间") |
| | | @TableField("update_time") |
| | | @JsonSerialize(using = DateTimeSerializer.class) |
| | | @JsonDeserialize(using = DateTimeDeserializer.class) |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | @FieldInfo(name = "remark",type = "varchar",explain = "备注") |
| | | @TableField("remark") |
| | | private String remark=""; |
| | | |
| | | } |
| | |
| | | package cc.mrbird.febs.server.hr.mapper; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.server.hr.entity.EmpBaseInfo; |
| | | import cc.mrbird.febs.server.hr.entity.EmpJobChange; |
| | | import cc.mrbird.febs.server.hr.entity.*; |
| | |
| | | "</script>") |
| | | int changeEmpJob(@Param("list") List<String> list, @Param("mapParams") Map<String,Object> mapParams); |
| | | @SqlParser(filter=true) |
| | | Map<String, Object> countBaseInfoList(@Param("index") String index,@Param("btime") String btime,@Param("etime") String etime); |
| | | Map<String, Object> countBaseInfoList(@Param("index") String index, @Param("btime") String btime, @Param("etime") String etime,@Param("manOld") String manOld,@Param("womanOld") String womanOld); |
| | | |
| | | Integer countXjygBaseInfoList(@Param("index")String index,@Param("btime") String btime,@Param("etime") String etime); |
| | | @SqlParser(filter=true) |
| | |
| | | IPage<EmpBaseInfo> sfzbaseInfoList(@Param("page") Page<EmpBaseInfo> page,@Param("index") String index,@Param("btime") String btime,@Param("etime") String etime,@Param("name") String name); |
| | | @SqlParser(filter=true) |
| | | IPage<EmpJobChange> empBaseInfoTgList(@Param("page")Page<EmpJobChange> page,@Param("index") String index,@Param("btime") String btime,@Param("etime") String etime,@Param("name") String name,@Param("number") String number); |
| | | @SqlParser(filter=true) |
| | | List<SysConfig> sysConfig(); |
| | | @SqlParser(filter=true) |
| | | IPage<EmpBaseInfo> clbaseInfoList(@Param("page")Page<EmpBaseInfo> page,@Param("index") String index,@Param("btime") String btime,@Param("etime") String etime,@Param("name") String name,@Param("manOld") String manOld,@Param("womanOld") String womanOld); |
| | | } |
| | |
| | | <!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.EmpBaseInfoMapper"> |
| | | |
| | | <select id="sysConfig" resultType="cc.mrbird.febs.common.core.entity.system.SysConfig"> |
| | | select * from sys_config where config_key in ("manOld","womanOld") ORDER BY config_key asc |
| | | </select> |
| | | |
| | | <select id="countBaseInfoList" resultType="java.util.Map"> |
| | | SELECT |
| | |
| | | ) zdlz, |
| | | count( |
| | | IF (t.dimissionType = '4', 1, NULL) |
| | | ) gsct |
| | | ) gsct, |
| | | count( if(t.sex is not null and t.age !=0 and t.sex=1 and t.age>=${manOld},1,null))+count( if(t.sex is not null and t.age !=0 and t.sex=2 and t.age>=${womanOld},1,null)) clyg |
| | | FROM |
| | | t_emp_baseinfo t where 1=1 |
| | | <choose> |
| | |
| | | </choose> |
| | | |
| | | </select> |
| | | |
| | | <select id="clbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo"> |
| | | select t1.* from ( |
| | | SELECT |
| | | t.* |
| | | FROM |
| | | t_emp_baseinfo t left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1 and t.sex is not null and t.age !=0 and t.sex=1 and t.age>=${manOld} |
| | | UNION |
| | | |
| | | SELECT |
| | | t.* |
| | | FROM |
| | | t_emp_baseinfo t left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1 and t.sex is not null and t.age !=0 and t.sex=2 and t.age>=${womanOld} |
| | | ) t1 where 1=1 |
| | | <if test="name!= 'undefined' and name!=null and name!=''"> |
| | | and (t1.empNumb like CONCAT('%',#{name},'%') or t1.empName like CONCAT('%',#{name},'%') or |
| | | t1.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%')) |
| | | </if> |
| | | <choose> |
| | | <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''"> |
| | | and date_format(t1.createTime,'%Y-%m-%d') >= #{btime} and date_format(t1.createTime,'%Y-%m-%d') <= #{etime} |
| | | </when> |
| | | <when test="index==0"> |
| | | and TO_DAYS(t1.createTime) = TO_DAYS(NOW()) |
| | | </when> |
| | | <when test="index==1"> |
| | | and YEARWEEK(date_format(t1.createTime,'%Y-%m-%d')) = YEARWEEK(now()) |
| | | </when> |
| | | <when test="index==2"> |
| | | and date_format(t1.createTime,'%Y-%m') = date_format(now(),'%Y-%m') |
| | | </when> |
| | | <otherwise> |
| | | and YEAR(t1.createTime)=YEAR(NOW()) |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="sfzbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo"> |
| | | select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1 |
| | | <if test="name!= 'undefined' and name!=null and name!=''"> |
| | |
| | | Page<EmpAccessory> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | String querySql = empAccessoryMapper.getQuerySql(); |
| | | return empAccessoryMapper.selectPageVo(page, queryWrapper, querySql); |
| | | IPage<Map<String, Object>> mapIPage = empAccessoryMapper.selectPageVo(page, queryWrapper, querySql); |
| | | return mapIPage; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import java.util.*; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.server.hr.entity.EmpDimissionLog; |
| | | import cc.mrbird.febs.server.hr.entity.EmpJobChange; |
| | | import cc.mrbird.febs.server.hr.service.IEmpDimissionLogService; |
| | |
| | | public IPage<EmpBaseInfo> baseInfoList(String index, String btime, String etime, String pageSize, String pageNum, String number, String name) { |
| | | Page<EmpBaseInfo> page = new Page<EmpBaseInfo>(new Long(pageNum), new Long(pageSize)); |
| | | IPage<EmpBaseInfo> iPage =null; |
| | | List<SysConfig> sysConfig=this.baseMapper.sysConfig(); |
| | | String manOld=""; |
| | | String womanOld=""; |
| | | if(sysConfig.size()>0){ |
| | | manOld=sysConfig.get(0).getConfigValue(); |
| | | womanOld=sysConfig.get(1).getConfigValue(); |
| | | } |
| | | if("1".equals(number)){ //在职员工 |
| | | iPage = this.empBaseInfoMapper.zzbaseInfoList(page, index,btime,etime,name); |
| | | }else if("2".equals(number)){ //新进员工 |
| | |
| | | }else if("4".equals(number)){ //临时员工 |
| | | iPage = this.empBaseInfoMapper.lsbaseInfoList(page, index,btime,etime,name); |
| | | }else if("5".equals(number)){ //超龄员工 |
| | | iPage = this.empBaseInfoMapper.baseInfoList(page, index,btime,etime,name); |
| | | iPage = this.empBaseInfoMapper.clbaseInfoList(page, index,btime,etime,name,manOld,womanOld); |
| | | }else if("6".equals(number)){ //离职员工总数 |
| | | iPage = this.empBaseInfoMapper.lzbaseInfoList(page, index,btime,etime,name); |
| | | }else if("7".equals(number)){ //辞职申请人数 |
| | |
| | | |
| | | @Override |
| | | public Map<String, Object> countBaseInfoList(String index, String btime, String etime) { |
| | | List<SysConfig> sysConfig=this.baseMapper.sysConfig(); |
| | | String manOld=""; |
| | | String womanOld=""; |
| | | if(sysConfig.size()>0){ |
| | | manOld=sysConfig.get(0).getConfigValue(); |
| | | womanOld=sysConfig.get(1).getConfigValue(); |
| | | } |
| | | //在职员工,正式员工,临时员工,正常离职,自动离职,公司辞退 判断条件离职申请日期 |
| | | Map<String, Object> stringObjectMap = this.baseMapper.countBaseInfoList(index,btime,etime); |
| | | Map<String, Object> stringObjectMap = this.baseMapper.countBaseInfoList(index,btime,etime,manOld,womanOld); |
| | | //新进员工 判断条件入职日期 |
| | | Integer xjygObjectMap =this.baseMapper.countXjygBaseInfoList(index,btime,etime); |
| | | if(xjygObjectMap!=null){ |
| | |
| | | } |
| | | |
| | | @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); |
| | |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('dic:delete')") |
| | | public void deleteDic(Dic dic) throws FebsException { |
| | | try { |
| | | this.dicService.deleteDic(dic); |
| | |
| | | } |
| | | |
| | | @DeleteMapping("{ids}") |
| | | @PreAuthorize("hasAuthority('dic:delete')") |
| | | public void logicDeleteDic(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.dicService.logicDelDic(ids); |
| | |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('dic:update')") |
| | | |
| | | public void updateDic(Dic dic) throws FebsException { |
| | | try { |
| | | this.dicService.updateDic(dic); |
| | |
| | | |
| | | 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.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 cc.mrbird.febs.server.system.service.IDicService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | |
| | | private final IDicItemService dicitemService; |
| | | |
| | | private final IDicService dicService; |
| | | |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('dicitem:list')") |
| | | public FebsResponse getAllDicitems(DicItem 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 { |
| | | Dic byId = dicService.getById(dicitem.getDicId()); |
| | | dicitem.setDicCode(byId.getDicCode()); |
| | | this.dicitemService.createDicItem(dicitem); |
| | | } catch (Exception e) { |
| | | String message = "新增数据字典项失败"; |
| | |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('dicitem:delete')") |
| | | public void deleteDicItem(DicItem dicitem) throws FebsException { |
| | | try { |
| | | this.dicitemService.deleteDicItem(dicitem); |
| | |
| | | } |
| | | |
| | | @DeleteMapping("{ids}") |
| | | @PreAuthorize("hasAuthority('dicitem:delete')") |
| | | public void logicDeleteDicItem(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.dicitemService.logicDelDicItem(ids); |
| | |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('dicitem:update')") |
| | | |
| | | public void updateDicItem(DicItem dicitem) throws FebsException { |
| | | try { |
| | | Dic byId = dicService.getById(dicitem.getDicId()); |
| | | dicitem.setDicCode(byId.getDicCode()); |
| | | this.dicitemService.updateDicItem(dicitem); |
| | | } catch (Exception e) { |
| | | String message = "修改数据字典项失败"; |
| New file |
| | |
| | | package cc.mrbird.febs.server.system.controller; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.server.system.service.ISysConfigService; |
| | | 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 io.swagger.annotations.ApiOperation; |
| | | 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:SysConfig |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:参数配置表控制器 |
| | | * |
| | | * @author Alan |
| | | * @date 2021-02-20 09:40:38 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Api(tags = "参数配置表管理接口") |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequestMapping("sysConfig") |
| | | @RequiredArgsConstructor |
| | | public class SysConfigController { |
| | | |
| | | private final ISysConfigService sysConfigService; |
| | | |
| | | @ApiOperation(value = "参数配置表无翻页列表") |
| | | @GetMapping |
| | | public FebsResponse getAllSysConfigs(SysConfig sysConfig) { |
| | | return new FebsResponse().data(sysConfigService.findSysConfigs(sysConfig)); |
| | | } |
| | | |
| | | @ApiOperation(value = "参数配置表翻页列表") |
| | | @GetMapping("list") |
| | | public FebsResponse sysConfigList(QueryRequest request, SysConfig sysConfig) { |
| | | Map |
| | | <String, Object> dataTable = FebsUtil.getDataTable(this.sysConfigService.findSysConfigs(request, sysConfig)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @ApiOperation(value = "参数配置表增加") |
| | | @PostMapping |
| | | public void addSysConfig(@Valid SysConfig sysConfig) throws FebsException { |
| | | try { |
| | | this.sysConfigService.createSysConfig(sysConfig); |
| | | } catch (Exception e) { |
| | | String message = "新增参数配置表失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "参数配置表物理删除") |
| | | @DeleteMapping |
| | | public void deleteSysConfig(SysConfig sysConfig) throws FebsException { |
| | | try { |
| | | this.sysConfigService.deleteSysConfig(sysConfig); |
| | | } catch (Exception e) { |
| | | String message = "删除参数配置表失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "参数配置表逻辑删除") |
| | | @DeleteMapping("{ids}") |
| | | public void logicDeleteSysConfig(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.sysConfigService.logicDelSysConfig(ids); |
| | | } catch (Exception e) { |
| | | String message = "逻辑删除参数配置表失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "参数配置表修改") |
| | | @PutMapping |
| | | public void updateSysConfig(SysConfig sysConfig) throws FebsException { |
| | | try { |
| | | this.sysConfigService.updateSysConfig(sysConfig); |
| | | } 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.SysConfig; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * name:SysConfig |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:参数配置表实体Mapper |
| | | * |
| | | * @author Alan |
| | | * @date 2021-02-20 09:40:38 |
| | | * @since JDK1.8 |
| | | */ |
| | | public interface SysConfigMapper extends BaseMapper<SysConfig> { |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * date Alan |
| | | * @author: 2021-02-20 09:40:38 |
| | | * @param list 待删除Id |
| | | * @param operatorId 操作员Id |
| | | * @return void |
| | | */ |
| | | @Update("<script> " + |
| | | " UPDATE sys_config 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.SysConfigMapper"> |
| | | |
| | | </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.SysConfig; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * name:SysConfig |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:参数配置表服务接口 |
| | | * |
| | | * @author Alan |
| | | * @date 2021-02-20 09:40:38 |
| | | * @since JDK1.8 |
| | | */ |
| | | public interface ISysConfigService extends IService<SysConfig> { |
| | | /** |
| | | * 查询(分页) |
| | | * |
| | | * @param request QueryRequest |
| | | * @param sysConfig sysConfig |
| | | * @return IPage<SysConfig> |
| | | */ |
| | | IPage<SysConfig> findSysConfigs(QueryRequest request, SysConfig sysConfig); |
| | | |
| | | /** |
| | | * 查询(所有) |
| | | * |
| | | * @param sysConfig sysConfig |
| | | * @return List<SysConfig> |
| | | */ |
| | | List<SysConfig> findSysConfigs(SysConfig sysConfig); |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param sysConfig sysConfig |
| | | */ |
| | | void createSysConfig(SysConfig sysConfig); |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param sysConfig sysConfig |
| | | */ |
| | | void updateSysConfig(SysConfig sysConfig); |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param sysConfig sysConfig |
| | | */ |
| | | void deleteSysConfig(SysConfig sysConfig); |
| | | |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * date 2021-01-28 10:48 |
| | | * @author: luoyibo |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | */ |
| | | void logicDelSysConfig(String ids); |
| | | } |
| | |
| | | |
| | | 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.entity.system.DicItem; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.core.utils.SequenceUtil; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | public IPage<DicItem> findDicItems(QueryRequest request, DicItem dicitem) { |
| | | LambdaQueryWrapper<DicItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(DicItem::getDelFlag, 0); |
| | | queryWrapper.eq(DicItem::getDicId, dicitem.getDicId()); |
| | | if(StringUtils.isNotBlank(dicitem.getDicItemName())){ |
| | | queryWrapper.like(DicItem::getDicItemName, dicitem.getDicItemName()); |
| | | } |
| | | Page<DicItem> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.page(page, queryWrapper); |
| | | } |
| | |
| | | public void deleteDicItem(DicItem dicitem) { |
| | | LambdaQueryWrapper<DicItem> wrapper = new LambdaQueryWrapper<>(); |
| | | // TODO 设置删除条件 |
| | | wrapper.eq(DicItem::getDicItemId, dicitem.getDicItemId()); |
| | | this.remove(wrapper); |
| | | } |
| | | |
| | |
| | | public void logicDelDicItem(String ids) { |
| | | String[] str = ids.split(","); |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | dicitemMapper.logicDeleteByIds(list, operatorId); |
| | | for (String str1:list){ |
| | | LambdaQueryWrapper<DicItem> wrapper = new LambdaQueryWrapper<>(); |
| | | // TODO 设置删除条件 |
| | | wrapper.eq(DicItem::getDicItemId, str1); |
| | | this.remove(wrapper); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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.entity.system.Position; |
| | | 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 com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | public IPage<Dic> findDics(QueryRequest request, Dic dic) { |
| | | LambdaQueryWrapper<Dic> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Dic::getDelFlag, 0); |
| | | if(StringUtils.isNotBlank(dic.getDicName())){ |
| | | queryWrapper.like(Dic::getDicName, dic.getDicName()); |
| | | } |
| | | Page<Dic> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.page(page, queryWrapper); |
| | | } |
| | |
| | | public void deleteDic(Dic dic) { |
| | | LambdaQueryWrapper<Dic> wrapper = new LambdaQueryWrapper<>(); |
| | | // TODO 设置删除条件 |
| | | wrapper.eq(Dic::getDicId, dic.getDicId()); |
| | | this.remove(wrapper); |
| | | } |
| | | |
| | |
| | | public void logicDelDic(String ids) { |
| | | String[] str = ids.split(","); |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | dicMapper.logicDeleteByIds(list, operatorId); |
| | | for (String str1:list){ |
| | | LambdaQueryWrapper<Dic> wrapper = new LambdaQueryWrapper<>(); |
| | | // TODO 设置删除条件 |
| | | wrapper.eq(Dic::getDicId, str1); |
| | | this.remove(wrapper); |
| | | } |
| | | } |
| | | } |
| 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.system.Dic; |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.server.system.mapper.SysConfigMapper; |
| | | import cc.mrbird.febs.server.system.service.ISysConfigService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | 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:SysConfig |
| | | * package:cc.mrbird.febs.server.system.controller |
| | | * description:参数配置表服务接口实现 |
| | | * |
| | | * @author Alan |
| | | * @date 2021-02-20 09:40:38 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) |
| | | class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService { |
| | | |
| | | private final SysConfigMapper sysConfigMapper; |
| | | private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser()) |
| | | .map(u -> u.getUserId().toString()) |
| | | .orElse("1"); |
| | | @Override |
| | | public IPage<SysConfig> findSysConfigs(QueryRequest request, SysConfig sysConfig) { |
| | | LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SysConfig::getDelFlag, 0); |
| | | if(StringUtils.isNotBlank(sysConfig.getConfigName())){ |
| | | queryWrapper.like(SysConfig::getConfigName, sysConfig.getConfigName()); |
| | | } |
| | | Page<SysConfig> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.page(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysConfig> findSysConfigs(SysConfig sysConfig) { |
| | | LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SysConfig::getDelFlag, 0); |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createSysConfig(SysConfig sysConfig) { |
| | | sysConfig.setConfigId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | sysConfig.setCreateBy(operatorId); |
| | | this.save(sysConfig); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateSysConfig(SysConfig sysConfig) { |
| | | SysConfig dbData = this.getById(sysConfig.getConfigId()); |
| | | sysConfig.setDelFlag(dbData.getDelFlag()); |
| | | sysConfig.setUpdateTime(new Date()); |
| | | sysConfig.setUpdateBy(operatorId); |
| | | this.saveOrUpdate(sysConfig); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteSysConfig(SysConfig sysConfig) { |
| | | LambdaQueryWrapper<SysConfig> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(SysConfig::getConfigId, sysConfig.getConfigId()); |
| | | // TODO 设置删除条件 |
| | | this.remove(wrapper); |
| | | } |
| | | /** |
| | | * |
| | | * 根据Id批量逻辑删除记录 |
| | | * |
| | | * date 2021-01-28 10:48 |
| | | * @author: luoyibo |
| | | * @param ids 待删除Id |
| | | * @return void |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void logicDelSysConfig(String ids) { |
| | | String[] str = ids.split(","); |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | for (String str1:list){ |
| | | LambdaQueryWrapper<SysConfig> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(SysConfig::getConfigId, str1); |
| | | // TODO 设置删除条件 |
| | | this.remove(wrapper); |
| | | } |
| | | } |
| | | } |