feat: 产品中心
This commit is contained in:
parent
c99ca55169
commit
89379b1683
|
|
@ -131,10 +131,11 @@ public class ProductSeriesController extends ControllerBase{
|
|||
|
||||
/**
|
||||
* 获取下拉的系列列表
|
||||
* @param moduleId 模块id
|
||||
*/
|
||||
@GetMapping("/getSimpleList")
|
||||
public ApiResult<Set<String>> getSimpleList(){
|
||||
return ApiResult.success(productSeriesService.getSimpleList());
|
||||
public ApiResult<Set<String>> getSimpleList(@Valid @RequestParam @NotNull Integer moduleId){
|
||||
return ApiResult.success(productSeriesService.getSimpleList(moduleId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -91,8 +91,9 @@ public class ProductTypeController extends ControllerBase{
|
|||
* @param seriesName 系列名称
|
||||
*/
|
||||
@GetMapping("/getSimpleList")
|
||||
public ApiResult<Set<String>> getSimpleList(@Valid @RequestParam @NotBlank String seriesName){
|
||||
return ApiResult.success(productTypeService.getSimpleList(seriesName));
|
||||
public ApiResult<Set<String>> getSimpleList(@Valid @RequestParam @NotNull Integer moduleId
|
||||
,@Valid @RequestParam @NotBlank String seriesName){
|
||||
return ApiResult.success(productTypeService.getSimpleList(moduleId,seriesName));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,10 +7,15 @@ import java.time.LocalDateTime;
|
|||
@Data
|
||||
public class ProductTypeSearchRequest extends PageRequest{
|
||||
|
||||
/**
|
||||
* 模块id
|
||||
*/
|
||||
private Integer moduleId;
|
||||
|
||||
/**
|
||||
* 系列名称
|
||||
*/
|
||||
private Integer seriesName;
|
||||
private String seriesName;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ public class ProductTypeInfoVO {
|
|||
*/
|
||||
private String seriesName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 多语言数据
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public interface IProductSeriesService extends IService<ProductSeries> {
|
|||
|
||||
void enable(@Valid EnableRequest request);
|
||||
|
||||
Set<String> getSimpleList();
|
||||
Set<String> getSimpleList(Integer moduleId);
|
||||
|
||||
ProductSeriesInfoVO getInfo(@Valid @NotNull Integer seriesId);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import com.nflg.mobilebroken.common.pojo.vo.ProductTypeVO;
|
|||
import com.nflg.mobilebroken.repository.entity.ProductType;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
|
@ -39,7 +38,7 @@ public interface IProductTypeService extends IService<ProductType> {
|
|||
|
||||
void publish(@Valid ProductPublishRequest request);
|
||||
|
||||
Set<String> getSimpleList(@Valid @NotBlank String seriesName);
|
||||
Set<String> getSimpleList(Integer moduleId,String seriesName);
|
||||
|
||||
ProductTypeInfoVO getInfo(@Valid @NotNull Integer typeId);
|
||||
|
||||
|
|
|
|||
|
|
@ -180,9 +180,10 @@ public class ProductSeriesServiceImpl extends ServiceImpl<ProductSeriesMapper, P
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSimpleList() {
|
||||
public Set<String> getSimpleList(Integer moduleId) {
|
||||
return lambdaQuery()
|
||||
.eq(ProductSeries::getEnable,true)
|
||||
.eq(ProductSeries::getModuleId,moduleId)
|
||||
.list()
|
||||
.stream()
|
||||
.map(ProductSeries::getName)
|
||||
|
|
|
|||
|
|
@ -187,8 +187,9 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSimpleList(String seriesName) {
|
||||
public Set<String> getSimpleList(Integer moduleId,String seriesName) {
|
||||
return lambdaQuery()
|
||||
.eq(ProductType::getModuleId, moduleId)
|
||||
.eq(ProductType::getSeriesName, seriesName)
|
||||
.eq(ProductType::getEnable, true)
|
||||
.list()
|
||||
|
|
@ -204,6 +205,7 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
return new ProductTypeInfoVO()
|
||||
.setId(info.getId())
|
||||
.setModuleId(info.getModuleId())
|
||||
.setSort(info.getSort())
|
||||
.setSeriesName(info.getSeriesName())
|
||||
.setItems(productTypeInfoService.getInfo(typeId))
|
||||
.setFiles(productTypeFileService.getInfo(typeId));
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.ProductTypeMapper">
|
||||
|
||||
<select id="getList" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductTypeSearchVO">
|
||||
SELECT pt.*,() AS 'seriesName',di.name as 'moduleName'
|
||||
SELECT pt.*,di.name as 'moduleName'
|
||||
FROM product_type pt
|
||||
LEFT JOIN dictionary_item di ON pt.module_id=di.id
|
||||
<where>
|
||||
<if test="request.seriesName != null">
|
||||
AND pt.series_name = #{request.seriesName}
|
||||
<if test="request.moduleId!=null">
|
||||
AND pt.module_id=#{request.moduleId}
|
||||
</if>
|
||||
<if test="request.enable!=null">
|
||||
AND ps.enable=#{request.enable}
|
||||
AND pt.enable=#{request.enable}
|
||||
</if>
|
||||
<if test="request.state != null">
|
||||
AND pt.state = #{request.state}
|
||||
|
|
@ -22,11 +22,14 @@
|
|||
<if test="request.endTime != null">
|
||||
AND pt.publish_time <= #{request.endTime}
|
||||
</if>
|
||||
<if test="request.seriesName != null">
|
||||
AND pt.series_name = #{request.seriesName}
|
||||
</if>
|
||||
<if test="request.name != null and request.name != ''">
|
||||
AND pt.name LIKE CONCAT('%', #{request.name}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY pt.state,pt.series_id,pt.name,pt.publish_time DESC
|
||||
ORDER BY pt.state,pt.series_name,pt.name,pt.publish_time DESC
|
||||
</select>
|
||||
|
||||
<select id="get" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductTypeVO">
|
||||
|
|
@ -34,6 +37,6 @@
|
|||
FROM product_type pt
|
||||
LEFT JOIN product_type_info pti ON pti.type_id=pt.id AND pti.language_code=#{language}
|
||||
WHERE pt.state=1 AND pt.enable=1 AND pt.module_id=#{moduleId} AND pt.series_name=#{seriesNo}
|
||||
ORDER BY pt.sort DESC
|
||||
ORDER BY pt.sort
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue