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
package pwc.taxtech.atms.organization.entity;
import java.util.ArrayList;
import java.util.List;
public class UserOrganizationHKExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_organization
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_organization
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table user_organization
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public UserOrganizationHKExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_organization
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table user_organization
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNull() {
addCriterion("organization_id is null");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNotNull() {
addCriterion("organization_id is not null");
return (Criteria) this;
}
public Criteria andOrganizationIdEqualTo(Long value) {
addCriterion("organization_id =", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotEqualTo(Long value) {
addCriterion("organization_id <>", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThan(Long value) {
addCriterion("organization_id >", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThanOrEqualTo(Long value) {
addCriterion("organization_id >=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThan(Long value) {
addCriterion("organization_id <", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThanOrEqualTo(Long value) {
addCriterion("organization_id <=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdIn(List<Long> values) {
addCriterion("organization_id in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotIn(List<Long> values) {
addCriterion("organization_id not in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdBetween(Long value1, Long value2) {
addCriterion("organization_id between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotBetween(Long value1, Long value2) {
addCriterion("organization_id not between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andIsAccessibleIsNull() {
addCriterion("is_accessible is null");
return (Criteria) this;
}
public Criteria andIsAccessibleIsNotNull() {
addCriterion("is_accessible is not null");
return (Criteria) this;
}
public Criteria andIsAccessibleEqualTo(Boolean value) {
addCriterion("is_accessible =", value, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleNotEqualTo(Boolean value) {
addCriterion("is_accessible <>", value, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleGreaterThan(Boolean value) {
addCriterion("is_accessible >", value, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_accessible >=", value, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleLessThan(Boolean value) {
addCriterion("is_accessible <", value, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleLessThanOrEqualTo(Boolean value) {
addCriterion("is_accessible <=", value, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleIn(List<Boolean> values) {
addCriterion("is_accessible in", values, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleNotIn(List<Boolean> values) {
addCriterion("is_accessible not in", values, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleBetween(Boolean value1, Boolean value2) {
addCriterion("is_accessible between", value1, value2, "isAccessible");
return (Criteria) this;
}
public Criteria andIsAccessibleNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_accessible not between", value1, value2, "isAccessible");
return (Criteria) this;
}
public Criteria andHasOriginalRoleIsNull() {
addCriterion("has_original_role is null");
return (Criteria) this;
}
public Criteria andHasOriginalRoleIsNotNull() {
addCriterion("has_original_role is not null");
return (Criteria) this;
}
public Criteria andHasOriginalRoleEqualTo(Boolean value) {
addCriterion("has_original_role =", value, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleNotEqualTo(Boolean value) {
addCriterion("has_original_role <>", value, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleGreaterThan(Boolean value) {
addCriterion("has_original_role >", value, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleGreaterThanOrEqualTo(Boolean value) {
addCriterion("has_original_role >=", value, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleLessThan(Boolean value) {
addCriterion("has_original_role <", value, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleLessThanOrEqualTo(Boolean value) {
addCriterion("has_original_role <=", value, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleIn(List<Boolean> values) {
addCriterion("has_original_role in", values, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleNotIn(List<Boolean> values) {
addCriterion("has_original_role not in", values, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleBetween(Boolean value1, Boolean value2) {
addCriterion("has_original_role between", value1, value2, "hasOriginalRole");
return (Criteria) this;
}
public Criteria andHasOriginalRoleNotBetween(Boolean value1, Boolean value2) {
addCriterion("has_original_role not between", value1, value2, "hasOriginalRole");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table user_organization
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table user_organization
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of 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="pwc.taxtech.atms.organization.dao.UserOrganizationHKMapper">
<resultMap id="BaseResultMap" type="pwc.taxtech.atms.organization.entity.UserOrganizationHK">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="organization_id" jdbcType="BIGINT" property="organizationId" />
<result column="is_accessible" jdbcType="BIT" property="isAccessible" />
<result column="has_original_role" jdbcType="BIT" property="hasOriginalRole" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, user_id, organization_id, is_accessible, has_original_role
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.organization.entity.UserOrganizationHKExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user_organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from user_organization
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from user_organization
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="pwc.taxtech.atms.organization.entity.UserOrganizationHKExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from user_organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="pwc.taxtech.atms.organization.entity.UserOrganizationHK">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into user_organization (id, user_id, organization_id,
is_accessible, has_original_role)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=VARCHAR}, #{organizationId,jdbcType=BIGINT},
#{isAccessible,jdbcType=BIT}, #{hasOriginalRole,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.organization.entity.UserOrganizationHK">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into user_organization
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="organizationId != null">
organization_id,
</if>
<if test="isAccessible != null">
is_accessible,
</if>
<if test="hasOriginalRole != null">
has_original_role,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
#{organizationId,jdbcType=BIGINT},
</if>
<if test="isAccessible != null">
#{isAccessible,jdbcType=BIT},
</if>
<if test="hasOriginalRole != null">
#{hasOriginalRole,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.organization.entity.UserOrganizationHKExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from user_organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_organization
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.organizationId != null">
organization_id = #{record.organizationId,jdbcType=BIGINT},
</if>
<if test="record.isAccessible != null">
is_accessible = #{record.isAccessible,jdbcType=BIT},
</if>
<if test="record.hasOriginalRole != null">
has_original_role = #{record.hasOriginalRole,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_organization
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=VARCHAR},
organization_id = #{record.organizationId,jdbcType=BIGINT},
is_accessible = #{record.isAccessible,jdbcType=BIT},
has_original_role = #{record.hasOriginalRole,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.organization.entity.UserOrganizationHK">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_organization
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
organization_id = #{organizationId,jdbcType=BIGINT},
</if>
<if test="isAccessible != null">
is_accessible = #{isAccessible,jdbcType=BIT},
</if>
<if test="hasOriginalRole != null">
has_original_role = #{hasOriginalRole,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.organization.entity.UserOrganizationHK">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_organization
set user_id = #{userId,jdbcType=VARCHAR},
organization_id = #{organizationId,jdbcType=BIGINT},
is_accessible = #{isAccessible,jdbcType=BIT},
has_original_role = #{hasOriginalRole,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
infrastructureModule
.controller('UserDetailViewController', ['$window', '$location', 'userService', '$stateParams', '$location', '$scope',
.controller('UserDetailViewController', ['$window', '$location', 'userOrgService', 'userService', '$stateParams', '$location', '$scope',
'$log', 'SweetAlert', 'permissionService', '$translate', 'areaRegionService', 'uiGridTreeViewConstants', '$timeout',
'areaService', 'uiGridConstants', '$interval', 'orgService', '$q', 'roleService', '$rootScope', '$state', 'userService',
function ($window, $location, userService, $stateParams, $location, $scope,
function ($window, $location, userOrgService, userService, $stateParams, $location, $scope,
$log, SweetAlert, permissionService, $translate, areaRegionService, uiGridTreeViewConstants, $timeout,
areaService, uiGridConstants, $interval, orgService, $q, roleService, $rootScope, $state, userService) {
......@@ -82,7 +82,7 @@
$scope.addExistOrg = function () {
var selectedKeyItem = [];
$scope.orgSettingList.data.forEach(function (row) {
selectedKeyItem.push(row.orgID);
selectedKeyItem.push(row.orgId);
});
$scope.selectedKeyItems = selectedKeyItem;
$scope.addExistOrgOperateType = constant.Operation.Add;
......@@ -90,7 +90,7 @@
};
$scope.$watch('addExistOrgOperateType', function (newValue, oldValue) {
if (newValue==null&&oldValue===constant.Operation.Add) {
if (newValue == null && oldValue === constant.Operation.Add) {
$scope.getOrgRoleListView();
}
});
......@@ -665,7 +665,9 @@
(item.userInfo !== undefined && item.userInfo.indexOf(searchValue) >= 0);
});
tempData.forEach(function (item) { item.$$treeLevel = 0; });
tempData.forEach(function (item) {
item.$$treeLevel = 0;
});
$scope.areaORGGridList.data = tempData;
} else {
$scope.areaORGGridList.data = $scope.data;
......@@ -743,25 +745,35 @@
//row.extraRoleList = _.filter(row.roleList, function (item) {
// return item.roleSource == constant.roleSource.OrganizationLevel;
//});
var uniqRoleList = _.uniq(row.roleList, function (item) { return item.id });
var uniqRoleList = _.uniq(row.roleList, function (item) {
return item.id
});
if (row.isAccessible) {
if (uniqRoleList && uniqRoleList.length > 0) {
row.roleName = _.map(uniqRoleList, function (x) { return x.name; }).join(constant.comma);
}
else {
row.roleName = _.map(uniqRoleList, function (x) {
return x.name;
}).join(constant.comma);
} else {
row.roleName = $translate.instant('NoRole');
}
}
else {
} else {
row.roleName = $translate.instant('NonAccessible'); //不可访问
}
});
$scope.orgRoleList = data.orgDtoList;
$scope.orgSettingList.data = data.orgDtoList;
// $scope.orgSettingList.data = data.orgDtoList;
$scope.allOrgInfo = data.orgRoleInfoList;
});
//获取用户对应的机构
userOrgService.getUserOrgList(userId).success(function (res) {
if (res.result) {
$scope.orgSettingList.data = res.data;
}
});
};
//添加现有机构
......@@ -784,9 +796,17 @@
});
var userID = $stateParams.id;
roleService.updateUserOrg(newAddedItems, userID).success(function (data) {
// roleService.updateUserOrg(newAddedItems, userID).success(function (data) {
// $scope.getOrgRoleListView();
// SweetAlert.success($translate.instant('addExistOrgTitle'), $translate.instant('addOrgListSuccess'));
// });
userOrgService.addUserOrg(newAddedItems, userID).success(function (res) {
if (res.result) {
$scope.getOrgRoleListView();
SweetAlert.success($translate.instant('addExistOrgTitle'), $translate.instant('addOrgListSuccess'));
} else {
SweetAlert.error($translate.instant('SystemError'));
}
});
}
}
......@@ -945,7 +965,8 @@
var orgStr = '';
if ($scope.hasEditPermission) {
orgStr = '<div class="text-align-left"><span><i style="color: #404041;" class="material-icons" ng-click="grid.appScope.modifyOrgRole(row)">create</i>&nbsp;<i class="fa fa-trash" style="color:#ee7749" aria-hidden="true" ng-click="grid.appScope.deleteOrgRole(row)"></i></span></div>';
// orgStr = '<div class="text-align-left"><span><i style="color: #404041;" class="material-icons" ng-click="grid.appScope.modifyOrgRole(row)">create</i>&nbsp;<i class="fa fa-trash" style="color:#ee7749" aria-hidden="true" ng-click="grid.appScope.deleteOrgRole(row)"></i></span></div>';
orgStr = '<div style="text-align: center"><span><i class="fa fa-trash" style="color:#ee7749" aria-hidden="true" ng-click="grid.appScope.deleteUserOrg(row)"></i></span></div>';
} else {
orgStr = '<div class="text-align-left"><span class="no-permission"><i class="material-icons">create</i>&nbsp;<i class="fa fa-trash" style="color:#ee7749" aria-hidden="true"></i></span></div>';
}
......@@ -966,23 +987,26 @@
showTreeExpandNoChildren: false,
enableFullRowSelection: true, //是否点击行任意位置后选中,默认为false
multiSelect: false, // 是否可以选择多个,默认为true;
columnDefs: [{
columnDefs: [
{
field: 'orgNameTitle',
name: $translate.instant('OrgNameTitle'),
headerCellClass: '',
width: '35%',
width: '90%',
cellTemplate: '<div ng-class="{true: \'text-align-left\', false: \'text-align-left-padding\'}[!row.entity.isOrganization]"><span title="{{row.entity.orgName}}">{{row.entity.orgName | limitString:30}}</span></div>'
}, {
field: 'roleTitle',
name: $translate.instant('RoleTitle'),
headerCellClass: '',
width: '40%',
cellTemplate: '<div class="text-align-left" id="{{row.entity.orgID}}" aria-hidden="true"><span title="{{row.entity.roleName}}">{{row.entity.roleName |limitString:32 }}</span></div>'
}, {
},
// {
// field: 'roleTitle',
// name: $translate.instant('RoleTitle'),
// headerCellClass: '',
// width: '40%',
// cellTemplate: '<div class="text-align-left" id="{{row.entity.orgID}}" aria-hidden="true"><span title="{{row.entity.roleName}}">{{row.entity.roleName |limitString:32 }}</span></div>'
// },
{
field: 'roleAction',
name: $translate.instant('OrgUserAction'),
headerCellClass: '',
width: '25%',
width: '10%',
cellTemplate: orgStr
}],
onRegisterApi: function (gridApi) {
......@@ -1041,6 +1065,33 @@
$scope.userRolesIsUpdate = false;
};
$scope.deleteUserOrg = function (data) {
var userOrgId = data.entity.userOrgId;
SweetAlert.swal({
title: $translate.instant('ConfirmDelete') + '?',
text: $translate.instant('userOrgDeleteConfirm') + '?',
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: false,
closeOnCancel: true
}, function (isConfirm) {
if (isConfirm) {
userOrgService.deleteUserOrg(userOrgId).success(function (res) {
if (res.result) {
SweetAlert.success($translate.instant('deleteRoleUserDetailTitle'), $translate.instant('deleteUserOrgSuccess'));
$scope.getOrgRoleListView();
} else {
SweetAlert.error($translate.instant('SystemError'));
}
});
}
});
};
$scope.deleteOrgRole = function (data) {
var userId = $stateParams.id;
......@@ -1076,7 +1127,6 @@
});
}
userService.deleteUserRoleOrg(selectedArr).success(function (data) {
if (data) {
SweetAlert.success($translate.instant('deleteRoleUserDetailTitle'), $translate.instant('deleteUserOrgSuccess'));
......
......@@ -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