mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
account read update 관련
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
package com.no1.wms.account;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.no1.wms.authority.AuthorityDto;
|
||||
import com.no1.wms.authority.AuthorityService;
|
||||
import com.no1.wms.utils.ConstantValues;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/account")
|
||||
@@ -17,6 +18,8 @@ public class AccountController {
|
||||
|
||||
@Autowired
|
||||
AccountService accountService;
|
||||
@Autowired
|
||||
AuthorityService authorityService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public ModelAndView list(ModelAndView mav, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "0") int start){
|
||||
@@ -34,11 +37,63 @@ public class AccountController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/show_modal")
|
||||
public ModelAndView showModal(ModelAndView mav, @RequestParam String name){
|
||||
//db에서 데이터 가져오는거 필요
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public String createProcess(AccountDto dto, Gson gson){
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
AuthorityDto authorityDto = new AuthorityDto();
|
||||
authorityDto.setId(dto.getGroupAuthorityId());
|
||||
authorityDto = authorityService.selectById(authorityDto);
|
||||
authorityDto.setId(uuid);
|
||||
authorityDto.setIsGroupAuthority(false);
|
||||
authorityDto.setName(dto.getEmployeeNumber());
|
||||
|
||||
accountService.insertToAuthority(authorityDto);
|
||||
dto.setPersonalAuthorityId(uuid);
|
||||
accountService.insert(dto);
|
||||
|
||||
return gson.toJson("s");
|
||||
}
|
||||
|
||||
@PostMapping("/read")
|
||||
public ModelAndView read(AccountDto dto, ModelAndView mav){
|
||||
dto = accountService.selectById(dto);
|
||||
mav.addObject("dto", dto);
|
||||
mav.setViewName("/account/read");
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public ModelAndView update(AccountDto dto, ModelAndView mav){
|
||||
dto = accountService.selectById(dto);
|
||||
mav.addObject("dto", dto);
|
||||
mav.setViewName("/account/update");
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/update_process")
|
||||
@ResponseBody
|
||||
public String updateProcess(AccountDto dto, Gson gson){
|
||||
|
||||
accountService.update(dto);
|
||||
|
||||
return gson.toJson("s");
|
||||
}
|
||||
|
||||
@PostMapping("/show_modal")
|
||||
public ModelAndView showModal(ModelAndView mav, @RequestParam(defaultValue = "") String search,
|
||||
@RequestParam(defaultValue = "0") int start, @RequestParam String name){
|
||||
//db에서 데이터 가져오는거 필요
|
||||
List list = null;
|
||||
if(name.equals("auth")){
|
||||
list = authorityService.selectAll(search, start, ConstantValues.PER_PAGE);
|
||||
}else if(name.equals("dept")){
|
||||
list = accountService.selectDeptAll(search, start, ConstantValues.PER_PAGE);
|
||||
}else if(name.equals("pos")){
|
||||
list = accountService.selectPosAll(search, start, ConstantValues.PER_PAGE);
|
||||
}
|
||||
//
|
||||
mav.addObject("list", list);
|
||||
mav.setViewName(name);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.ibatis.type.Alias;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -25,6 +26,7 @@ public class AccountDto {
|
||||
private String personalAuthorityId;
|
||||
private String name;
|
||||
private String gender;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date birth;
|
||||
private String telephone;
|
||||
private String address;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.no1.wms.account;
|
||||
|
||||
import com.no1.wms.authority.AuthorityDto;
|
||||
import com.no1.wms.department.DepartmentDto;
|
||||
import com.no1.wms.position.PositionDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -11,9 +14,15 @@ import java.util.Map;
|
||||
public interface AccountMapper {
|
||||
|
||||
int insert(AccountDto dto);
|
||||
|
||||
int insertToAuthority(AuthorityDto dto);
|
||||
int update(AccountDto dto);
|
||||
|
||||
int selectById(AccountDto dto);
|
||||
AccountDto selectById(AccountDto dto);
|
||||
|
||||
List<AccountDto> selectAll(Map<String, Object> m);
|
||||
|
||||
List<DepartmentDto> selectDeptAll(Map<String, Object> m);
|
||||
|
||||
List<PositionDto> selectPosAll(Map<String, Object> m);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.no1.wms.account;
|
||||
|
||||
import com.no1.wms.authority.AuthorityDto;
|
||||
import com.no1.wms.department.DepartmentDto;
|
||||
import com.no1.wms.position.PositionDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -15,11 +18,14 @@ public class AccountService {
|
||||
public int insert(AccountDto dto){
|
||||
return mapper.insert(dto);
|
||||
}
|
||||
int insertToAuthority(AuthorityDto dto){
|
||||
return mapper.insertToAuthority(dto);
|
||||
}
|
||||
public int update(AccountDto dto){
|
||||
return mapper.update(dto);
|
||||
}
|
||||
|
||||
public int selectById(AccountDto dto){
|
||||
public AccountDto selectById(AccountDto dto){
|
||||
return mapper.selectById(dto);
|
||||
}
|
||||
|
||||
@@ -34,4 +40,22 @@ public class AccountService {
|
||||
return mapper.selectAll(map);
|
||||
}
|
||||
|
||||
List<DepartmentDto> selectDeptAll(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.selectDeptAll(map);
|
||||
}
|
||||
|
||||
List<PositionDto> selectPosAll(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.selectPosAll(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.no1.wms.account;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Alias("DeptPositionDto")
|
||||
public class DeptAndPositionDto {
|
||||
private String id;
|
||||
private String name;
|
||||
}
|
||||
@@ -13,6 +13,8 @@
|
||||
<result column="telephone" property="telephone"/>
|
||||
<result column="address" property="address"/>
|
||||
<result column="activation" property="activation"/>
|
||||
<result column="personal_authority_id" property="personalAuthorityId" />
|
||||
<result column="group_authority_id" property="groupAuthorityId" />
|
||||
<association property="groupAuthorityDto" javaType="authorityDto">
|
||||
<id column="auth2.id" property="id" />
|
||||
<result column="group_auth_name" property="name" />
|
||||
@@ -21,12 +23,12 @@
|
||||
<id column="auth.id" property="id" />
|
||||
<result column="personal_auth_name" property="name" />
|
||||
</association>
|
||||
<association property="departmentDto" javaType="deptPositionDto">
|
||||
<id column="dept.id" property="id" />
|
||||
<association property="departmentDto" javaType="departmentDto">
|
||||
<id column="dept_id" property="id" />
|
||||
<result column="dept_name" property="name" />
|
||||
</association>
|
||||
<association property="positionDto" javaType="deptPositionDto">
|
||||
<id column="pos.id" property="id" />
|
||||
<association property="positionDto" javaType="positionDto">
|
||||
<id column="pos_id" property="id" />
|
||||
<result column="pos_name" property="name" />
|
||||
</association>
|
||||
</resultMap>
|
||||
@@ -35,12 +37,14 @@
|
||||
acc.id, acc.name,
|
||||
acc.employee_number, acc.password, acc.email, acc.gender,
|
||||
acc.birth, acc.telephone, acc.address, acc.activation,
|
||||
acc.personal_authority_id , acc.group_authority_id,
|
||||
acc.department_id, acc.position_id,
|
||||
auth2.name group_auth_name, auth.name personal_auth_name,
|
||||
dept.name dept_name, pos.name pos_name
|
||||
from account acc join authority auth join authority auth2 join department dept join position pos
|
||||
on acc.personal_authority_id = auth.id and acc.group_authority_id = auth2.id
|
||||
and dept.id = acc.department_id and acc.position_id = pos.id
|
||||
where acc.name like concat('%',#{search},'%')
|
||||
where acc.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="accountResultMap" parameterType="map">
|
||||
@@ -62,11 +66,55 @@
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
UUID(), #{employeeNumber}, #{password},
|
||||
UUID(), #{employeeNumber}, #{employeeNumber},
|
||||
#{email}, #{groupAuthorityId},
|
||||
#{personalAuthorityId},#{name},#{gender},
|
||||
#{birth},#{stelephone}, #{address},
|
||||
#{birth},#{telephone}, #{address},
|
||||
#{departmentId},#{positionId},#{activation}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertToAuthority" 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 (
|
||||
#{id}, #{name}, #{account},
|
||||
#{authority}, #{productCategory},
|
||||
#{product},#{prices},#{vendor},
|
||||
#{warehouse},#{stock}, #{planIn},
|
||||
#{productIn},#{productOut},#{board},
|
||||
#{activation}, #{isGroupAuthority}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="selectDeptAll" resultType="departmentDto" parameterType="map">
|
||||
select * from department
|
||||
where name like concat('%',#{search},'%')
|
||||
order by name limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="selectPosAll" resultType="positionDto" parameterType="map">
|
||||
select * from position
|
||||
where name like concat('%',#{search},'%')
|
||||
order by name limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="accountDto">
|
||||
update account SET
|
||||
name = #{name},
|
||||
employee_number = #{employeeNumber},
|
||||
email = #{email},
|
||||
personal_authority_id = #{personalAuthorityId},
|
||||
gender = #{gender},
|
||||
birth = #{birth},
|
||||
telephone = #{telephone},
|
||||
address = #{address},
|
||||
department_id = #{departmentId},
|
||||
position_id = #{positionId},
|
||||
activation = #{activation}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -27,6 +27,33 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createProcess(){
|
||||
let data = {};
|
||||
const $dataInputList = $("input.create_data");
|
||||
$dataInputList.each(function(index, element){
|
||||
const $element = $(element);
|
||||
const name = $element.attr("name");
|
||||
const val = $element.val();
|
||||
data[name] = val;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/account/create_process', // 요청할 서버url
|
||||
dataType : 'json', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
alert("성공");
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
@@ -43,46 +70,52 @@
|
||||
<div class="col-12">
|
||||
<div class="input-group w-50">
|
||||
<span id='account_name_label' class="input-group-text">사용자 명</span>
|
||||
<input name="name" id="account_name" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_name_label">
|
||||
<input name="name" id="account_name" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_name_label">
|
||||
<span class="me-5"></span>
|
||||
<span id='employee_number_label' class="input-group-text">사번</span>
|
||||
<input id=employee_number" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="employee_number_label">
|
||||
<input id=employee_number" name="employeeNumber" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="employee_number_label">
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_dept_label' class="input-group-text">부서 명</span>
|
||||
<input readonly id="account_dept" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_dept_label">
|
||||
<button id="btn_dept" type="button" class="btn btn-primary">검색</button>
|
||||
<input readonly id="account_dept_name" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_dept_label">
|
||||
<input hidden name="departmentId" readonly id="departmentId" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_dept_label">
|
||||
<button id="btn_dept" type="button" class="btn btn-primary" onclick="showSearchModal('부서 검색','dept')">검색</button>
|
||||
<span class="me-5"></span>
|
||||
<span id='employee_pos_label' class="input-group-text">직책</span>
|
||||
<input readonly id="employee_pos" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="employee_number_pos">
|
||||
<button id="btn_pos" type="button" class="btn btn-primary">검색</button>
|
||||
<input readonly id="account_pos_name" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="employee_number_pos">
|
||||
<input hidden name="positionId" readonly id="positionId" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="employee_number_pos">
|
||||
<button id="btn_pos" type="button" class="btn btn-primary" onclick="showSearchModal('직책 검색','pos')">검색</button>
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_group_label' class="input-group-text">권한</span>
|
||||
<input readonly id="account_auth_group_name" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_group_label">
|
||||
<input hidden name="groupAuthorityId" readonly id="groupAuthorityId" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_group_label">
|
||||
<input hidden name="groupAuthorityId" readonly id="groupAuthorityId" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_group_label">
|
||||
<button id="account_search_button" class="btn-primary btn" onclick="showSearchModal('권한 검색','auth')">검색</button>
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_email_label' class="input-group-text">이메일</span>
|
||||
<input id="account_email" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_email_label">
|
||||
<input id="account_email" name="email" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_email_label">
|
||||
<span class="me-5"></span>
|
||||
<span id='employee_telephone_label' class="input-group-text">전화번호</span>
|
||||
<input id=employee_telephone" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="employee_telephone_label">
|
||||
<input id=employee_telephone" name="telephone" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="employee_telephone_label">
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_gender_label' class="input-group-text">성별</span>
|
||||
<input id="account_gender" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_gender_label">
|
||||
<input id="account_gender" name="gender" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_gender_label">
|
||||
<span class="me-5"></span>
|
||||
<span id='employee_birth_label' class="input-group-text">생일</span>
|
||||
<input id="employee_birth" type="date" class="form-control" placeholder="" aria-label="Username" aria-describedby="employee_birth_label">
|
||||
<input id="employee_birth" name="birth" type="date" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="employee_birth_label">
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_address_label' class="input-group-text">주소</span>
|
||||
<input id="account_address" type="text" name="address" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_address_label">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<button class="btn btn-primary" id="btn_confirm">확인</button>
|
||||
<button class="btn btn-danger" id="btn_exit">뒤로</button>
|
||||
<button class="btn btn-primary" id="btn_confirm" onclick="createProcess()">확인</button>
|
||||
<button class="btn btn-danger" id="btn_exit" onclick="window.history.back()">뒤로</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
80
src/main/webapp/WEB-INF/views/account/read.jsp
Normal file
80
src/main/webapp/WEB-INF/views/account/read.jsp
Normal file
@@ -0,0 +1,80 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<!-- 이 안에 내용 복사해서 jsp에 붙여넣기 -->
|
||||
<script>
|
||||
/*
|
||||
yes no 모달의 확인 버튼을 누를때 재정의할 function
|
||||
|
||||
yesNoModal.yesFunction = myYesFunction;
|
||||
function myYesFunction(){
|
||||
alert("재정의 됨");
|
||||
}
|
||||
*/
|
||||
const tid = '${dto.id}';
|
||||
$(function(){
|
||||
|
||||
});
|
||||
function goList(){
|
||||
const $form =$("<form action='/account/list'></form>");
|
||||
$(".c_body").after($form);
|
||||
$form.submit();
|
||||
}
|
||||
|
||||
function goUpdate(){
|
||||
const $form =$("<form method='post' action='/account/update'><input hidden name='id' value='"+tid+"'></form>");
|
||||
$(".c_body").after($form);
|
||||
$form.submit();
|
||||
}
|
||||
</script>
|
||||
<div class="container-fluid c_body">
|
||||
<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="w-50">
|
||||
<span>이름 : ${dto.name}</span>
|
||||
|
||||
<span class="me-5"></span>
|
||||
<span>사번 : ${dto.employeeNumber}</span>
|
||||
</div>
|
||||
<div class="w-50 mt-3">
|
||||
<span>부서 : ${dto.departmentDto.name}</span>
|
||||
<span class="me-5"></span>
|
||||
<span>직책 : ${dto.positionDto.name}</span>
|
||||
</div>
|
||||
<div class="w-50 mt-3">
|
||||
<span>권한 : ${dto.personalAuthorityDto.name}</span>
|
||||
</div>
|
||||
<div class="w-50 mt-3">
|
||||
<span>이메일 : ${dto.email}</span>
|
||||
<span class="me-5"></span>
|
||||
<span>전화번호 : ${dto.telephone}</span>
|
||||
</div>
|
||||
<div class="w-50 mt-3">
|
||||
<span>성별 : ${dto.gender}</span>
|
||||
<span class="me-5"></span>
|
||||
<span>생일 : <fmt:formatDate value="${dto.birth}" pattern="yyyy-MM-dd" type="date"/></span>
|
||||
|
||||
</div>
|
||||
<div class="w-50 mt-3">
|
||||
<span>주소 : ${dto.address}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<button class="btn btn-primary" id="btn_edit" onclick="goUpdate()">수정</button>
|
||||
<button class="btn btn-danger" id="btn_exit" onclick="goList()">뒤로</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 이 안에 내용 복사해서 jsp에 붙여넣기 끝 -->
|
||||
136
src/main/webapp/WEB-INF/views/account/update.jsp
Normal file
136
src/main/webapp/WEB-INF/views/account/update.jsp
Normal file
@@ -0,0 +1,136 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<!-- 이 안에 내용 복사해서 jsp에 붙여넣기 -->
|
||||
<script>
|
||||
/*
|
||||
yes no 모달의 확인 버튼을 누를때 재정의할 function
|
||||
|
||||
yesNoModal.yesFunction = myYesFunction;
|
||||
function myYesFunction(){
|
||||
alert("재정의 됨");
|
||||
}
|
||||
*/
|
||||
const tid = '${dto.id}';
|
||||
function showSearchModal(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/account/show_modal', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateProcess(){
|
||||
let data = {};
|
||||
data.id = tid;
|
||||
data.activation = $("input[name='activation']:checked").val();
|
||||
const $dataInputList = $("input.create_data");
|
||||
$dataInputList.each(function(index, element){
|
||||
const $element = $(element);
|
||||
const name = $element.attr("name");
|
||||
const val = $element.val();
|
||||
data[name] = val;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/account/update_process', // 요청할 서버url
|
||||
dataType : 'json', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
alert("성공");
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
</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="input-group w-50">
|
||||
<span class="input-group-text">활성화</span>
|
||||
<div class="form-check form-check-inline">
|
||||
<input <c:if test="${dto.activation == true}">checked </c:if> class="form-check-input" type="radio" name="activation" id="inlineRadio1" value="true">
|
||||
<label class="form-check-label" for="inlineRadio1">활성</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input <c:if test="${dto.activation == false}">checked </c:if> class="form-check-input" type="radio" name="activation" id="inlineRadio2" value="false">
|
||||
<label class="form-check-label" for="inlineRadio2">비활성</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_name_label' class="input-group-text">이름</span>
|
||||
<input value = "${dto.name}" name="name" id="account_name" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_name_label">
|
||||
<span class="me-5"></span>
|
||||
<span id='employee_number_label' class="input-group-text">사번</span>
|
||||
<input value = "${dto.employeeNumber}" id=employee_number" name="employeeNumber" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="employee_number_label">
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_dept_label' class="input-group-text">부서</span>
|
||||
<input value = "${dto.departmentDto.name}" readonly id="account_dept_name" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_dept_label">
|
||||
<input value = "${dto.departmentId}" hidden name="departmentId" readonly id="departmentId" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_dept_label">
|
||||
<button id="btn_dept" type="button" class="btn btn-primary" onclick="showSearchModal('부서 검색','dept')">검색</button>
|
||||
<span class="me-5"></span>
|
||||
<span id='employee_pos_label' class="input-group-text">직책</span>
|
||||
<input value = "${dto.positionDto.name}" readonly id="account_pos_name" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="employee_number_pos">
|
||||
<input value = "${dto.positionId}" hidden name="positionId" readonly id="positionId" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="employee_number_pos">
|
||||
<button id="btn_pos" type="button" class="btn btn-primary" onclick="showSearchModal('직책 검색','pos')">검색</button>
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_group_label' class="input-group-text">권한</span>
|
||||
<input value = "${dto.personalAuthorityDto.name}" readonly id="account_auth_group_name" type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="account_group_label">
|
||||
<input value = "${dto.personalAuthorityId}" hidden name="personalAuthorityId" readonly id="personalAuthorityId" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_group_label">
|
||||
<button id="account_search_button" class="btn-primary btn" onclick="showSearchModal('권한 검색','auth')">검색</button>
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_email_label' class="input-group-text">이메일</span>
|
||||
<input value = "${dto.email} "id="account_email" name="email" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_email_label">
|
||||
<span class="me-5"></span>
|
||||
<span id='employee_telephone_label' class="input-group-text">전화번호</span>
|
||||
<input value = "${dto.telephone}" id=employee_telephone" name="telephone" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="employee_telephone_label">
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_gender_label' class="input-group-text">성별</span>
|
||||
<input value = "${dto.gender}" id="account_gender" name="gender" type="text" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_gender_label">
|
||||
<span class="me-5"></span>
|
||||
<span id='employee_birth_label' class="input-group-text">생일</span>
|
||||
<input value = "${dto.birth}" id="employee_birth" name="birth" type="date" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="employee_birth_label">
|
||||
</div>
|
||||
<div class="input-group w-50 mt-3">
|
||||
<span id='account_address_label' class="input-group-text">주소</span>
|
||||
<input value = "${dto.address}" id="account_address" type="text" name="address" class="create_data form-control" placeholder="" aria-label="Username" aria-describedby="account_address_label">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<button class="btn btn-primary" id="btn_confirm" onclick="updateProcess()">확인</button>
|
||||
<button class="btn btn-danger" id="btn_exit" onclick="window.history.back()">뒤로</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 이 안에 내용 복사해서 jsp에 붙여넣기 끝 -->
|
||||
@@ -1,7 +1,8 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<script>
|
||||
function onSearchAuth(){
|
||||
function onSearch(){
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
@@ -25,7 +26,7 @@
|
||||
<option value="30">30</option>
|
||||
</select>
|
||||
<input id="search_auth_input" type="text" class="w-30 d-inline form-control" placeholder="검색">
|
||||
<button id="search_auth_btn" type="button" class="btn btn-primary" onclick="onSearchAuth()">검색</button>
|
||||
<button id="search_auth_btn" type="button" class="btn btn-primary" onclick="onSearch()">검색</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
@@ -34,14 +35,12 @@
|
||||
<tr><th>권한명</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto" varStatus="status">
|
||||
<tr>
|
||||
<td>관리자</td>
|
||||
<td><button data-tid="1234" data-tname="관리자" class="btn btn-primary" onclick="onSelectAuth(this)">선택</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>사원</td>
|
||||
<td><button data-tid="5678"data-tname="사원" class="btn btn-primary" onclick="onSelectAuth(this)">선택</button></td>
|
||||
<td>${dto.name}</td>
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelectAuth(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
48
src/main/webapp/WEB-INF/views/modal/dept.jsp
Normal file
48
src/main/webapp/WEB-INF/views/modal/dept.jsp
Normal file
@@ -0,0 +1,48 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<script>
|
||||
function onSearch(){
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
function onSelectDept(tag){
|
||||
const $tag = $(tag);
|
||||
const tid = $tag.data('tid');
|
||||
const name = $tag.data('tname');
|
||||
|
||||
$("#account_dept_name").val(name);
|
||||
$("#departmentId").val(tid);
|
||||
hideSearchModal();
|
||||
}
|
||||
</script>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="div_auth_search" class="text-end">
|
||||
<select name="search_select" class="form-select d-inline w-10">
|
||||
<option selected value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
</select>
|
||||
<input id="search_auth_input" type="text" class="w-30 d-inline form-control" placeholder="검색">
|
||||
<button id="search_auth_btn" type="button" class="btn btn-primary" onclick="onSearch()">검색</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr><th>부서 명</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto" varStatus="status">
|
||||
<tr>
|
||||
<td>${dto.name}</td>
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelectDept(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
47
src/main/webapp/WEB-INF/views/modal/pos.jsp
Normal file
47
src/main/webapp/WEB-INF/views/modal/pos.jsp
Normal file
@@ -0,0 +1,47 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<script>
|
||||
function onSearchAuth(){
|
||||
//
|
||||
}
|
||||
|
||||
function onSelectPos(tag){
|
||||
const $tag = $(tag);
|
||||
const tid = $tag.data('tid');
|
||||
const name = $tag.data('tname');
|
||||
|
||||
$("#account_pos_name").val(name);
|
||||
$("#positionId").val(tid);
|
||||
hideSearchModal();
|
||||
}
|
||||
</script>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="div_auth_search" class="text-end">
|
||||
<select name="search_select" class="form-select d-inline w-10">
|
||||
<option selected value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
</select>
|
||||
<input id="search_auth_input" type="text" class="w-30 d-inline form-control" placeholder="검색">
|
||||
<button id="search_auth_btn" type="button" class="btn btn-primary" onclick="onSearchAuth()">검색</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr><th>권한명</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto" varStatus="status">
|
||||
<tr>
|
||||
<td>${dto.name}</td>
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelectPos(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,8 +4,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
kkkkk 성공
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user