mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 12:13:24 +09:00
#update
ResetPasswordController.java ResetPasswordMapper.java ResetPasswordService.java ResetPasswordMapper.xml resetpassword/list.jsp
This commit is contained in:
@@ -17,15 +17,22 @@ public class ResetPasswordController {
|
||||
@Autowired
|
||||
ResetPasswordService resetPasswordService;
|
||||
|
||||
/*GetMapping("/list")
|
||||
@GetMapping("/list")
|
||||
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, String resetpassword, String cancelrequest, Model m) {
|
||||
int count = resetPasswordService.count(searchn, search);
|
||||
|
||||
int perPage = 10; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
if(resetpassword != null){
|
||||
|
||||
}
|
||||
if(cancelrequest != null){
|
||||
|
||||
}
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<Map<String, Object>> dto = resetPasswordService.list(searchn, search, startRow ,perPage);
|
||||
m.addAttribute("rlist", dto);
|
||||
@@ -51,8 +58,8 @@ public class ResetPasswordController {
|
||||
System.out.println("테스트 : : " + m);
|
||||
|
||||
|
||||
return "out/list";
|
||||
}*/
|
||||
return "resetpassword/list";
|
||||
}
|
||||
|
||||
@PostMapping("/insert")
|
||||
@ResponseBody
|
||||
|
||||
@@ -3,13 +3,22 @@ package com.no1.wms.resetpassword;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface ResetPasswordMapper {
|
||||
|
||||
List<Map<String, Object>> list(Map<String, Object> m);
|
||||
|
||||
int count(Map<String, Object> m);
|
||||
|
||||
void insert(ResetPasswordDto dto);
|
||||
|
||||
void delete(ResetPasswordDto dto);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,39 @@ package com.no1.wms.resetpassword;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ResetPasswordService {
|
||||
|
||||
@Autowired
|
||||
ResetPasswordMapper mapper;
|
||||
|
||||
public int count(int searchn, String search) {
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> list(int searchn, String search, int start, int perPage){
|
||||
|
||||
System.out.println(searchn+search);
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
return mapper.list(m);
|
||||
|
||||
}
|
||||
|
||||
void insert(ResetPasswordDto dto){
|
||||
mapper.insert(dto);
|
||||
}
|
||||
|
||||
@@ -20,29 +20,36 @@
|
||||
(UUID(), (SELECT id from account where employee_number = #{employeeNumber} ), #{note}, NOW())
|
||||
</insert>
|
||||
|
||||
<select id="resetpasswordAll" resultMap="resetPasswordResultMap" parameterType="map">
|
||||
<select id="list" resultMap="resetPasswordResultMap" parameterType="map">
|
||||
SELECT
|
||||
id, account_id, note, date, acc.id, acc.name, acc.mail, acc.employee_number
|
||||
rs.id as id,
|
||||
rs.account_id as account_id,
|
||||
rs.note as note,
|
||||
rs.date as date,
|
||||
acc.id,
|
||||
acc.name as name,
|
||||
acc.email as email,
|
||||
acc.employee_number as employee_number
|
||||
|
||||
from reset_password rs join account acc on rs.account_id = acc.id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 1"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 0"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by date desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="count" resultMap="resetPasswordResultMap" parameterType="map">
|
||||
SELECT
|
||||
count(id)
|
||||
<select id="count" resultType="int" parameterType="map">
|
||||
SELECT count(rs.id)
|
||||
from reset_password rs join account acc on rs.account_id = acc.id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 1"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 0"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by date desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="resetPasswordResultMap" parameterType="map">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="w-25">
|
||||
<select class="form-select" name="searchn" id="searchn">
|
||||
<option value="0">사원명</option>
|
||||
<option value="1">아이디</option>
|
||||
<option value="1">사번</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
@@ -42,7 +42,7 @@
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>사원명</th>
|
||||
<th>아이디</th>
|
||||
<th>email</th>
|
||||
<th>요청사유</th>
|
||||
<th></th>
|
||||
|
||||
@@ -53,9 +53,12 @@
|
||||
<tr class="detailTr col-5" data-id="${dto.id}" >
|
||||
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||
<td class="col-1">${dto.name }</td>
|
||||
<td class="col-1">${dto.president_telephone }</td>
|
||||
<td class="col-1">${dto.vendor_manager }</td>
|
||||
<td class="col-1">${dto.vendor_manager_telephone }</td>
|
||||
<td class="col-1">${dto.email }</td>
|
||||
<td class="col-1">${dto.note }</td>
|
||||
<td class="col-1">
|
||||
<button type="button" class="btn btn-primary" value="${dto.id}" id="resetpassword">확인</button>
|
||||
<button type="button" class="btn btn-warning" value="${dto.id}" id="cancelrequest">취소</button>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
@@ -65,36 +68,32 @@
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row row-buttons">
|
||||
<div class="col-3 text-start">
|
||||
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
|
||||
<button type="button" class="btn btn-success" id="uploadExcel">업로드</button>
|
||||
<button type="button" class="btn btn-success" id="download">다운로드</button>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" id="before"
|
||||
value="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " id="pageNow"
|
||||
value="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" id="after" value="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="col-3 text-end">
|
||||
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
||||
</div>
|
||||
|
||||
</div><!-- row row-buttons -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -104,31 +103,74 @@
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
//POST방식으로 create폼화면 출력
|
||||
$("#createButton").on("click",function(){
|
||||
$("#resetpassword").on("click",function(){
|
||||
var resetpassword = $("#resetpassword").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/create";
|
||||
form.method = "POST";
|
||||
form.action = "/resetpassword/list";
|
||||
form.method = "get";
|
||||
|
||||
var input1 = document.createElement("input");
|
||||
input1.type = "hidden";
|
||||
input1.name = "searchn";
|
||||
input1.value = searchn;
|
||||
form.appendChild(input1);
|
||||
|
||||
var input2 = document.createElement("input");
|
||||
input2.type = "hidden";
|
||||
input2.name = "search";
|
||||
input2.value = search;
|
||||
form.appendChild(input2);
|
||||
|
||||
var input3 = document.createElement("input");
|
||||
input3.type = "hidden";
|
||||
input3.name = "p";
|
||||
input3.value = pageNow;
|
||||
form.appendChild(input3);
|
||||
|
||||
var input4 = document.createElement("input");
|
||||
input4.type = "hidden";
|
||||
input4.name = "resetpassword";
|
||||
input4.value = resetpassword;
|
||||
form.appendChild(input4);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
});
|
||||
|
||||
$("body").on("click", ".detailTr", function(){
|
||||
var id = $(this).data("id");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
$("#cancelrequest").on("click",function(){
|
||||
var cancelrequest = $("#cancelrequest").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/resetpassword/list";
|
||||
form.method = "get";
|
||||
|
||||
var input1 = document.createElement("input");
|
||||
input1.type = "hidden";
|
||||
input1.name = "searchn";
|
||||
input1.value = searchn;
|
||||
form.appendChild(input1);
|
||||
|
||||
var input2 = document.createElement("input");
|
||||
input2.type = "hidden";
|
||||
input2.name = "search";
|
||||
input2.value = search;
|
||||
form.appendChild(input2);
|
||||
|
||||
var input3 = document.createElement("input");
|
||||
input3.type = "hidden";
|
||||
input3.name = "p";
|
||||
input3.value = 1;
|
||||
form.appendChild(input3);
|
||||
|
||||
var input4 = document.createElement("input");
|
||||
input4.type = "hidden";
|
||||
input4.name = "cancelrequest";
|
||||
input4.value = cancelrequest;
|
||||
form.appendChild(input4);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
});
|
||||
|
||||
//검색기능
|
||||
@@ -138,7 +180,7 @@
|
||||
var search = $("#search").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/list";
|
||||
form.action = "/resetpassword/list";
|
||||
form.method = "get";
|
||||
|
||||
var input1 = document.createElement("input");
|
||||
@@ -167,35 +209,36 @@
|
||||
|
||||
|
||||
});//ready
|
||||
function pageingFunction(clickedId){
|
||||
var searchn1 = $("#searchn1").val();
|
||||
var search1 = $("#search1").val();
|
||||
|
||||
$("#before, #pageNow, #after").on("click", function () {
|
||||
var searchn = $("#searchn1").val();
|
||||
var search = $("#search1").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/list";
|
||||
form.action = "/resetpassword/list";
|
||||
form.method = "get";
|
||||
|
||||
|
||||
var input1 = document.createElement("input");
|
||||
input1.type = "hidden";
|
||||
input1.name = "searchn";
|
||||
input1.value = searchn1;
|
||||
input1.value = searchn;
|
||||
form.appendChild(input1);
|
||||
|
||||
|
||||
var input2 = document.createElement("input");
|
||||
input2.type = "hidden";
|
||||
input2.name = "search";
|
||||
input2.value = search1;
|
||||
input2.value = search;
|
||||
form.appendChild(input2);
|
||||
|
||||
|
||||
var input3 = document.createElement("input");
|
||||
input3.type = "hidden";
|
||||
input3.name = "p";
|
||||
input3.name = "p1";
|
||||
input3.value = clickedId;
|
||||
form.appendChild(input3);
|
||||
|
||||
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user