Commit 6146b6cc authored by mengmeng's avatar mengmeng

Merge branch 'lings' into 'master'

Lings

See merge request !6
parents e6b6e9da 3d225969
......@@ -11,7 +11,10 @@ import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.NewsDTO;
import io.hmit.modules.serviceOrder.dto.NewsDocumentDTO;
import io.hmit.modules.serviceOrder.dto.PensionServiceDocumentDTO;
import io.hmit.modules.serviceOrder.excel.NewsExcel;
import io.hmit.modules.serviceOrder.service.NewsDocumentService;
import io.hmit.modules.serviceOrder.service.NewsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -23,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -39,6 +43,8 @@ import java.util.Map;
public class NewsController {
@Autowired
private NewsService newsService;
@Autowired
private NewsDocumentService newsDocumentService;
@GetMapping("page")
@ApiOperation("分页")
......@@ -60,7 +66,11 @@ public class NewsController {
@RequiresPermissions("serviceOrder:news:info")
public Result<NewsDTO> get(@PathVariable("id") Long id){
NewsDTO data = newsService.get(id);
//获取活动新闻的附件
Map<String,Object> param = new HashMap<>();
param.put("newsId",data.getId());
List<NewsDocumentDTO> newsDocumentDTOList = newsDocumentService.list(param);
data.setNewsDocumentDTOList(newsDocumentDTOList);
return new Result<NewsDTO>().ok(data);
}
......@@ -73,6 +83,14 @@ public class NewsController {
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
newsService.save(dto);
//保存新闻详情页面的附件
List<NewsDocumentDTO> newsDocumentDTOList = dto.getNewsDocumentDTOList();
if(newsDocumentDTOList!=null){
for (NewsDocumentDTO newsDocumentDTO : newsDocumentDTOList) {
newsDocumentDTO.setNewId(dto.getId());
newsDocumentService.save(newsDocumentDTO);
}
}
return new Result();
}
......@@ -86,6 +104,16 @@ public class NewsController {
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
newsService.update(dto);
newsDocumentService.deletebyNewsId(dto.getId());
//保存新闻详情页面的附件
List<NewsDocumentDTO> newsDocumentDTOList = dto.getNewsDocumentDTOList();
if(newsDocumentDTOList!=null){
for (NewsDocumentDTO newsDocumentDTO : newsDocumentDTOList) {
newsDocumentDTO.setNewId(dto.getId());
newsDocumentService.save(newsDocumentDTO);
}
}
return new Result();
}
......@@ -113,4 +141,4 @@ public class NewsController {
ExcelUtils.exportExcelToTarget(response, null, list, NewsExcel.class);
}
}
\ No newline at end of file
}
......@@ -11,6 +11,7 @@ import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.PensionDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
import io.hmit.modules.serviceOrder.excel.PensionDocumentExcel;
import io.hmit.modules.serviceOrder.service.PensionDocumentService;
import io.swagger.annotations.Api;
......@@ -19,10 +20,15 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -39,6 +45,8 @@ import java.util.Map;
public class PensionDocumentController {
@Autowired
private PensionDocumentService pensionDocumentService;
@Value("${QR.download-path}")
private String QRPath;
@GetMapping("page")
@ApiOperation("分页")
......@@ -113,4 +121,48 @@ public class PensionDocumentController {
ExcelUtils.exportExcelToTarget(response, null, list, PensionDocumentExcel.class);
}
}
\ No newline at end of file
/**
* 上传文件
*/
@PostMapping("/uploadFile")
@ApiOperation("附件上传")
public Result<Map<String, Object>> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
if (file.isEmpty()) {
throw new Exception("上传文件不能为空");
}
//生成随机时间错
Long currenttime=System.currentTimeMillis();
//上传文件
String file_path = "/static/"+ currenttime +"-" + file.getOriginalFilename();
String file_path_act = QRPath + currenttime+"-"+file.getOriginalFilename();
System.out.println(file_path_act);
File fileAct = new File(file_path_act);
if (!fileAct.getParentFile().exists()) {
fileAct.getParentFile().mkdirs();
}
try {
file.transferTo(fileAct);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
//保存文件信息
PensionDocumentEntity pensionDocumentEntity = new PensionDocumentEntity();
pensionDocumentEntity.setFileName(fileAct.getName());
pensionDocumentEntity.setFilePath(file_path);
pensionDocumentEntity.setFilePathAct(fileAct.getPath());
pensionDocumentEntity.setFileSize(Double.parseDouble(String.valueOf(file.getSize())));
pensionDocumentEntity.setFileType(file.getContentType());
pensionDocumentEntity.setStatus("1");
pensionDocumentService.insert(pensionDocumentEntity);
Map<String, Object> result = new HashMap<>();
result.put("fileName",fileAct.getName());
result.put("filePath",file_path);
result.put("docId", pensionDocumentEntity.getId());
return new Result<Map<String, Object>>().ok(result);
}
}
......@@ -46,7 +46,8 @@ public class PensionOrderController {
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "status", value = "状态值", paramType = "query", dataType="String")
})
@RequiresPermissions("serviceOrder:pensionorder:page")
public Result<PageData<PensionOrderDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
......@@ -113,4 +114,4 @@ public class PensionOrderController {
ExcelUtils.exportExcelToTarget(response, null, list, PensionOrderExcel.class);
}
}
\ No newline at end of file
}
......@@ -11,7 +11,9 @@ import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.dto.PensionServiceDocumentDTO;
import io.hmit.modules.serviceOrder.excel.PensionServiceExcel;
import io.hmit.modules.serviceOrder.service.PensionServiceDocumentService;
import io.hmit.modules.serviceOrder.service.PensionServiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -39,6 +42,8 @@ import java.util.Map;
public class PensionServiceController {
@Autowired
private PensionServiceService pensionServiceService;
@Autowired
private PensionServiceDocumentService pensionServiceDocumentService;
@GetMapping("page")
@ApiOperation("分页")
......@@ -55,12 +60,28 @@ public class PensionServiceController {
return new Result<PageData<PensionServiceDTO>>().ok(page);
}
@GetMapping("getServiceList")
@ApiOperation("获取服务list不分页")
@ApiImplicitParams({
@ApiImplicitParam(name = "keyword", value = "查询字段,", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "serviceType", value = "服务类型", paramType = "query", dataType="String")
})
public Result<List<PensionServiceDTO>> getServiceList(@ApiIgnore @RequestParam Map<String, Object> params){
List<PensionServiceDTO> pensionServiceDTOList = pensionServiceService.list(params);
return new Result<List<PensionServiceDTO>>().ok(pensionServiceDTOList);
}
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("serviceOrder:pensionservice:info")
public Result<PensionServiceDTO> get(@PathVariable("id") Long id){
PensionServiceDTO data = pensionServiceService.get(id);
//获取服务的轮播图
Map<String,Object> param = new HashMap<>();
param.put("serviceId",data.getId());
List<PensionServiceDocumentDTO> pensionServiceDocumentDTOList = pensionServiceDocumentService.list(param);
data.setPensionServiceDocumentDTOList(pensionServiceDocumentDTOList);
return new Result<PensionServiceDTO>().ok(data);
}
......@@ -74,6 +95,16 @@ public class PensionServiceController {
pensionServiceService.save(dto);
//保存服务详情页面的轮播图
List<PensionServiceDocumentDTO> pensionServiceDocumentDTOList = dto.getPensionServiceDocumentDTOList();
if(pensionServiceDocumentDTOList!=null){
for (PensionServiceDocumentDTO pensionServiceDocumentDTO : pensionServiceDocumentDTOList) {
pensionServiceDocumentDTO.setServiceId(dto.getId());
pensionServiceDocumentService.save(pensionServiceDocumentDTO);
}
}
return new Result();
}
......@@ -86,6 +117,15 @@ public class PensionServiceController {
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
pensionServiceService.update(dto);
pensionServiceDocumentService.deletebyServiceId(dto.getId());
//保存服务详情页面的轮播图
List<PensionServiceDocumentDTO> pensionServiceDocumentDTOList = dto.getPensionServiceDocumentDTOList();
if(pensionServiceDocumentDTOList!=null){
for (PensionServiceDocumentDTO pensionServiceDocumentDTO : pensionServiceDocumentDTOList) {
pensionServiceDocumentDTO.setServiceId(dto.getId());
pensionServiceDocumentService.save(pensionServiceDocumentDTO);
}
}
return new Result();
}
......@@ -113,4 +153,4 @@ public class PensionServiceController {
ExcelUtils.exportExcelToTarget(response, null, list, PensionServiceExcel.class);
}
}
\ No newline at end of file
}
......@@ -13,6 +13,7 @@ import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.RoleDTO;
import io.hmit.modules.serviceOrder.excel.RoleExcel;
import io.hmit.modules.serviceOrder.service.RoleService;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -39,6 +40,8 @@ import java.util.Map;
public class RoleController {
@Autowired
private RoleService roleService;
@Autowired
private RoleServiceService roleServiceService;
@GetMapping("page")
@ApiOperation("分页")
......@@ -60,6 +63,9 @@ public class RoleController {
@RequiresPermissions("serviceOrder:role:info")
public Result<RoleDTO> get(@PathVariable("id") Long id){
RoleDTO data = roleService.get(id);
//查询角色对应的服务
List<Long> serviceIdList = roleServiceService.getServiceIdList(id);
data.setServiceIdList(serviceIdList);
return new Result<RoleDTO>().ok(data);
}
......@@ -73,6 +79,8 @@ public class RoleController {
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
roleService.save(dto);
//保存角色和服务菜单的关系
roleService.saveOrUpdateRoleService(dto.getId(),dto.getServiceIdList());
return new Result();
}
......@@ -86,6 +94,8 @@ public class RoleController {
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
roleService.update(dto);
//更新角色和服务菜单的关系
roleService.saveOrUpdateRoleService(dto.getId(),dto.getServiceIdList());
return new Result();
}
......@@ -113,4 +123,4 @@ public class RoleController {
ExcelUtils.exportExcelToTarget(response, null, list, RoleExcel.class);
}
}
\ No newline at end of file
}
......@@ -12,6 +12,7 @@ import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.UserDTO;
import io.hmit.modules.serviceOrder.excel.UserExcel;
import io.hmit.modules.serviceOrder.service.RoleUserService;
import io.hmit.modules.serviceOrder.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -39,6 +40,8 @@ import java.util.Map;
public class UserController {
@Autowired
private UserService userService;
@Autowired
private RoleUserService roleUserService;
@GetMapping("page")
@ApiOperation("分页")
......@@ -60,6 +63,7 @@ public class UserController {
@RequiresPermissions("serviceOrder:user:info")
public Result<UserDTO> get(@PathVariable("id") Long id){
UserDTO data = userService.get(id);
roleUserService.getRoleIdList(data.getId());
return new Result<UserDTO>().ok(data);
}
......@@ -73,6 +77,7 @@ public class UserController {
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
userService.save(dto);
userService.saveOrUpdateUserRole(dto.getId(),dto.getRoleIdList());
return new Result();
}
......@@ -86,6 +91,7 @@ public class UserController {
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
userService.update(dto);
userService.saveOrUpdateUserRole(dto.getId(),dto.getRoleIdList());
return new Result();
}
......@@ -113,4 +119,4 @@ public class UserController {
ExcelUtils.exportExcelToTarget(response, null, list, UserExcel.class);
}
}
\ No newline at end of file
}
......@@ -12,5 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface NewsDocumentDao extends BaseDao<NewsDocumentEntity> {
}
\ No newline at end of file
void deletebyNewsId (Long id);
}
......@@ -12,5 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PensionServiceDocumentDao extends BaseDao<PensionServiceDocumentEntity> {
}
\ No newline at end of file
void deleteByServiceId(Long id);
}
......@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.RoleServiceEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 角色菜单关系
*
......@@ -12,5 +14,9 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface RoleServiceDao extends BaseDao<RoleServiceEntity> {
}
\ No newline at end of file
void deleteByRoleIds(Long[] roleIds);
List<Long> getServiceIdList(Long roleId);
}
......@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.RoleUserEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 角色用户关系
*
......@@ -12,5 +14,16 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface RoleUserDao extends BaseDao<RoleUserEntity> {
}
\ No newline at end of file
void deleteByUserIds(Long[] userIds);
/**
* 角色ID列表
*
* @param userId 用户ID
* @return
*/
List<Long> getRoleIdList(Long userId);
}
package io.hmit.modules.serviceOrder.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
......@@ -46,5 +48,10 @@ public class NewsDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
// 附件
@TableField(exist = false)
private List<NewsDocumentDTO> newsDocumentDTOList;
}
\ No newline at end of file
}
package io.hmit.modules.serviceOrder.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -8,6 +9,7 @@ import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
/**
* 服务表
......@@ -68,5 +70,8 @@ public class PensionServiceDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
// 附件
@TableField(exist = false)
private List<PensionServiceDocumentDTO> pensionServiceDocumentDTOList;
}
\ No newline at end of file
}
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
......@@ -43,5 +44,8 @@ public class RoleDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
@ApiModelProperty(value = "服务ID列表")
private List<Long> serviceIdList;
}
\ No newline at end of file
}
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
......@@ -28,6 +29,9 @@ public class UserDTO implements Serializable {
@ApiModelProperty(value = "用户名")
private String username;
@ApiModelProperty(value = "头像")
private String headUrl;
@ApiModelProperty(value = "手机号")
private String mobile;
......@@ -49,5 +53,8 @@ public class UserDTO implements Serializable {
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "角色ID列表")
private List<Long> roleIdList;
}
\ No newline at end of file
}
......@@ -27,6 +27,10 @@ public class UserEntity extends BaseEntity {
* 用户名
*/
private String username;
/**
* 头像
*/
private String headUrl;
/**
* 手机号
*/
......@@ -51,4 +55,4 @@ public class UserEntity extends BaseEntity {
* 详细地址
*/
private String address;
}
\ No newline at end of file
}
......@@ -11,5 +11,6 @@ import io.hmit.modules.serviceOrder.entity.NewsDocumentEntity;
* @since 1.0.0 2021-01-26
*/
public interface NewsDocumentService extends CrudService<NewsDocumentEntity, NewsDocumentDTO> {
void deletebyNewsId(Long id);
}
\ No newline at end of file
}
......@@ -12,4 +12,6 @@ import io.hmit.modules.serviceOrder.entity.PensionServiceDocumentEntity;
*/
public interface PensionServiceDocumentService extends CrudService<PensionServiceDocumentEntity, PensionServiceDocumentDTO> {
}
\ No newline at end of file
void deletebyServiceId(Long id);
}
......@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.RoleDTO;
import io.hmit.modules.serviceOrder.entity.RoleEntity;
import java.util.List;
/**
* 角色管理
*
......@@ -11,5 +13,6 @@ import io.hmit.modules.serviceOrder.entity.RoleEntity;
* @since 1.0.0 2021-01-26
*/
public interface RoleService extends CrudService<RoleEntity, RoleDTO> {
void saveOrUpdateRoleService(Long roleId, List<Long> serviceIdList);
}
\ No newline at end of file
}
......@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.RoleServiceDTO;
import io.hmit.modules.serviceOrder.entity.RoleServiceEntity;
import java.util.List;
/**
* 角色菜单关系
*
......@@ -12,4 +14,10 @@ import io.hmit.modules.serviceOrder.entity.RoleServiceEntity;
*/
public interface RoleServiceService extends CrudService<RoleServiceEntity, RoleServiceDTO> {
}
\ No newline at end of file
void saveOrUpdateRoleService(Long roleId, List<Long> serviceIdList) ;
/**
* 根据角色ID,获取服务ID列表
*/
List<Long> getServiceIdList(Long roleId);
}
......@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.RoleUserDTO;
import io.hmit.modules.serviceOrder.entity.RoleUserEntity;
import java.util.List;
/**
* 角色用户关系
*
......@@ -12,4 +14,19 @@ import io.hmit.modules.serviceOrder.entity.RoleUserEntity;
*/
public interface RoleUserService extends CrudService<RoleUserEntity, RoleUserDTO> {
}
\ No newline at end of file
/**
* 保存或修改
*
* @param userId 用户ID
* @param roleIdList 角色ID列表
*/
void saveOrUpdate(Long userId, List<Long> roleIdList);
/**
* 角色ID列表
*
* @param userId 用户ID
*/
List<Long> getRoleIdList(Long userId);
}
......@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.UserDTO;
import io.hmit.modules.serviceOrder.entity.UserEntity;
import java.util.List;
/**
* 用户
*
......@@ -12,4 +14,6 @@ import io.hmit.modules.serviceOrder.entity.UserEntity;
*/
public interface UserService extends CrudService<UserEntity, UserDTO> {
}
\ No newline at end of file
void saveOrUpdateUserRole(Long userId, List<Long> roleIdList);
}
......@@ -7,6 +7,7 @@ import io.hmit.modules.serviceOrder.dto.NewsDocumentDTO;
import io.hmit.modules.serviceOrder.entity.NewsDocumentEntity;
import io.hmit.modules.serviceOrder.service.NewsDocumentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
......@@ -20,15 +21,24 @@ import java.util.Map;
@Service
public class NewsDocumentServiceImpl extends CrudServiceImpl<NewsDocumentDao, NewsDocumentEntity, NewsDocumentDTO> implements NewsDocumentService {
@Autowired
private NewsDocumentDao newsDocumentDao;
@Override
public QueryWrapper<NewsDocumentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
Long newsId = (Long)params.get("newsId");
QueryWrapper<NewsDocumentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(id), "id", id)
.eq(newsId != null, "new_id", newsId);
return wrapper;
}
}
\ No newline at end of file
@Override
public void deletebyNewsId(Long id) {
newsDocumentDao.deletebyNewsId(id);
}
}
......@@ -23,12 +23,14 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Override
public QueryWrapper<PensionOrderEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String status = (String)params.get("status");
QueryWrapper<PensionOrderEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(id), "id", id)
.eq(StringUtils.isNotBlank(status), "status", status);
return wrapper;
}
}
\ No newline at end of file
}
......@@ -7,6 +7,7 @@ import io.hmit.modules.serviceOrder.dto.PensionServiceDocumentDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceDocumentEntity;
import io.hmit.modules.serviceOrder.service.PensionServiceDocumentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
......@@ -20,15 +21,23 @@ import java.util.Map;
@Service
public class PensionServiceDocumentServiceImpl extends CrudServiceImpl<PensionServiceDocumentDao, PensionServiceDocumentEntity, PensionServiceDocumentDTO> implements PensionServiceDocumentService {
@Autowired
private PensionServiceDocumentDao pensionServiceDocumentDao;
@Override
public QueryWrapper<PensionServiceDocumentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
Long serviceId =(Long) params.get("serviceId");
QueryWrapper<PensionServiceDocumentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(id), "id", id)
.eq(serviceId != null, "service_id", serviceId);
return wrapper;
}
}
\ No newline at end of file
@Override
public void deletebyServiceId(Long id) {
pensionServiceDocumentDao.deleteByServiceId(id);
}
}
......@@ -23,12 +23,19 @@ public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao
@Override
public QueryWrapper<PensionServiceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String keyword = (String)params.get("keyword");
String serviceType = (String)params.get("serviceType");
QueryWrapper<PensionServiceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(serviceType), "service_type_id", serviceType);
wrapper.like(StringUtils.isNotBlank(serviceType), "name", keyword);
return wrapper;
}
}
\ No newline at end of file
}
......@@ -6,9 +6,12 @@ import io.hmit.modules.serviceOrder.dao.RoleDao;
import io.hmit.modules.serviceOrder.dto.RoleDTO;
import io.hmit.modules.serviceOrder.entity.RoleEntity;
import io.hmit.modules.serviceOrder.service.RoleService;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
......@@ -20,6 +23,8 @@ import java.util.Map;
@Service
public class RoleServiceImpl extends CrudServiceImpl<RoleDao, RoleEntity, RoleDTO> implements RoleService {
@Autowired
private RoleServiceService roleServiceService;
@Override
public QueryWrapper<RoleEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
......@@ -31,4 +36,8 @@ public class RoleServiceImpl extends CrudServiceImpl<RoleDao, RoleEntity, RoleDT
}
}
\ No newline at end of file
@Override
public void saveOrUpdateRoleService(Long roleId, List<Long> serviceIdList) {
roleServiceService.saveOrUpdateRoleService(roleId, serviceIdList);
}
}
package io.hmit.modules.serviceOrder.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.RoleServiceDao;
import io.hmit.modules.serviceOrder.dto.RoleServiceDTO;
import io.hmit.modules.serviceOrder.entity.RoleServiceEntity;
import io.hmit.modules.serviceOrder.service.RoleServiceService;
import io.hmit.modules.sys.entity.SysRoleMenuEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
......@@ -31,4 +35,29 @@ public class RoleServiceServiceImpl extends CrudServiceImpl<RoleServiceDao, Role
}
}
\ No newline at end of file
@Override
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdateRoleService(Long roleId, List<Long> serviceIdList) {
//先删除角色服务关系
baseDao.deleteByRoleIds(new Long[]{roleId});
if (CollUtil.isEmpty(serviceIdList)) {
return;
}
//保存角色服务关系
for (Long serviceId : serviceIdList) {
RoleServiceEntity roleServiceEntity = new RoleServiceEntity();
roleServiceEntity.setServiceTypeId(serviceId);
roleServiceEntity.setRoleId(roleId);
//保存
insert(roleServiceEntity);
}
}
@Override
public List<Long> getServiceIdList(Long roleId) {
return baseDao.getServiceIdList(roleId);
}
}
package io.hmit.modules.serviceOrder.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.RoleUserDao;
import io.hmit.modules.serviceOrder.dto.RoleUserDTO;
import io.hmit.modules.serviceOrder.entity.RoleUserEntity;
import io.hmit.modules.serviceOrder.service.RoleUserService;
import io.hmit.modules.sys.entity.SysRoleUserEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
......@@ -31,4 +34,27 @@ public class RoleUserServiceImpl extends CrudServiceImpl<RoleUserDao, RoleUserEn
}
}
\ No newline at end of file
@Override
public void saveOrUpdate(Long userId, List<Long> roleIdList) {
baseDao.deleteByUserIds(new Long[]{userId});
if (CollUtil.isEmpty(roleIdList)) {
return;
}
//保存角色用户关系
for (Long roleId : roleIdList) {
RoleUserEntity roleUserEntity = new RoleUserEntity();
roleUserEntity.setUserId(userId);
roleUserEntity.setRoleId(roleId);
//保存
insert(roleUserEntity);
}
}
@Override
public List<Long> getRoleIdList(Long userId) {
return baseDao.getRoleIdList(userId);
}
}
......@@ -5,10 +5,13 @@ import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.UserDao;
import io.hmit.modules.serviceOrder.dto.UserDTO;
import io.hmit.modules.serviceOrder.entity.UserEntity;
import io.hmit.modules.serviceOrder.service.RoleUserService;
import io.hmit.modules.serviceOrder.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
......@@ -20,6 +23,8 @@ import java.util.Map;
@Service
public class UserServiceImpl extends CrudServiceImpl<UserDao, UserEntity, UserDTO> implements UserService {
@Autowired
private RoleUserService roleUserService;
@Override
public QueryWrapper<UserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
......@@ -31,4 +36,8 @@ public class UserServiceImpl extends CrudServiceImpl<UserDao, UserEntity, UserDT
}
}
\ No newline at end of file
@Override
public void saveOrUpdateUserRole(Long userId, List<Long> roleIdList) {
roleUserService.saveOrUpdate(userId,roleIdList);
}
}
......@@ -66,3 +66,6 @@ mybatis-plus:
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
QR:
# download-path: /home/resourse/bsqzc/ D:/123/ /home/websoft/java_jar/bl_workorder/myfile/
download-path: /home/websoft/java_jar/pension_service/myfile/
......@@ -16,5 +16,9 @@
<result property="updateDate" column="update_date"/>
</resultMap>
<delete id="deletebyNewsId">
delete from tb_news_document where 1 = 1 and new_id = #{id}
</delete>
</mapper>
\ No newline at end of file
</mapper>
......@@ -16,5 +16,7 @@
<result property="updateDate" column="update_date"/>
</resultMap>
</mapper>
\ No newline at end of file
<delete id="deleteByServiceId" >
delete from pension_service_document where 1 = 1 and service_id = #{id}
</delete >
</mapper>
......@@ -10,6 +10,16 @@
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
</resultMap>
<delete id="deleteByRoleIds">
delete from tb_role_service where role_id in
<foreach item="roleId" collection="array" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<select id="getServiceIdList" resultType="long">
select service_type_id from tb_role_service where role_id = #{value}
</select>
</mapper>
\ No newline at end of file
</mapper>
......@@ -11,5 +11,16 @@
<result property="createDate" column="create_date"/>
</resultMap>
<delete id="deleteByUserIds">
delete from tb_role_user where user_id in
<foreach item="userId" collection="array" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<select id="getRoleIdList" resultType="long">
select role_id from tb_role_user where user_id = #{value}
</select>
</mapper>
......@@ -7,6 +7,7 @@
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="username" column="username"/>
<result property="headUrl" column="head_url"/>
<result property="mobile" column="mobile"/>
<result property="password" column="password"/>
<result property="createDate" column="create_date"/>
......@@ -17,4 +18,4 @@
</resultMap>
</mapper>
\ No newline at end of file
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment