parent
1731a9b6aa
commit
bda4d27def
|
@ -59,5 +59,10 @@ public class DepartmentController {
|
||||||
public Response<List<Department>> list(){
|
public Response<List<Department>> list(){
|
||||||
return Response.succeed(departmentService.list());
|
return Response.succeed(departmentService.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDepartment")
|
||||||
|
public Response<Department> getDepartment(@RequestParam String id){
|
||||||
|
return Response.succeed(departmentService.getById(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/gaswell")
|
@RequestMapping("/gasWell")
|
||||||
public class GasWellController {
|
public class GasWellController {
|
||||||
|
|
||||||
private final GasWellService gasWellService;
|
private final GasWellService gasWellService;
|
||||||
|
@ -43,23 +43,26 @@ public class GasWellController {
|
||||||
/**
|
/**
|
||||||
* 查询气井列表
|
* 查询气井列表
|
||||||
*/
|
*/
|
||||||
@GetMapping
|
@GetMapping(value = "/page")
|
||||||
public Response<Page<GasWellVO>> page(GasWellPageQuery query) {
|
public Response<Page<GasWellVO>> page(@RequestParam(defaultValue = "1") Integer currentPage,
|
||||||
return Response.succeed(gasWellService.pageForQuery(query));
|
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(required = false) String name,
|
||||||
|
@RequestParam Long blockId) {
|
||||||
|
return Response.succeed(gasWellService.pageForQuery(currentPage, pageSize, name,blockId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取气井详细信息
|
* 获取气井详细信息
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/getGasWell")
|
||||||
public Response<GasWellVO> getInfo(@PathVariable("id") Long id) {
|
public Response<GasWellVO> getGasWell(@RequestParam Long id) {
|
||||||
return Response.succeed(gasWellService.selectGasWellById(id));
|
return Response.succeed(gasWellService.selectGasWellById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增气井
|
* 新增气井
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping(value = "/add")
|
||||||
@OperationLog(description = "新增气井", type = LogType.ADD)
|
@OperationLog(description = "新增气井", type = LogType.ADD)
|
||||||
public Response<String> add(@RequestBody @Valid GasWellCreateRequest gasWellCreateRequest) {
|
public Response<String> add(@RequestBody @Valid GasWellCreateRequest gasWellCreateRequest) {
|
||||||
gasWellService.insertGasWell(gasWellCreateRequest);
|
gasWellService.insertGasWell(gasWellCreateRequest);
|
||||||
|
@ -69,7 +72,7 @@ public class GasWellController {
|
||||||
/**
|
/**
|
||||||
* 修改气井
|
* 修改气井
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PostMapping("/edit")
|
||||||
@OperationLog(description = "修改气井", type = LogType.UPDATE)
|
@OperationLog(description = "修改气井", type = LogType.UPDATE)
|
||||||
public Response<String> edit(@RequestBody GasWellEditRequest gasWellEditRequest) {
|
public Response<String> edit(@RequestBody GasWellEditRequest gasWellEditRequest) {
|
||||||
gasWellService.updateGasWell(gasWellEditRequest);
|
gasWellService.updateGasWell(gasWellEditRequest);
|
||||||
|
@ -79,11 +82,12 @@ public class GasWellController {
|
||||||
/**
|
/**
|
||||||
* 删除气井
|
* 删除气井
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/{ids}")
|
@GetMapping("/delete")
|
||||||
@OperationLog(description = "删除气井", type = LogType.DELETE)
|
@OperationLog(description = "删除气井", type = LogType.DELETE)
|
||||||
public Response<String> delete(@PathVariable Collection<Long> ids) {
|
public Response<String> delete(@RequestParam Long id) {
|
||||||
gasWellService.deleteGasWellByIds(ids);
|
gasWellService.deleteGasWellById(id);
|
||||||
return Response.succeed();
|
return Response.succeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,5 +57,10 @@ public class RoleController {
|
||||||
public Response<List<Role>> delete(){
|
public Response<List<Role>> delete(){
|
||||||
return Response.succeed(roleService.list());
|
return Response.succeed(roleService.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getRole")
|
||||||
|
public Response<Role> getRole(@RequestParam Long id){
|
||||||
|
return Response.succeed(roleService.getById(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,9 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.isu.gaswellwatch.vo.GasWellVO;
|
import com.isu.gaswellwatch.vo.GasWellVO;
|
||||||
import com.isu.gaswellwatch.vo.GasWellPageQuery;
|
|
||||||
import com.isu.gaswellwatch.entity.GasWell;
|
import com.isu.gaswellwatch.entity.GasWell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +24,7 @@ public interface GasWellDao extends BaseMapper<GasWell> {
|
||||||
* @param id 气井主键
|
* @param id 气井主键
|
||||||
* @return 气井
|
* @return 气井
|
||||||
*/
|
*/
|
||||||
GasWell selectGasWellById(Long id);
|
GasWellVO selectGasWellById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询气井列表
|
* 查询气井列表
|
||||||
|
@ -39,10 +37,10 @@ public interface GasWellDao extends BaseMapper<GasWell> {
|
||||||
/**
|
/**
|
||||||
* 分页查询气井列表
|
* 分页查询气井列表
|
||||||
*
|
*
|
||||||
* @param query 查询条件
|
* @param blockId
|
||||||
* @return 气井
|
* @return 气井
|
||||||
*/
|
*/
|
||||||
Page<GasWellVO> pageForQuery(Page<GasWellVO> page, @Param("query") GasWellPageQuery query);
|
Page<GasWellVO> pageForQuery(Page<GasWellVO> page, String name, Long blockId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增气井
|
* 新增气井
|
||||||
|
@ -58,7 +56,7 @@ public interface GasWellDao extends BaseMapper<GasWell> {
|
||||||
* @param gasWell 气井
|
* @param gasWell 气井
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int updateGasWell(GasWell gasWell);
|
int updateGasWell(GasWellVO gasWell);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除气井
|
* 删除气井
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.isu.gaswellwatch.dto;
|
package com.isu.gaswellwatch.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -28,13 +30,19 @@ public class GasWellCreateRequest implements Serializable {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 关联公司 */
|
|
||||||
private Long companyId;
|
|
||||||
|
|
||||||
|
/** 气井ID */
|
||||||
|
private Long id;
|
||||||
/** 气井名称 */
|
/** 气井名称 */
|
||||||
|
@NotBlank(message = "气井名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/** 描述 */
|
/** 描述 */
|
||||||
private String details;
|
private String details;
|
||||||
|
|
||||||
|
|
||||||
|
/** 所属区块 */
|
||||||
|
@NotNull(message = "所属区块不能为空")
|
||||||
|
private Long blockId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,6 @@ public class GasWellEditRequest implements Serializable {
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 关联公司 */
|
|
||||||
private Long companyId;
|
|
||||||
|
|
||||||
/** 气井名称 */
|
/** 气井名称 */
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
|
@ -26,26 +26,24 @@ public class GasWell extends Model<GasWell> {
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 关联公司 */
|
|
||||||
private Long companyId;
|
|
||||||
|
|
||||||
/** 气井名称 */
|
/** 气井名称 */
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/** 描述 */
|
/** 描述 */
|
||||||
private String details;
|
private String details;
|
||||||
|
|
||||||
/** 创建人 */
|
/** 设备ID */
|
||||||
private Long createBy;
|
private Long deviceId;
|
||||||
|
|
||||||
|
/** 区块ID */
|
||||||
|
private Long blockId;
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
private LocalDateTime createTime;
|
private String createTime;
|
||||||
|
|
||||||
/** 更新人 */
|
|
||||||
private Long updateBy;
|
|
||||||
|
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
private LocalDateTime updateTime;
|
private String updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,7 @@ public interface GasWellMapper {
|
||||||
UserLoginInfoVO userLoginInfoVO = (UserLoginInfoVO) StpUtil.getTokenSession()
|
UserLoginInfoVO userLoginInfoVO = (UserLoginInfoVO) StpUtil.getTokenSession()
|
||||||
.get(UserConstant.TOKEN_SESSION);
|
.get(UserConstant.TOKEN_SESSION);
|
||||||
if (Objects.nonNull(userLoginInfoVO) && Objects.nonNull(userLoginInfoVO.getUserVO())) {
|
if (Objects.nonNull(userLoginInfoVO) && Objects.nonNull(userLoginInfoVO.getUserVO())) {
|
||||||
gasWell.setUpdateBy(gasWell.getCreateBy());
|
|
||||||
}
|
}
|
||||||
gasWell.setUpdateTime(LocalDateTime.now());
|
|
||||||
copyToEntity(request, gasWell);
|
copyToEntity(request, gasWell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,12 +48,6 @@ public interface GasWellMapper {
|
||||||
UserLoginInfoVO userLoginInfoVO = (UserLoginInfoVO) StpUtil.getTokenSession()
|
UserLoginInfoVO userLoginInfoVO = (UserLoginInfoVO) StpUtil.getTokenSession()
|
||||||
.get(UserConstant.TOKEN_SESSION);
|
.get(UserConstant.TOKEN_SESSION);
|
||||||
GasWell gasWell =new GasWell();
|
GasWell gasWell =new GasWell();
|
||||||
gasWell.setCreateTime(LocalDateTime.now());
|
|
||||||
gasWell.setUpdateTime(gasWell.getCreateTime());
|
|
||||||
if (Objects.nonNull(userLoginInfoVO) && Objects.nonNull(userLoginInfoVO.getUserVO())) {
|
|
||||||
gasWell.setCreateBy(userLoginInfoVO.getUserVO().getId());
|
|
||||||
gasWell.setUpdateBy(gasWell.getCreateBy());
|
|
||||||
}
|
|
||||||
create(request, gasWell);
|
create(request, gasWell);
|
||||||
return gasWell;
|
return gasWell;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Collection;
|
||||||
|
|
||||||
import com.isu.gaswellwatch.dto.GasWellCreateRequest;
|
import com.isu.gaswellwatch.dto.GasWellCreateRequest;
|
||||||
import com.isu.gaswellwatch.dto.GasWellEditRequest;
|
import com.isu.gaswellwatch.dto.GasWellEditRequest;
|
||||||
import com.isu.gaswellwatch.vo.GasWellPageQuery;
|
|
||||||
import com.isu.gaswellwatch.vo.GasWellVO;
|
import com.isu.gaswellwatch.vo.GasWellVO;
|
||||||
import com.isu.gaswellwatch.entity.GasWell;
|
import com.isu.gaswellwatch.entity.GasWell;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
@ -37,10 +36,9 @@ public interface GasWellService extends IService<GasWell> {
|
||||||
/**
|
/**
|
||||||
* 分页查询气井列表
|
* 分页查询气井列表
|
||||||
*
|
*
|
||||||
* @param query 查询条件
|
|
||||||
* @return 气井
|
* @return 气井
|
||||||
*/
|
*/
|
||||||
Page<GasWellVO> pageForQuery(GasWellPageQuery query);
|
Page<GasWellVO> pageForQuery(Integer currentPage, Integer pageSize, String name, Long blockId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增气井
|
* 新增气井
|
||||||
|
|
|
@ -2,13 +2,19 @@ package com.isu.gaswellwatch.service.impl;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.isu.gaswellwatch.config.SnowflakeConfig;
|
||||||
|
import com.isu.gaswellwatch.exception.BusinessException;
|
||||||
|
import com.isu.gaswellwatch.utils.ConverterUtil;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.isu.gaswellwatch.dto.GasWellCreateRequest;
|
import com.isu.gaswellwatch.dto.GasWellCreateRequest;
|
||||||
import com.isu.gaswellwatch.dto.GasWellEditRequest;
|
import com.isu.gaswellwatch.dto.GasWellEditRequest;
|
||||||
import com.isu.gaswellwatch.vo.GasWellPageQuery;
|
|
||||||
import com.isu.gaswellwatch.vo.GasWellVO;
|
import com.isu.gaswellwatch.vo.GasWellVO;
|
||||||
import com.isu.gaswellwatch.dao.GasWellDao;
|
import com.isu.gaswellwatch.dao.GasWellDao;
|
||||||
import com.isu.gaswellwatch.entity.GasWell;
|
import com.isu.gaswellwatch.entity.GasWell;
|
||||||
|
@ -28,6 +34,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public class GasWellServiceImpl extends ServiceImpl<GasWellDao, GasWell> implements GasWellService {
|
public class GasWellServiceImpl extends ServiceImpl<GasWellDao, GasWell> implements GasWellService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SnowflakeConfig snowflakeConfig;
|
||||||
|
|
||||||
private final GasWellDao gasWellDao;
|
private final GasWellDao gasWellDao;
|
||||||
private final GasWellMapper gasWellMapper = Mappers.getMapper(GasWellMapper.class);
|
private final GasWellMapper gasWellMapper = Mappers.getMapper(GasWellMapper.class);
|
||||||
|
|
||||||
|
@ -39,7 +48,7 @@ public class GasWellServiceImpl extends ServiceImpl<GasWellDao, GasWell> implem
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GasWellVO selectGasWellById(Long id) {
|
public GasWellVO selectGasWellById(Long id) {
|
||||||
return gasWellMapper.toPageVO(gasWellDao.selectGasWellById(id));
|
return gasWellDao.selectGasWellById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,12 +65,11 @@ public class GasWellServiceImpl extends ServiceImpl<GasWellDao, GasWell> implem
|
||||||
/**
|
/**
|
||||||
* 分页查询气井列表
|
* 分页查询气井列表
|
||||||
*
|
*
|
||||||
* @param query 查询条件
|
|
||||||
* @return 气井
|
* @return 气井
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<GasWellVO> pageForQuery(GasWellPageQuery query){
|
public Page<GasWellVO> pageForQuery(Integer currentPage, Integer pageSize, String name, Long blockId){
|
||||||
return gasWellDao.pageForQuery(new Page<>(query.getCurrentPage(), query.getPageSize()), query);
|
return gasWellDao.pageForQuery(new Page<>(currentPage, pageSize), name,blockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +81,15 @@ public class GasWellServiceImpl extends ServiceImpl<GasWellDao, GasWell> implem
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Throwable.class)
|
@Transactional(rollbackFor = Throwable.class)
|
||||||
public int insertGasWell(GasWellCreateRequest gasWellCreateRequest) {
|
public int insertGasWell(GasWellCreateRequest gasWellCreateRequest) {
|
||||||
return gasWellDao.insertGasWell(gasWellMapper.create(gasWellCreateRequest));
|
GasWell gasWell = ConverterUtil.convert(gasWellCreateRequest,GasWell.class);
|
||||||
|
|
||||||
|
//查重
|
||||||
|
List<GasWell> list = list(new LambdaQueryWrapper<GasWell>().eq(GasWell::getName, gasWellCreateRequest.getName()));
|
||||||
|
if(CollectionUtil.isNotEmpty(list)) {
|
||||||
|
throw new BusinessException("已有相同名称,请重新输入");
|
||||||
|
}
|
||||||
|
gasWell.setId(snowflakeConfig.snowflakeId());
|
||||||
|
return gasWellDao.insertGasWell(gasWell);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,9 +101,8 @@ public class GasWellServiceImpl extends ServiceImpl<GasWellDao, GasWell> implem
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Throwable.class)
|
@Transactional(rollbackFor = Throwable.class)
|
||||||
public int updateGasWell(GasWellEditRequest gasWellEditRequest) {
|
public int updateGasWell(GasWellEditRequest gasWellEditRequest) {
|
||||||
GasWell gasWell = gasWellDao.selectGasWellById(gasWellEditRequest.getId());
|
GasWellVO gasWellVO = ConverterUtil.convert(gasWellEditRequest,GasWellVO.class);
|
||||||
gasWellMapper.copyToEntity(gasWellEditRequest, gasWell);
|
return gasWellDao.updateGasWell(gasWellVO);
|
||||||
return gasWellDao.updateGasWell(gasWell);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,6 +114,11 @@ public class GasWellServiceImpl extends ServiceImpl<GasWellDao, GasWell> implem
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Throwable.class)
|
@Transactional(rollbackFor = Throwable.class)
|
||||||
public int deleteGasWellById(Long id) {
|
public int deleteGasWellById(Long id) {
|
||||||
|
//判断气井是否被关联设备,如果已经关联设备则无法删除
|
||||||
|
GasWellVO gasWellVO = gasWellDao.selectGasWellById(id);
|
||||||
|
if(gasWellVO.getDeviceId() != null){
|
||||||
|
throw new BusinessException("该气井已经关联设备,无法删除");
|
||||||
|
}
|
||||||
return gasWellDao.deleteGasWellById(id);
|
return gasWellDao.deleteGasWellById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,25 +31,22 @@ public class GasWellVO implements Serializable {
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 关联公司 */
|
|
||||||
private Long companyId;
|
|
||||||
|
|
||||||
/** 气井名称 */
|
/** 气井名称 */
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/** 描述 */
|
/** 描述 */
|
||||||
private String details;
|
private String details;
|
||||||
|
|
||||||
/** 创建人 */
|
|
||||||
private Long createBy;
|
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
private LocalDateTime createTime;
|
private String createTime;
|
||||||
|
|
||||||
/** 更新人 */
|
|
||||||
private Long updateBy;
|
|
||||||
|
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
private LocalDateTime updateTime;
|
private String updateTime;
|
||||||
|
|
||||||
|
/** 设备id */
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/** 区块id */
|
||||||
|
private Long blockId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,40 +6,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<resultMap type="com.isu.gaswellwatch.vo.GasWellVO" id="GasWellVO">
|
<resultMap type="com.isu.gaswellwatch.vo.GasWellVO" id="GasWellVO">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="companyId" column="company_id" />
|
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name" />
|
||||||
<result property="details" column="details" />
|
<result property="details" column="details" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="deviceId" column="device_id" />
|
||||||
<result property="createTime" column="create_time" jdbcType="DATE" typeHandler="com.isu.gaswellwatch.utils.LocalDateTimeTypeHandler" />
|
<result property="blockId" column="block_id" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateTime" column="update_time" jdbcType="DATE" typeHandler="com.isu.gaswellwatch.utils.LocalDateTimeTypeHandler" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<resultMap type="com.isu.gaswellwatch.entity.GasWell" id="GasWellResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="companyId" column="company_id" />
|
|
||||||
<result property="name" column="name" />
|
|
||||||
<result property="details" column="details" />
|
|
||||||
<result property="createBy" column="create_by" />
|
|
||||||
<result property="createTime" column="create_time" jdbcType="DATE" typeHandler="com.isu.gaswellwatch.utils.LocalDateTimeTypeHandler" />
|
|
||||||
<result property="updateBy" column="update_by" />
|
|
||||||
<result property="updateTime" column="update_time" jdbcType="DATE" typeHandler="com.isu.gaswellwatch.utils.LocalDateTimeTypeHandler" />
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectGasWellVo">
|
<sql id="selectGasWellVo">
|
||||||
select t1.id, t1.company_id, t1.name, t1.details, t1.create_by, t1.create_time, t1.update_by, t1.update_time from gas_wells t1
|
select t1.id, t1.name, t1.details, t1.block_id,t1.device_id, t1.create_time, t1.update_time from gas_well t1
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="pageForQuery" resultMap="GasWellVO">
|
<select id="pageForQuery" resultMap="GasWellVO">
|
||||||
<include refid="selectGasWellVo"/>
|
<include refid="selectGasWellVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="query.companyId != null "> and t1.company_id = #{companyId}</if>
|
<if test="name != null and name != ''"> and t1.name like concat('%', #{name}, '%')</if>
|
||||||
<if test="query.name != null and query.name != ''"> and t1.name like concat('%', #{query.name}, '%')</if>
|
and t1.block_id = #{blockId}
|
||||||
</where>
|
</where>
|
||||||
order by t1.id desc
|
order by t1.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGasWellList" resultMap="GasWellResult">
|
<select id="selectGasWellList" resultMap="GasWellVO">
|
||||||
<include refid="selectGasWellVo"/>
|
<include refid="selectGasWellVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="companyId != null "> and t1.company_id = #{companyId}</if>
|
<if test="companyId != null "> and t1.company_id = #{companyId}</if>
|
||||||
|
@ -47,53 +35,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGasWellById" parameterType="Long" resultMap="GasWellResult">
|
<select id="selectGasWellById" parameterType="Long" resultMap="GasWellVO">
|
||||||
<include refid="selectGasWellVo"/>
|
<include refid="selectGasWellVo"/>
|
||||||
where t1.id = #{id}
|
where t1.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertGasWell" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertGasWell">
|
||||||
insert into gas_wells
|
insert into gas_well
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="companyId != null">company_id,</if>
|
<if test="id != null">id,</if>
|
||||||
<if test="name != null and name != ''">name,</if>
|
<if test="name != null and name != ''">name,</if>
|
||||||
<if test="details != null">details,</if>
|
<if test="details != null">details,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="blockId != null">block_id,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="updateBy != null">update_by,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="companyId != null">#{companyId},</if>
|
<if test="id != null">#{id},</if>
|
||||||
<if test="name != null and name != ''">#{name},</if>
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
<if test="details != null">#{details},</if>
|
<if test="details != null">#{details},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="blockId != null">#{blockId},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateGasWell">
|
<update id="updateGasWell">
|
||||||
update gas_wells
|
update gas_well
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="companyId != null">company_id = #{companyId},</if>
|
|
||||||
<if test="name != null and name != ''">name = #{name},</if>
|
<if test="name != null and name != ''">name = #{name},</if>
|
||||||
<if test="details != null">details = #{details},</if>
|
<if test="details != null">details = #{details},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteGasWellById" parameterType="Long">
|
<delete id="deleteGasWellById" parameterType="Long">
|
||||||
delete from gas_wells where id = #{id}
|
delete from gas_well where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteGasWellByIds">
|
<delete id="deleteGasWellByIds">
|
||||||
delete from gas_wells where id in
|
delete from gas_well where id in
|
||||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
Loading…
Reference in New Issue