科目信息
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
package com.cwhelp.admin.business.controller;
|
||||
|
||||
import com.cwhelp.admin.business.validator.BssClassItemValid;
|
||||
import com.cwhelp.common.enums.AccountStandardEnum;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.EntityBeanUtil;
|
||||
import com.cwhelp.common.utils.ResultVoUtil;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import com.cwhelp.common.vo.ResultVo;
|
||||
import com.cwhelp.modules.business.domain.BssClassItem;
|
||||
import com.cwhelp.modules.business.service.BssClassItemService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author huang.jc
|
||||
* @date 2019/12/11
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/bss/classItem")
|
||||
public class BssClassItemController {
|
||||
|
||||
@Autowired
|
||||
private BssClassItemService bssClassItemService;
|
||||
|
||||
/**
|
||||
* 列表页面
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
@RequiresPermissions("bss:classItem:index")
|
||||
public String index(Model model, BssClassItem classItem) {
|
||||
|
||||
// 创建匹配器,进行动态查询匹配
|
||||
ExampleMatcher matcher = ExampleMatcher.matching()
|
||||
.withMatcher("itemName", match -> match.contains());
|
||||
|
||||
// 获取数据列表
|
||||
Example<BssClassItem> example = Example.of(classItem, matcher);
|
||||
Page<BssClassItem> list = bssClassItemService.getPageList(example);
|
||||
List<BssClassItem> items = list.getContent();
|
||||
items.stream().forEach(bssClassItem -> {
|
||||
bssClassItem.setItemTypeName(AccountStandardEnum.getNameById(bssClassItem.getItemType()));
|
||||
});
|
||||
|
||||
// 封装数据
|
||||
model.addAttribute("list", items);
|
||||
model.addAttribute("page", list);
|
||||
return "/business/classItem/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到添加页面
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
@RequiresPermissions("bss:classItem:add")
|
||||
public String toAdd() {
|
||||
return "/business/classItem/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到编辑页面
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
@RequiresPermissions("bss:classItem:edit")
|
||||
public String toEdit(@PathVariable("id") BssClassItem classItem, Model model) {
|
||||
model.addAttribute("classItem", classItem);
|
||||
return "/business/classItem/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存添加/修改的数据
|
||||
* @param valid 验证对象
|
||||
*/
|
||||
@PostMapping({"/add","/edit"})
|
||||
@RequiresPermissions({"bss:classItem:add","bss:classItem:edit"})
|
||||
@ResponseBody
|
||||
public ResultVo save(@Validated BssClassItemValid valid, BssClassItem classItem) {
|
||||
|
||||
|
||||
|
||||
// 复制保留无需修改的数据
|
||||
if (classItem.getId() != null) {
|
||||
BssClassItem beClassItem = bssClassItemService.getById(classItem.getId());
|
||||
EntityBeanUtil.copyProperties(beClassItem, classItem);
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
bssClassItemService.save(classItem);
|
||||
return ResultVoUtil.SAVE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到详细页面
|
||||
*/
|
||||
@GetMapping("/detail/{id}")
|
||||
@RequiresPermissions("bss:classItem:detail")
|
||||
public String toDetail(@PathVariable("id") BssClassItem classItem, Model model) {
|
||||
model.addAttribute("classItem",classItem);
|
||||
return "/business/classItem/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置一条或者多条数据的状态
|
||||
*/
|
||||
@RequestMapping("/status/{param}")
|
||||
@RequiresPermissions("bss:classItem:status")
|
||||
@ResponseBody
|
||||
public ResultVo status(
|
||||
@PathVariable("param") String param,
|
||||
@RequestParam(value = "ids", required = false) List<Long> ids) {
|
||||
// 更新状态
|
||||
StatusEnum statusEnum = StatusUtil.getStatusEnum(param);
|
||||
if (bssClassItemService.updateStatus(statusEnum, ids)) {
|
||||
return ResultVoUtil.success(statusEnum.getMessage() + "成功");
|
||||
} else {
|
||||
return ResultVoUtil.error(statusEnum.getMessage() + "失败,请重新操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cwhelp.admin.business.controller;
|
||||
package com.cwhelp.admin.business.controller.api;
|
||||
|
||||
import com.cwhelp.common.api.baidu.BaiduAipOCR;
|
||||
import com.cwhelp.common.api.baidu.entity.vatinvoice.*;
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.cwhelp.admin.business.validator;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author huang.jc
|
||||
* @date 2019/12/11
|
||||
*/
|
||||
@Data
|
||||
public class BssClassItemValid implements Serializable {
|
||||
@NotEmpty(message = "科目名称不能为空")
|
||||
private String itemName;
|
||||
|
||||
@NotNull(message = "科目类型不能为空")
|
||||
private Short itemType;
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.cwhelp.admin.business.controller;
|
||||
package com.cwhelp.admin.system.controller.api;
|
||||
|
||||
import com.cwhelp.common.constant.ApiConst;
|
||||
import com.cwhelp.common.utils.ResultVoUtil;
|
||||
@@ -22,7 +22,7 @@ import java.util.UUID;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class BssApiLoginController {
|
||||
public class ApiLoginController {
|
||||
|
||||
@Autowired
|
||||
private ApiUserService apiUserService;
|
||||
@@ -13,6 +13,8 @@ project:
|
||||
|
||||
### spring配置
|
||||
spring:
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
## 数据库配置
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-form timo-compile">
|
||||
<form th:action="@{/bss/classItem/add}">
|
||||
<input type="hidden" name="id" th:if="${classItem}" th:value="${classItem.id}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">科目名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="itemName" placeholder="请输入科目名称" th:value="${classItem?.itemName}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">科目类型</label>
|
||||
<div class="layui-input-inline">
|
||||
<select class="layui-select" name="itemType" mo:dict="ACCOUNTING_STANDARDS" mo-selected="${classItem?.itemType}" mo-empty="" lay-type="itemType"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea placeholder="请输入内容" class="layui-textarea" name="remark">[[${classItem?.remark}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item timo-finally">
|
||||
<button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
|
||||
<button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body>
|
||||
<div class="timo-detail-page">
|
||||
<div class="timo-detail-title">基本信息</div>
|
||||
<table class="layui-table timo-detail-table">
|
||||
<colgroup>
|
||||
<col width="100px"><col>
|
||||
<col width="100px"><col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>主键ID</th>
|
||||
<td th:text="${classItem.id}"></td>
|
||||
<th>科目名称</th>
|
||||
<td th:text="${classItem.itemName}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>科目类型</th>
|
||||
<td th:text="${classItem.itemType}"></td>
|
||||
<th>创建者</th>
|
||||
<td th:text="${classItem.createBy?.nickname}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>创建时间</th>
|
||||
<td th:text="${#dates.format(classItem.createDate, 'yyyy-MM-dd HH:mm:ss')}" colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>备注</th>
|
||||
<td th:text="${classItem.remark}" colspan="3"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
|
||||
</head>
|
||||
<body class="timo-layout-page">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header timo-card-header">
|
||||
<span><i class="fa fa-bars"></i> 科目信息管理</span>
|
||||
<i class="layui-icon layui-icon-refresh refresh-btn"></i>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-row timo-card-screen">
|
||||
<div class="pull-left layui-form-pane timo-search-box">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">状态</label>
|
||||
<div class="layui-input-block timo-search-status">
|
||||
<select class="timo-search-select" name="status" mo:dict="SEARCH_STATUS" mo-selected="${param.status}"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">科目名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="itemName" th:value="${param.itemName}" placeholder="请输入科目名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn timo-search-btn">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-right screen-btn-group">
|
||||
<button class="layui-btn open-popup" data-title="添加科目信息" th:attr="data-url=@{/bss/classItem/add}" data-size="auto">
|
||||
<i class="fa fa-plus"></i> 添加</button>
|
||||
<div class="btn-group">
|
||||
<button class="layui-btn">操作<span class="caret"></span></button>
|
||||
<dl class="layui-nav-child layui-anim layui-anim-upbit">
|
||||
<dd><a class="ajax-status" th:href="@{/bss/classItem/status/ok}">启用</a></dd>
|
||||
<dd><a class="ajax-status" th:href="@{/bss/classItem/status/freezed}">冻结</a></dd>
|
||||
<dd><a class="ajax-status" th:href="@{/bss/classItem/status/delete}">删除</a></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="timo-table-wrap">
|
||||
<table class="layui-table timo-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="timo-table-checkbox">
|
||||
<label class="timo-checkbox"><input type="checkbox">
|
||||
<i class="layui-icon layui-icon-ok"></i></label>
|
||||
</th>
|
||||
<th>主键ID</th>
|
||||
<th>科目名称</th>
|
||||
<th>科目类型</th>
|
||||
<th>数据状态</th>
|
||||
<th>创建时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="item:${list}">
|
||||
<td><label class="timo-checkbox"><input type="checkbox" th:value="${item.id}">
|
||||
<i class="layui-icon layui-icon-ok"></i></label></td>
|
||||
<td th:text="${item.id}">主键ID</td>
|
||||
<td th:text="${item.itemName}">科目名称</td>
|
||||
<td th:text="${item.itemTypeName}">科目类型</td>
|
||||
<td th:text="${#dicts.dataStatus(item.status)}">数据状态</td>
|
||||
<td th:text="${#dates.format(item.createDate, 'yyyy-MM-dd HH:mm:ss')}">创建时间</td>
|
||||
<td>
|
||||
<a class="open-popup" data-title="编辑科目信息" th:attr="data-url=@{'/bss/classItem/edit/'+${item.id}}" data-size="auto" href="#">编辑</a>
|
||||
<a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/bss/classItem/detail/'+${item.id}}" data-size="800,600" href="#">详细</a>
|
||||
<a class="ajax-get" data-msg="您是否确认删除" th:href="@{/bss/classItem/status/delete(ids=${item.id})}">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div th:replace="/common/fragment :: page"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script th:replace="/common/template :: script"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user