mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 12:13:24 +09:00
mybatis join 관련한 기능 추가
This commit is contained in:
@@ -1,36 +1,48 @@
|
||||
package com.no1.wms.authority;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/authority")
|
||||
public class AuthorityController {
|
||||
@Autowired
|
||||
AuthorityService authorityService;
|
||||
private static final int PER_PAGE = 10;
|
||||
|
||||
|
||||
@GetMapping("/test/tt")
|
||||
public ModelAndView test(ModelAndView mav, AuthorityDto d){
|
||||
d.setId("94690a18-a933-11ee-b9dd-0242ac110006");
|
||||
AuthorityDto dto = authorityService.selectById(d);
|
||||
|
||||
System.out.println(dto.getName());
|
||||
|
||||
mav.setViewName("test/testlayout");
|
||||
@GetMapping("/list")
|
||||
public ModelAndView list(ModelAndView mav, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "0") int start){
|
||||
List<AuthorityDto> list = authorityService.selectAll(search, start, PER_PAGE);
|
||||
for(int i=0; i < list.size(); ++i){
|
||||
System.out.println(list.get(i));
|
||||
}
|
||||
mav.addObject("list", list);
|
||||
mav.setViewName("/authority/list");
|
||||
return mav;
|
||||
}
|
||||
@GetMapping("/tt")
|
||||
public ModelAndView test2(ModelAndView mav){
|
||||
//AuthorityDto dto = authorityService.selectById("94690a18-a933-11ee-b9dd-0242ac110006");
|
||||
@GetMapping("/create")
|
||||
public String create(){
|
||||
return "/authority/create_group";
|
||||
|
||||
//System.out.println(dto.getName());
|
||||
}
|
||||
|
||||
mav.setViewName("test/testlayout");
|
||||
return mav;
|
||||
@PostMapping("/checkNameDuplicate")
|
||||
@ResponseBody
|
||||
public String checkNameDuplicate(@RequestParam String name, Gson gson){
|
||||
int count = authorityService.selectByName(name);
|
||||
return gson.toJson(count);
|
||||
}
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public String createProcess(AuthorityDto dto, Gson gson){
|
||||
int result = authorityService.insert(dto);
|
||||
return gson.toJson(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,52 @@
|
||||
package com.no1.wms.authority;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Alias("AuthorityDto")
|
||||
public class AuthorityDto {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private Integer account;
|
||||
private Integer authority;
|
||||
private Integer productCategory;
|
||||
private Integer product;
|
||||
private Integer prices;
|
||||
private Integer vendor;
|
||||
private Integer warehouse;
|
||||
private Integer stock;
|
||||
private Integer planIn;
|
||||
private Integer productIn;
|
||||
private Integer productOut;
|
||||
private Integer board;
|
||||
|
||||
@Builder.Default
|
||||
private Integer account = 0;
|
||||
@Builder.Default
|
||||
private Integer authority = 0;
|
||||
@Builder.Default
|
||||
private Integer productCategory = 0;
|
||||
@Builder.Default
|
||||
private Integer product = 0;
|
||||
@Builder.Default
|
||||
private Integer prices = 0;
|
||||
@Builder.Default
|
||||
private Integer vendor = 0;
|
||||
@Builder.Default
|
||||
private Integer warehouse = 0;
|
||||
@Builder.Default
|
||||
private Integer stock = 0;
|
||||
@Builder.Default
|
||||
private Integer planIn = 0;
|
||||
@Builder.Default
|
||||
private Integer productIn = 0;
|
||||
@Builder.Default
|
||||
private Integer productOut = 0;
|
||||
@Builder.Default
|
||||
private Integer board = 0;
|
||||
|
||||
private AccountDto accountDto;
|
||||
|
||||
|
||||
private Boolean activation;
|
||||
private Boolean isGroupAuthority;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,17 @@ package com.no1.wms.authority;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface AuthorityMapper {
|
||||
AuthorityDto selectById(AuthorityDto id);
|
||||
int selectByName(String name);
|
||||
|
||||
int insert(AuthorityDto dto);
|
||||
|
||||
List<AuthorityDto> selectAll(Map<String, Object> m);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ package com.no1.wms.authority;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class AuthorityService {
|
||||
@@ -14,4 +16,21 @@ public class AuthorityService {
|
||||
public AuthorityDto selectById(AuthorityDto dto){
|
||||
return mapper.selectById(dto);
|
||||
}
|
||||
|
||||
public List<AuthorityDto> selectAll(String search, int start, int perPage){
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("search", search);
|
||||
map.put("start", start);
|
||||
map.put("perPage", perPage);
|
||||
|
||||
return mapper.selectAll(map);
|
||||
}
|
||||
|
||||
public int selectByName(String name){
|
||||
return mapper.selectByName(name);
|
||||
}
|
||||
|
||||
public int insert(AuthorityDto dto){
|
||||
return mapper.insert(dto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,62 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.no1.wms.authority.AuthorityMapper">
|
||||
<resultMap id="authorityResultMap" type="AuthorityDto">
|
||||
<id column="id" property="id"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="account" property="account"/>
|
||||
<result column="authority" property="authority"/>
|
||||
<result column="product_category" property="productCategory"/>
|
||||
<result column="product" property="product"/>
|
||||
<result column="prices" property="prices"/>
|
||||
<result column="vendor" property="vendor"/>
|
||||
<result column="warehouse" property="warehouse"/>
|
||||
<result column="stock" property="stock"/>
|
||||
<result column="plan_in" property="planIn"/>
|
||||
<result column="product_in" property="productIn"/>
|
||||
<result column="product_out" property="productOut"/>
|
||||
<result column="board" property="board"/>
|
||||
<result column="activation" property="activation"/>
|
||||
<result column="is_group_authority" property="isGroupAuthority"/>
|
||||
<association property="accountDto" javaType="AccountDto">
|
||||
<id column="personal_authority_id" property="personalAuthorityId" />
|
||||
<result column="employee_number" property="employeeNumber" />
|
||||
<result column="acc_name" property="name" />
|
||||
</association>
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectById" resultType="AuthorityDto">
|
||||
SELECT * FROM authority WHERE id = #{id}
|
||||
</select>
|
||||
<select id="selectAll" resultMap="authorityResultMap" parameterType="map">
|
||||
SELECT
|
||||
auth.id, auth.name, auth.account, auth.authority, auth.product_category, auth.product,
|
||||
auth.prices, auth.vendor, auth.warehouse, auth.stock, auth.plan_in, auth.product_in,
|
||||
auth.product_out, auth.board, auth.activation, auth.is_group_authority,
|
||||
acc.employee_number, acc.name acc_name
|
||||
from authority auth left join account acc on acc.personal_authority_id = auth.id
|
||||
where auth.name like concat('%',#{search},'%')
|
||||
order by auth.activation desc, auth.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
<select id="selectByName" resultType="int">
|
||||
SELECT count(name) FROM authority WHERE name = #{name}
|
||||
</select>
|
||||
<insert id="insert" parameterType="AuthorityDto">
|
||||
insert into authority
|
||||
(
|
||||
id, name, account, authority, product_category,
|
||||
product, prices, vendor, warehouse, stock, plan_in,
|
||||
product_in, product_out, board, activation, is_group_authority)
|
||||
VALUES (
|
||||
UUID(), #{name}, #{account},
|
||||
#{authority}, #{productCategory},
|
||||
#{product},#{prices},#{vendor},
|
||||
#{warehouse},#{stock}, #{planIn},
|
||||
#{productIn},#{productOut},#{board},
|
||||
#{activation}, #{isGroupAuthority}
|
||||
)
|
||||
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -3,4 +3,8 @@
|
||||
}
|
||||
.tab-pane{
|
||||
background-color: rgb(208, 208, 208);
|
||||
}
|
||||
|
||||
.form-check{
|
||||
display: inline!important;
|
||||
}
|
||||
@@ -187,9 +187,6 @@
|
||||
*/
|
||||
$(function() {
|
||||
$("#div_personal_search").hide();
|
||||
$("#search_btn").on("click", function () {
|
||||
$("select[name='search_select'] option:selected").val();
|
||||
});
|
||||
$(".nav-item button").on("click", function(obj){
|
||||
const selectedButtonId = $(obj.currentTarget).attr('id');
|
||||
if(selectedButtonId === 'home-tab'){
|
||||
@@ -201,6 +198,19 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function onSearch(isPersonalSearch){
|
||||
let jsonData = {};
|
||||
if(isPersonalSearch){
|
||||
jsonData.searchOption = $("select[name='search_select'] option:selected").val();
|
||||
jsonData.searchValue = $("#search_personal_input").val();
|
||||
|
||||
}else{
|
||||
jsonData.searchValue = $("#search_group_input").val();
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(jsonData));
|
||||
}
|
||||
</script>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
@@ -212,70 +222,71 @@
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<!-- 탭 부분 -->
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#group_authority_tab" type="button" role="tab" aria-controls="home" aria-selected="true">그룹 권한</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#personal_authority_tab" type="button" role="tab" aria-controls="profile" aria-selected="false">개인 권한</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div id="div_group_search" class="text-end">
|
||||
<input id="search_group_input" type="text" class="w-60 d-inline form-control" placeholder="검색">
|
||||
<button id="search_group_btn" type="button" class="btn btn-primary">검색</button>
|
||||
</div>
|
||||
<div id="div_personal_search" class="text-end">
|
||||
<select name="search_select" class="form-select d-inline">
|
||||
<option selected value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
</select>
|
||||
<input id="search_personal_input" type="text" class="w-60 d-inline form-control" placeholder="검색">
|
||||
<button id="search_personal_btn" type="button" class="btn btn-primary">검색</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<!-- 탭 부분 -->
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="profile-tab" data-bs-toggle="tab" data-bs-target="#personal_authority_tab" type="button" role="tab" aria-controls="profile" aria-selected="false">개인 권한</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="home-tab" data-bs-toggle="tab" data-bs-target="#group_authority_tab" type="button" role="tab" aria-controls="home" aria-selected="true">그룹 권한</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="group_authority_tab" role="tabpanel" aria-labelledby="group-authority-tab">
|
||||
<table class="table" >
|
||||
<thead class="table-dark">
|
||||
<tr><th>번호</th><th>권한 명</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>1</td><td>사장 권한</td></tr>
|
||||
<tr><td>2</td><td>관리자 권한</td></tr>
|
||||
<tr><td>3</td><td>사원 권한</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="personal_authority_tab" role="tabpanel" aria-labelledby="personal-authority-tab">
|
||||
<table class="table" >
|
||||
<thead class="table-dark">
|
||||
<tr><th>번호</th><th>id</th><th>이름</th><th>권한 명</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>1</td><td>230112</td><td>김이박</td><td>사장 권한</td></tr>
|
||||
<tr><td>2</td><td>230112</td><td>김이박</td><td>사장 권한</td></tr>
|
||||
<tr><td>3</td><td>230112</td><td>김이박</td><td>사장 권한</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div id="div_group_search" class="text-end">
|
||||
<input id="search_group_input" type="text" class="w-60 d-inline form-control" placeholder="검색">
|
||||
<button id="search_group_btn" type="button" class="btn btn-primary" onclick="onSearch(false)">검색</button>
|
||||
</div>
|
||||
<div id="div_personal_search" class="text-end">
|
||||
<select name="search_select" class="form-select d-inline">
|
||||
<option selected value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
</select>
|
||||
<input id="search_personal_input" type="text" class="w-60 d-inline form-control" placeholder="검색">
|
||||
<button id="search_personal_btn" type="button" class="btn btn-primary" onclick="onSearch(true)">검색</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="personal_authority_tab" role="tabpanel" aria-labelledby="personal-authority-tab">
|
||||
<table class="table" >
|
||||
<thead class="table-dark">
|
||||
<tr><th>번호</th><th>ID</th><th>사용자 명</th><th>권한 명</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>1</td><td>230112</td><td>김이박</td><td>사장 권한</td></tr>
|
||||
<tr><td>2</td><td>230112</td><td>김이박</td><td>사장 권한</td></tr>
|
||||
<tr><td>3</td><td>230112</td><td>김이박</td><td>사장 권한</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="group_authority_tab" role="tabpanel" aria-labelledby="group-authority-tab">
|
||||
<table class="table" >
|
||||
<thead class="table-dark">
|
||||
<tr><th>번호</th><th>권한 명</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>1</td><td>사장 권한</td></tr>
|
||||
<tr><td>2</td><td>관리자 권한</td></tr>
|
||||
<tr><td>3</td><td>사원 권한</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 탭 부분 끝 -->
|
||||
</div>
|
||||
<!-- 탭 부분 끝 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
169
src/main/webapp/WEB-INF/views/authority/create_group.jsp
Normal file
169
src/main/webapp/WEB-INF/views/authority/create_group.jsp
Normal file
@@ -0,0 +1,169 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<script>
|
||||
/*
|
||||
yes no 모달의 확인 버튼을 누를때 재정의할 function
|
||||
|
||||
yesNoModal.yesFunction = myYesFunction;
|
||||
function myYesFunction(){
|
||||
alert("재정의 됨");
|
||||
}
|
||||
*/
|
||||
const authorityCategoryList = [
|
||||
{'eng' : 'account', 'kor' : '계정'},
|
||||
{'eng':'authority','kor' : '권한'},
|
||||
{'eng' : 'productCategory', 'kor' : '제품 카테고리'},
|
||||
{'eng': 'product' ,'kor' : '제품' },
|
||||
{'eng':'prices' ,'kor' : '가격' },
|
||||
{'eng': 'vendor' ,'kor' : '거래처' } ,
|
||||
{'eng':'warehouse' ,'kor' : '창고' },
|
||||
{'eng': 'stock' ,'kor' : '재고' } ,
|
||||
{'eng':'planIn' ,'kor' : '입고 예정'},
|
||||
{'eng':'productIn' ,'kor' : '입고'},
|
||||
{'eng':'productOut' ,'kor' : '출고'},
|
||||
{'eng':'board' ,'kor' : '게시판'}
|
||||
]
|
||||
|
||||
$(function(){
|
||||
const $div_check_box_body = $("#table_check_box_body");
|
||||
authorityCategoryList.reverse().forEach(function(element){
|
||||
$div_check_box_body.after('<tr>' +
|
||||
' <td>'+element.kor+'</td>\n' +
|
||||
' <td><div id="'+element.eng+'_check_read" class="form-check form-check-inline">\n' +
|
||||
' <input class="form-check-input" data-category="'+element.eng+'" type="checkbox" value="8" id="'+element.eng+'_read">\n' +
|
||||
' <label class="form-check-label" for='+element.eng+'_read">\n' +
|
||||
' 읽기\n' +
|
||||
' </label>\n' +
|
||||
' </div>\n' +
|
||||
' <div id="'+element.eng+'_check_write" class="form-check form-check-inline">\n' +
|
||||
' <input class="form-check-input" data-category="'+element.eng+'" type="checkbox" value="4" id="'+element.eng+'_create">\n' +
|
||||
' <label class="form-check-label" for="'+element.eng+'_create">\n' +
|
||||
' 쓰기\n' +
|
||||
' </label>\n' +
|
||||
' </div>\n' +
|
||||
' <div id="'+element.eng+'_check_create" class="form-check form-check-inline">\n' +
|
||||
' <input class="form-check-input" data-category="'+element.eng+'" type="checkbox" value="2" id="'+element.eng+'_update">\n' +
|
||||
' <label class="form-check-label" for="'+element.eng+'_update">\n' +
|
||||
' 수정\n' +
|
||||
' </label>\n' +
|
||||
' </div>\n' +
|
||||
' <div id="'+element.eng+'_check_delete" class="form-check form-check-inline">\n' +
|
||||
' <input class="form-check-input" data-category="'+element.eng+'" type="checkbox" value="1" id="'+element.eng+'_delete">\n' +
|
||||
' <label class="form-check-label" for="'+element.eng+'_delete">\n' +
|
||||
' 삭제\n' +
|
||||
' </label>\n' +
|
||||
' </div></td>\n' +
|
||||
' </tr>');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function checkName(){
|
||||
if($("#btn_check_name").text() === "다시 설정"){
|
||||
$("#authority_name").removeAttr("disabled");
|
||||
$("#btn_check_name").text("중복 확인");
|
||||
return;
|
||||
}
|
||||
|
||||
const name = $("#authority_name").val();
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/authority/checkNameDuplicate', // 요청할 서버url
|
||||
dataType : 'json', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : {'name' : name},
|
||||
success : function(data) { // 결과 성공 콜백함수
|
||||
if(Number(data) === 0){
|
||||
$("#authority_name").attr('disabled','true');
|
||||
$("#btn_check_name").text("다시 설정");
|
||||
}else{
|
||||
alert("이미 존재하는 권한 명 입니다");
|
||||
}
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onAuthorityProcess(){
|
||||
if($("#authority_name:disabled").length === 0 ){
|
||||
alert("'중복 확인'을 해주세요");
|
||||
return;
|
||||
}
|
||||
|
||||
let data = {};
|
||||
data.name = $("#authority_name").val();
|
||||
const $checkBoxList = $("input[type='checkbox']:checked");
|
||||
$checkBoxList.each(function(index, element){
|
||||
const category = $(element).data('category');
|
||||
if(data[category] == null){
|
||||
data[category] = 0;
|
||||
}
|
||||
data[category] += Number($(element).val());
|
||||
});
|
||||
data['isGroupAuthority'] = true;
|
||||
data['activation'] = true;
|
||||
console.log(data);
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/authority/create_process', // 요청할 서버url
|
||||
dataType : 'json', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
alert(result);
|
||||
if(result === 's'){
|
||||
$("#authority_name").attr('disabled','true');
|
||||
}else if(result === 'f'){
|
||||
alert("이미 존재하는 권한 명 입니다");
|
||||
}
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>권한 추가</h1>
|
||||
</div>
|
||||
<div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
권한명
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<input class="form-control w-30 d-inline" id="authority_name" name='name' type="text" placeholder="권한 명을 입력하세요">
|
||||
<button id="btn_check_name" class="btn btn-primary" onclick="checkName()">중복 확인</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<tbody id="table_check_box_body">
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<button class="btn btn-primary" onclick="onAuthorityProcess()">생성</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
125
src/main/webapp/WEB-INF/views/authority/list.jsp
Normal file
125
src/main/webapp/WEB-INF/views/authority/list.jsp
Normal file
@@ -0,0 +1,125 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<!-- 이 안에 내용 복사해서 jsp에 붙여넣기 -->
|
||||
<link rel="stylesheet" href="authority.css">
|
||||
<script>
|
||||
/*
|
||||
yes no 모달의 확인 버튼을 누를때 재정의할 function
|
||||
|
||||
yesNoModal.yesFunction = myYesFunction;
|
||||
function myYesFunction(){
|
||||
alert("재정의 됨");
|
||||
}
|
||||
*/
|
||||
$(function() {
|
||||
$("#div_personal_search").hide();
|
||||
$(".nav-item button").on("click", function(obj){
|
||||
const selectedButtonId = $(obj.currentTarget).attr('id');
|
||||
if(selectedButtonId === 'home-tab'){
|
||||
$("#div_group_search").show();
|
||||
$("#div_personal_search").hide();
|
||||
}else{
|
||||
$("#div_group_search").hide();
|
||||
$("#div_personal_search").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function onSearch(isPersonalSearch){
|
||||
let jsonData = {};
|
||||
if(isPersonalSearch){
|
||||
jsonData.searchOption = $("select[name='search_select'] option:selected").val();
|
||||
jsonData.searchValue = $("#search_personal_input").val();
|
||||
|
||||
}else{
|
||||
jsonData.searchValue = $("#search_group_input").val();
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(jsonData));
|
||||
}
|
||||
</script>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>그룹 권한 관리</h1>
|
||||
</div>
|
||||
<div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<!-- 탭 부분 -->
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="profile-tab" data-bs-toggle="tab" data-bs-target="#personal_authority_tab" type="button" role="tab" aria-controls="profile" aria-selected="false">개인 권한</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="home-tab" data-bs-toggle="tab" data-bs-target="#group_authority_tab" type="button" role="tab" aria-controls="home" aria-selected="true">그룹 권한</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div id="div_group_search" class="text-end">
|
||||
<input id="search_group_input" type="text" class="w-60 d-inline form-control" placeholder="검색">
|
||||
<button id="search_group_btn" type="button" class="btn btn-primary" onclick="onSearch(false)">검색</button>
|
||||
</div>
|
||||
<div id="div_personal_search" class="text-end">
|
||||
<select name="search_select" class="form-select d-inline">
|
||||
<option selected value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
</select>
|
||||
<input id="search_personal_input" type="text" class="w-60 d-inline form-control" placeholder="검색">
|
||||
<button id="search_personal_btn" type="button" class="btn btn-primary" onclick="onSearch(true)">검색</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="personal_authority_tab" role="tabpanel" aria-labelledby="personal-authority-tab">
|
||||
<table class="table" >
|
||||
<thead class="table-dark">
|
||||
<tr><th>사번</th><th>사용자 명</th><th>권한 명</th><th>활성 여부</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto" varStatus="status">
|
||||
<c:if test="${dto.isGroupAuthority == false}">
|
||||
<tr>
|
||||
<td>${dto.accountDto.employeeNumber}</td>
|
||||
<td>${dto.accountDto.name}</td>
|
||||
<td>${dto.name}</td>
|
||||
<td>${dto.activation}</td>
|
||||
</tr>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="group_authority_tab" role="tabpanel" aria-labelledby="group-authority-tab">
|
||||
<table class="table" >
|
||||
<thead class="table-dark">
|
||||
<tr><th>번호</th><th>권한 명</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>1</td><td>사장 권한</td></tr>
|
||||
<tr><td>2</td><td>관리자 권한</td></tr>
|
||||
<tr><td>3</td><td>사원 권한</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 탭 부분 끝 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user