ere
This commit is contained in:
parent
11975d5c18
commit
c43543c185
|
|
@ -54,6 +54,10 @@
|
||||||
<groupId>jakarta.validation</groupId>
|
<groupId>jakarta.validation</groupId>
|
||||||
<artifactId>jakarta.validation-api</artifactId>
|
<artifactId>jakarta.validation-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nflg</groupId>
|
||||||
|
<artifactId>nflg-mobilebroken-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.nflg.mobilebroken.admin.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.db.Page;
|
||||||
|
import com.nflg.mobilebroken.admin.pojo.query.DeviceComponentQuery;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.vo.AreaSimpleVO;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.vo.AreaVO;
|
||||||
|
import com.nflg.mobilebroken.repository.service.IDeviceComponentService;
|
||||||
|
import com.nflg.mobilebroken.starter.annotation.MethodInfoMark;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/deviceComponent")
|
||||||
|
public class DeviceComponentController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IDeviceComponentService deviceComponentService;
|
||||||
|
|
||||||
|
@PostMapping("getList")
|
||||||
|
@MethodInfoMark("获取部件列表")
|
||||||
|
public ApiResult<List<AreaSimpleVO>> getSimpleAreas(@RequestBody DeviceComponentQuery query){
|
||||||
|
deviceComponentService.selectListByPage(query);
|
||||||
|
|
||||||
|
return ApiResult.success(vos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.nflg.mobilebroken.admin.pojo.query;
|
||||||
|
|
||||||
|
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceComponentQuery extends PageBaseQuery {
|
||||||
|
private String modelNo;
|
||||||
|
|
||||||
|
private String component;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.nflg.mobilebroken.common.pojo.query;
|
||||||
|
|
||||||
|
public class PageBaseQuery {
|
||||||
|
|
||||||
|
private Integer page=1;
|
||||||
|
|
||||||
|
private Integer pageSize=20;
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package com.nflg.mobilebroken.repository.mapper;
|
package com.nflg.mobilebroken.repository.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||||
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -13,4 +16,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
*/
|
*/
|
||||||
public interface DeviceComponentMapper extends BaseMapper<DeviceComponent> {
|
public interface DeviceComponentMapper extends BaseMapper<DeviceComponent> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param page
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<DeviceComponent> selectListByPage(@Param("page") Page<PageBaseQuery> page, @Param("query") PageBaseQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
package com.nflg.mobilebroken.repository.service;
|
package com.nflg.mobilebroken.repository.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||||
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -13,4 +19,18 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
*/
|
*/
|
||||||
public interface IDeviceComponentService extends IService<DeviceComponent> {
|
public interface IDeviceComponentService extends IService<DeviceComponent> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param page
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DeviceComponent> selectListByPage( @Param("query") PageBaseQuery query);
|
||||||
|
|
||||||
|
DeviceComponent saveComponent(DeviceComponent component);
|
||||||
|
|
||||||
|
|
||||||
|
void delComponent(Integer component);
|
||||||
|
|
||||||
|
Boolean saveOrUpdateBatchComponent(List<DeviceComponent> data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,16 @@
|
||||||
package com.nflg.mobilebroken.repository.service.impl;
|
package com.nflg.mobilebroken.repository.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||||
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
||||||
import com.nflg.mobilebroken.repository.mapper.DeviceComponentMapper;
|
import com.nflg.mobilebroken.repository.mapper.DeviceComponentMapper;
|
||||||
import com.nflg.mobilebroken.repository.service.IDeviceComponentService;
|
import com.nflg.mobilebroken.repository.service.IDeviceComponentService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 机型部件 服务实现类
|
* 机型部件 服务实现类
|
||||||
|
|
@ -17,4 +22,37 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class DeviceComponentServiceImpl extends ServiceImpl<DeviceComponentMapper, DeviceComponent> implements IDeviceComponentService {
|
public class DeviceComponentServiceImpl extends ServiceImpl<DeviceComponentMapper, DeviceComponent> implements IDeviceComponentService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param page
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Page<DeviceComponent> selectListByPage(@Param("page") Page<PageBaseQuery> page, @Param("query") PageBaseQuery query){
|
||||||
|
return this.getBaseMapper().selectListByPage(page,query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
* @param component
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public DeviceComponent saveComponent(DeviceComponent component){
|
||||||
|
this.saveOrUpdate(component);
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delComponent(Integer id){
|
||||||
|
this.getBaseMapper().deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Boolean saveOrUpdateBatchComponent(List<DeviceComponent> data){
|
||||||
|
return this.saveOrUpdateBatch(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,16 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.DeviceComponentMapper">
|
<mapper namespace="com.nflg.mobilebroken.repository.mapper.DeviceComponentMapper">
|
||||||
|
|
||||||
|
<sql id="whr">
|
||||||
|
<if test="query.modelNo!=null and query.modelNo!=''">
|
||||||
|
and model_no=#{query.modelNo}
|
||||||
|
</if>
|
||||||
|
<if test="query.component!=null and query.component!=''">
|
||||||
|
and component like concat('%',#{query.component} ,"%")
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
<select id="selectListByPage" resultType="com.nflg.mobilebroken.repository.entity.DeviceComponent">
|
||||||
|
select * from device_component where 1=1
|
||||||
|
<include refid="whr" />
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.nflg.mobilebroken.starter.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface MethodInfoMark {
|
||||||
|
String value() default "";
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue