Merge branch 'DM/基础信息维护' into develop

This commit is contained in:
大米 2025-01-20 10:54:42 +08:00
commit 1df75ad211
9 changed files with 147 additions and 0 deletions

View File

@ -71,6 +71,10 @@
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>com.nflg</groupId>
<artifactId>nflg-mobilebroken-starter</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,8 @@
package com.nflg.mobilebroken.common.pojo.query;
public class PageBaseQuery {
private Integer page=1;
private Integer pageSize=20;
}

View File

@ -1,7 +1,10 @@
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.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
@ -13,4 +16,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface DeviceComponentMapper extends BaseMapper<DeviceComponent> {
/**
* 分页查询
* @param page
* @param query
* @return
*/
Page<DeviceComponent> selectListByPage(@Param("page") Page<PageBaseQuery> page, @Param("query") PageBaseQuery query);
}

View File

@ -1,7 +1,13 @@
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.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* <p>
@ -13,4 +19,18 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
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);
}

View File

@ -1,11 +1,16 @@
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.mapper.DeviceComponentMapper;
import com.nflg.mobilebroken.repository.service.IDeviceComponentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 机型部件 服务实现类
@ -17,4 +22,37 @@ import org.springframework.stereotype.Service;
@Service
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);
}
}

View File

@ -2,4 +2,16 @@
<!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">
<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>

View File

@ -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 "";
}