| | |
| | | package com.panzhihua.sangeshenbian; |
| | | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.client.SpringCloudApplication; |
| | | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
| | |
| | | @EnableEurekaClient |
| | | @EnableCircuitBreaker |
| | | @ComponentScan({"com.panzhihua.sangeshenbian", "com.panzhihua.common"}) |
| | | @MapperScan("com.panzhihua.sangeshenbian.dao") |
| | | @EnableScheduling |
| | | public class ServiceSangeshenbianApplication |
| | | { |
| | |
| | | if(null == department.getPid()){ |
| | | department.setPid(0); |
| | | } |
| | | int count = departmentService.count(new LambdaQueryWrapper<Department>().eq(Department::getPid, department.getPid()).eq(Department::getName, department.getName())); |
| | | long count = departmentService.count(new LambdaQueryWrapper<Department>().eq(Department::getPid, department.getPid()).eq(Department::getName, department.getName())); |
| | | if(0 < count){ |
| | | return R.fail("单位名称重复。"); |
| | | } |
| | |
| | | if(null == department.getPid()){ |
| | | department.setPid(0); |
| | | } |
| | | int count = departmentService.count(new LambdaQueryWrapper<Department>().eq(Department::getPid, department.getPid()) |
| | | long count = departmentService.count(new LambdaQueryWrapper<Department>().eq(Department::getPid, department.getPid()) |
| | | .eq(Department::getName, department.getName()).ne(Department::getId, department.getId())); |
| | | if(0 < count){ |
| | | return R.fail("单位名称重复。"); |
| | |
| | | @ApiOperation(value = "删除单位信息", tags = {"三个身边后台-用户管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 3, businessType = "删除单位信息") |
| | | public R delete(@PathVariable("id") Integer id){ |
| | | int count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getOneDepartmentId, id).or().eq(SystemUser::getTwoDepartmentId, id) |
| | | long count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getOneDepartmentId, id).or().eq(SystemUser::getTwoDepartmentId, id) |
| | | .or().eq(SystemUser::getThreeDepartmentId, id).or().eq(SystemUser::getFourDepartmentId, id).ne(SystemUser::getStatus, 3)); |
| | | if(0 < count){ |
| | | return R.fail("该单位已被使用,删除失败。"); |
| | |
| | | userId = id.toString(); |
| | | break; |
| | | } |
| | | Integer count = messageNotificationService.lambdaQuery() |
| | | long count = messageNotificationService.lambdaQuery() |
| | | .eq(MessageNotification::getReadStatus, 0) |
| | | .eq(MessageNotification::getUndertakerType, systemUser.getAccountLevel()) |
| | | .eq(MessageNotification::getUndertakerUserId, userId) |
| | |
| | | if(systemUser.getAccountLevel() != 1){ |
| | | return R.fail("添加失败"); |
| | | } |
| | | int count = problemTypeService.count(new LambdaQueryWrapper<ProblemType>().eq(ProblemType::getName, problemType.getName()).eq(ProblemType::getDel, 0)); |
| | | long count = problemTypeService.count(new LambdaQueryWrapper<ProblemType>().eq(ProblemType::getName, problemType.getName()).eq(ProblemType::getDel, 0)); |
| | | if(0 < count){ |
| | | return R.fail("该问题类型已存在"); |
| | | } |
| | |
| | | if(systemUser.getAccountLevel() != 1){ |
| | | return R.fail("编辑失败"); |
| | | } |
| | | int count = problemTypeService.count(new LambdaQueryWrapper<ProblemType>().eq(ProblemType::getName, problemType.getName()).eq(ProblemType::getDel, 0).ne(ProblemType::getId, problemType.getId())); |
| | | long count = problemTypeService.count(new LambdaQueryWrapper<ProblemType>().eq(ProblemType::getName, problemType.getName()).eq(ProblemType::getDel, 0).ne(ProblemType::getId, problemType.getId())); |
| | | if(0 < count){ |
| | | return R.fail("该问题类型已存在"); |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.api; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.panzhihua.common.interfaces.OperLog; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemPost; |
| | | import com.panzhihua.sangeshenbian.service.ISystemPostService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/2/25 19:44 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/systemPost") |
| | | public class SystemPostController { |
| | | |
| | | @Resource |
| | | private ISystemPostService systemPostService; |
| | | |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加职位", tags = {"三个身边后台-职位管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 1,businessType = "添加职位") |
| | | public R add(@RequestBody SystemPost systemPost) { |
| | | systemPostService.save(systemPost); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/edit") |
| | | @ApiOperation(value = "编辑职位", tags = {"三个身边后台-职位管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 2,businessType = "编辑职位") |
| | | public R edit(@RequestBody SystemPost systemPost) { |
| | | systemPostService.updateById(systemPost); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete/{id}") |
| | | @ApiOperation(value = "删除职位", tags = {"三个身边后台-职位管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 3,businessType = "删除职位") |
| | | public R delete(@PathVariable("id") Integer id) { |
| | | systemPostService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取列表数据", tags = {"三个身边后台-职位管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 0,businessType = "获取职位列表数据") |
| | | public R<IPage<SystemPost>> list(String name, Integer pageNum, Integer pageSize) { |
| | | return R.ok(systemPostService.list(name, pageNum, pageSize)); |
| | | } |
| | | } |
| | |
| | | @ApiOperation(value = "添加角色", tags = {"三个身边后台-角色管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 1,businessType = "添加角色") |
| | | public R add(@RequestBody AddSystemRole addSystemRole){ |
| | | int count = systemRoleService.count(new LambdaQueryWrapper<SystemRole>().eq(SystemRole::getDel, 0).eq(SystemRole::getName, addSystemRole.getName())); |
| | | long count = systemRoleService.count(new LambdaQueryWrapper<SystemRole>().eq(SystemRole::getDel, 0).eq(SystemRole::getName, addSystemRole.getName())); |
| | | if(0 < count){ |
| | | return R.fail("该角色名称已存在"); |
| | | } |
| | |
| | | @ApiOperation(value = "编辑角色", tags = {"三个身边后台-角色管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 2,businessType = "编辑角色") |
| | | public R edit(@RequestBody EditSystemRole editSystemRole){ |
| | | int count = systemRoleService.count(new LambdaQueryWrapper<SystemRole>().eq(SystemRole::getDel, 0) |
| | | long count = systemRoleService.count(new LambdaQueryWrapper<SystemRole>().eq(SystemRole::getDel, 0) |
| | | .eq(SystemRole::getName, editSystemRole.getName()).ne(SystemRole::getId, editSystemRole.getId())); |
| | | if(0 < count){ |
| | | return R.fail("该角色名称已存在"); |
| | |
| | | if(4 == user.getAccountLevel() && 4 < systemUser.getAccountLevel()){ |
| | | return R.fail("不能添加街道、区县和市级账号"); |
| | | } |
| | | int count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getPhone, systemUser.getPhone()).ne(SystemUser::getStatus, 3)); |
| | | long count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getPhone, systemUser.getPhone()).ne(SystemUser::getStatus, 3)); |
| | | if(0 < count){ |
| | | return R.fail("手机号重复。"); |
| | | } |
| | |
| | | @ApiOperation(value = "编辑人员", tags = {"三个身边后台-人员管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 2,businessType = "编辑人员") |
| | | public R edit(@RequestBody SystemUser systemUser){ |
| | | int count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getPhone, systemUser.getPhone()) |
| | | long count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getPhone, systemUser.getPhone()) |
| | | .ne(SystemUser::getStatus, 3).ne(SystemUser::getId, systemUser.getId())); |
| | | if(0 < count){ |
| | | return R.fail("手机号重复。"); |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemPost; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/2/25 19:41 |
| | | */ |
| | | @Mapper |
| | | public interface SystemPostMapper extends BaseMapper<SystemPost> { |
| | | |
| | | |
| | | |
| | | IPage<SystemPost> list(Page page, @Param("name") String name); |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.model.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/2/25 19:39 |
| | | */ |
| | | @Data |
| | | @TableName("sgsb_system_post") |
| | | public class SystemPost { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 删除标识(0=否,1=是) |
| | | */ |
| | | @TableField("del") |
| | | private Integer del; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemPost; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/2/25 19:42 |
| | | */ |
| | | public interface ISystemPostService extends IService<SystemPost> { |
| | | |
| | | |
| | | IPage<SystemPost> list(String name, Integer pageNum, Integer pageSize); |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.sangeshenbian.dao.SystemPostMapper; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemPost; |
| | | import com.panzhihua.sangeshenbian.service.ISystemPostService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/2/25 19:43 |
| | | */ |
| | | @Service |
| | | public class SystemPostServiceImpl extends ServiceImpl<SystemPostMapper, SystemPost> implements ISystemPostService { |
| | | |
| | | @Override |
| | | public IPage<SystemPost> list(String name, Integer pageNum, Integer pageSize) { |
| | | Page page = new Page<>(); |
| | | page.setCurrent(pageNum); |
| | | page.setSize(pageSize); |
| | | return this.baseMapper.list(page, name); |
| | | } |
| | | } |
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="com.panzhihua.sangeshenbian.dao.SystemPostMapper"> |
| | | |
| | | <select id="list" resultType="com.panzhihua.sangeshenbian.model.entity.SystemPost"> |
| | | select |
| | | id, |
| | | name, |
| | | del, |
| | | create_time |
| | | from sgsb_system_post |
| | | where del = 0 |
| | | <if test="name != null and name != ''"> |
| | | and name like concat('%',#{name},'%') |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | </mapper> |