Commit bce74232 by Suvalue

指标查询页面以及接口

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