sql表:entientity:
@Data @TableName("t_categories") @AllArgsConstructor @NoArgsConstructor public class CategoriesEntity { @TableId(type= IdType.AUTO) private Integer id; private String cNname; private String cDescri;//描述分类信息 private Date cCreateTime;//生成时间 private Date cUpdateTime; }
service:
public interface CategoriesService extends IService<CategoriesEntity> { void updateCategoriesName(Integer id); void seleceCategories(Integer id); void addCategories(CategoriesEntity categoriesEntity); void deleteCagegories(Integer id); }
ServiceImpl:
@Service public class CategoriesImpl extends ServiceImpl<CategoriesDao, CategoriesEntity> implements CategoriesService { //@Autowired //private CategoriesEntity categoriesEntity; @Override public void updateCategoriesName(Integer id) { Integer categoriesEntity=baseMapper.updateCategoriesName(id); } @Override public void seleceCategories(Integer id) { // CategoriesEntity categoriesEntity = null; // QueryWrapper queryWrapper=new QueryWrapper(); // queryWrapper.eq("id",categoriesEntity.getId()); // CategoriesEntity categoriesEntity1=baseMapper.selectOne(queryWrapper); CategoriesEntity i=baseMapper.selectById(id); } @Override public void addCategories(CategoriesEntity categoriesEntity) { //categoriesEntity.setCDescri("describle",categoriesEntity.getCDescri()); Integer categoriesEntity1=baseMapper.insert(categoriesEntity); } @Override public void deleteCagegories(Integer id) { Integer i=baseMapper.deleteById(id); }
Dao:
@Mapper public interface CategoriesDao extends BaseMapper<CategoriesEntity> { Integer updateCategoriesName(@Param("id")Integer id); /* Integer addCategories(@Param()Integer id, @Param()String name, @Param()Date oldTime, @Param()Date newTime, @Param()String describle); */}