Browse Source
# Conflicts: # epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java # epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xmlmaster
119 changed files with 2010 additions and 1218 deletions
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.commons.mybatis.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
@Data |
||||
|
public class GetSQLFilterFormDTO { |
||||
|
|
||||
|
@NotBlank |
||||
|
private String operationKey; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String userId; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String app; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String client; |
||||
|
|
||||
|
private String tableAlias; |
||||
|
|
||||
|
private String gridId; |
||||
|
|
||||
|
private String departmentId; |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.epmet.commons.tools.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
@Data |
||||
|
public class HasSpecifiedPermissionFormDTO { |
||||
|
|
||||
|
@NotBlank |
||||
|
private String operationKey; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String userId; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String app; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String client; |
||||
|
|
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
@Data |
||||
|
public class GetSQLFilterFormDTO { |
||||
|
|
||||
|
@NotBlank |
||||
|
private String operationKey; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String userId; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String app; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String client; |
||||
|
|
||||
|
private String tableAlias; |
||||
|
|
||||
|
private String gridId; |
||||
|
|
||||
|
private String departmentId; |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
@Data |
||||
|
public class HasSpecifiedPermissionFormDTO { |
||||
|
|
||||
|
@NotBlank |
||||
|
private String operationKey; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String userId; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String app; |
||||
|
|
||||
|
@NotBlank |
||||
|
private String client; |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
@Data |
||||
|
public class ListOpePermsFormDTO { |
||||
|
|
||||
|
@NotBlank(message = "用户ID不能为空") |
||||
|
private String staffId; |
||||
|
@NotBlank(message = "当前单位不能为空") |
||||
|
private String currAgencyId; |
||||
|
} |
@ -1,14 +0,0 @@ |
|||||
package com.epmet.dto.result; |
|
||||
|
|
||||
import lombok.Data; |
|
||||
|
|
||||
@Data |
|
||||
public class AccessConfigSettingResultDTO { |
|
||||
|
|
||||
private String settingKey; |
|
||||
private String settingName; |
|
||||
private String roleId; |
|
||||
private Boolean assigned; |
|
||||
private String operationKey; |
|
||||
|
|
||||
} |
|
@ -0,0 +1,15 @@ |
|||||
|
package com.epmet.bean; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.HashSet; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
@Data |
||||
|
public class OpeScopeFilterResultBean { |
||||
|
|
||||
|
private HashSet<String> orgLevelScopes; |
||||
|
private Set<String> switchScopes; |
||||
|
private boolean allScopes; |
||||
|
|
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package com.epmet.constant; |
||||
|
|
||||
|
/** |
||||
|
* 操作范围系列常量 |
||||
|
*/ |
||||
|
public class OperationScopeConstant { |
||||
|
|
||||
|
/** |
||||
|
* ===================系列=================== |
||||
|
*/ |
||||
|
public static final String SERIES_ORG_LEVEL = "org_level"; |
||||
|
public static final String SERIES_SWITCH = "switch"; |
||||
|
public static final String SERIES_ALL = "all"; |
||||
|
|
||||
|
/** |
||||
|
* ===================范围=================== |
||||
|
*/ |
||||
|
// 无任何范围限制
|
||||
|
public static final String SCOPE_ALL = "all"; |
||||
|
|
||||
|
// 覆盖机构下的所有范围
|
||||
|
public static final String SCOPE_ORG_ALL = "org_all"; |
||||
|
|
||||
|
//"同级组织的下级"
|
||||
|
public static final String SCOPE_ORG_EQUAL_SUB = "org_equal_sub"; |
||||
|
//"同级组织及下级"
|
||||
|
public static final String SCOPE_ORG_EQUAL_AND_SUB = "org_equal_and_sub"; |
||||
|
// 同级组织的上级
|
||||
|
public static final String SCOPE_ORG_EQUAL_SUP = "org_equal_sup"; |
||||
|
// 同级组织及上级
|
||||
|
public static final String SCOPE_ORG_EQUAL_AND_SUP = "org_equal_and_sup"; |
||||
|
//"同级组织"
|
||||
|
public static final String SCOPE_ORG_EQUAL = "org_equal"; |
||||
|
|
||||
|
//"本组织的下级"
|
||||
|
public static final String SCOPE_ORG_CURR_SUB = "org_curr_sub"; |
||||
|
//"本组织及下级"
|
||||
|
public static final String SCOPE_ORG_CURR_AND_SUB = "org_curr_and_sub"; |
||||
|
//"本组织"
|
||||
|
public static final String SCOPE_ORG_CURR = "org_curr"; |
||||
|
|
||||
|
//我创建的
|
||||
|
public static final String SCOPE_I_CREATED = "i_created"; |
||||
|
//网格内
|
||||
|
public static final String SCOPE_IN_GRID = "in_grid"; |
||||
|
// 部门内
|
||||
|
public static final String SCOPE_IN_DEPARTMENT = "in_department"; |
||||
|
} |
@ -1,75 +0,0 @@ |
|||||
/** |
|
||||
* Copyright 2018 人人开源 https://www.renren.io
|
|
||||
* <p> |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* <p> |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* <p> |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||
*/ |
|
||||
|
|
||||
package com.epmet.dao; |
|
||||
|
|
||||
import com.epmet.commons.mybatis.dao.BaseDao; |
|
||||
import com.epmet.dto.result.AccessConfigSettingResultDTO; |
|
||||
import com.epmet.dto.result.AccessSettingResultDTO; |
|
||||
import com.epmet.entity.AccessSettingEntity; |
|
||||
import org.apache.ibatis.annotations.Mapper; |
|
||||
import org.apache.ibatis.annotations.Param; |
|
||||
|
|
||||
import java.util.List; |
|
||||
import java.util.Set; |
|
||||
|
|
||||
/** |
|
||||
* 权限配置 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2020-04-29 |
|
||||
*/ |
|
||||
@Mapper |
|
||||
public interface AccessSettingDao extends BaseDao<AccessSettingEntity> { |
|
||||
|
|
||||
/** |
|
||||
* 根据角色查询配置列表 |
|
||||
* @param roleId |
|
||||
* @return |
|
||||
*/ |
|
||||
List<AccessSettingResultDTO> listAccessSettingsByRoleId(@Param("roleId") String roleId, |
|
||||
@Param("operationKey") String operationKey); |
|
||||
|
|
||||
List<AccessConfigSettingResultDTO> listSettingOptionsForAccessConfig(@Param("roleId") String roleId, |
|
||||
@Param("operationKey") String operationKey); |
|
||||
|
|
||||
/** |
|
||||
* 删除 |
|
||||
* @param roleId |
|
||||
* @param operationKey |
|
||||
* @param settingKeys2Delete |
|
||||
* @return |
|
||||
*/ |
|
||||
int delete(@Param("roleId") String roleId, |
|
||||
@Param("operationKey") String operationKey, |
|
||||
@Param("settingKeys2Delete") Set<String> settingKeys2Delete); |
|
||||
|
|
||||
AccessSettingEntity get(@Param("roleId") String roleId, |
|
||||
@Param("operationKey") String operationKey, |
|
||||
@Param("settingKey") String settingKey); |
|
||||
|
|
||||
/** |
|
||||
* 启用 |
|
||||
* @param roleId |
|
||||
* @param operationKey |
|
||||
* @param settingKey |
|
||||
* @return |
|
||||
*/ |
|
||||
int enable(@Param("roleId") String roleId, |
|
||||
@Param("operationKey") String operationKey, |
|
||||
@Param("settingKey") String settingKey); |
|
||||
} |
|
@ -0,0 +1,64 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.GovStaffRoleDTO; |
||||
|
import com.epmet.dto.form.LatestGridFormDTO; |
||||
|
import com.epmet.dto.form.StaffGridVisitedFormDTO; |
||||
|
import com.epmet.dto.form.StaffRoleFormDTO; |
||||
|
import com.epmet.dto.result.CustomerGridByUserIdResultDTO; |
||||
|
import com.epmet.dto.result.LatestCustomerResultDTO; |
||||
|
import com.epmet.feign.fallback.EpmetUserFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
//, url = "localhost:8087"
|
||||
|
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) |
||||
|
public interface EpmetUserFeignClient { |
||||
|
/** |
||||
|
* 获取最近一次登录的客户信息 |
||||
|
* |
||||
|
* @param userId |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/epmetuser/staffagencyvisited/getlatestcustomer/{userId}") |
||||
|
Result<LatestCustomerResultDTO> getLatestCustomer(@PathVariable("userId") String userId); |
||||
|
|
||||
|
/** |
||||
|
* @Description 查询工作人员上次登录的网格 |
||||
|
* @Param customerId ; staffId |
||||
|
* @return Result<CustomerGridByUserIdResultDTO> |
||||
|
* @Author wangc |
||||
|
* @Date 2020.04.23 10:44 |
||||
|
**/ |
||||
|
@PostMapping(value = "/epmetuser/staffgridvisited/getstafflatestgrid") |
||||
|
Result<CustomerGridByUserIdResultDTO> getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); |
||||
|
|
||||
|
/** |
||||
|
* @param staffGridVisitedFormDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result |
||||
|
* @Author yinzuomei |
||||
|
* @Description 保存网格访问记录 |
||||
|
* @Date 2020/4/23 13:27 |
||||
|
**/ |
||||
|
@PostMapping(value = "/epmetuser/staffgridvisited/savestaffgridvisitedrecord", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) |
||||
|
Result saveStaffGridVisitedRecord(@RequestBody StaffGridVisitedFormDTO staffGridVisitedFormDTO); |
||||
|
/** |
||||
|
* 查询工作人员的角色 |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/epmetuser/staffrole/staffroles") |
||||
|
Result<List<GovStaffRoleDTO>> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO); |
||||
|
} |
||||
|
|
@ -0,0 +1,34 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.CustomerAgencyDTO; |
||||
|
import com.epmet.feign.fallback.GovOrgFeignClientFallBack; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
//, url = "localhost:8092"
|
||||
|
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) |
||||
|
public interface GovOrgFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* 根据Id查询agency |
||||
|
* @param agencyId |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/gov/org/agency/agencybyid/{agencyId}") |
||||
|
Result<CustomerAgencyDTO> getAgencyById(@PathVariable("agencyId") String agencyId); |
||||
|
|
||||
|
/** |
||||
|
* 根据staffId查询所属的组织机构 |
||||
|
* @param staffId |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/gov/org/agency/agencybystaff/{staffId}") |
||||
|
Result<CustomerAgencyDTO> getAgencyByStaff(@PathVariable("staffId") String staffId); |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.epmet.feign.fallback; |
||||
|
|
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.ModuleUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.GovStaffRoleDTO; |
||||
|
import com.epmet.dto.form.LatestGridFormDTO; |
||||
|
import com.epmet.dto.form.StaffGridVisitedFormDTO; |
||||
|
import com.epmet.dto.form.StaffRoleFormDTO; |
||||
|
import com.epmet.dto.result.CustomerGridByUserIdResultDTO; |
||||
|
import com.epmet.dto.result.LatestCustomerResultDTO; |
||||
|
import com.epmet.feign.EpmetUserFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@Component |
||||
|
public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result<LatestCustomerResultDTO> getLatestCustomer(String userId) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<GovStaffRoleDTO>> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRolesOfStaff"); |
||||
|
} |
||||
|
@Override |
||||
|
public Result<CustomerGridByUserIdResultDTO> getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffLatestGrid",latestGridFormDTO); |
||||
|
} |
||||
|
@Override |
||||
|
public Result saveStaffGridVisitedRecord(StaffGridVisitedFormDTO staffGridVisitedFormDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffGridVisitedRecord", staffGridVisitedFormDTO); |
||||
|
} |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.epmet.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.ModuleUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.CustomerAgencyDTO; |
||||
|
import com.epmet.dto.form.LatestGridFormDTO; |
||||
|
import com.epmet.dto.result.CustomerGridByUserIdResultDTO; |
||||
|
import com.epmet.dto.result.LatestCustomerResultDTO; |
||||
|
import com.epmet.feign.GovOrgFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@Component |
||||
|
public class GovOrgFeignClientFallBack implements GovOrgFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result<CustomerAgencyDTO> getAgencyById(String agencyId) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyById", agencyId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<CustomerAgencyDTO> getAgencyByStaff(String staffId) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaff", staffId); |
||||
|
} |
||||
|
} |
@ -1,52 +0,0 @@ |
|||||
package com.epmet.redis; |
|
||||
|
|
||||
import com.epmet.commons.tools.redis.RedisKeys; |
|
||||
import com.epmet.commons.tools.redis.RedisUtils; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
import org.springframework.util.CollectionUtils; |
|
||||
|
|
||||
import java.util.HashMap; |
|
||||
import java.util.Map; |
|
||||
import java.util.Set; |
|
||||
|
|
||||
@Component |
|
||||
public class RoleAccessSettingRedis { |
|
||||
|
|
||||
@Autowired |
|
||||
private RedisUtils redisUtils; |
|
||||
|
|
||||
public void set(Map<String, String> settings, String roleId, String operationKey) { |
|
||||
// 转化Map
|
|
||||
HashMap<String, Object> newSettings = new HashMap<>(); |
|
||||
Set<Map.Entry<String, String>> entries = settings.entrySet(); |
|
||||
entries.forEach(entry -> { |
|
||||
newSettings.put(entry.getKey(), entry.getValue()); |
|
||||
}); |
|
||||
|
|
||||
String roleAccessSettingKey = RedisKeys.getRoleAccessSettingKey(roleId, operationKey); |
|
||||
redisUtils.hMSet(roleAccessSettingKey, newSettings); |
|
||||
} |
|
||||
|
|
||||
public Map<String, String> get(String roleId, String operationKey) { |
|
||||
String roleAccessSettingKey = RedisKeys.getRoleAccessSettingKey(roleId, operationKey); |
|
||||
Map<String, Object> s = redisUtils.hGetAll(roleAccessSettingKey); |
|
||||
// 转化Map
|
|
||||
if (!CollectionUtils.isEmpty(s)) { |
|
||||
Map<String, String> settings = new HashMap<>(); |
|
||||
s.forEach((s1, o) -> { |
|
||||
if (o != null) { |
|
||||
settings.put(s1, String.valueOf(o)); |
|
||||
} |
|
||||
}); |
|
||||
return settings; |
|
||||
} |
|
||||
|
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
public void delete(String roleId, String operationKey) { |
|
||||
redisUtils.delete(RedisKeys.getRoleAccessSettingKey(roleId, operationKey)); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,80 +0,0 @@ |
|||||
<?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.epmet.dao.AccessSettingDao"> |
|
||||
|
|
||||
<resultMap type="com.epmet.entity.AccessSettingEntity" id="accessSettingMap"> |
|
||||
<result property="id" column="ID"/> |
|
||||
<result property="roleId" column="ROLE_ID"/> |
|
||||
<result property="operationKey" column="OPERATION_KEY"/> |
|
||||
<result property="settingKey" column="SETTING_KEY"/> |
|
||||
<result property="settingValue" column="SETTING_VALUE"/> |
|
||||
<result property="delFlag" column="DEL_FLAG"/> |
|
||||
<result property="revision" column="REVISION"/> |
|
||||
<result property="createdBy" column="CREATED_BY"/> |
|
||||
<result property="createdTime" column="CREATED_TIME"/> |
|
||||
<result property="updatedBy" column="UPDATED_BY"/> |
|
||||
<result property="updatedTime" column="UPDATED_TIME"/> |
|
||||
</resultMap> |
|
||||
|
|
||||
<!--根据角色查询配置列表--> |
|
||||
<select id="listAccessSettingsByRoleId" resultType="com.epmet.dto.result.AccessSettingResultDTO"> |
|
||||
SELECT |
|
||||
s.*, |
|
||||
opt.SETTING_NAME |
|
||||
FROM |
|
||||
access_setting s |
|
||||
INNER JOIN access_setting_options opt ON ( s.SETTING_KEY = opt.SETTING_KEY AND opt.DEL_FLAG = 0) |
|
||||
WHERE |
|
||||
s.ROLE_ID = #{roleId} |
|
||||
AND s.DEL_FLAG = 0 |
|
||||
AND s.OPERATION_KEY = #{operationKey} |
|
||||
AND s.DEL_FLAG = 0 |
|
||||
</select> |
|
||||
|
|
||||
<!--权限配置:列出配置项--> |
|
||||
<select id="listSettingOptionsForAccessConfig" |
|
||||
resultType="com.epmet.dto.result.AccessConfigSettingResultDTO"> |
|
||||
SELECT opt.SETTING_KEY, |
|
||||
opt.SETTING_NAME, |
|
||||
s.ROLE_ID, |
|
||||
CASE |
|
||||
WHEN s.ROLE_ID IS NULL THEN FALSE |
|
||||
ELSE TRUE END AS assigned, |
|
||||
s.OPERATION_KEY |
|
||||
FROM access_setting_options opt |
|
||||
LEFT JOIN access_setting s ON (s.DEL_FLAG = 0 AND opt.SETTING_KEY = s.SETTING_KEY AND s.ROLE_ID = #{roleId} |
|
||||
AND s.OPERATION_KEY = #{operationKey}) |
|
||||
WHERE opt.DEL_FLAG = 0 |
|
||||
ORDER BY opt.SETTING_KEY ASC |
|
||||
</select> |
|
||||
|
|
||||
<!--删除--> |
|
||||
<delete id="delete"> |
|
||||
DELETE |
|
||||
FROM access_setting |
|
||||
WHERE ROLE_ID = #{roleId} |
|
||||
AND OPERATION_KEY = #{operationKey} |
|
||||
AND SETTING_KEY IN |
|
||||
<foreach collection="settingKeys2Delete" item="settingKey" open="(" separator="," close=")"> |
|
||||
#{settingKey} |
|
||||
</foreach> |
|
||||
</delete> |
|
||||
|
|
||||
<select id="get" resultType="com.epmet.entity.AccessSettingEntity"> |
|
||||
SELECT s.* |
|
||||
FROM access_setting s |
|
||||
WHERE s.ROLE_ID = #{roleId} |
|
||||
AND s.OPERATION_KEY = #{operationKey} |
|
||||
AND s.SETTING_KEY = #{settingKey} |
|
||||
</select> |
|
||||
|
|
||||
<!--启用--> |
|
||||
<update id="enable"> |
|
||||
UPDATE access_setting s |
|
||||
SET DEL_FLAG = 0 |
|
||||
WHERE s.ROLE_ID = #{roleId} |
|
||||
AND s.OPERATION_KEY = #{operationKey} |
|
||||
AND s.SETTING_KEY = #{settingKey} |
|
||||
</update> |
|
||||
</mapper> |
|
@ -1,20 +0,0 @@ |
|||||
<?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.epmet.dao.AccessSettingOptionsDao"> |
|
||||
|
|
||||
<resultMap type="com.epmet.entity.AccessSettingOptionsEntity" id="accessSettingOptionsMap"> |
|
||||
<result property="id" column="ID"/> |
|
||||
<result property="settingKey" column="SETTING_KEY"/> |
|
||||
<result property="settingName" column="SETTING_NAME"/> |
|
||||
<result property="brief" column="BRIEF"/> |
|
||||
<result property="delFlag" column="DEL_FLAG"/> |
|
||||
<result property="revision" column="REVISION"/> |
|
||||
<result property="createdBy" column="CREATED_BY"/> |
|
||||
<result property="createdTime" column="CREATED_TIME"/> |
|
||||
<result property="updatedBy" column="UPDATED_BY"/> |
|
||||
<result property="updatedTime" column="UPDATED_TIME"/> |
|
||||
</resultMap> |
|
||||
|
|
||||
|
|
||||
</mapper> |
|
@ -1,38 +0,0 @@ |
|||||
package com.epmet.test.govaccess; |
|
||||
|
|
||||
import com.epmet.dao.AccessSettingDao; |
|
||||
import com.epmet.dto.result.AccessSettingResultDTO; |
|
||||
import com.epmet.redis.RoleAccessSettingRedis; |
|
||||
import org.junit.Test; |
|
||||
import org.junit.runner.RunWith; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.boot.test.context.SpringBootTest; |
|
||||
import org.springframework.test.context.junit4.SpringRunner; |
|
||||
|
|
||||
import java.util.HashMap; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
@RunWith(SpringRunner.class) |
|
||||
@SpringBootTest |
|
||||
public class AccessSettingTest { |
|
||||
|
|
||||
@Autowired |
|
||||
private AccessSettingDao roleAccessSettingDao; |
|
||||
|
|
||||
@Autowired |
|
||||
private RoleAccessSettingRedis roleAccessSettingRedis; |
|
||||
|
|
||||
@Test |
|
||||
public void addAccessSettings2Redis() { |
|
||||
List<AccessSettingResultDTO> settings = roleAccessSettingDao.listAccessSettingsByRoleId("1", "org_staff_list"); |
|
||||
HashMap<String, String> objectObjectHashMap = new HashMap<>(); |
|
||||
settings.forEach(setting -> { |
|
||||
objectObjectHashMap.put(setting.getSettingKey(), setting.getSettingValue()); |
|
||||
}); |
|
||||
roleAccessSettingRedis.set(objectObjectHashMap, "1", "org_staff_list"); |
|
||||
Map<String, String> map = roleAccessSettingRedis.get("1", "org_staff_list"); |
|
||||
System.out.println(map); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -0,0 +1,91 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 项目相关人员表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ProjectRelatedPersonnelDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 项目ID |
||||
|
*/ |
||||
|
private String projectId; |
||||
|
|
||||
|
/** |
||||
|
* 所属端 居民端用户resi、政府端工作人员gov、运营端工作人员oper |
||||
|
*/ |
||||
|
private String app; |
||||
|
|
||||
|
/** |
||||
|
* 网格ID app=resi时,此列为gridId,其他情况暂定 * |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.constant; |
||||
|
|
||||
|
/** |
||||
|
* @Description 项目跟踪模块消息通知 |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
public interface UserMessageConstant { |
||||
|
|
||||
|
/** |
||||
|
* 消息标题 |
||||
|
*/ |
||||
|
String PROJECT_TITLE = "您有一条项目消息"; |
||||
|
|
||||
|
/** |
||||
|
* 议题转项目、项目流转、项目退回消息模板 |
||||
|
*/ |
||||
|
String PROJECT_RESOLVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; |
||||
|
|
||||
|
/** |
||||
|
* 项目结案消息模板 |
||||
|
*/ |
||||
|
String PROJECT_CLOSED_MSG = "您好,您参与的【%s】项目已结案,原因:%s"; |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ExcelUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.AssertUtils; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.dto.ProjectRelatedPersonnelDTO; |
||||
|
import com.epmet.excel.ProjectRelatedPersonnelExcel; |
||||
|
import com.epmet.service.ProjectRelatedPersonnelService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 项目相关人员表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("projectrelatedpersonnel") |
||||
|
public class ProjectRelatedPersonnelController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectRelatedPersonnelService projectRelatedPersonnelService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<ProjectRelatedPersonnelDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<ProjectRelatedPersonnelDTO> page = projectRelatedPersonnelService.page(params); |
||||
|
return new Result<PageData<ProjectRelatedPersonnelDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<ProjectRelatedPersonnelDTO> get(@PathVariable("id") String id){ |
||||
|
ProjectRelatedPersonnelDTO data = projectRelatedPersonnelService.get(id); |
||||
|
return new Result<ProjectRelatedPersonnelDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody ProjectRelatedPersonnelDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
projectRelatedPersonnelService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody ProjectRelatedPersonnelDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
projectRelatedPersonnelService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
projectRelatedPersonnelService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<ProjectRelatedPersonnelDTO> list = projectRelatedPersonnelService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, ProjectRelatedPersonnelExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 项目相关人员表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ProjectRelatedPersonnelExcel { |
||||
|
|
||||
|
@Excel(name = "主键 唯一标识") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "项目ID") |
||||
|
private String projectId; |
||||
|
|
||||
|
@Excel(name = "所属端 居民端用户resi、政府端工作人员gov、运营端工作人员oper") |
||||
|
private String app; |
||||
|
|
||||
|
@Excel(name = "网格ID app=resi时,此列为gridId,其他情况暂定 *") |
||||
|
private String gridId; |
||||
|
|
||||
|
@Excel(name = "用户ID") |
||||
|
private String userId; |
||||
|
|
||||
|
@Excel(name = "删除标识") |
||||
|
private String delFlag; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.UserMessageFormDTO; |
||||
|
import com.epmet.feign.fallback.MessageFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description 调用epmet-message服务 |
||||
|
* @Author sun |
||||
|
* , url = "localhost:8085" |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = MessageFeignClientFallback.class) |
||||
|
public interface MessageFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* @param msgList |
||||
|
* @return com.epmet.commons.tools.utils.Result |
||||
|
* @Author sun |
||||
|
* @Description 批量推送消息 |
||||
|
**/ |
||||
|
@PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) |
||||
|
Result saveUserMessageList(List<UserMessageFormDTO> msgList); |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.epmet.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.ModuleUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.UserMessageFormDTO; |
||||
|
import com.epmet.feign.MessageFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description 调用epmet-message服务 |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@Component |
||||
|
public class MessageFeignClientFallback implements MessageFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result saveUserMessageList(List<UserMessageFormDTO> msgList) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList); |
||||
|
} |
||||
|
} |
@ -0,0 +1,104 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.ProjectRelatedPersonnelDTO; |
||||
|
import com.epmet.entity.ProjectRelatedPersonnelEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 项目相关人员表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
public interface ProjectRelatedPersonnelService extends BaseService<ProjectRelatedPersonnelEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<ProjectRelatedPersonnelDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-05-20 |
||||
|
*/ |
||||
|
PageData<ProjectRelatedPersonnelDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<ProjectRelatedPersonnelDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-05-20 |
||||
|
*/ |
||||
|
List<ProjectRelatedPersonnelDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return ProjectRelatedPersonnelDTO |
||||
|
* @author generator |
||||
|
* @date 2020-05-20 |
||||
|
*/ |
||||
|
ProjectRelatedPersonnelDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-05-20 |
||||
|
*/ |
||||
|
void save(ProjectRelatedPersonnelDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-05-20 |
||||
|
*/ |
||||
|
void update(ProjectRelatedPersonnelDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-05-20 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 查找项目关联人员 |
||||
|
* @author zhaoqifeng |
||||
|
* @date 2020/5/20 13:52 |
||||
|
* @param projectId |
||||
|
* @return java.util.List<com.epmet.dto.ProjectRelatedPersonnelDTO> |
||||
|
*/ |
||||
|
List<ProjectRelatedPersonnelDTO> getPersonnelListByProjectId(String projectId); |
||||
|
} |
@ -0,0 +1,109 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.dao.ProjectRelatedPersonnelDao; |
||||
|
import com.epmet.dto.ProjectRelatedPersonnelDTO; |
||||
|
import com.epmet.entity.ProjectRelatedPersonnelEntity; |
||||
|
import com.epmet.redis.ProjectRelatedPersonnelRedis; |
||||
|
import com.epmet.service.ProjectRelatedPersonnelService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 项目相关人员表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ProjectRelatedPersonnelServiceImpl extends BaseServiceImpl<ProjectRelatedPersonnelDao, ProjectRelatedPersonnelEntity> implements ProjectRelatedPersonnelService { |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectRelatedPersonnelRedis projectRelatedPersonnelRedis; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<ProjectRelatedPersonnelDTO> page(Map<String, Object> params) { |
||||
|
IPage<ProjectRelatedPersonnelEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, ProjectRelatedPersonnelDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ProjectRelatedPersonnelDTO> list(Map<String, Object> params) { |
||||
|
List<ProjectRelatedPersonnelEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, ProjectRelatedPersonnelDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<ProjectRelatedPersonnelEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<ProjectRelatedPersonnelEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ProjectRelatedPersonnelDTO get(String id) { |
||||
|
ProjectRelatedPersonnelEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, ProjectRelatedPersonnelDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(ProjectRelatedPersonnelDTO dto) { |
||||
|
ProjectRelatedPersonnelEntity entity = ConvertUtils.sourceToTarget(dto, ProjectRelatedPersonnelEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(ProjectRelatedPersonnelDTO dto) { |
||||
|
ProjectRelatedPersonnelEntity entity = ConvertUtils.sourceToTarget(dto, ProjectRelatedPersonnelEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ProjectRelatedPersonnelDTO> getPersonnelListByProjectId(String projectId) { |
||||
|
return baseDao.selectPersonnelListByProjectId(projectId); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
<?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.epmet.dao.ProjectRelatedPersonnelDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.ProjectRelatedPersonnelEntity" id="projectRelatedPersonnelMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="projectId" column="PROJECT_ID"/> |
||||
|
<result property="app" column="APP"/> |
||||
|
<result property="gridId" column="GRID_ID"/> |
||||
|
<result property="userId" column="USER_ID"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
<select id="selectPersonnelListByProjectId" resultType="com.epmet.dto.ProjectRelatedPersonnelDTO"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
project_related_personnel |
||||
|
WHERE |
||||
|
DEL_FLAG = '0' |
||||
|
AND PROJECT_ID = #{projectId} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue