Commit 0a59ae29 authored by Mccoy Z Xia's avatar Mccoy Z Xia

机构权限设置 页面与接口

parent 576adcab
package pwc.taxtech.atms.controller;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.impl.UserOrganizationHKServiceImpl;
import java.util.List;
/**
* <p> @Description </p>
*
* @Author: Mccoy Z Xia (Xia zhixin)
* @Date: 2019-08-01 15:26
* @Version: 1.0
**/
@RestController
@RequestMapping("api/v1/user_org/")
public class UserOrganizationHKController {
@Autowired
private UserOrganizationHKServiceImpl userOrganizationHKServiceImpl;
@GetMapping("getUserOrgList")
public OperationResultDto getUserOrgList(@Param("userId") String userId){
return OperationResultDto.success(userOrganizationHKServiceImpl.getUserOrgList(userId));
}
@GetMapping("deleteUserOrg")
public OperationResultDto deleteUserOrg(@Param("userOrgId") Long userOrgId){
return OperationResultDto.success(userOrganizationHKServiceImpl.delete(userOrgId));
}
@PostMapping("addUserOrg")
public OperationResultDto addUserOrg(@RequestBody List<Long> orgIdList, @RequestParam("userId") String userId){
return OperationResultDto.success(userOrganizationHKServiceImpl.add(orgIdList, userId));
}
}
package pwc.taxtech.atms.service.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.organization.dao.UserOrganizationHKMapper;
import pwc.taxtech.atms.organization.dao.extension.UserOrganizationHKExtMapper;
import pwc.taxtech.atms.organization.dpo.UserOrganizationHKDto;
import pwc.taxtech.atms.organization.entity.UserOrganizationHK;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* <p> 用户与机构关系相关接口 </p>
*
* @Author: Mccoy Z Xia (Xia zhixin)
* @Date: 2019-08-01 15:21
* @Version: 1.0
**/
@Service
public class UserOrganizationHKServiceImpl extends BaseService {
private static final Logger log = LoggerFactory.getLogger(UserOrganizationHKServiceImpl.class);
@Resource
private UserOrganizationHKExtMapper userOrganizationHKExtMapper;
@Resource
private UserOrganizationHKMapper userOrganizationHKMapper;
public Integer delete(Long userOrgId){
return userOrganizationHKMapper.deleteByPrimaryKey(userOrgId);
}
public Integer add(List<Long> orgIdList, String userId){
AtomicInteger count = new AtomicInteger();
orgIdList.forEach(orgId -> {
UserOrganizationHK record = new UserOrganizationHK();
record.setId(idService.nextId());
record.setOrganizationId(orgId);
record.setUserId(userId);
count.addAndGet(userOrganizationHKMapper.insertSelective(record));
});
return count.get();
}
public List<UserOrganizationHKDto> getUserOrgList(String userId) {
return userOrganizationHKExtMapper.getUserOrgList(userId);
}
}
package pwc.taxtech.atms.organization.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.organization.entity.UserOrganizationHK;
import pwc.taxtech.atms.organization.entity.UserOrganizationHKExample;
@Mapper
public interface UserOrganizationHKMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
long countByExample(UserOrganizationHKExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
int deleteByExample(UserOrganizationHKExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
int insert(UserOrganizationHK record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
int insertSelective(UserOrganizationHK record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
List<UserOrganizationHK> selectByExample(UserOrganizationHKExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
UserOrganizationHK selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") UserOrganizationHK record, @Param("example") UserOrganizationHKExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
int updateByExample(@Param("record") UserOrganizationHK record, @Param("example") UserOrganizationHKExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(UserOrganizationHK record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
int updateByPrimaryKey(UserOrganizationHK record);
}
\ No newline at end of file
package pwc.taxtech.atms.organization.dao.extension;
import org.apache.ibatis.annotations.Select;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.organization.dpo.UserOrganizationHKDto;
import java.util.List;
/**
* <p> @Description </p>
*
* @Author: Mccoy Z Xia (Xia zhixin)
* @Date: 2019-08-01 15:16
* @Version: 1.0
**/
public interface UserOrganizationHKExtMapper extends MyMapper {
@Select("SELECT\n" +
"\tt1.id AS userOrgId,\n" +
"\tt2.id AS orgId,\n" +
"\tt2. NAME AS orgName\n" +
"FROM\n" +
"\tuser_organization t1\n" +
"LEFT JOIN organization t2 ON t1.organization_id = t2.id\n" +
"WHERE\n" +
"\tt2.is_active = 1\n" +
"AND t1.user_id = #{userId}")
List<UserOrganizationHKDto> getUserOrgList(String userId);
}
package pwc.taxtech.atms.organization.dpo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.Setter;
/**
* <p> @Description </p>
*
* @Author: Mccoy Z Xia (Xia zhixin)
* @Date: 2019-08-01 16:43
* @Version: 1.0
**/
@Getter
@Setter
public class UserOrganizationHKDto {
@JsonSerialize(using = ToStringSerializer.class)
private Long userOrgId;
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
private String orgName;
}
package pwc.taxtech.atms.organization.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
import java.util.Date;
import pwc.taxtech.atms.entity.BaseEntity;
/**
*
......
package pwc.taxtech.atms.organization.entity;
import java.io.Serializable;
import pwc.taxtech.atms.entity.BaseEntity;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table user_organization
*
* @mbg.generated do_not_delete_during_merge
*/
public class UserOrganizationHK extends BaseEntity implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_organization.id
*
* @mbg.generated
*/
private Long id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_organization.user_id
*
* @mbg.generated
*/
private String userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_organization.organization_id
*
* @mbg.generated
*/
private Long organizationId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_organization.is_accessible
*
* @mbg.generated
*/
private Boolean isAccessible;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_organization.has_original_role
*
* @mbg.generated
*/
private Boolean hasOriginalRole;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_organization
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_organization.id
*
* @return the value of user_organization.id
*
* @mbg.generated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_organization.id
*
* @param id the value for user_organization.id
*
* @mbg.generated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_organization.user_id
*
* @return the value of user_organization.user_id
*
* @mbg.generated
*/
public String getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_organization.user_id
*
* @param userId the value for user_organization.user_id
*
* @mbg.generated
*/
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_organization.organization_id
*
* @return the value of user_organization.organization_id
*
* @mbg.generated
*/
public Long getOrganizationId() {
return organizationId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_organization.organization_id
*
* @param organizationId the value for user_organization.organization_id
*
* @mbg.generated
*/
public void setOrganizationId(Long organizationId) {
this.organizationId = organizationId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_organization.is_accessible
*
* @return the value of user_organization.is_accessible
*
* @mbg.generated
*/
public Boolean getIsAccessible() {
return isAccessible;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_organization.is_accessible
*
* @param isAccessible the value for user_organization.is_accessible
*
* @mbg.generated
*/
public void setIsAccessible(Boolean isAccessible) {
this.isAccessible = isAccessible;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_organization.has_original_role
*
* @return the value of user_organization.has_original_role
*
* @mbg.generated
*/
public Boolean getHasOriginalRole() {
return hasOriginalRole;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_organization.has_original_role
*
* @param hasOriginalRole the value for user_organization.has_original_role
*
* @mbg.generated
*/
public void setHasOriginalRole(Boolean hasOriginalRole) {
this.hasOriginalRole = hasOriginalRole;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", organizationId=").append(organizationId);
sb.append(", isAccessible=").append(isAccessible);
sb.append(", hasOriginalRole=").append(hasOriginalRole);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
......@@ -98,27 +98,27 @@
<!--总体设置-->
<div style="margin: 10px 20px 0px 15px; display:block;">
<div>
<div>
<div style="height: 36px; line-height: 36px; float: left;">机构上层维度设置</div>
<div style="float:right">
<button class="btn btn-in-grid" ng-class="{false:'no-permission'}[hasEditPermission]" ng-disabled="!hasEditPermission" ng-click="popupDimensionAddWin()" style="margin-bottom: 5px;">
<i class=" material-icons">add_circle_outline</i> <span translate="AddDimensionTitle"></span>
</button>
</div>
</div>
<div class="clear"></div>
<div id="generalSettingGrid" style="width:99%;height:200px;border-radius: 5px;"
ui-grid="generalSettingList"
ui-grid-selection
ui-grid-auto-resize
ng-style="getGridHeight()">
</div>
</div>
</div>
<!-- <div style="margin: 10px 20px 0px 15px; display:block;">-->
<!-- <div>-->
<!-- <div>-->
<!-- <div style="height: 36px; line-height: 36px; float: left;">机构上层维度设置</div>-->
<!-- <div style="float:right">-->
<!-- <button class="btn btn-in-grid" ng-class="{false:'no-permission'}[hasEditPermission]" ng-disabled="!hasEditPermission" ng-click="popupDimensionAddWin()" style="margin-bottom: 5px;">-->
<!-- <i class=" material-icons">add_circle_outline</i> <span translate="AddDimensionTitle"></span>-->
<!-- </button>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="clear"></div>-->
<!-- <div id="generalSettingGrid" style="width:99%;height:200px;border-radius: 5px;"-->
<!-- ui-grid="generalSettingList"-->
<!-- ui-grid-selection-->
<!-- ui-grid-auto-resize-->
<!-- ng-style="getGridHeight()">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--各机构设置-->
<div style="margin: 30px 20px 0px 15px; display:block;" id="orgSetting">
......
webservices.factory('userOrgService', ['$http', 'apiConfig', 'httpCacheService', 'loginContext', 'FileSaver', function ($http, apiConfig, httpCacheService, loginContext, FileSaver) {
'use strict';
return {
getUserOrgList: function (userId) {
return $http.get('/user_org/getUserOrgList?userId=' + userId, apiConfig.create());
},
deleteUserOrg: function (userOrgId) {
return $http.get('/user_org/deleteUserOrg?userOrgId=' + userOrgId, apiConfig.create());
},
addUserOrg: function (orgIdList, userId) {
return $http.post('/user_org/addUserOrg?userId=' + userId, orgIdList, apiConfig.create());
}
}
}
]);
\ No newline at end of file
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