| | |
| | | import com.lf.server.entity.Result; |
| | | import com.lf.server.entity.organization.DepEntity; |
| | | import com.lf.server.service.oraganization.DepService; |
| | | import io.netty.util.internal.StringUtil; |
| | | import org.apache.tomcat.util.buf.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | DepService depService; |
| | | |
| | | @RequestMapping(value ="/insertDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Boolean insertDep(DepEntity depEntity){ |
| | | public Integer insertDep(DepEntity depEntity){ |
| | | |
| | | return depService.insertDep(depEntity); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value ="/delecteDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Boolean delecteDep(int id){ |
| | | return depService.delecteDep(id); |
| | | @RequestMapping(value ="/deleteDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteDep(int id){ |
| | | return depService.deleteDep(id); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value ="/deleteDeps", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Integer deleteDeps(Integer[] ids){ |
| | | if(null == ids || ids.length ==0 ){ |
| | | return -1; |
| | | //}else{ |
| | | // return depService.deleteDep(StringUtils.join(ids,",")); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value ="/updateDep", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | public Boolean updateDep(DepEntity depEntity){ |
| | | public Integer updateDep(DepEntity depEntity){ |
| | | return depService.updateDep(depEntity); |
| | | } |
| | | |
| | | |
| | | @GetMapping(value ="/selectDep") |
| | | public DepEntity selectDep(DepEntity depEntity){ |
| | |
| | | * @param depEntity |
| | | * @return |
| | | */ |
| | | public Boolean insertDep(DepEntity depEntity); |
| | | public Integer insertDep(DepEntity depEntity); |
| | | |
| | | /** |
| | | * 刪除数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public Boolean delecteDep(int id); |
| | | public Integer deleteDep(int id); |
| | | |
| | | public Integer deleteDeps(String ids); |
| | | |
| | | /** |
| | | * 修改数据 |
| | | * @param depEntity |
| | | * @return |
| | | */ |
| | | public Boolean updateDep(DepEntity depEntity); |
| | | public Integer updateDep(DepEntity depEntity); |
| | | |
| | | /** |
| | | * 查询单条数据 |
| | |
| | | DepMapper depMapper; |
| | | |
| | | @Override |
| | | public Boolean insertDep(DepEntity depEntity) { |
| | | public Integer insertDep(DepEntity depEntity) { |
| | | return depMapper.insertDep(depEntity); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean delecteDep(int id) { |
| | | return depMapper.delecteDep(id); |
| | | public Integer deleteDep(int id) { |
| | | return depMapper.deleteDep(id); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateDep(DepEntity depEntity) { |
| | | public Integer deleteDeps(String ids) { |
| | | return depMapper.deleteDeps(ids); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateDep(DepEntity depEntity) { |
| | | return depMapper.updateDep(depEntity); |
| | | } |
| | | |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.lf.server.mapper.oraganization.DepMapper"> |
| | | <resultMap id="selectDepAllMap" type="com.lf.server.entity.organization.DepEntity"> |
| | | <resultMap id="resultMap" type="com.lf.server.entity.organization.DepEntity"> |
| | | <id property="id" column="id"></id> |
| | | <result property="orderNum" column="order_num"></result> |
| | | <result property="createUser" column="create_user"></result> |
| | |
| | | <result property="updateTime" column="update_time"></result> |
| | | </resultMap> |
| | | |
| | | <select id="selectDepAll" resultMap="selectDepAllMap" resultType="com.lf.server.entity.organization.DepEntity"> |
| | | <select id="selectDepAll" resultMap="resultMap" resultType="com.lf.server.entity.organization.DepEntity"> |
| | | select * from lf.sys_dep |
| | | </select> |
| | | |
| | | <insert id="insertDep" parameterType="com.lf.server.entity.organization.DepEntity"> |
| | | insert into lf.sys_dep |
| | | (pid,name,sname,code,uncode,addr,contact,fax,email,post,website,level,order_num,create_user,create_time,bak) |
| | | values |
| | | (#{pid},#{name},#{sname},#{code},#{uncode},#{addr},#{contact},#{fax},#{email},#{post},#{website}, |
| | | #{level},#{orderNum},#{createUser},now(),#{bak}); |
| | | </insert> |
| | | |
| | | <delete id="delecteDep" > |
| | | delete from lf.sys_dep where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteDeps" > |
| | | delete from lf.sys_dep where id in (#{ids}) |
| | | </delete> |
| | | |
| | | <update id="updateDep"> |
| | | update lf.sys_dep set pid=#{pid},name=#{name},sname=#{sname},code=#{code},uncode=#{uncode},addr=#{addr},contact=#{contact},fax=#{fax}, |
| | | email=#{email},post=#{post},website=#{website},level=#{level},order_num =#{orderNum},update_user=#{updateUser},update_time=now(),bak=#{bak} where id=#{id} |
| | | </update> |
| | | </mapper> |