| | |
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.homemodule.SpecialPlaceMapper;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SpecialPlace;
|
| | | import com.yeshi.fanli.exception.FloatADException;
|
| | | import com.yeshi.fanli.exception.SpecialPlaceException;
|
| | | import com.yeshi.fanli.exception.homemodule.SpecialPlaceException;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public SpecialPlace selectByPrimaryKey(Long id) {
|
| | | return specialPlaceMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void saveObject(SpecialPlace record) throws SpecialPlaceException, Exception{
|
| | |
|
| | | String placeName = record.getPlaceName();
|
| | | String placeName = record.getName();
|
| | | if (placeName == null || placeName.trim().length() == 0) {
|
| | | throw new FloatADException(1, "位置名称不能为空");
|
| | | throw new SpecialPlaceException(1, "位置名称不能为空");
|
| | | }
|
| | |
|
| | | String key = record.getKey();
|
| | | if (key == null || key.trim().length() == 0) {
|
| | | throw new FloatADException(1, "位置标识不能为空");
|
| | | throw new SpecialPlaceException(1, "位置标识不能为空");
|
| | | }
|
| | |
|
| | | Long id = record.getId();
|
| | | if (id == null) {
|
| | | |
| | | record.setCreateTime(new Date());
|
| | | record.setUpdateTime(new Date());
|
| | | specialPlaceMapper.insert(record);
|
| | |
| | | // 修改
|
| | | SpecialPlace resultObj = specialPlaceMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new FloatADException(1, "修改内容已不存在");
|
| | | throw new SpecialPlaceException(1, "修改内容已不存在");
|
| | | }
|
| | | |
| | |
|
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | record.setUpdateTime(new Date());
|
| | | specialPlaceMapper.updateByPrimaryKey(record);
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public int deleteByPrimaryKeyList(List<Long> list) throws Exception{
|
| | | return specialPlaceMapper.deleteByPrimaryKeyList(list);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<SpecialPlace> getList() {
|
| | | return specialPlaceMapper.getList();
|
| | | public List<SpecialPlace> getEffectiveList() {
|
| | | return specialPlaceMapper.getAll();
|
| | | }
|
| | |
|
| | | }
|