Merge branch 'develop_3' into 'develop_master'

Develop 3 feat: 自定义分页总数 和 区域管理接口

See merge request !4
This commit is contained in:
super_liu
2021-06-16 07:06:26 +00:00
6 changed files with 249 additions and 0 deletions
@@ -68,6 +68,8 @@ public class SarStandAttrDetailsServiceImpl extends ServiceImpl<SarStandAttrDeta
@Override
public List<SarStandAttrDetails> queryByPage(SarStandAttrDetailsEOPage page){
Integer pageCount = dao.queryByCount(page);
page.getPager().setRowCount(pageCount);
return dao.queryByPage(page);
}
@@ -43,4 +43,59 @@ public class UtAreaController extends BaseController<UtArea> {
return Result.success(utAreaEOService.getAreaSelList(utAreaEO));
}
@ApiOperation(value = "|UtAreaEO|分页查询")
@GetMapping("/page")
// @RequiresPermissions("lawssBase:utArea:page")
public ResponseMessage<PageInfo<UtArea>> page(UtAreaEOPage page) throws Exception {
List<UtArea> rows = utAreaEOService.queryByPage(page);
return Result.success(getPageInfo(page.getPager(), rows));
}
@ApiOperation(value = "|UtAreaEO|查询")
@GetMapping("/list")
// @RequiresPermissions("lawssBase:utArea:list")
public ResponseMessage<List<UtArea>> list(UtAreaEOPage page) throws Exception {
return Result.success(utAreaEOService.queryByList(page));
}
@ApiOperation(value = "|UtAreaEO|详情")
@GetMapping("/getById")
// @RequiresPermissions("lawssBase:utArea:get")
public ResponseMessage<UtArea> find(@PathVariable String id) throws Exception {
return Result.success(utAreaEOService.getById(id));
}
@ApiOperation(value = "|UtAreaEO|新增")
@PostMapping("/createUtArea")
// @RequiresPermissions("lawssBase:utArea:save")
public ResponseMessage<UtArea> create(@RequestBody UtArea utAreaEO) throws Exception {
String result = utAreaEOService.createUtArea(utAreaEO);
if ("success".equals(result)) {
return Result.success("0","新增成功",utAreaEO);
} else {
return Result.error("0",result,utAreaEO);
}
}
@ApiOperation(value = "|UtAreaEO|修改")
@PutMapping("/updateUtArea")
// @RequiresPermissions("lawssBase:utArea:update")
public ResponseMessage<UtArea> update(@RequestBody UtArea utAreaEO) throws Exception {
String result = utAreaEOService.updateUtArea(utAreaEO);
if ("success".equals(result)) {
return Result.success("0","修改成功",utAreaEO);
} else {
return Result.error("0",result,utAreaEO);
}
}
@ApiOperation(value = "|UtAreaEO|删除")
@DeleteMapping("/deleteById")
// @RequiresPermissions("lawssBase:utArea:delete")
public ResponseMessage delete(String id) throws Exception {
utAreaEOService.removeById(id);
logger.info("delete from UT_AREA where id = {}", id);
return Result.success();
}
}
@@ -1,6 +1,7 @@
package com.adc.da.slrs.utArea.dao;
import com.adc.da.slrs.utArea.entity.UtArea;
import com.adc.da.slrs.utArea.page.UtAreaEOPage;
import com.adc.da.sys.common.SelectionResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -16,6 +17,15 @@ import java.util.List;
*/
public interface UtAreaDao extends BaseMapper<UtArea> {
Integer queryByCount(UtAreaEOPage page);
List<UtArea> queryByPage(UtAreaEOPage page);
List<UtArea> queryByList(UtAreaEOPage page);
List<SelectionResult> getAreaSelList(UtArea utAreaEO);
}
@@ -1,6 +1,7 @@
package com.adc.da.slrs.utArea.service;
import com.adc.da.slrs.utArea.entity.UtArea;
import com.adc.da.slrs.utArea.page.UtAreaEOPage;
import com.adc.da.sys.common.SelectionResult;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -17,4 +18,12 @@ import java.util.List;
public interface IUtAreaService extends IService<UtArea> {
List<SelectionResult> getAreaSelList(UtArea utAreaEO);
List<UtArea> queryByPage(UtAreaEOPage page);
List<UtArea> queryByList(UtAreaEOPage page);
String createUtArea(UtArea utAreaEO);
String updateUtArea(UtArea utAreaEO);
}
@@ -2,14 +2,18 @@ package com.adc.da.slrs.utArea.service.impl;
import com.adc.da.slrs.utArea.entity.UtArea;
import com.adc.da.slrs.utArea.dao.UtAreaDao;
import com.adc.da.slrs.utArea.page.UtAreaEOPage;
import com.adc.da.slrs.utArea.service.IUtAreaService;
import com.adc.da.sys.common.SelectionResult;
import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@@ -36,4 +40,57 @@ public class UtAreaServiceImpl extends ServiceImpl<UtAreaDao, UtArea> implements
return dao.getAreaSelList(utAreaEO);
}
@Override
public List<UtArea> queryByPage(UtAreaEOPage page){
Integer rowCount = dao.queryByCount(page);
page.getPager().setRowCount(rowCount);
return dao.queryByPage(page);
}
@Override
public List<UtArea> queryByList(UtAreaEOPage page){
return dao.queryByList(page);
}
public String createUtArea (UtArea utAreaEO) {
// 判断名称是否已存在
UtAreaEOPage page = new UtAreaEOPage();
page.setAreaName(utAreaEO.getAreaName());
page.setSarType(utAreaEO.getSarType());
List<UtArea> getList = dao.queryByList(page);
if (getList != null && !getList.isEmpty()) {
return "新增失败,展示区域名称已存在";
}
utAreaEO.setId(UUIDUtils.randomUUID20());
utAreaEO.setCreationUser(LoginUserUtil.getUserId());
utAreaEO.setCreationTime(new Date());
utAreaEO.setModifyTime(new Date());
utAreaEO.setValidFlag(0);
int result = dao.insert(utAreaEO);
if (result > 0) {
return "success";
} else {
return "新增失败";
}
}
public String updateUtArea (UtArea utAreaEO) {
// 判断名称是否已存在
UtAreaEOPage page = new UtAreaEOPage();
page.setAreaName(utAreaEO.getAreaName());
page.setSarType(utAreaEO.getSarType());
page.setNotId(utAreaEO.getId());
List<UtArea> getList = dao.queryByList(page);
if (getList != null && !getList.isEmpty()) {
return "修改失败,展示区域名称已存在";
}
utAreaEO.setModifyTime(new Date());
int result = dao.updateById(utAreaEO);
if (result > 0) {
return "success";
} else {
return "修改失败";
}
}
}
@@ -65,6 +65,122 @@
</trim>
</sql>
<!-- 插入记录 -->
<insert id="insert" parameterType="com.adc.da.slrs.utArea.entity.UtArea" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_UT_AREA.NEXTVAL FROM DUAL
</selectKey> -->
insert into UT_AREA(<include refid="Base_Column_List" />)
values (#{id, jdbcType=VARCHAR}, #{areaName, jdbcType=VARCHAR}, #{showIndex, jdbcType=INTEGER}, #{sarType, jdbcType=VARCHAR}, #{creationUser, jdbcType=VARCHAR}, #{validFlag, jdbcType=INTEGER}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP})
</insert>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.utArea.entity.UtArea" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_UT_AREA.NEXTVAL FROM DUAL
</selectKey> -->
insert into UT_AREA
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >id,</if>
<if test="areaName != null" >area_name,</if>
<if test="showIndex != null" >show_index,</if>
<if test="sarType != null" >sar_type,</if>
<if test="creationUser != null" >creation_user,</if>
<if test="validFlag != null" >valid_flag,</if>
<if test="creationTime != null" >creation_time,</if>
<if test="modifyTime != null" >modify_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
<if test="areaName != null" >#{areaName, jdbcType=VARCHAR},</if>
<if test="showIndex != null" >#{showIndex, jdbcType=INTEGER},</if>
<if test="sarType != null" >#{sarType, jdbcType=VARCHAR},</if>
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<!-- 根据pk,修改记录-->
<update id="updateByPrimaryKey" parameterType="com.adc.da.slrs.utArea.entity.UtArea" >
update UT_AREA
set area_name = #{areaName},
show_index = #{showIndex},
sar_type = #{sarType},
creation_user = #{creationUser},
valid_flag = #{validFlag},
creation_time = #{creationTime},
modify_time = #{modifyTime}
where id = #{id}
</update>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.utArea.entity.UtArea" >
update UT_AREA
<set >
<if test="areaName != null" >
area_name = #{areaName},
</if>
<if test="showIndex != null" >
show_index = #{showIndex},
</if>
<if test="sarType != null" >
sar_type = #{sarType},
</if>
<if test="creationUser != null" >
creation_user = #{creationUser},
</if>
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="modifyTime != null" >
modify_time = #{modifyTime},
</if>
</set>
where id = #{id}
</update>
<!-- 根据id查询 UT_AREA -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from UT_AREA
where id = #{value}
</select>
<!-- 删除记录 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from UT_AREA
where id = #{value}
</delete>
<!-- UT_AREA 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from UT_AREA
<include refid="Base_Where_Clause"/>
</select>
<!-- 查询UT_AREA列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List" /> from
(select tmp_tb.* from
(select <include refid="Base_Column_List" /> from UT_AREA
<include refid="Base_Where_Clause"/>
order by show_index,id
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List"/> from UT_AREA
<include refid="Base_Where_Clause"/>
order by show_index,id
</select>
<select id="getAreaSelList" parameterType="com.adc.da.slrs.utArea.entity.UtArea" resultType="com.adc.da.sys.common.SelectionResult">
select id as value,area_name as label
from UT_AREA