Java源码示例:com.macro.mall.model.PmsProductAttributeExample
示例1
@Override
public int delete(List<Long> ids) {
//获取分类
PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
Integer type = pmsProductAttribute.getType();
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.createCriteria().andIdIn(ids);
int count = productAttributeMapper.deleteByExample(example);
//删除完成后修改数量
if(type==0){
if(pmsProductAttributeCategory.getAttributeCount()>=count){
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
}else{
pmsProductAttributeCategory.setAttributeCount(0);
}
}else if(type==1){
if(pmsProductAttributeCategory.getParamCount()>=count){
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
}else{
pmsProductAttributeCategory.setParamCount(0);
}
}
productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
return count;
}
示例2
@Override
public int delete(List<Long> ids) {
//获取分类
PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
Integer type = pmsProductAttribute.getType();
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.createCriteria().andIdIn(ids);
int count = productAttributeMapper.deleteByExample(example);
//删除完成后修改数量
if(type==0){
if(pmsProductAttributeCategory.getAttributeCount()>=count){
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
}else{
pmsProductAttributeCategory.setAttributeCount(0);
}
}else if(type==1){
if(pmsProductAttributeCategory.getParamCount()>=count){
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
}else{
pmsProductAttributeCategory.setParamCount(0);
}
}
productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
return count;
}
示例3
@Override
public int delete(List<Long> ids) {
//获取分类
PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
Integer type = pmsProductAttribute.getType();
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.createCriteria().andIdIn(ids);
int count = productAttributeMapper.deleteByExample(example);
//删除完成后修改数量
if(type==0){
if(pmsProductAttributeCategory.getAttributeCount()>=count){
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
}else{
pmsProductAttributeCategory.setAttributeCount(0);
}
}else if(type==1){
if(pmsProductAttributeCategory.getParamCount()>=count){
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
}else{
pmsProductAttributeCategory.setParamCount(0);
}
}
productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
return count;
}
示例4
@Override
public int delete(List<Long> ids) {
//获取分类
PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
Integer type = pmsProductAttribute.getType();
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.createCriteria().andIdIn(ids);
int count = productAttributeMapper.deleteByExample(example);
//删除完成后修改数量
if(type==0){
if(pmsProductAttributeCategory.getAttributeCount()>=count){
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
}else{
pmsProductAttributeCategory.setAttributeCount(0);
}
}else if(type==1){
if(pmsProductAttributeCategory.getParamCount()>=count){
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
}else{
pmsProductAttributeCategory.setParamCount(0);
}
}
productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
return count;
}
示例5
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.setOrderByClause("sort desc");
example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
return productAttributeMapper.selectByExample(example);
}
示例6
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.setOrderByClause("sort desc");
example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
return productAttributeMapper.selectByExample(example);
}
示例7
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.setOrderByClause("sort desc");
example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
return productAttributeMapper.selectByExample(example);
}
示例8
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.setOrderByClause("sort desc");
example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
return productAttributeMapper.selectByExample(example);
}
示例9
long countByExample(PmsProductAttributeExample example);
示例10
int deleteByExample(PmsProductAttributeExample example);
示例11
List<PmsProductAttribute> selectByExample(PmsProductAttributeExample example);
示例12
int updateByExampleSelective(@Param("record") PmsProductAttribute record, @Param("example") PmsProductAttributeExample example);
示例13
int updateByExample(@Param("record") PmsProductAttribute record, @Param("example") PmsProductAttributeExample example);
示例14
int countByExample(PmsProductAttributeExample example);
示例15
int deleteByExample(PmsProductAttributeExample example);
示例16
List<PmsProductAttribute> selectByExample(PmsProductAttributeExample example);
示例17
int updateByExampleSelective(@Param("record") PmsProductAttribute record, @Param("example") PmsProductAttributeExample example);
示例18
int updateByExample(@Param("record") PmsProductAttribute record, @Param("example") PmsProductAttributeExample example);
示例19
long countByExample(PmsProductAttributeExample example);
示例20
int deleteByExample(PmsProductAttributeExample example);
示例21
List<PmsProductAttribute> selectByExample(PmsProductAttributeExample example);
示例22
int updateByExampleSelective(@Param("record") PmsProductAttribute record, @Param("example") PmsProductAttributeExample example);
示例23
int updateByExample(@Param("record") PmsProductAttribute record, @Param("example") PmsProductAttributeExample example);
示例24
int countByExample(PmsProductAttributeExample example);
示例25
int deleteByExample(PmsProductAttributeExample example);
示例26
List<PmsProductAttribute> selectByExample(PmsProductAttributeExample example);
示例27
int updateByExampleSelective(@Param("record") PmsProductAttribute record, @Param("example") PmsProductAttributeExample example);
示例28
int updateByExample(@Param("record") PmsProductAttribute record, @Param("example") PmsProductAttributeExample example);