main
tamguo 7 years ago
parent 1e11f37417
commit 22cceed493

@ -1,5 +1,6 @@
package com.tamguo.modules.sys.service.impl; package com.tamguo.modules.sys.service.impl;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.modules.sys.dao.SysPostMapper; import com.tamguo.modules.sys.dao.SysPostMapper;
import com.tamguo.modules.sys.model.SysPostEntity; import com.tamguo.modules.sys.model.SysPostEntity;
import com.tamguo.modules.sys.model.condition.SysPostCondition; import com.tamguo.modules.sys.model.condition.SysPostCondition;
import com.tamguo.modules.sys.model.enums.SysPostStatusEnum;
import com.tamguo.modules.sys.service.IPostService; import com.tamguo.modules.sys.service.IPostService;
@Service @Service
@ -26,12 +28,22 @@ public class PostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity> i
@Transactional(readOnly=false) @Transactional(readOnly=false)
@Override @Override
public void add(SysPostEntity post) { public void add(SysPostEntity post) {
post.setCreateDate(new Date());
post.setUpdateDate(new Date());
post.setStatus(SysPostStatusEnum.NORMAL);
sysPostMapper.insert(post); sysPostMapper.insert(post);
} }
@Transactional(readOnly=false) @Transactional(readOnly=false)
@Override @Override
public void update(SysPostEntity post) { public void update(SysPostEntity post) {
SysPostEntity entity = sysPostMapper.selectById(post.getId());
entity.setCode(post.getCode());
entity.setName(post.getName());
entity.setPostType(post.getPostType().getValue().toString());
entity.setRemarks(post.getRemarks());
entity.setSorts(post.getSorts());
post.setUpdateDate(new Date());
sysPostMapper.updateById(post); sysPostMapper.updateById(post);
} }

@ -61,8 +61,8 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<option value="">&nbsp;</option> <option value="">&nbsp;</option>
<option value="gaoguan" th:selected="${post.postType.value=='gaoguan'}? true : false">高管</option> <option value="gaoguan" th:selected="${post.postType.value=='gaoguan'}? true : false">高管</option>
<option value="zhongceng" th:selected="${post.postType.value=='zhongceng'}? true : false">中层</option> <option value="zhongceng" th:selected="${post.postType.value=='zhongceng'}? true : false">中层</option>
<option value="jiceng" th:select="${post.postType.value=='jiceng'}? true : false">基层</option> <option value="jiceng" th:selected="${post.postType.value=='jiceng'}? true : false">基层</option>
<option value="qita" th:select="${post.postType.value=='qita'}? true : false">其它</option> <option value="qita" th:selected="${post.postType.value=='qita'}? true : false">其它</option>
</select> </select>
</div> </div>
</div> </div>

Loading…
Cancel
Save