Commit bce74232 by Suvalue

指标查询页面以及接口

parent 79c20ae4
package com.bsoft.api.controller;
import com.bsoft.api.service.DicIndService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -7,21 +9,21 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;
import java.util.List;
@RequestMapping("ind")
@Controller
public class IndController {
@Autowired
private DicIndService dicIndService;
@GetMapping
public ModelAndView index(Model model, String filter){
model.addAttribute("title", "指标搜索");
model.addAttribute("indList", null);
model.addAttribute("indList", dicIndService.selectAll(filter));
model.addAttribute("filter", filter==null?"":filter);
ModelAndView mav = new ModelAndView("ind", "indModel", model);
return mav;
}
......
package com.bsoft.api.mapper;
import com.bsoft.api.model.DicInd;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DicIndMapper {
......@@ -12,5 +14,7 @@ public interface DicIndMapper {
List<DicInd> selectAll();
List<DicInd> selectAllByFilter(@Param("filter") String filter);
int updateByPrimaryKey(DicInd record);
}
\ No newline at end of file
......@@ -15,6 +15,8 @@ public class DicInd {
private String indName;
private String indField;
private Short computeMode;
private String execSql;
......@@ -69,6 +71,14 @@ public class DicInd {
this.indName = indName;
}
public String getIndField() {
return indField;
}
public void setIndField(String indField) {
this.indField = indField;
}
public Short getComputeMode() {
return computeMode;
}
......
......@@ -2,5 +2,8 @@ package com.bsoft.api.service;
import com.bsoft.api.model.DicInd;
import java.util.List;
public interface DicIndService extends ServiceBase<DicInd>{
List<DicInd> selectAll(String filter);
}
......@@ -42,4 +42,11 @@ public class DicIndServiceImpl implements DicIndService {
public int update(DicInd dicInd) {
return dicIndMapper.updateByPrimaryKey(dicInd);
}
@Override
public List<DicInd> selectAll(String filter) {
List<DicInd> list = dicIndMapper.selectAllByFilter(filter);
return list;
}
}
......@@ -8,10 +8,12 @@
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="IND_CODE" jdbcType="VARCHAR" property="indCode" />
<result column="IND_NAME" jdbcType="VARCHAR" property="indName" />
<result column="IND_FIELD" jdbcType="VARCHAR" property="indField" />
<result column="COMPUTE_MODE" jdbcType="DECIMAL" property="computeMode" />
<result column="EXEC_SQL" jdbcType="VARCHAR" property="execSql" />
<result column="DESCRIBE" jdbcType="VARCHAR" property="describe" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from LL.DIC_IND
where ID = #{id,jdbcType=DECIMAL}
......@@ -50,4 +52,10 @@
DESCRIBE
from LL.DIC_IND
</select>
<select id="selectAllByFilter" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, IND_CODE, IND_NAME,IND_FIELD, COMPUTE_MODE, EXEC_SQL,
DESCRIBE
from LL.DIC_IND
where IND_NAME LIKE '%'||#{filter,jdbcType=VARCHAR}||'%'
</select>
</mapper>
\ No newline at end of file
......@@ -5,29 +5,81 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ind search</title>
</head>
<style type="text/css">
.table
{
border-collapse: collapse;
margin: 0 auto;
text-align: center;
}
.table td, table th
{
border: 1px solid #cad9ea;
color: #666;
height: 30px;
}
.table thead th
{
background-color: #CCE8EB;
width: 100px;
}
.table tr:nth-child(odd)
{
background: #fff;
}
.table tr:nth-child(even)
{
background: #F5FAFA;
}
.filterTxt
{
font-size: 15px;
letter-spacing:2px;
border-bottom:1px solid #dddddd;
padding:5px 0px 3px 0px;
margin:4px 0px 4px 0px;
text-align:center;height:24px;
}
.subBtn {
width: 50px;
height: 30px;
color: white;
background-color: cornflowerblue;
border-radius: 3px;
border-width: 0;
margin: 0;
outline: none;
font-family: KaiTi;
font-size: 15px;
text-align: center;
cursor: pointer;
}
</style>
<body>
<h1 th:text="${indModel.title}">指标查询</h1>
<form action="./ind/search" method="post">
<input type = "text" name="filter" th:value="${indModel.filter}"/>
<input type="submit" value="提交">
</form>
<div>
<table border="1">
<div style="text-align: center">
<h1 th:text="${indModel.title}">指标查询</h1>
<form action="http://localhost:8080/ind" method="get">
<input type = "text" name="filter" class="filterTxt" th:value="${indModel.filter}"/>
<input type="submit" class="subBtn" value="提交">
</form>
</div>
<div style="margin-top: 20px">
<table width="60%" class="table">
<thead>
<tr>
<td>编码</td>
<td>名称</td>
<td>字段名</td>
<th style="">编码</th>
<th>名称</th>
<th>字段名</th>
</tr>
</thead>
<tbody>
<tr th:if="${indModel.indList.size()} eq 0">
<td colspan="2">无数据</td>
<td colspan="3">无数据</td>
</tr>
<tr th:each="ind : ${indModel.indList}">
<td th:text="${ind.indCode}"></td>
<td th:text="${ind.indName}"></td>
<td th:text="${ind.computeMode}"></td>
<td th:text="${ind.indField}"></td>
</tr>
</tbody>
</table>
......
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