Commit af9f4516 authored by phùng văn dung's avatar phùng văn dung

ahihi đồ ngốc

parent db2f63d3
......@@ -25,18 +25,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<<<<<<< HEAD
=======
>>>>>>> ce3006b6a5fafbd06aecf7141c3e8b97909de200
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
<<<<<<< HEAD
=======
>>>>>>> ce3006b6a5fafbd06aecf7141c3e8b97909de200
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
......@@ -59,35 +47,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<<<<<<< HEAD
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>io.jsonwebtoken</groupId>-->
<!-- <artifactId>jjwt</artifactId>-->
<!-- <version>0.9.1</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
=======
<!-- <dependency>-->
<!-- <groupId>org.springframework.security</groupId>-->
<!-- <artifactId>spring-security-test</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
>>>>>>> ce3006b6a5fafbd06aecf7141c3e8b97909de200
</dependencies>
......
......@@ -13,6 +13,8 @@ public interface ProjectBussiness {
String saveProject(ProjectDTO dto);
// tìm kiếm dự án theo id
ProjectDTO findByProjectId(Integer id);
// xóa dự án
// xóa list dự án theo arr ids
String deleteProject(Integer[] ids);
// xóa một project
String deleteProjectById(Integer ids);
}
......@@ -82,6 +82,7 @@ public class ProjectBussinessImpl implements ProjectBussiness {
return null;
}
@Override
public String deleteProject(Integer[] ids) {
int count = 0;
......@@ -94,6 +95,19 @@ public class ProjectBussinessImpl implements ProjectBussiness {
return views;
}
@Override
public String deleteProjectById(Integer id) {
logger.info("deleteProjectById");
int count = 0;
count = projectRepository.deleteEntityByID(id);
if (count != 0) {
views = "xóa thành công " + count + " project";
} else {
views = "project không tồn tại";
}
return views;
}
public List<ProjectDTO> lstDTO(List<Project> lstModels) {
List<ProjectDTO> lstDTO = new ArrayList<>();
for (Project project : lstModels) {
......
......@@ -35,9 +35,24 @@ public class ProjectController {
String views = projectBussiness.updateProject(projectDTO);
return ResponseEntity.ok(views);
}
@DeleteMapping(value = "/xoa-du-an",consumes = SystemConstants.TYPE_JSON)
@DeleteMapping(value = "/xoa-danh-sach-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity deleteProject(@RequestBody ProjectDTO projectDTO){
String views = projectBussiness.deleteProject(projectDTO.getIds());
String views ="";
if(projectDTO.getIds()!=null){
views = projectBussiness.deleteProject(projectDTO.getIds());
}else{
views="không tồn tại";
}
return ResponseEntity.ok(views);
}
@DeleteMapping(value = "/xoa-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity deleteProjectById(@RequestBody ProjectDTO projectDTO){
String views ="";
if(projectDTO.getId()!=null){
views = projectBussiness.deleteProjectById(projectDTO.getId());
}else{
views="không tồn tại";
}
return ResponseEntity.ok(views);
}
}
......@@ -10,7 +10,7 @@ import java.sql.Timestamp;
@AllArgsConstructor
@NoArgsConstructor
public class ProjectDTO {
private int id;
private Integer id;
// tên project
private String name;
//mô tả ngắn
......
......@@ -21,7 +21,7 @@ public class Project {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private int id;
private Integer id;
// tên project
......
......@@ -90,7 +90,7 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
}
public Integer deleteEntity(ID[] ids) {
log.info("delete by id ");
log.info("delete by ids ");
Integer count = 0;
try {
entityManager = entityManagerFactory.createEntityManager();
......@@ -114,6 +114,30 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
return count;
}
@Override
public Integer deleteEntityByID(Integer id) {
log.info("delete by id ");
Integer count = 0;
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
T entity = entityManager.find(persistenceClass, id);
if (entity != null) {
entityManager.remove(entity);
count++;
}
entityManager.getTransaction().commit();
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return count;
}
@Override
public T findByEmtityId(ID id) {
log.info("find by id");
......
......@@ -8,6 +8,7 @@ public interface GennericeEntityManagerDao<ID extends Serializable,T> {
void saveEntity(T entity);
T updateEntity(T entity);
Integer deleteEntity(ID[] ids);
Integer deleteEntityByID(Integer id);
T findByEmtityId(ID id);
List<T> finByProperty(String property, Object value, String sortExperssion, String sortDirection);
}
#server.port=8081
server.port=8081
# ===============================
# DATABASE CONNECTION
# ===============================
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/qtvp_01
spring.datasource.username=root
<<<<<<< HEAD
spring.datasource.password=12345678
=======
spring.datasource.password=vanloc
>>>>>>> ce3006b6a5fafbd06aecf7141c3e8b97909de200
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
......@@ -18,8 +14,6 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialec
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=
spring.mail.password=
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.auth=true
......
<!-- Sticky Footer -->
<footer class="sticky-footer">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>PS: Phung Van Dung</span>
</div>
</div>
</footer>
\ No newline at end of file
<nav class="navbar navbar-expand navbar-dark bg-dark static-top">
<a class="navbar-brand mr-1" href="index.html">Trang Quản Trị</a>
<!-- Navbar Search -->
<form class="d-none d-md-inline-block form-inline ml-auto mr-0 mr-md-3 my-2 my-md-0">
</form>
<!-- Navbar -->
<ul class="navbar-nav ml-auto ml-md-0">
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user-circle fa-fw"></i>Admin
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">
<a class="dropdown-item" href="#">Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">Logout</a>
</div>
</li>
</ul>
</nav>
\ No newline at end of file
<div id="wrapper">
<!-- Sidebar -->
<ul class="sidebar navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-fw fa-folder"></i>
<span>Quản Trị Văn Phòng</span>
</a>
<div class="dropdown-menu" aria-labelledby="pagesDropdown">
<h6 class="dropdown-header">Quản Trị</h6>
<a class="dropdown-item" data-ng-href="/project/danh-sach-tat-ca-du-an.html">Dự Án</a>
<a class="dropdown-item" href="#">Nhân Viên</a>
<a class="dropdown-item" href="#">Báo Cáo</a>
<a class="dropdown-item" href="#">Tin Tức</a>
<div class="dropdown-divider">aaa</div>
<h6 class="dropdown-header">Báo Cáo</h6>
<a class="dropdown-item" href="#">Xin Phép</a>
<a class="dropdown-item" href="#">Time Sheet</a>
<a class="dropdown-item" href="#">Quản lý Issuses</a>
</div>
</li>
</ul>
</div>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Quản Trị Văn Phòng</title>
<!-- angular -->
<script src="angularjs/angular.js"></script>
<!-- Custom fonts for this template-->
<link href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
rel="stylesheet" type="text/css">
<link href="admin/css/all.min.css" rel="stylesheet"
type="text/css">
<!-- Page level plugin CSS-->
<link href="admin/css/dataTables.bootstrap4.css"
rel="stylesheet">
<!-- Custom styles for this template-->
<link href="admin/css/sb-admin.css" rel="stylesheet">
</head>
<body ng-app="">
<!-- header -->
<div ng-include=" 'common/admin/header.html' "></div>
<!--end header -->
<div id="wrapper">
<!-- menu -->
<div ng-include=" 'common/admin/menu.html' "></div>
<!-- end menu -->
<div class="container-fluid">
<!-- Content -->
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body" ng-app="ProjectApiModule">
<div class="table-responsive" ng-controller="showProject">
<a href="#" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Mô tả ngắn</th>
<th>Ngày bắt đầu</th>
<th>Hạn giao</th>
<th>Trạng Thái</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="project in listProject">
<td>{{ project.name }}</td>
<td>{{ project.descriptions }}</td>
<td>{{ project.startDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.endDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.statusGet }}</td>
<td><a data-ng-href="#" class="btn btn-info btn-circle btn-sm">
Xem </a> <a data-ng-href="#" class="btn btn-warning btn-circle btn-sm">
Sửa </a> <a data-ng-href="#" class="btn btn-danger btn-circle btn-sm">Xóa</a>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!--End Content -->
</div>
<!-- footer -->
<div ng-include=" 'common/admin/footer.html' "></div>
</div>
<!--end footer -->
<!-- Js -->
<!-- Bootstrap core JavaScript-->
<script src="admin/js/jquery.min.js"></script>
<script src="admin/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="admin/js/jquery.easing.min.js"></script>
<!-- Page level plugin JavaScript-->
<script src="admin/js/Chart.min.js"></script>
<script src="admin/js/jquery.dataTables.js"></script>
<script src="admin/js/dataTables.bootstrap4.js"></script>
<!-- Custom scripts for all pages-->
<script src="admin/js/sb-admin.min.js"></script>
<!--angular js-->
<script src="components/project/projectController.js"></script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Nhóm Dự Án</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<div class="card-header">
<i class="fas fa-table"></i> Thêm mới dự án
</div>
<div class="card-body" ng-app="insertProjectModule">
<form ng-controller="insertProject">
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.name" id="name" class="form-control"
placeholder="Tên Dự Án"
required="required" autofocus="autofocus">
<label for="name">Tên Dự Án</label>
<span>{{lstProject.name}}</span>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.descriptions" id="descriptions"
class="form-control"
placeholder="Mô tả ngắn"
required="required">
<label for="descriptions">Mô tả ngắn</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.startDate" id="startDate" class="form-control"
placeholder="Ngày Bắt Đầu" required="required">
<label for="startDate">Ngày Bắt Đầu</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.endDate" id="endDate" class="form-control"
placeholder="nick skype" required="required">
<label for="endDate">Ngày Kết Thuc</label>
</div>
</div>
</div>
</div>
<div>
<input ng-click="insert_project()" type="submit" value="Lưu">
<input type="reset" value="Reset">
</div>
</form>
</div>
<script src="components/project/projectAddController.js"></script>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body" ng-app="GetAPI">
<div class="table-responsive" ng-controller="showProject">
<a href="#" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Mô tả ngắn</th>
<th>Ngày bắt đầu</th>
<th>Hạn giao</th>
<th>Trạng Thái</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="project in listProject">
<td>{{ project.name }}</td>
<td>{{ project.descriptions }}</td>
<td>{{ project.startDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.endDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.statusGet }}</td>
<td><a data-ng-href="#" class="btn btn-info btn-circle btn-sm">
Xem </a> <a data-ng-href="#" class="btn btn-warning btn-circle btn-sm">
Sửa </a> <a data-ng-href="#" class="btn btn-danger btn-circle btn-sm">Xóa</a>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!--angular js-->
<script src="components/project/projectController.js"></script>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/*!
DataTables Bootstrap 4 integration
©2011-2017 SpryMedia Ltd - datatables.net/license
*/
(function(b){"function"===typeof define&&define.amd?define(["static/admin/js/jquery","datatables.net"],function(a){return b(a,window,document)}):"object"===typeof exports?module.exports=function(a, d){a||(a=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(a,d).$;return b(d,a,a.document)}:b(jQuery,window,document)})(function(b, a, d, m){var f=b.fn.dataTable;b.extend(!0,f.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
renderer:"bootstrap"});b.extend(f.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"});f.ext.renderer.pageButton.bootstrap=function(a,h,r,s,j,n){var o=new f.Api(a),t=a.oClasses,k=a.oLanguage.oPaginate,u=a.oLanguage.oAria.paginate||{},e,g,p=0,q=function(d,f){var l,h,i,c,m=function(a){a.preventDefault();
!b(a.currentTarget).hasClass("disabled")&&o.page()!=a.data.action&&o.page(a.data.action).draw("page")};l=0;for(h=f.length;l<h;l++)if(c=f[l],b.isArray(c))q(d,c);else{g=e="";switch(c){case "ellipsis":e="&#x2026;";g="disabled";break;case "first":e=k.sFirst;g=c+(0<j?"":" disabled");break;case "previous":e=k.sPrevious;g=c+(0<j?"":" disabled");break;case "next":e=k.sNext;g=c+(j<n-1?"":" disabled");break;case "last":e=k.sLast;g=c+(j<n-1?"":" disabled");break;default:e=c+1,g=j===c?"active":""}e&&(i=b("<li>",
{"class":t.sPageButton+" "+g,id:0===r&&"string"===typeof c?a.sTableId+"_"+c:null}).append(b("<a>",{href:"#","aria-controls":a.sTableId,"aria-label":u[c],"data-dt-idx":p,tabindex:a.iTabIndex,"class":"page-link"}).html(e)).appendTo(d),a.oApi._fnBindAction(i,{action:c},m),p++)}},i;try{i=b(h).find(d.activeElement).data("dt-idx")}catch(v){}q(b(h).empty().html('<ul class="pagination"/>').children("ul"),s);i!==m&&b(h).find("[data-dt-idx="+i+"]").focus()};return f});
This diff is collapsed.
(function(factory){if(typeof define==="function"&&define.amd){define(["static/admin/js/jquery"],function($){return factory($)})}else if(typeof module==="object"&&typeof module.exports==="object"){exports=factory(require("static/admin/js/jquery"))}else{factory(jQuery)}})(function($){$.easing.jswing=$.easing.swing;var pow=Math.pow,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,PI=Math.PI,c1=1.70158,c2=c1*1.525,c3=c1+1,c4=2*PI/3,c5=2*PI/4.5;function bounceOut(x){var n1=7.5625,d1=2.75;if(x<1/d1){return n1*x*x}else if(x<2/d1){return n1*(x-=1.5/d1)*x+.75}else if(x<2.5/d1){return n1*(x-=2.25/d1)*x+.9375}else{return n1*(x-=2.625/d1)*x+.984375}}$.extend($.easing,{def:"easeOutQuad",swing:function(x){return $.easing[$.easing.def](x)},easeInQuad:function(x){return x*x},easeOutQuad:function(x){return 1-(1-x)*(1-x)},easeInOutQuad:function(x){return x<.5?2*x*x:1-pow(-2*x+2,2)/2},easeInCubic:function(x){return x*x*x},easeOutCubic:function(x){return 1-pow(1-x,3)},easeInOutCubic:function(x){return x<.5?4*x*x*x:1-pow(-2*x+2,3)/2},easeInQuart:function(x){return x*x*x*x},easeOutQuart:function(x){return 1-pow(1-x,4)},easeInOutQuart:function(x){return x<.5?8*x*x*x*x:1-pow(-2*x+2,4)/2},easeInQuint:function(x){return x*x*x*x*x},easeOutQuint:function(x){return 1-pow(1-x,5)},easeInOutQuint:function(x){return x<.5?16*x*x*x*x*x:1-pow(-2*x+2,5)/2},easeInSine:function(x){return 1-cos(x*PI/2)},easeOutSine:function(x){return sin(x*PI/2)},easeInOutSine:function(x){return-(cos(PI*x)-1)/2},easeInExpo:function(x){return x===0?0:pow(2,10*x-10)},easeOutExpo:function(x){return x===1?1:1-pow(2,-10*x)},easeInOutExpo:function(x){return x===0?0:x===1?1:x<.5?pow(2,20*x-10)/2:(2-pow(2,-20*x+10))/2},easeInCirc:function(x){return 1-sqrt(1-pow(x,2))},easeOutCirc:function(x){return sqrt(1-pow(x-1,2))},easeInOutCirc:function(x){return x<.5?(1-sqrt(1-pow(2*x,2)))/2:(sqrt(1-pow(-2*x+2,2))+1)/2},easeInElastic:function(x){return x===0?0:x===1?1:-pow(2,10*x-10)*sin((x*10-10.75)*c4)},easeOutElastic:function(x){return x===0?0:x===1?1:pow(2,-10*x)*sin((x*10-.75)*c4)+1},easeInOutElastic:function(x){return x===0?0:x===1?1:x<.5?-(pow(2,20*x-10)*sin((20*x-11.125)*c5))/2:pow(2,-20*x+10)*sin((20*x-11.125)*c5)/2+1},easeInBack:function(x){return c3*x*x*x-c1*x*x},easeOutBack:function(x){return 1+c3*pow(x-1,3)+c1*pow(x-1,2)},easeInOutBack:function(x){return x<.5?pow(2*x,2)*((c2+1)*2*x-c2)/2:(pow(2*x-2,2)*((c2+1)*(x*2-2)+c2)+2)/2},easeInBounce:function(x){return 1-bounceOut(1-x)},easeOutBounce:bounceOut,easeInOutBounce:function(x){return x<.5?(1-bounceOut(1-2*x))/2:(1+bounceOut(2*x-1))/2}})});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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