| | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | |
| | | @ApiModelProperty(value = "用户昵称") |
| | | private String nickName; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "电话号码") |
| | | private Timestamp birthday; |
| | | |
| | | @Email |
| | | @NotBlank |
| | | @ApiModelProperty(value = "邮箱") |
| | |
| | | @ApiModelProperty(value = "电话号码") |
| | | private String phone; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "住址") |
| | | private String address; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "钉钉号") |
| | | private String dingding; |
| | | |
| | | @OneToOne |
| | | @JoinColumn(name = "rostering_id") |
| | | @ApiModelProperty(value = "排班") |
| | | private SysRostering sysRostering; |
| | | |
| | | @ApiModelProperty(value = "用户性别") |
| | | private String gender; |
| | | |
| | |
| | | @Query(value = "SELECT count(1) FROM sys_user u, sys_users_roles r WHERE " + |
| | | "u.user_id = r.user_id AND r.role_id in ?1", nativeQuery = true) |
| | | int countByRoles(Set<Long> ids); |
| | | |
| | | /** |
| | | * 根据排班查询 |
| | | * @param ids / |
| | | * @return / |
| | | */ |
| | | @Query(value = "SELECT count(1) FROM sys_user WHERE rostering_id IN ?1", nativeQuery = true) |
| | | int countByRosterings(Long[] ids); |
| | | } |
| | |
| | | @ApiOperation("删除排班") |
| | | @PreAuthorize("@el.check('sysRostering:del')") |
| | | public ResponseEntity<Object> deleteSysRostering(@RequestBody Long[] ids) { |
| | | // 验证是否被关联 |
| | | sysRosteringService.verification(ids); |
| | | sysRosteringService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import java.util.Set; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysRosteringDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 验证是否被关联 |
| | | * @param ids / |
| | | */ |
| | | void verification(Long[] ids); |
| | | } |
| | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.system.domain.SysRostering; |
| | | |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | import java.util.Set; |
| | | |
| | |
| | | |
| | | private String nickName; |
| | | |
| | | private Timestamp birthday; |
| | | |
| | | private String email; |
| | | |
| | | private String phone; |
| | | |
| | | private String address; |
| | | |
| | | private String dingding; |
| | | |
| | | private SysRosteringDto sysRostering; |
| | | |
| | | private String gender; |
| | | |
| | | private String avatarName; |
| | |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.system.domain.SysRostering; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | |
| | | private final SysRosteringRepository sysRosteringRepository; |
| | | private final SysRosteringMapper sysRosteringMapper; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysRosteringQueryCriteria criteria, Pageable pageable){ |
| | |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | public void verification(Long[] ids) { |
| | | if(userRepository.countByRosterings(ids) > 0){ |
| | | throw new BadRequestException("所选的排班中存在用户关联,请解除关联再试!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | user.setPhone(resources.getPhone()); |
| | | user.setNickName(resources.getNickName()); |
| | | user.setGender(resources.getGender()); |
| | | user.setBirthday(resources.getBirthday()); |
| | | user.setAddress(resources.getAddress()); |
| | | user.setDingding(resources.getDingding()); |
| | | user.setSysRostering(resources.getSysRostering()); |
| | | userRepository.save(user); |
| | | // 清除缓存 |
| | | delCaches(user.getId(), user.getUsername()); |
| | |
| | | v-model="jobDatas" |
| | | style="width: 178px" |
| | | multiple |
| | | multiple-limit="1" |
| | | placeholder="请选择" |
| | | @remove-tag="deleteTag" |
| | | @change="changeJob" |
| | |
| | | <el-radio label="女">女</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="生日" prop="birthday"> |
| | | <el-date-picker |
| | | v-model="form.birthday" |
| | | type="date" |
| | | style="width: 178px" |
| | | placeholder="选择日期" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="排班" prop="sysRostering.id"> |
| | | <el-select v-model="form.sysRostering.id" clearable style="width: 178px" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in rosterings" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="钉钉号" prop="dingding"> |
| | | <el-input v-model="form.dingding" /> |
| | | </el-form-item> |
| | | <el-form-item label="状态"> |
| | | <el-radio-group v-model="form.enabled" :disabled="form.id === user.id"> |
| | | <el-radio |
| | |
| | | >{{ item.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="住址" prop="address"> |
| | | <el-input v-model="form.address" style="width: 437px" /> |
| | | </el-form-item> |
| | | <el-form-item style="margin-bottom: 0;" label="角色" prop="roles"> |
| | | <el-select |
| | | v-model="roleDatas" |
| | | style="width: 437px" |
| | | multiple |
| | | multiple-limit="1" |
| | | placeholder="请选择" |
| | | @remove-tag="deleteTag" |
| | | @change="changeRole" |
| | |
| | | import { mapGetters } from 'vuex' |
| | | import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
| | | import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' |
| | | import crudRostering from '@/api/system/rostering' |
| | | let userRoles = [] |
| | | let userJobs = [] |
| | | const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null } |
| | | const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, sysRostering: { id: null }} |
| | | export default { |
| | | name: 'User', |
| | | components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker }, |
| | |
| | | ], |
| | | phone: [ |
| | | { required: true, trigger: 'blur', validator: validPhone } |
| | | ], |
| | | birthday: [ |
| | | { required: true, message: '请选择生日', trigger: 'change' } |
| | | ], |
| | | 'sysRostering.id': [ |
| | | { required: true, message: '请选择排班', trigger: 'change' } |
| | | ], |
| | | dingding: [ |
| | | { required: true, message: '请输入钉钉号', trigger: 'blur' }, |
| | | { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } |
| | | ], |
| | | address: [ |
| | | { required: true, message: '请输入住址', trigger: 'blur' }, |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ] |
| | | } |
| | | }, |
| | | // 排班 |
| | | rosterings: [] |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | // 获取排班 |
| | | this.getRostering() |
| | | this.getRoles() |
| | | if (form.id == null) { |
| | | this.getDepts() |
| | |
| | | data.enabled = !data.enabled |
| | | }) |
| | | }, |
| | | // 获取排班 |
| | | getRostering() { |
| | | // 获取排班 |
| | | crudRostering.getAll().then(res => { |
| | | // 排班 |
| | | this.rosterings = res |
| | | }) |
| | | }, |
| | | // 获取弹窗内角色数据 |
| | | getRoles() { |
| | | getAll().then(res => { |