| | |
| | | }) |
| | | @GetMapping("/table") |
| | | public Result<?> getDepartmentListTable(Integer departmentId) { |
| | | MyUtil.PrintLog(departmentId.toString()); |
| | | List<Map<String, Object>> departmentListTable = organizationalService.getDepartmentListTable(departmentId); |
| | | return Result.success(departmentListTable); |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "å é¤é¨é¨") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteDepartment(Integer id) { |
| | | Integer deleteDepartment = organizationalService.deleteDepartment(id); |
| | | if (deleteDepartment >= 1){ |
| | | return Result.success("å 餿åï¼"); |
| | | } |
| | | return Result.fail("å é¤å¤±è´¥ï¼"); |
| | | public Result<?> deleteDepartment(String ids) { |
| | | organizationalService.deleteDepartment(ids); |
| | | return Result.success("å 餿åï¼"); |
| | | } |
| | | } |
| | |
| | | List<Map<String, Object>> OrganizationalTree(Integer father_id); |
| | | |
| | | List<Map<String, Object>> getDepartmentListTable(Integer departmentId); |
| | | |
| | | void deleteDepartment(String ids); |
| | | } |
| | |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiModelProperty(value = "é¨é¨åç§°", example = "å¼åé¨", required = true) |
| | | private String department; |
| | | |
| | | @NotBlank(message = "è¯·éæ©ä¸çº§é¨é¨ï¼") |
| | | @NotNull(message = "è¯·éæ©ä¸çº§é¨é¨ï¼") |
| | | @ApiModelProperty(value = "ä¸çº§é¨é¨ID", example = "1", required = true) |
| | | private Integer fatherId; |
| | | |
| | |
| | | |
| | | Integer updateDepartment(Integer id, Organizational organizational); |
| | | |
| | | Integer deleteDepartment(Integer id); |
| | | void deleteDepartment(String ids); |
| | | |
| | | List<Map<String, Object>> getDepartmentListTable(Integer departmentId); |
| | | } |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> mapData = new ArrayList<>(); |
| | | map.put("children", mapList); |
| | | map.put("id", 0); |
| | | map.put("department", firstEnterpriseName); |
| | | map.put("value", 0); |
| | | map.put("label", firstEnterpriseName); |
| | | mapData.add(map); |
| | | return mapData; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteDepartment(Integer id) { |
| | | LambdaUpdateWrapper<Organizational> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Organizational::getId, id); |
| | | updateWrapper.set(Organizational::getState, 0); |
| | | return organizationalMapper.update(new Organizational(), updateWrapper); |
| | | public void deleteDepartment(String ids) { |
| | | organizationalMapper.deleteDepartment(ids); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | <select id="FourTree" resultMap="OneLevelTreeMap"> |
| | | SELECT m.`type`, m.`id` materialId, m.`name` materialName, s.id standardId, s.name standardName, |
| | | f.id specificationsId, f.name specificationsName |
| | | f.id specificationsId, f.name specificationsName |
| | | FROM material m |
| | | LEFT JOIN (SELECT s.`id`, s.`name`, s.`material_id` FROM standard s WHERE s.`state` = 1) s |
| | | ON s.material_id = m.`id` |
| | | LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id` FROM specifications f WHERE f.`state` = 1) f |
| | | ON f.standard_id = s.id |
| | | LEFT JOIN (SELECT s.`id`, s.`name`, s.`material_id` FROM standard s WHERE s.`state` = 1) s |
| | | ON s.material_id = m.`id` |
| | | LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id`, f.`create_time` FROM specifications f WHERE f.`state` = 1) f |
| | | ON f.standard_id = s.id |
| | | WHERE m.`state` = 1 |
| | | ORDER BY f.create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </resultMap> |
| | | |
| | | <select id="OrganizationalTree" resultMap="OrganizationalMap"> |
| | | SELECT o.id, o.`department` FROM organizational o where o.`father_id` = #{father_id} |
| | | SELECT o.id, o.`department` |
| | | FROM organizational o |
| | | where o.`father_id` = #{father_id} |
| | | and o.state = 1 |
| | | </select> |
| | | |
| | | <select id="getDepartmentListTable" resultType="map"> |
| | |
| | | WHERE o.`father_id` = #{departmentId} |
| | | AND o.`state` = 1 |
| | | </select> |
| | | |
| | | <select id="deleteDepartment"> |
| | | update lims_laboratory.organizational |
| | | set state=0 |
| | | where id in (${ids}) |
| | | </select> |
| | | </mapper> |
| | |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{specificationsId} |
| | | ORDER BY product.`create_time` DESC |
| | | </select> |
| | | |
| | | <select id="deleteList"> |
| | |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://192.168.110.209:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | username: user |
| | | # url: jdbc:mysql://192.168.110.209:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | # username: user |
| | | url: jdbc:mysql://localhost:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | druid: |
| | | # Druidæ°æ®æºé
ç½® |
| | |
| | | # redisæ°æ®åºç´¢å¼(é»è®¤ä¸º0)ï¼æä»¬ä½¿ç¨ç´¢å¼ä¸º3çæ°æ®åºï¼é¿å
åå
¶ä»æ°æ®åºå²çª |
| | | database: 0 |
| | | # redisæå¡å¨å°åï¼é»è®¤ä¸ºlocalhostï¼ |
| | | host: 192.168.110.209 |
| | | # host: 192.168.110.209 |
| | | host: localhost |
| | | # redis端å£ï¼é»è®¤ä¸º6379ï¼ |
| | | port: 6380 |
| | | # redis访é®å¯ç ï¼é»è®¤ä¸ºç©ºï¼ |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.clients.UserLoginUtils; |
| | | import com.yuanchu.limslaboratory.pojo.Enterprise; |
| | | import com.yuanchu.limslaboratory.pojo.User; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import com.yuanchu.limslaboratory.shiro.realm.ShiroRealm; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.utils.SpringUtil; |
| | | import com.yuanchu.limslaboratory.vo.NewPersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.PagePersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.NewPersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.PagePersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import com.yuanchu.limslaboratory.vo.UpdatePersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.UpdatePersonnelVo; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authc.IncorrectCredentialsException; |
| | |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "èµ·å§é¡µ", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯ä¸é¡µæ°é", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "name", value = "人ååç§°", dataTypeClass = String.class) |
| | | @ApiImplicitParam(name = "name", value = "人ååç§°", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "status", value = "å¨èç¶æ", dataTypeClass = Integer.class) |
| | | }) |
| | | public Result<Map<String, Object>> getNewPersonnelPage(Integer pageNo, Integer pageSize, String name) { |
| | | IPage<PagePersonnelVo> PageList = userService.getNewPersonnelPage(name, new Page<Objects>(pageNo, pageSize)); |
| | | public Result<Map<String, Object>> getNewPersonnelPage(Integer pageNo, Integer pageSize, String name, Integer status) { |
| | | IPage<PagePersonnelVo> PageList = userService.getNewPersonnelPage(name, new Page<Objects>(pageNo, pageSize), status); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("row", PageList.getRecords()); |
| | | map.put("total", PageList.getTotal()); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.User; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.vo.PagePersonnelVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | import com.yuanchu.limslaboratory.pojo.vo.PagePersonnelVo; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public interface UserMapper extends BaseMapper<User> { |
| | | Map<String, String> selectUserByUserId(int userId); |
| | | |
| | | IPage<PagePersonnelVo> getNewPersonnelPage(String name, Page page); |
| | | IPage<PagePersonnelVo> getNewPersonnelPage(String name, Page page, Integer status); |
| | | |
| | | List<Map<String,Object>> selectUser(); |
| | | |
| | |
| | | @ApiModelProperty(value = "å
³è ä¼ä¸id") |
| | | private Integer enterpriseId; |
| | | |
| | | @ApiModelProperty(value = "ç»ç»æ¶æId", example = "2") |
| | | private Integer organizationId; |
| | | |
| | | @TableLogic(value = "1", delval = "0") |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0") |
| | | private Integer state; |
| | | |
| | | public User(String account, String name, String phone, String email, String info) { |
| | | this.account = account; |
| | | this.name = name; |
ÎļþÃû´Ó user-server/src/main/java/com/yuanchu/limslaboratory/vo/NewPersonnelVo.java ÐÞ¸Ä |
| | |
| | | package com.yuanchu.limslaboratory.vo; |
| | | package com.yuanchu.limslaboratory.pojo.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "0ï¼æ æéï¼1ï¼ææé", example = "1", required = true) |
| | | private Integer role_id; |
| | | private Integer roleId; |
| | | |
| | | @ApiModelProperty(value = "å¹´é¾", example = "23") |
| | | private Integer age; |
| | |
| | | |
| | | @ApiModelProperty(value = "é®ç®±", example = "12345678@qq.com") |
| | | private String email; |
| | | |
| | | @ApiModelProperty(value = "ç»ç»æ¶æId", example = "2") |
| | | private Integer organizationId; |
| | | } |
ÎļþÃû´Ó user-server/src/main/java/com/yuanchu/limslaboratory/vo/PagePersonnelVo.java ÐÞ¸Ä |
| | |
| | | package com.yuanchu.limslaboratory.vo; |
| | | package com.yuanchu.limslaboratory.pojo.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | |
| | | @ApiModelProperty(value = "å¨èç¶æ æ£å¸¸>=1,离è<=0", example = "0") |
| | | private Integer jobState; |
| | | |
| | | private String department; |
| | | } |
ÎļþÃû´Ó user-server/src/main/java/com/yuanchu/limslaboratory/vo/UpdatePersonnelVo.java ÐÞ¸Ä |
| | |
| | | package com.yuanchu.limslaboratory.vo; |
| | | package com.yuanchu.limslaboratory.pojo.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "è´¦å·å¯ç ", example = "654321") |
| | | private String password; |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.User; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.vo.NewPersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.PagePersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.UpdatePersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.NewPersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.PagePersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.UpdatePersonnelVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @param page |
| | | * @return |
| | | */ |
| | | IPage<PagePersonnelVo> getNewPersonnelPage(String name, Page page); |
| | | IPage<PagePersonnelVo> getNewPersonnelPage(String name, Page page, Integer status); |
| | | |
| | | /** |
| | | * ç»å½è·åç¨æ·åºæ¬ä¿¡æ¯ä¸ç³»ç»è¶
æ¶æ¶é´æé |
| | |
| | | import com.yuanchu.limslaboratory.mapper.UserMapper; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.vo.NewPersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.PagePersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.UpdatePersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.NewPersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.PagePersonnelVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.UpdatePersonnelVo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | |
| | | @Override |
| | | public Integer addNewPersonnel(NewPersonnelVo newPersonnelVo, String enterpriseId) { |
| | | User user = new User() |
| | | .setName(newPersonnelVo.getName()) |
| | | .setAccount(newPersonnelVo.getAccount()) |
| | | .setAge(String.valueOf(newPersonnelVo.getAge())) |
| | | .setPhone(newPersonnelVo.getPhone()) |
| | | .setEmail(newPersonnelVo.getEmail()) |
| | | .setRoleId(newPersonnelVo.getRole_id()) |
| | | .setPassword(newPersonnelVo.getPassword()) |
| | | .setEnterpriseId(Integer.valueOf(enterpriseId)); |
| | | return userMapper.insert(user); |
| | | try { |
| | | User unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(newPersonnelVo), User.class); |
| | | unmarshal.setEnterpriseId(Integer.valueOf(enterpriseId)); |
| | | return userMapper.insert(unmarshal); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<PagePersonnelVo> getNewPersonnelPage(String name, Page page) { |
| | | return userMapper.getNewPersonnelPage(name, page); |
| | | public IPage<PagePersonnelVo> getNewPersonnelPage(String name, Page page, Integer status) { |
| | | MyUtil.PrintLog(name + status + "============="); |
| | | return userMapper.getNewPersonnelPage(name, page, status); |
| | | } |
| | | } |
| | |
| | | AND u.id = #{userId} |
| | | </select> |
| | | |
| | | <resultMap id="PagePersonnelVoMap" type="com.yuanchu.limslaboratory.vo.PagePersonnelVo"> |
| | | <resultMap id="PagePersonnelVoMap" type="com.yuanchu.limslaboratory.pojo.vo.PagePersonnelVo"> |
| | | <result property="id" column="id"/> |
| | | <result property="username" column="username"/> |
| | | <result property="roleName" column="roleName"/> |
| | |
| | | <result property="phone" column="phone"/> |
| | | <result property="email" column="email"/> |
| | | <result property="jobState" column="job_state"/> |
| | | <result property="department" column="department"/> |
| | | </resultMap> |
| | | <select id="getNewPersonnelPage" resultMap="PagePersonnelVoMap"> |
| | | SELECT u.`id`, u.`name` username, r.`name` roleName, u.`create_time`, IFNULL(u.`age`, '---') age, |
| | | IFNULL(u.`phone`, '---') phone, IFNULL(u.`email`, '---') email, u.`job_state` |
| | | FROM `user` u, role r |
| | | WHERE u.`role_id` = r.`id` |
| | | <if test="name != null and name!=''"> |
| | | AND u.name = #{name} |
| | | SELECT u.`id`, u.`name` username, r.`name` roleName, u.`create_time`, u.`age`, |
| | | u.`phone`, u.`email`, u.`job_state`, o.`department` |
| | | FROM `user` u |
| | | LEFT JOIN role r |
| | | ON u.`role_id` = r.`id` AND r.`state` = 1 |
| | | LEFT JOIN organizational o |
| | | ON u.`organization_id` = o.`id` AND o.`state` = 1 |
| | | WHERE u.`state` = 1 |
| | | <if test="name != null and name != ''"> |
| | | AND u.`name` LIKE CONCAT('%',#{name}, '%') |
| | | </if> |
| | | <if test="status != null"> |
| | | AND u.`job_state` in (#{status}) |
| | | </if> |
| | | ORDER BY u.`create_time` DESC |
| | | </select> |
| | | |
| | | <select id="selectUser" resultType="Map"> |