【制作物料英文描述】增删改查
This commit is contained in:
parent
a2e0d72842
commit
070943ceff
|
|
@ -0,0 +1,89 @@
|
|||
package com.nflg.product.material.api.user.material;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.material.pojo.dto.MaterialAttrValueI18n21DTO;
|
||||
import com.nflg.product.material.pojo.query.MaterialAttrValueI18n21Query;
|
||||
import com.nflg.product.material.pojo.vo.MaterialAttrValueI18n21VO;
|
||||
import com.nflg.product.material.service.MaterialAttrValueI18n21Service;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
*/
|
||||
@Api(tags = "制作物料英文描述")
|
||||
@RestController
|
||||
@RequestMapping("materialAttrValueI18n21")
|
||||
public class MaterialAttrValueI18n21Api extends BaseApi {
|
||||
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private MaterialAttrValueI18n21Service materialAttrValueI18n21Service;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param query Query 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@PostMapping("getlistPage")
|
||||
@ApiOperation("auto-按字段条件分页查询")
|
||||
public ResultVO<IPage<MaterialAttrValueI18n21VO>> selectPageByCondition(@RequestBody MaterialAttrValueI18n21Query query) {
|
||||
return ResultVO.success(materialAttrValueI18n21Service.selectPageByCondition(query));
|
||||
}
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param rowId 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("selectByRowId")
|
||||
@ApiOperation("auto-根据rowId查询")
|
||||
public ResultVO<MaterialAttrValueI18n21VO> selectByRowId(@RequestParam("rowId") Long rowId) {
|
||||
return ResultVO.success(materialAttrValueI18n21Service.selectByRowId(rowId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param paramDto DTO 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@ApiOperation("auto-新增数据")
|
||||
public ResultVO<Boolean> addMaterialAttrValueI18n21Entity(@RequestBody MaterialAttrValueI18n21DTO paramDto) {
|
||||
return ResultVO.success(materialAttrValueI18n21Service.addMaterialAttrValueI18n21Entity(paramDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param paramDto DTO 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PostMapping("updateByRowId")
|
||||
@ApiOperation("auto-根据rowId更新")
|
||||
public ResultVO<Boolean> updateByRowId(@RequestBody MaterialAttrValueI18n21DTO paramDto) {
|
||||
return ResultVO.success(materialAttrValueI18n21Service.updateByRowId(paramDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param rowId
|
||||
* @return 删除结果
|
||||
*/
|
||||
@GetMapping("del")
|
||||
@ApiOperation("auto-删除")
|
||||
public ResultVO<Boolean> del(@RequestParam("rowId") Long rowId) {
|
||||
|
||||
return ResultVO.success(materialAttrValueI18n21Service.updateDelFlagByRowId(rowId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,12 @@
|
|||
package com.nflg.product.material.mapper.master;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.product.material.pojo.entity.MaterialAttrValueI18n21Entity;
|
||||
import com.nflg.product.material.pojo.query.MaterialAttrValueI18n21Query;
|
||||
import com.nflg.product.material.pojo.vo.MaterialAttrValueI18n21VO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* t_material_attr_value_i18n_21 表数据库访问层
|
||||
|
|
@ -11,4 +16,7 @@ import com.nflg.product.material.pojo.entity.MaterialAttrValueI18n21Entity;
|
|||
* @since 2022-05-08 17:29:08
|
||||
*/
|
||||
public interface MaterialAttrValueI18n21Mapper extends BaseMapper<MaterialAttrValueI18n21Entity> {
|
||||
|
||||
IPage<MaterialAttrValueI18n21VO> getList(Page<MaterialAttrValueI18n21Entity> page, @Param("query") MaterialAttrValueI18n21Query query);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.nflg.product.material.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="com-nflg-product-material-pojo-dto-MaterialAttrValueI18n21DTO")
|
||||
public class MaterialAttrValueI18n21DTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 行ID
|
||||
*/
|
||||
@ApiModelProperty(value = "行ID")
|
||||
private Long rowId;
|
||||
|
||||
/**
|
||||
* 中文名
|
||||
*/
|
||||
@ApiModelProperty(value = "中文名")
|
||||
private String attrValueCn;
|
||||
|
||||
/**
|
||||
* 翻译参照值
|
||||
*/
|
||||
@ApiModelProperty(value = "翻译参照值")
|
||||
private String attrValueRefer;
|
||||
|
||||
/**
|
||||
* 英文名
|
||||
*/
|
||||
@ApiModelProperty(value = "英文名")
|
||||
private String attrValueEn;
|
||||
|
||||
/**
|
||||
* 删除标记 Y是 N否
|
||||
*/
|
||||
@ApiModelProperty(value = "删除标记 Y是 N否")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,15 +1,13 @@
|
|||
package com.nflg.product.material.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* t_material_attr_value_i18n_21
|
||||
|
|
@ -52,6 +50,34 @@ public class MaterialAttrValueI18n21Entity implements Serializable {
|
|||
@ApiModelProperty(value = "英文名")
|
||||
private String attrValueEn;
|
||||
|
||||
/**
|
||||
* 删除标记 Y是 N否
|
||||
*/
|
||||
@TableField(value = "del_flag")
|
||||
@ApiModelProperty(value = "删除标记 Y是 N否")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(value = "created_by", fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_time", fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package com.nflg.product.material.pojo.query;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="com-nflg-product-material-pojo-query-MaterialAttrValueI18n21Query")
|
||||
public class MaterialAttrValueI18n21Query implements Serializable {
|
||||
|
||||
/**
|
||||
* 行ID
|
||||
*/
|
||||
@ApiModelProperty(value = "行ID")
|
||||
private Long rowId;
|
||||
|
||||
/**
|
||||
* 中文名
|
||||
*/
|
||||
@ApiModelProperty(value = "中文名")
|
||||
private String attrValueCn;
|
||||
|
||||
/**
|
||||
* 翻译参照值
|
||||
*/
|
||||
@ApiModelProperty(value = "翻译参照值")
|
||||
private String attrValueRefer;
|
||||
|
||||
/**
|
||||
* 英文名
|
||||
*/
|
||||
@ApiModelProperty(value = "英文名")
|
||||
private String attrValueEn;
|
||||
|
||||
/**
|
||||
* 删除标记 Y是 N否
|
||||
*/
|
||||
@ApiModelProperty(value = "删除标记 Y是 N否")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 设置每页显示条数
|
||||
*/
|
||||
@ApiModelProperty(value = "设置每页显示条数")
|
||||
private Long pageSize = 20L;
|
||||
|
||||
/**
|
||||
* 当前页
|
||||
*/
|
||||
@ApiModelProperty(value = "当前页")
|
||||
private Long page = 1L;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package com.nflg.product.material.pojo.vo;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "com-nflg-product-material-pojo-vo-MaterialAttrValueI18n21VO")
|
||||
public class MaterialAttrValueI18n21VO implements Serializable {
|
||||
|
||||
/**
|
||||
* 行ID 雪花
|
||||
*/
|
||||
@ApiModelProperty(value = "行ID 雪花")
|
||||
private Long rowId;
|
||||
|
||||
/**
|
||||
* 中文名
|
||||
*/
|
||||
@ApiModelProperty(value = "中文名")
|
||||
private String attrValueCn;
|
||||
|
||||
/**
|
||||
* 翻译参照值
|
||||
*/
|
||||
@ApiModelProperty(value = "翻译参照值")
|
||||
private String attrValueRefer;
|
||||
|
||||
/**
|
||||
* 英文名
|
||||
*/
|
||||
@ApiModelProperty(value = "英文名")
|
||||
private String attrValueEn;
|
||||
|
||||
/**
|
||||
* 删除标记 Y是 N否
|
||||
*/
|
||||
@ApiModelProperty(value = "删除标记 Y是 N否")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package com.nflg.product.material.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.base.core.vo.PageVO;
|
||||
import com.nflg.product.material.mapper.master.MaterialAttrValueI18n21Mapper;
|
||||
import com.nflg.product.material.pojo.dto.MaterialAttrValueI18n21DTO;
|
||||
import com.nflg.product.material.pojo.entity.MaterialAttrValueI18n21Entity;
|
||||
import com.nflg.product.material.pojo.query.MaterialAttrValueI18n21Query;
|
||||
import com.nflg.product.material.pojo.vo.MaterialAttrValueI18n21VO;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class MaterialAttrValueI18n21Service extends ServiceImpl<MaterialAttrValueI18n21Mapper, MaterialAttrValueI18n21Entity> {
|
||||
@Resource
|
||||
private MaterialAttrValueI18n21Mapper materialAttrValueI18n21Mapper;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param query Query 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
public IPage<MaterialAttrValueI18n21VO> selectPageByCondition(@RequestBody MaterialAttrValueI18n21Query query) {
|
||||
//设置分页
|
||||
Page<MaterialAttrValueI18n21Entity> page = new PageVO<>(query.getPage(), query.getPageSize());
|
||||
return materialAttrValueI18n21Mapper.getList(page, query);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param rowId 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
public MaterialAttrValueI18n21VO selectByRowId(@RequestParam("rowId") Long rowId) {
|
||||
MaterialAttrValueI18n21Entity entity = materialAttrValueI18n21Mapper.selectById(rowId);
|
||||
//查询结果类型转换
|
||||
MaterialAttrValueI18n21VO materialAttrValueI18n21VO = new MaterialAttrValueI18n21VO();
|
||||
BeanUtils.copyProperties(entity, materialAttrValueI18n21VO);
|
||||
return materialAttrValueI18n21VO;
|
||||
}
|
||||
|
||||
private void checkUniq(MaterialAttrValueI18n21DTO parm){
|
||||
List<MaterialAttrValueI18n21Entity> list = this.lambdaQuery().eq(MaterialAttrValueI18n21Entity::getAttrValueCn, parm.getAttrValueCn()).ne(!Objects.isNull(parm.getRowId()), MaterialAttrValueI18n21Entity::getRowId, parm.getRowId()).list();
|
||||
if(list.size()>0){
|
||||
throw new NflgBusinessException(STATE.BusinessError,parm.getAttrValueCn().concat("已存在"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param paramDto DTO 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
public Boolean addMaterialAttrValueI18n21Entity(MaterialAttrValueI18n21DTO paramDto) {
|
||||
//数据校验
|
||||
checkUniq(paramDto);
|
||||
|
||||
//类型转换
|
||||
MaterialAttrValueI18n21Entity entity = new MaterialAttrValueI18n21Entity();
|
||||
BeanUtils.copyProperties(paramDto, entity);
|
||||
entity.setRowId(null);
|
||||
return materialAttrValueI18n21Mapper.insert(entity) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param paramDto DTO 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
public Boolean updateByRowId(MaterialAttrValueI18n21DTO paramDto) {
|
||||
//数据校验
|
||||
checkUniq(paramDto);
|
||||
//类型转换
|
||||
MaterialAttrValueI18n21Entity entity = new MaterialAttrValueI18n21Entity();
|
||||
BeanUtils.copyProperties(paramDto, entity);
|
||||
return materialAttrValueI18n21Mapper.updateById(entity) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
* @param rowId
|
||||
* @return
|
||||
*/
|
||||
public Boolean updateDelFlagByRowId(Long rowId) {
|
||||
MaterialAttrValueI18n21Entity updateEntity = new MaterialAttrValueI18n21Entity();
|
||||
updateEntity.setRowId(rowId);
|
||||
updateEntity.setDelFlag("Y");
|
||||
return materialAttrValueI18n21Mapper.updateById(updateEntity) == 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -164,13 +164,13 @@ public class MaterialAttrValueService extends ServiceImpl<MaterialAttrValueMappe
|
|||
|
||||
public ResultVO<MaterialAttrValueI18n21Entity> getI18n21(String attrValueCn) {
|
||||
LambdaQueryWrapper<MaterialAttrValueI18n21Entity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MaterialAttrValueI18n21Entity::getAttrValueCn, attrValueCn);
|
||||
queryWrapper.eq(MaterialAttrValueI18n21Entity::getAttrValueCn, attrValueCn).eq(MaterialAttrValueI18n21Entity::getDelFlag, "N");
|
||||
return ResultVO.success(materialAttrValueI18n21Mapper.selectOne(queryWrapper));
|
||||
}
|
||||
|
||||
public ResultVO<List<MaterialAttrValueI18n21Entity>> getI18n21List(String attrValueCn) {
|
||||
LambdaQueryWrapper<MaterialAttrValueI18n21Entity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(MaterialAttrValueI18n21Entity::getAttrValueCn, attrValueCn);
|
||||
queryWrapper.like(MaterialAttrValueI18n21Entity::getAttrValueCn, attrValueCn).eq(MaterialAttrValueI18n21Entity::getDelFlag, "N");
|
||||
return ResultVO.success(materialAttrValueI18n21Mapper.selectList(queryWrapper));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,21 @@
|
|||
</sql>
|
||||
|
||||
<sql id="where_time"></sql>
|
||||
|
||||
<select id="getList" resultType="com.nflg.product.material.pojo.vo.MaterialAttrValueI18n21VO">
|
||||
select * from t_material_attr_value_i18n_21 where 1=1
|
||||
<if test="query.attrValueCn!=null and query.attrValueCn!=''">
|
||||
and attr_value_cn like concat('%',#{query.attrValueCn},'%')
|
||||
</if>
|
||||
<if test="query.attrValueRefer!=null and query.attrValueRefer!=''">
|
||||
and attr_value_refer like concat('%',#{query.attrValueRefer},'%')
|
||||
</if>
|
||||
<if test="query.attrValueEn!=null and query.attrValueEn!=''">
|
||||
and attr_value_en like concat('%',#{query.attrValueEn},'%')
|
||||
</if>
|
||||
<if test="query.delFlag!=null and query.delFlag!=''">
|
||||
and del_flag = #{query.delFlag}
|
||||
</if>
|
||||
order by created_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue